QT Embedded 4.4.3 and TS-7390 Color Depth Issues

The colour display on the TS-7390′s screen wasn’t very good. It seemed no red or green could be displayed.
I copied the compiled version of QT3 on ftp.embeddedarm.com and this seemed to display colours ok?

So what was up. I discovered that QT4 was detecting my board as 15 bit colour depth but QT3 didn’t support it. So it assumed it would use 16bits (RGB 565 (5 bits for red, 6 green and 5 for blue).
I contacted technologic and they confirmed that my board was actually 16bits (RGB 565) but the least significant bit of green was ignored. A handy way of supporting RGB555 and RGB565. But this extra padding bit was in the middle where as QT4 expects it as the MSB or LSB of the 16bits.
This is the layout of the TS-7390: RRRRRGGGGGXBBBBB where X is the ignored bit by the TS7390.

Looking into the sources I discovered /src/gui/embedded/qscreenlinuxfb_qws.cpp. In it there is a setPixFormat function. Here I tried forcing it to QImage::Format_RGB16.

void QLinuxFbScreen::setPixelFormat(struct fb_var_screeninfo info)
{
QScreen::setPixelFormat(QImage::Format_RGB16);
}

Re compiling and deploying it, it made no difference. So then i decided to do a whole series of qDebugs in qscreenlinuxfb_qws.cpp and qscreen_qws.cpp. The result was interesting. It still claimed to be using 15 bits when infact 16.

After a lot of investigation I discovered it was detecting the green length as 5 when infact should be 6 so i forced it to 6.
In qscreenlinuxfb_qws.cpp line 309 (before the grayscale = vinfo…..) enter this line:
vinfo.green.length = 6;

re compiled and everything working fine. Note I think the modification of the setPixFormat is still required.

And that was it, perfect colour. I hope it helps someone else that has the same problem.

Saturday, January 31st, 2009 QT Embdedded Programming, Single Board Computer

2 Comments to QT Embedded 4.4.3 and TS-7390 Color Depth Issues

  • Ilija says:

    Just wanted to say big thanks. I have the same board, and had the exact same problem with the Qt4 application I am developing. This post just saved me hours (if not days) of debugging.

    For the record, only the latter modification was required to fix the problem (i.e. forcing the length of green to be 6).

    Cheers,
    Ilija

  • Donal says:

    No problem. I’m glad I could help. The problem drove me insane, so didn’t want to see it happen anyone else :)

    Regards,
    Donal

  • Leave a Reply

    You must be logged in to post a comment.