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.

render image with fbdev

Guru 20755 points

Hi,

 I am trying to output lcd display graphic 240x320.

When triggerting test color bar (internal davinci register), I see color bar stable and clean, but on rendering image with fbdev, I get v-sync movement .

I have tried to check the assumption that the color bar stability is only because of its vertical lines, so I created the following image (note that it contain a white bar in the left too, it is on white background so hard to notice)

 But on rendering it with fbdev I still got v-sync movements:

https://drive.google.com/file/d/0B22GsWueReZTMEI0QTlic0h6N0U/view?usp=sharing

It also seems to be shifted (in the LCD I see the pink and red bards in the margins instead of white and black, note that it is not the same bar as the internal color bar test in hdvpss)

I still don't understand what it means, maybe rendering through fbdev change the timings ?

 

I also tried to display white image (240x320) and I still see some lines.

Is it becuase fbdev changes timing compared to the internal color bar test ?

Regards,

Ran

  • Ran,

    Ran Shalit said:
     I am trying to output lcd display graphic 240x320.

    This resolution (QVGA in portrait orientation) is not supported by default in the ti81xx linux kernel. May be this is the root case. Can you try with some of the officially supported display resolutions, will you have the same issue?

    Check linux-kernel/drivers/video/ti81xx/vpss/sysfs.h to get name of the supported modes.

    BR
    Pavel

  • Hi Pavel,

    Thank you very much for the assistance !

    I work only with LCD 240x320 on the custom board, but I have EVM 800x480 to compare with.
    On trying almost same kernel(pinmux change) in EVM with 800x480 LCD it works fine with fbdev .

    >Check linux-kernel/drivers/video/ti81xx/vpss/sysfs.h to get name of the supported modes.
    When I do :
    echo 6500,240/1/22/2,320/2/1/1,1 > /sys/devices/platform/vpss/display1/timings
    it seems to have an effect. the test color bar is stable, so seems that vpss is configured, even if sysfs.h does not include this mode.
    Maybe adding the custom timing for 240x320 in this header will make a difference ?

    Best Regards,
    Ran
  • Ran,

    I can recommend you to search in the e2e and processors ti wiki for 240x320 resolution settings and to contact your LCD supplier for the correct 240x320 settings.

    After verify the correct 240x320 settings, you can add these settings in the linux kernel, same as (for example) 800x480 settings.

    BR
    Pavel

  • Hi Pavel,

    I have the correct setting.

    Is it suffecient to add them as following:
    echo <correct lcd settings> > /sys/devices/platform/vpss/display1/timings

    or do I need to do additional changes ?

    Regards,
    Ran
  • I can not test this on my side (DM814x TI EVM with TFC-S9700RTWV43-01B LCD display, 800x480 7inch, WVGA, RGB, ThreeFive Corp), so I can not verify.

    If your LCD works fine with only this (echo <correct lcd settings> > /sys/devices/platform/vpss/display1/timings) it should be sufficient. If not, you can try to examine the 800x480 settings in the linux kernel and port the 240x320 settings.

    BR
    Pavel
  • See also the below linux kernel porting guide regarding LCD:

    processors.wiki.ti.com/.../Sitara_Linux_SDK_Training -> Sitara Linux Training: Linux Board Port

    Linux Board Port Exercise 4 - adding support for an LCD
  • Thank you Pavel,

    I've been trying to add the resolution to sysfs.h,
    but I still get the same results.
    The main mystery is that after setting
    echo <correct lcd settings> > /sys/devices/platform/vpss/display1/timings
    The internal color bar seems to be perfect, but trying to render image through fbdev has problems (as seen in my above links).
    I checked during fbdev rendering the value in sys/devices/platform/vpss/display1/timings, but it is the same as with the color bar.
    So I don't yet understand how it is that the color bar is perfect while any fbdev image write is bad.

    Regards,
    Ran
  • Ran,

    Can this issue be reproduced on the DM814x TI EVM? If yes, can you send me the exact steps?

    BR
    Pavel
  • Hi Pavel,

    I can't see this issue with EVM, but since the resolution is quite rare (240x320) , it could be that some driver such as fbdev, does not support it ?

    It also seems that timing is OK becuase the internal color bar is perfect,

    So it seems that on moving  to fbdev, something gets wrong.

    Since the supsicious is on fbdev settings,  in continuity effort to understand the LCD 240x320 failure when rendering image through framebuffer,

    please take a look at the tests below, each time I've change one parameter in framebuffer.

    Usually I got the following image result (this is named "Result 1" in below report)

    Note: the video starts with showing the internal color bar (which is different and does not use fbdev), than from 00:11 second you can see the result with fbdev)

    This is the image I try to display:

    1.

    fbset -fb /dev/fb0 -xres 240 -yres 320 -vxres 240 -vyres 320 -depth 32

    fbset -fb /dev/fb0 -rgba 5,6,5

    root@dm814x:/opt/dvr_rdk/ti814x/bin# fbset -fb /dev/fb0

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 240 320 240 320 32

    timings 6734 148 88 36 4 44 5

    rgba 8/16,8/8,8/0,8/24

    endmode

    root@dm814x:/opt/dvr_rdk/ti814x/bin#

    Result: shifted bars, with 5 lines in horizontal (240) splitting the image, and shaking.

    2.

    fbset -fb /dev/fb0 -xres 240 -yres 320 -vxres 240 -vyres 320 -depth 24

    root@dm814x:/opt/dvr_rdk/ti814x/bin# fbset -fb /dev/fb0

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 240 320 240 320 24

    timings 6734 148 88 36 4 44 5

    rgba 8/16,8/8,8/0,8/24

    endmode

    root@dm814x:/opt/dvr_rdk/ti814x/bin#

    Result: same as image 1

    3.

    fbset -fb /dev/fb0 -xres 240 -yres 320 -vxres 240 -vyres 320 -depth 16

    root@dm814x:/opt/dvr_rdk/ti814x/bin# fbset -fb /dev/fb0

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 240 320 720 320 16

    timings 6734 148 88 36 4 44 5

    rgba 5/11,6/5,5/0,0/0

    endmode

    root@dm814x:/opt/dvr_rdk/ti814x/bin#

    Result: same as image 1

    4.

    echo 6500,240/1/22/2,320/2/1/1,0 > /sys/devices/platform/vpss/display1/timings

    fbset -fb /dev/fb0 -xres 240 -yres 320 -vxres 240 -vyres 320 -depth 24

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 240 320 240 320 24

    timings 6734 148 88 36 4 44 5

    rgba 5/11,6/5,5/0,0/0

    endmode

    Result: same image video but slightly more shaking

    5.

    triplediscrete -> triple

    echo 6500,240/1/22/2,320/2/1/1,1 > /sys/devices/platform/vpss/display1/timings

    fbset -fb /dev/fb0 -xres 240 -yres 320 -vxres 240 -vyres 320 -depth 24

    echo triple,rgb888,0/0/1/1 > /sys/devices/platform/vpss/display1/output

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 240 320 240 320 24

    timings 6734 148 88 36 4 44 5

    rgba 5/11,6/5,5/0,0/0

    endmode

    Result:same as image 1

    6.

    echo triplediscrete,rgb888,0/0/0/0 > /sys/devices/platform/vpss/display1/output

    /HS/VS inverted

    Result: same as image 1

    7.

    echo triplediscrete,rgb888,1/1/1/1 > /sys/devices/platform/vpss/display1/output

    echo 6500,240/1/22/2,320/2/1/1,1 > /sys/devices/platform/vpss/display1/timings

    echo triple,rgb888,0/0/1/1 > /sys/devices/platform/vpss/display1/output

    Result:image disappeared

    8.

    echo triplediscrete,rgb888,1/0/1/1 > /sys/devices/platform/vpss/display1/output

    echo 6500,240/1/22/2,320/2/1/1,1 > /sys/devices/platform/vpss/display1/timings

    echo triple,rgb888,0/0/1/1 > /sys/devices/platform/vpss/display1/output

    Result: same as 1

    9.

    fbset -fb /dev/fb0 -xres 480 -yres 320 -vxres 480 -vyres 320 -depth 16

    echo 6500,240/1/22/2,320/2/1/1,1 > /sys/devices/platform/vpss/display1/timings

    echo triple,rgb888,0/0/1/1 > /sys/devices/platform/vpss/display1/output

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 480 340 480 340 16

    timings 6734 148 88 36 4 44 5

    rgba 8/16,8/8,8/0,8/24

    endmode

    Result: bars are shifted with weaker colors

    10.

    fbset -fb /dev/fb0 -xres 480 -yres 640 -vxres 480 -vyres 640 -depth 32

    echo 6500,240/1/22/2,320/2/1/1,1 > /sys/devices/platform/vpss/display1/timings

    echo triple,rgb888,0/0/1/1 > /sys/devices/platform/vpss/display1/output

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 480 640 480 640 32

    timings 6734 148 88 36 4 44 5

    rgba 8/16,8/8,8/0,8/24

    endmode

    Result: same as 9

    11.

    fbset -fb /dev/fb0 -xres 480 -yres 320 -vxres 480 -vyres 640 -depth 32

    root@dm814x:/opt/dvr_rdk/ti814x# fbset -fb /dev/fb0

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 480 320 480 640 32

    timings 6734 148 88 36 4 44 5

    rgba 8/16,8/8,8/0,8/24

    endmode

    Result: white image with 5 horizontal lines (240) splitting the image to 5 pieces, these black lines are shaking

    12. -extsync true or false

    root@dm814x:/opt/dvr_rdk/ti814x# fbset -fb /dev/fb0

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 240 320 240 320 32

    timings 6734 148 88 36 4 44 5

    rgba 8/16,8/8,8/0,8/24

    endmode

    Result: same as 1

    13. laced true or false

    root@dm814x:/opt/dvr_rdk/ti814x# fbset -fb /dev/fb0

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 240 320 240 320 32

    timings 6734 148 88 36 4 44 5

    rgba 8/16,8/8,8/0,8/24

    endmode

    Result: same as 1

    14.  double true or false

    root@dm814x:/opt/dvr_rdk/ti814x# fbset -fb /dev/fb0

    mode "240x320-782"

    # D: 148.500 MHz, H: 285.577 kHz, V: 782.403 Hz

    geometry 240 320 240 320 32

    timings 6734 148 88 36 4 44 5

    rgba 8/16,8/8,8/0,8/24

    endmode

    Result: same as 1

    I would appreciate any idea on this subject.

    Best Regards,

    Ran

  • Hi Pavel,

    I have made some progress.
    I changed the timings, and got a stable picture - BUT every time it started with a different vertical offset.

    the timing I use is:

    echo 6500,240/1/100/14,512/1/1/10,1 > /sys/devices/platform/vpss/display1/timings

    though the strange about this timing is that the number of lines is 512 instead of 320 !!
    Maybe that exaplin the issue of the image displayed each time starting at different line ?


    Eventually I found that if I do:
    dd if=/dev/zero of=/dev/fb0 bs=3200 count=600
    It solved the starting line offset problem !


    Do you have any idea what the effect of this and why did it solved the line offset issue ( the framebuffer starts with same physical address, so I don't understand what the effect of this )
    When I tried to output video, I still got the same issue , it always starts in another vertical offset. But this time - I don;t have any /dev device.
    Do you have any idea how this can be resolved for video?

    Thanks,
    Ran

  • Hi,

    I wanted to add that framebuffer is configured as following:

    fbset -fb /dev/fb0 -xres 240 -yres 320 -vxres 240 -vyres 320 

    so, I don't know why 

    dd if=/dev/zero of=/dev/fb0

    results in image correct display starting with line 0 on the screen.

    I think that writing to framebuffer should fill the complete buffer.

    Regards,

    Ran

  • This issue been resolved.
    Failure in HW which resulted in wrong timing !
  • Hi Ran,

    Thank you for sharing the solution. Just to add that I have found the below script to configure the DM814x LCD in EZSDK:

    modprobe vpss sbufaddr=0xBFB00000 mode=hdmi:1080p-60 i2c_mode=1

    modprobe ti81xxfb vram=0:24M,1:16M,2:6M

    configure_lcd

     

     

    configure_lcd()

    {

       echo "Configuring fb0 to LCD"

       echo 1:dvo2 > /sys/devices/platform/vpss/graphics0/nodes

       echo 0 > /sys/devices/platform/vpss/display1/enabled

       echo 33500,800/164/89/10,480/10/23/10,1 > /sys/devices/platform/vpss/display1/timings

       echo triplediscrete,rgb888 > /sys/devices/platform/vpss/display1/output

       echo 1 > /sys/devices/platform/vpss/display1/enabled

       fbset -xres 800 -yres 480 -vxres 800 -vyres 480

    }