Trolltech Home | Qtopia-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qtopia-interest Archive, March 2008
Red and blue swapped in Qtopia core


Message 1 in thread


Hello !

I am running Qt for Embedded Linux (aka Qtopia Core) on an AT91SAM9261-EK board and the red and blue are swapped...

Apparently Qtopia is configured for RGB whereas my board expect BGR...


Is there a solution ?



Cheers,

Guillaume

Message 2 in thread

GARDET Guillaume wrote:
> 
> 
> Hello !
> 
> I am running Qt for Embedded Linux (aka Qtopia Core) on an
> AT91SAM9261-EK board and the red and blue are swapped...
> 
> Apparently Qtopia is configured for RGB whereas my board expect BGR...
> 
> 
> Is there a solution ?

You may need to have your own screen driver.  In any case I'd suggest
looking under the QScreen documentation, pixelType()

Also: QScreenDriverPlugin, QScreenDriverFactory and Qtopia Core Display
Management.

--
 [ signature omitted ] 

Message 3 in thread

Thanks for your reply !

I am running the 4.3.4 and the frammebuffer depth is 16.

I tried your solution but when I run the demos or examples I get the following error :

solidFill_setup(): Screen depth 16 not supported!


I will try the 4.4 beta1 available on the trolltech ftp server.


Cheers,

Guillaume


-------- Message d'origine--------
De: Tom Cooksey [mailto:tomcooksey@xxxxxxxxxxxxxx]
Date: jeu. 06/03/2008 18:03
À: GARDET Guillaume
Objet : Re: Red and blue swapped in Qtopia core
 
What's your framebuffer depth and which qt version are you using?

If you are uging 4.3.x, try adding "-depth generic" to configure. You
will also need to export "QWS_DISPLAY=Linuxfb:genericcolors".

This should be fixed automatically (and be much faster) in 4.4.


Cheers,

Tom

PS: These will only work if the LinuxFB driver gives QT the correct information.

On 3/6/08, GARDET Guillaume <ggardet@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>
> Hello !
>
> I am running Qt for Embedded Linux (aka Qtopia Core) on an AT91SAM9261-EK
> board and the red and blue are swapped...
>
> Apparently Qtopia is configured for RGB whereas my board expect BGR...
>
>
> Is there a solution ?
>
>
>
> Cheers,
>
> Guillaume
>


Message 4 in thread


I will try it and let you know if it works !

Thanks

Guillaume



-------- Message d'origine--------
De: Ulf Samuelsson [mailto:ulf.samuelsson@xxxxxxxxx]
Date: ven. 07/03/2008 01:34
À: GARDET Guillaume; qtopia-interest@xxxxxxxxxxxxx
Objet : Re: Red and blue swapped in Qtopia core
 
> Hello !
> 
> I am running Qt for Embedded Linux (aka Qtopia Core) on an AT91SAM9261-EK board and the red and blue are swapped...
> 
> Apparently Qtopia is configured for RGB whereas my board expect BGR...
> 
> 
> Is there a solution ?
> 
> 
> 
> Cheers,
> 
> Guillaume

Checked with the AT91 hotline and got this answer:


   As you know our LCD controller works with a non standard RGB mode,
"BGR-555.1" instead "RGB-565".
   And you are totally right, the major part of graphic stack for embedded
systems uses only "RGB-565" (mplayer -vo /dev/fb, windows CE, directdraw, ....).

  The simplest way is to swap LCD IOs (See application note AT91SAM9 LCD
Controller http://www.atmel.com/dyn/resources/prod_documents/doc6300.pdf)

 Qt Embedded works only in RGB 565 mode.
 To change that, you have to change the QT_QWS_DEPTH16_RGB define to 555 and
bits shift and mask values.

#ifndef QT_QWS_DEPTH16_RGB
#define QT_QWS_DEPTH16_RGB 565
#endif
static const int qt_rbits = (QT_QWS_DEPTH16_RGB/100);
static const int qt_gbits = (QT_QWS_DEPTH16_RGB/10%10);
static const int qt_bbits = (QT_QWS_DEPTH16_RGB%10);
static const int qt_red_shift = qt_bbits+qt_gbits-(8-qt_rbits);
static const int qt_green_shift = qt_bbits-(8-qt_gbits);
static const int qt_neg_blue_shift = 8-qt_bbits;
static const int qt_blue_mask = (1<<qt_bbits)-1;
static const int qt_green_mask = (1<<(qt_gbits+qt_bbits))-(1<<qt_bbits);
static const int qt_red_mask =
(1<<(qt_rbits+qt_gbits+qt_bbits))-(1<<(qt_gbits+qt_bbits));


=========
After looking at the stuff above, I think the new code should look like:
(Didn't test)

#ifndef QT_QWS_DEPTH16_RGB
#define QT_QWS_DEPTH16_RGB 555
#endif
static const int qt_bbits = (QT_QWS_DEPTH16_RGB/100);
static const int qt_gbits = (QT_QWS_DEPTH16_RGB/10%10);
static const int qt_rbits = (QT_QWS_DEPTH16_RGB%10);

static const int qt_red_shift = 
static const int qt_green_shift = qt_rbits-(8-qt_gbits);
static const int qt_blue_shift = qt_rbits+qt_gbits-(8-qt_bbits);


static const int qt_neg_red_shift = 8-qt_rbits;
static const int qt_blue_mask = (1<<(qt_bbits+qt_gbits+qt_rbits))-(1<<(qt_gbits+qt_rbits)); 
static const int qt_green_mask = (1<<(qt_gbits+qt_rbits))-(1<<qt_rbits);
static const int qt_red_mask = (1<<qt_rbits)-1;




Best Regards
Ulf Samuelsson



Message 5 in thread

Hi Guillaume and Ulf,

I think the method Ulf points to can work in Qt/E 2.3 and also up to  
Qtopia Core 4.2.x, but I'm not 100% sure this will still work in 4.3  
or that this code is still even there.

I think what Ian suggests about having your own screen driver is not  
a bad idea anyway because you might also find some optimizations you  
can make by a custom driver for your particular hardware. It also is  
made easier to encapsulate the hardware specific changes in a device  
configuration profile when you make a screen driver plugin instead of  
by making patches to the baseline qtopia core code.

--
 [ signature omitted ] 

Message 6 in thread

GARDET Guillaume wrote:
>
>
> Hello !
>
> I am running Qt for Embedded Linux (aka Qtopia Core) on an 
> AT91SAM9261-EK board and the red and blue are swapped...
>
> Apparently Qtopia is configured for RGB whereas my board expect BGR...
>
>
> Is there a solution ?
>
In Qtopia Core 4.3 you should be able to configure with:
./configure -depths generic
and then run your application with
./myApp -qws -display linuxfb:genericcolors
(or adjust your QWS_DISPLAY environment variable)

In Qtopia Core 4.4 BGR framebuffers are supported by the standard driver.

--
 [ signature omitted ] 

Message 7 in thread

hello !

I tried Qtopia core 4.4 beta 1 but I cannot compile it... I have an undefined ref. during the make : "qt_atomic_yield()"

Any idea to solve it ?

When will be released the Qt for embedded Linux (aka Qtopia Core) 4.4 ?


Cheers,

Guillaume


-------- Message d'origine--------
De: Håvard Wall [mailto:hwall@xxxxxxxxxxxxx]
Date: ven. 14/03/2008 08:48
À: GARDET Guillaume
Cc: qtopia-interest@xxxxxxxxxxxxx
Objet : Re: Red and blue swapped in Qtopia core
 
GARDET Guillaume wrote:
>
>
> Hello !
>
> I am running Qt for Embedded Linux (aka Qtopia Core) on an 
> AT91SAM9261-EK board and the red and blue are swapped...
>
> Apparently Qtopia is configured for RGB whereas my board expect BGR...
>
>
> Is there a solution ?
>
In Qtopia Core 4.3 you should be able to configure with:
./configure -depths generic
and then run your application with
./myApp -qws -display linuxfb:genericcolors
(or adjust your QWS_DISPLAY environment variable)

In Qtopia Core 4.4 BGR framebuffers are supported by the standard driver.

--
 [ signature omitted ] 

Message 8 in thread

On Friday 14 March 2008 09:03:45 you wrote:
> 
> hello !
> 
> I tried Qtopia core 4.4 beta 1 but I cannot compile it... I have an undefined ref. during the make : "qt_atomic_yield()"
> 
> Any idea to solve it ?

Please try the attached patch and let me know if that solves your issue.

> When will be released the Qt for embedded Linux (aka Qtopia Core) 4.4 ?

I'm not sure about the final release, but we're planning for a release candidate within a month. 

If you want to try out 4.4 for solving your bgr issues, these are not fixed in the beta package and you will have to download a recent snapshot instead. I you give me feedback on the qt_atomic_yield() patch I'll apply that as soon as possible and it should appear in the snapshots within a day or two.

--
 [ signature omitted ] 
--- src/corelib/arch/arm/qatomic_arm.cpp~	2008-02-19 15:54:26.000000000 +0100
+++ src/corelib/arch/arm/qatomic_arm.cpp	2008-03-14 09:45:24.000000000 +0100
@@ -43,7 +43,10 @@
 
 #include <QtCore/qglobal.h>
 
+#include <unistd.h>
+#ifdef _POSIX_PRIORITY_SCHEDULING
 #include <sched.h>
+#endif
 
 QT_BEGIN_NAMESPACE
 
@@ -53,7 +56,9 @@
 
 Q_CORE_EXPORT void qt_atomic_yield()
 {
+#ifdef _POSIX_PRIORITY_SCHEDULING
     sched_yield();
+#endif
 }
 
 QT_END_NAMESPACE

Message 9 in thread


Your patch has no effect...


-------- Message d'origine--------
De: Håvard Wall [mailto:hwall@xxxxxxxxxxxxx]
Date: ven. 14/03/2008 09:57
À: GARDET Guillaume
Cc: qtopia-interest@xxxxxxxxxxxxx
Objet : Re: Red and blue swapped in Qtopia core
 
On Friday 14 March 2008 09:03:45 you wrote:
> 
> hello !
> 
> I tried Qtopia core 4.4 beta 1 but I cannot compile it... I have an undefined ref. during the make : "qt_atomic_yield()"
> 
> Any idea to solve it ?

Please try the attached patch and let me know if that solves your issue.

> When will be released the Qt for embedded Linux (aka Qtopia Core) 4.4 ?

I'm not sure about the final release, but we're planning for a release candidate within a month. 

If you want to try out 4.4 for solving your bgr issues, these are not fixed in the beta package and you will have to download a recent snapshot instead. I you give me feedback on the qt_atomic_yield() patch I'll apply that as soon as possible and it should appear in the snapshots within a day or two.

--
 [ signature omitted ] 

Message 10 in thread

On Monday 17 March 2008 12:44:39 GARDET Guillaume wrote:
> 
> Your patch has no effect...


Ok, could you send me the exact error message?

--
 [ signature omitted ] 

Message 11 in thread


I also tried "qt-embedded-linux-opensource-src-4.4.0-snapshot-20080314" but I get the following error about an undefined ref. to "qt_atomic_yield(int*)" :

**********************************************************************
arm-linux-g++ -fno-exceptions -Wl,-rpath,/tftpboot/tst_4.4.0-snapshot-20080314/lib -Wl,-rpath,/tftpboot/tst_4.4.0-snapshot-20080314/lib -o screenshot .obj/release-shared-emb-arm/main.o .obj/release-shared-emb-arm/screenshot.o .obj/release-shared-emb-arm/moc_screenshot.o    -L/tftpboot/at91/lib/ -L/home/ggardet/Desktop/tests/build_qt-embedded-linux-opensource-src-4.4.0-snapshot-20080314/lib -lQtGui -L/tftpboot/at91/lib/ -L/tftpboot/tst_4.3.4_modifie//lib -lts -lpng -lQtNetwork -lQtCore -lz -lm -ldl -lpthread
.obj/release-shared-emb-arm/screenshot.o: dans la fonction « Screenshot::createButtonsLayout()      »:
screenshot.cpp:(.text+0x344): référence indéfinie vers « qt_atomic_yield(int*) »
screenshot.cpp:(.text+0x3c0): référence indéfinie vers « qt_atomic_yield(int*) »
screenshot.cpp:(.text+0x43c): référence indéfinie vers « qt_atomic_yield(int*) »
.obj/release-shared-emb-arm/screenshot.o: dans la fonction « Screenshot::createOptionsGroupBox()      »:
screenshot.cpp:(.text+0x580): référence indéfinie vers « qt_atomic_yield(int*) »
screenshot.cpp:(.text+0x60c): référence indéfinie vers « qt_atomic_yield(int*) »
.obj/release-shared-emb-arm/screenshot.o:screenshot.cpp:(.text+0x6bc): encore plus de références indéfinies suivent vers « qt_atomic_yield(int*) »
collect2: ld a retourné 1 code d'état d'exécution
make[3]: *** [screenshot] Erreur 1
make[3]: quittant le répertoire « /home/ggardet/Desktop/tests/build_qt-embedded-linux-opensource-src-4.4.0-snapshot-20080314/examples/desktop/screenshot »
make[2]: *** [sub-screenshot-make_default-ordered] Erreur 2
make[2]: quittant le répertoire « /home/ggardet/Desktop/tests/build_qt-embedded-linux-opensource-src-4.4.0-snapshot-20080314/examples/desktop »
make[1]: *** [sub-desktop-make_default] Erreur 2
make[1]: quittant le répertoire « /home/ggardet/Desktop/tests/build_qt-embedded-linux-opensource-src-4.4.0-snapshot-20080314/examples »
make: *** [sub-examples-make_default-ordered] Erreur 2
**********************************************************************

(I'm sorry the terminal output is in french but you should understand the error. If you cannot, please tell me how setup my Konsole in english)

It is nearly the same error in the 4.4.0 beta1, I get an error about "qt_atomic_yield()" instead of "qt_atomic_yield(int*)"...


I will (re)try to build the libs only and not the demos and examples... (I am not sure but I think that I get the error with the libs too...)

Cheers,

Guillaume



-------- Message d'origine--------
De: Håvard Wall [mailto:hwall@xxxxxxxxxxxxx]
Date: lun. 17/03/2008 12:48
À: qtopia-interest@xxxxxxxxxxxxx
Cc: GARDET Guillaume
Objet : Re: Red and blue swapped in Qtopia core
 
On Monday 17 March 2008 12:44:39 GARDET Guillaume wrote:
> 
> Your patch has no effect...


Ok, could you send me the exact error message?

--
 [ signature omitted ] 

Message 12 in thread

hmm, could you send me the following files as well?
config.status
.qmake.cache
mkspecs/qconfig.pri

Which version of gcc are you using?

--
 [ signature omitted ]