This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Question on OMAP-L138 dmai application video_display

Other Parts Discussed in Thread: OMAP-L138, OMAPL138

Dear Ms./Mr.:

We tried to run dmai application program video_display on our own OMAP-L138 target board. Since our display has 640*480 resolution, RGB565 format, 30 fps. So, we tried to modify dmai drivers and even the kernel file da8xx-fb.c. Please see the attached file.

 

modified sources:
1.   ~/ti-dvsdk_omapl138-evm_4_02_00_06/dmai_2_20_00_15/packages/ti/sdo/dmai/linux/Display.c

	const Display_Attrs Display_Attrs_OMAPL138_OSD_DEFAULT = {
    1,
    Display_Std_FBDEV,
	//VideoStd_QVGA,
	//Display_Output_LCD,
    VideoStd_VGA,
    Display_Output_COMPONENT,
    "/dev/fb0",
    0,
    ColorSpace_RGB565,
    -1,
    -1,
    FALSE,
    0,
    0,
    FALSE
};

2. ~/ti-dvsdk_omapl138-evm_4_02_00_06/dmai_2_20_00_15/packages/ti/sdo/dmai/linux/omapl138/Display_fbdev.c

/******************************************************************************
 * Display_fbdev_create
 ******************************************************************************/
Display_Handle Display_fbdev_create(BufTab_Handle hBufTab, Display_Attrs *attrs)
{
    BufferGfx_Attrs         gfxAttrs       = BufferGfx_Attrs_DEFAULT;
    struct fb_var_screeninfo varInfo;
    struct fb_fix_screeninfo fixInfo;
    Int                      displaySize;
    Int                      bufIdx;
    Int8                    *virtPtr;
    Int32                    physPtr;
    Int32                    height, width;
    Display_Handle           hDisplay;
    Buffer_Handle            hBuf;

    :
    :
    :
    /**************************/
     width = 640;
     height = 480;
     attrs->width = width;
     attrs->height = height;
     attrs->numBufs = 1;
     fixInfo.line_length = 1280;
    /**************************/

    varInfo.xoffset         = 0;
    varInfo.yoffset         = 0;
    varInfo.xres            = width;
    varInfo.yres            = height;
    varInfo.xres_virtual    = width;
    varInfo.yres_virtual    = varInfo.yres * attrs->numBufs;

    /* Set video display format */
    Dmai_dbg4("Setting width=%d height=%d, yres_virtual=%d,"
              " xres_virtual=%d\n", varInfo.xres, varInfo.yres,
              varInfo.yres_virtual, varInfo.xres_virtual);

    if (ioctl(hDisplay->fd, FBIOPUT_VSCREENINFO, &varInfo) == -1) {
        Dmai_err2("Failed FBIOPUT_VSCREENINFO on %s (%s)\n",
                  attrs->displayDevice, strerror(errno));
        cleanup(hDisplay);
        return NULL;
    }

    if (ioctl(hDisplay->fd, FBIOGET_FSCREENINFO, &fixInfo) == -1) {
        Dmai_err2("Failed FBIOGET_FSCREENINFO on %s (%s)\n",
                  attrs->displayDevice, strerror(errno));
        cleanup(hDisplay);
        return NULL;
    }

    fixInfo.line_length = 1280;
    Dmai_dbg5("New width=%d, height=%d, yres_virtual=%d,xres_virtual=%d, "
              "line_length=%d\n", varInfo.xres, varInfo.yres,
              varInfo.yres_virtual, varInfo.xres_virtual, fixInfo.line_length);

    gfxAttrs.dim.width          = varInfo.xres;
    gfxAttrs.colorSpace         = attrs->colorSpace;
    gfxAttrs.dim.height         = varInfo.yres;
    gfxAttrs.dim.lineLength     = fixInfo.line_length;
    gfxAttrs.bAttrs.reference   = TRUE;
    displaySize                 = fixInfo.line_length * varInfo.yres;  //1280x480

    hBufTab = BufTab_create(attrs->numBufs, displaySize,
                            BufferGfx_getBufferAttrs(&gfxAttrs));

    if (hBufTab == NULL) {
        Dmai_err0("Failed to allocate BufTab for display buffers\n");
        cleanup(hDisplay);
        return NULL;
    }

    hBuf = BufTab_getBuf(hBufTab, 0);

    Buffer_setNumBytesUsed(hBuf, varInfo.xres * varInfo.yres *
                                 varInfo.bits_per_pixel / 8);
    virtPtr = (Int8 *) mmap (NULL,
                             displaySize * attrs->numBufs,
                             PROT_READ | PROT_WRITE,
                             MAP_SHARED,
                             hDisplay->fd, 0);

    if (virtPtr == MAP_FAILED) {
        Dmai_err2("Failed mmap on %s (%s)\n", attrs->displayDevice,
                                              strerror(errno));
        cleanup(hDisplay);
        return NULL;
    }

    :
    :


3.  kernel source:
    ~/ti-dvsdk_omapl138-evm_4_02_00_06/psp/linux-2.6.33-rc4-psp03.20.00.14.sdk/drivers/video/da8xx-fb.c

    static struct da8xx_panel known_lcd_panels[] = {
    	/* Sharp LCD035Q3DG01 */
    	[0] = {
    		.name = "Sharp_LCD035Q3DG01",
    		.width = 320,
    		.height = 240,
    		.hfp = 8,
    		.hbp = 6,
    		.hsw = 0,
    		.vfp = 2,
    		.vbp = 2,
    		.vsw = 0,
    		.pxl_clk = 4608000,
    		.invert_pxl_clk = 1,
    	},
    	/* Sharp LK043T1DG01 */
    	[1] = {
    		.name = "Sharp_LK043T1DG01",
    		.width = 640,
    		.height = 480,
    //		.width = 480,
    //		.height = 272,
    		.hfp = 2,
    		.hbp = 2,
    		.hsw = 41,
    		.vfp = 3,
    		.vbp = 3,
    		.vsw = 10,
    		.pxl_clk = 13500000,
    //		.pxl_clk = 7833600,
    		.invert_pxl_clk = 0,
    	},
    };

 

We have rebuilt dmai library and the kernel. But it shows:

root@arago:/usr/share/ti/ti-dmai-apps# DMAI_DEBUG=2 ./video_display_omapl138.x470MV -y 14 -O component --display_buffer 2

@0x0005d2b6:[T:0x4001f040] ti.sdo.dmai - [Dmai] Dmai log level set to '2'. Note that calling CERuntime_init after this point may cause unexpected change to DMAI tracing behavior.

@0x0005d8ef:[T:0x4001f040] ti.sdo.dmai - [Display] Found width=480 height=272, yres_virtual=272,xres_virtual=480, line_length=960

@0x0005da24:[T:0x4001f040] ti.sdo.dmai - [Display] Setting width=640 height=480, yres_virtual=480, xres_virtual=640

@0x0005db3d:[T:0x4001f040] ti.sdo.dmai - [Display] New width=640, height=480, yres_virtual=480,xres_virtual=640, line_length=1280

@0x0005dc68:[T:0x4001f040] ti.sdo.dmai - [BufTab] Allocating BufTab for 1 buffers

@0x0005e013:[T:0x4001f040] ti.sdo.dmai - [Display] Failed mmap on /dev/fb0 (Invalid argument)

Failed to open display device

What steps we went wrong?
Please help.
Thank you so much.
Yu-Fu Hsieh