PDA

View Full Version : How to draw a widget directly on the frame buffer



kapoorsudhish
3rd November 2009, 06:27
Hi,
I am developing an embedded application where in i need to paint directly on the frame buffer as the size of the frame buffer is not as small as a mobile screen, the paint on screnn is happening slowly. How can i make the widget paint on the screen faster by directly painting on the frame buffer???

wysota
3rd November 2009, 10:02
If you are using embedded (without X11) it probably already is painting directly to frame buffer. That's the way embedded works. You can verify that you are using appropriate framebuffer driver (like DirectFB?), but that's probably it.

kapoorsudhish
4th November 2009, 05:33
Actually even i felt that in absence of X11 the application will directly interacting to the frame buffer, indeed it is but the painting is done by the client application (my application) which is slow as the client handles the paint event through qws server (according to my understanding) so when i am disabling the client and painting through server, the application response is fast, but my problem still remains where i am painting a table widget with colour which is taking some time, how can i reduce it further...???

wysota
4th November 2009, 09:24
You need to use proper mode for all your data to match your framebuffer (i.e. jus 16 bit images if your framebuffer is 16 bit deep), otherwise you'll have a big performance hit due to conversions. Apart from that you should debug your app and see what exactly takes that long.

kapoorsudhish
4th November 2009, 10:05
As of now i am trying to use the QDirectPainter class, but when i try to get the instance of the screen using QDirectPainter::frameBuffer () its returning me (0x0), so when i try to create the object of QDirectPainter and try to use


directPainter->allocatedRegion() or
directPainter->reservedRegion()


the application is crashing, i am stuck as to how can get the access to the framebuffer ...???

For refrence to QDirectPainter please check the link:
http://doc.trolltech.com/4.2/qdirectpainter.html#QDirectPainter

my requirement is to paint a 672 cells of table widget with different colours for which the painting is slow and i ma trying to reduce the on screen paint time, i dont know if the same can also be achieved in some other ways...???


Please suggest me some other alternative if possible.

wysota
4th November 2009, 14:14
Try going through what is said in the "Rendering" section of QDirectPainter docs (namely going through QScreen::base()).

kapoorsudhish
10th November 2009, 07:29
Hi,

I am currently using this code


QWSServer *server = QWSServer::instance();
if (server) {
server->enablePainting(false);
QScreen *screen = QScreen::instance();
screen->shutdownDevice();
screen->disconnect();
screen->connect("/dev/fb0");
screen->initDevice();
server->enablePainting(true);
server->refresh();

which has certainly increased the on-screen click response to the widget.

I am not sure if its actually helping in direct painting...???

kapoorsudhish
10th November 2009, 09:31
Hi,
I also used


QScreen *screen = QScreen::instance();
qDebug()<<"$$$$$$$$$$$$ direct painter"<<QDirectPainter::frameBuffer();
qDebug()<<"**$$$$$$$$$$ screen base"<< screen->base();



but i am getting a 0x0 at the output for both the functions which means i cont have the control to the frame buffer, am i doing something wrong here...????

kapoorsudhish
12th November 2009, 07:59
After Browsing through the code. i found
1) The screen->classID() returns QDirectFbScreen
2) The implementation of QScreen::Base() is to return the protected membet data.
3) The protected member data is filled by the derived class. So from point 1 the derived class in this case is QDirectFbScreen.
4) The data member is made data=0; in QDirectFbScreen::connect() method. and after that there is no other change to the data member.

This gives the reason why screen->base() is returning 0.

So can some one please tell me if i have to change the implementation of qDirectfbscreen provide by QT to get the valid frame buffer pointer????