Results 1 to 9 of 9

Thread: How to draw a widget directly on the frame buffer

  1. #1
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question How to draw a widget directly on the frame buffer

    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???

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to draw a widget directly on the frame buffer

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to draw a widget directly on the frame buffer

    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...???

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to draw a widget directly on the frame buffer

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to draw a widget directly on the frame buffer

    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
    Qt Code:
    1. directPainter->allocatedRegion() or
    2. directPainter->reservedRegion()
    To copy to clipboard, switch view to plain text mode 

    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/qdirect...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.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to draw a widget directly on the frame buffer

    Try going through what is said in the "Rendering" section of QDirectPainter docs (namely going through QScreen::base()).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Re: How to draw a widget directly on the frame buffer

    Hi,

    I am currently using this code
    Qt Code:
    1. QWSServer *server = QWSServer::instance();
    2. if (server) {
    3. server->enablePainting(false);
    4. QScreen *screen = QScreen::instance();
    5. screen->shutdownDevice();
    6. screen->disconnect();
    7. screen->connect("/dev/fb0");
    8. screen->initDevice();
    9. server->enablePainting(true);
    10. server->refresh();
    To copy to clipboard, switch view to plain text mode 
    which has certainly increased the on-screen click response to the widget.

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

  8. #8
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Re: How to draw a widget directly on the frame buffer

    Hi,
    I also used
    Qt Code:
    1. QScreen *screen = QScreen::instance();
    2. qDebug()<<"$$$$$$$$$$$$ direct painter"<<QDirectPainter::frameBuffer();
    3. qDebug()<<"**$$$$$$$$$$ screen base"<< screen->base();
    To copy to clipboard, switch view to plain text mode 


    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...????

  9. #9
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Re: How to draw a widget directly on the frame buffer

    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????

Similar Threads

  1. how to draw a circle on a frame in Qt-4
    By grsandeep85 in forum Qt Programming
    Replies: 1
    Last Post: 16th September 2009, 08:05
  2. Replies: 0
    Last Post: 8th July 2009, 11:01
  3. Replies: 2
    Last Post: 21st June 2009, 06:04
  4. Draw contents of widget in another widget
    By gustavosbarreto in forum Qt Programming
    Replies: 1
    Last Post: 6th August 2007, 14:43
  5. Replies: 5
    Last Post: 7th November 2006, 15:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.