6

I'm using QtEmbedded (4.8.0) on an ARM display device with 16bits color depth on the framebuffer (/dev/fb0). At this scenario we are getting the colors bits RED and BLUE exchanged.

We are using the following compile flags:

./configure -embedded arm -xplatform qws/linux-arm-gnueabi-g++ -prefix /home/rchaves/Toolchain -release -opensource -shared -fast -depths 16 -largefile -no-exceptions -no-accessibility -stl -no-sql-mysql -no-sql-psql -no-sql-oci -no-sql-odbc -no-sql-tds -no-sql-db2 -no-sql-sqlite -no-sql-sqlite2 -no-sql-ibase -no-qt3support -no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon-backend -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -no-declarative-debug -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-openssl -no-nis -no-cups -iconv -no-pch -no-dbus -qt-freetype -no-opengl -qt-gfx-linuxfb -qt-kbd-linuxinput -qt-mouse-tslib -nomake demos -nomake examples

And the following parameters to execute the application:

QWS_DISPLAY=LinuxFb:/dev/fb0:depth=16 ./app -qws

Here there are the application framebuffer (samples) log:

The framebuffer device was opened successfully.

Fixed screen info:
    id:          DISP3 BG
    smem_start:  0x93800000
    smem_len:    7864320
    type:        0
    type_aux:    0
    visual:      2
    xpanstep:    1
    ypanstep:    1
    ywrapstep:   0
    line_length: 2048
    mmio_start:  0x0
    mmio_len:    0
    accel:       0

The framebuffer device was mapped to memory successfully.

Successfully switched to graphics mode.

Variable screen info:
    xres:           1024
    yres:           768
    xres_virtual:   1024
    yres_virtual:   3840
    yoffset:        0
    xoffset:        0
    bits_per_pixel: 16
    grayscale: 0
    red:    offset:  0, length:  5, msb_right:  0
    green:  offset:  5, length:  6, msb_right:  0
    blue:   offset: 11, length:  5, msb_right:  0
    transp: offset:  0, length:  0, msb_right:  0
    nonstd:       0
    activate:     64
    height:       -1
    width:        -1
    accel_flags:  0x0
    pixclock:     15385
    left_margin:  157
    right_margin: 157
    upper_margin: 16
    lower_margin: 15
    hsync_len:    5
    vsync_len:    1
    sync:         0
    vmode:        0

Frame Buffer Performance test...
    Average:   43020 usecs
    Bandwidth: 174.338 MByte/Sec
    Max. FPS:  23.245 fps

Will draw 3 rectangles on the screen,
they should be colored red, green and blue (in that order).
Done.
André G. Andrade
  • 501
  • 11
  • 21

2 Answers2

1

Better late than never. I had this exact problem with a SAM5 processor using Qt5.5.1 and the linuxfb plugin. Reconfigure or recompile the Qt5 framework will NOT solve the problem.

Apparently the LinuxFB plugin does not support the BGR format. There is an open bug tracking this issue. Check the determineFormat function in ../src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp, in which you will find out that the ImageFormats are hardcoded to **RGB no matter what kind of framebuffer info was provided.

To solve the problem, applying the patch attached to the bug may help you to resolve this issue.

I said "may" because my framebuffer driver was falsely reporting it is in the RBG format. So watch out for that. If that is the case, just hardcode the swapRgb flag until you fix your framebuffer driver.

Frank Liu
  • 1,466
  • 3
  • 23
  • 36
0

Update: Try setting -depths generic in ./configure and run with -display linuxfb:genericcolors. This is as per this thread which discusses the problem.

Old answer: It sounds like your endian-ness of the display is swapped.

As per the documentation, you can try to pass the littleendian option to the display string. The other option is to consult the linux fb documentation about performing endian swaps.

Yann Ramin
  • 32,895
  • 3
  • 59
  • 82
  • Hi Yann, we already tried to use littleendian option on framebuffer parameter without result. – André G. Andrade Aug 06 '12 at 16:37
  • @AndréAndrade: darn :(. Have you verified this problem is unique to the Qt application, and not just a result of the LCD being mis-wired? Does the console have the same color inversion if you display non-white text? – Yann Ramin Aug 06 '12 at 16:49
  • When I use the provided display Qt libary it works well, but when I use my own Qt compilation I got the problemn. The colors at the display are ok, the problemn is with my application + my Qt compilation. – André G. Andrade Aug 06 '12 at 16:52
  • @AndréAndrade: Try my updated suggestion. I don't have a board with a swapped LCD so I can easily test :) – Yann Ramin Aug 06 '12 at 16:58
  • We already tried your update sugestion this morning without success. I posted some framebuffer debug on my question update. – André G. Andrade Aug 06 '12 at 17:38