Results 1 to 11 of 11

Thread: udateGL() with Nvidia&ATI

  1. #1
    Join Date
    Dec 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default udateGL() with Nvidia&ATI

    Hi,

    my situation is following:

    I write an app that have one QWidget. This widtget contains between 9 and 12 custom QGLWidget. Every custom QGLWidget get every 40 ms an image from a worker(which works in his one thread). I use PBO to copy imgaes in textur. And I use following connects:
    Qt Code:
    1. connect(mCam, SIGNAL(renderedImage(const QImage &)), this, SLOT(updateTextur(const QImage &)));
    2. QTimer *timer = new QTimer();
    3. timer->start(40);
    4. connect(timer,SIGNAL(timeout()),this,SLOT(updateGL()),Qt::DirectConnection);
    To copy to clipboard, switch view to plain text mode 

    updateTextur is simple:
    Qt Code:
    1. void OpenGLWidget::updateTextur(const QImage &image)
    2. {
    3. if(image.byteCount() > 0)
    4. {
    5. mImg = QImage(image);
    6.  
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

    Furthermore, I stop Time between painGL's invocation. And I get 47 ms with ATI and over 100 ms with NVidia!

    Have sombody an idea why?

    thanks!

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

    Default Re: udateGL() with Nvidia&ATI

    Change byteCount() to isNull() and see if it changes anything. Apart from that - use a profiler to see where the bottle-neck of your application is.
    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
    Dec 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: udateGL() with Nvidia&ATI

    Thank you for Answer!

    I replaced byteCount() by isNull(), and I already profiled my app, But I can't find any bottle-neck.

    But I saw some other problems:
    My rozessor works with 50%, but if I put other window from other app over my app, than my app works with 20% and it stay on 20% if i do ohter window off.
    If I put ohter window over half of my window, than I get better stop time (60 ms)

    It is very strange! With ATI it works realy fine, but with NVIDIA come this Problems.

    Somebody an idea?

    thanks!

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

    Default Re: udateGL() with Nvidia&ATI

    Quote Originally Posted by bahbah30 View Post
    and I already profiled my app, But I can't find any bottle-neck.
    Then it means you didn't profile you app. There is always a bottle-neck, it's nothing to be "found" really, it's the code path taking the most time.

    But I saw some other problems:
    My rozessor works with 50%,
    You probably have two cores in your machine and the application uses only one. Do you use threads in your app?

    but if I put other window from other app over my app, than my app works with 20%
    Less to calculate/display.
    and it stay on 20% if i do ohter window off.
    I can't explain that.
    If I put ohter window over half of my window, than I get better stop time (60 ms)
    Less to calculate/display.
    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
    Dec 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: udateGL() with Nvidia&ATI

    I used gprof to profile my app, but i found nothing, becouse my app is multithreded. And I use minGW. So I can't profile my app.

    I have main.cpp and 3 other classes. Worker is in itsown thread. In main-tread is my MainWindows and my OpenGLWidget. OpenGLWidget will be shown between 9 and 12 times in MainWindow. If is stop time in painGL using QTime:
    Qt Code:
    1. void OpenGLWidget::paintGL()
    2. {
    3. endTime1= t1.elapsed();//rest of the time
    4. t.start();
    5. paint();//openGL code
    6. endTime = t.elapsed(); //within paintGL
    7. t1.start();
    8. }
    To copy to clipboard, switch view to plain text mode 

    endTime ist always 0. But the endTime1 is between 40 and 160 ms(with 12 widgets ) or 40 and 120 ms (with 9 widgets). But i do nothing in the rest of time. If I execute the same binary on ATI I get expected time (40 ms) Because :
    Qt Code:
    1. QTimer *timer = new QTimer();
    2. timer->start(40);
    3. connect(timer,SIGNAL(timeout()),this,SLOT(updateGL()),Qt::DirectConnection);
    To copy to clipboard, switch view to plain text mode 

    Use QT driver specific way to show an app?

    thanks!

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

    Default Re: udateGL() with Nvidia&ATI

    Quote Originally Posted by bahbah30 View Post
    I used gprof to profile my app, but i found nothing, becouse my app is multithreded. And I use minGW. So I can't profile my app.
    There is more than one profiling tool in the world.

    So what do the threads do?

    In general your application is eating up a lot of cpu power because you're repainting it constantly (even when there is nothing to repaint).
    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
    Dec 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: udateGL() with Nvidia&ATI

    Quote Originally Posted by wysota View Post
    There is more than one profiling tool in the world..
    Do you know one non commercial that works with minGW on windows (with multitreadinbg support)?

    Quote Originally Posted by wysota View Post
    So what do the threads do?.
    It encapsulates ffmpeg to decode Video and emits QImage as Signal.

    Quote Originally Posted by wysota View Post
    In general your application is eating up a lot of cpu power because you're repainting it constantly (even when there is nothing to repaint)
    I Know, but the question ist still, why it works fine on ATI and so bad on NVIDIA?

    Thanks!

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

    Default Re: udateGL() with Nvidia&ATI

    Quote Originally Posted by bahbah30 View Post
    Do you know one non commercial that works with minGW on windows (with multitreadinbg support)?
    I'm not that fond of Windows, sorry. You can run linux as a virtual machine and use Valgrind. That's the best profiling tool available. As for gprof, I know it can handle threads at least on Linux with a bit of tweaking. Moreover you can rem out the thread for now and emit bogus data - then you'll be able to use gprof directly.

    It encapsulates ffmpeg to decode Video and emits QImage as Signal.
    Can we see the code and the connect statement using the signal?


    I Know, but the question ist still, why it works fine on ATI and so bad on NVIDIA?
    You'd have to ask ATI and NVIDIA, their GL drivers are proprietary Nobody will be able to tell you the exact code paths used in both cases.

    I suggest you start by getting rid of the timer and updating the widget when something really changes in 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.


  9. #9
    Join Date
    Dec 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: udateGL() with Nvidia&ATI

    Hi,

    now I have minimal exmaple of the problem as Attachment._profileOpenGL.zip

    If I do following:
    Qt Code:
    1. OpenGLWidget::OpenGLWidget( QWidget *parent):
    2. QGLWidget(parent)
    3. {
    4. QTimer *mTimer = new QTimer();
    5. mTimer->start(40);
    6. connect(mTimer,SIGNAL(timeout()),this,SLOT(updateGL()));
    7. }
    To copy to clipboard, switch view to plain text mode 

    I expect, that I get 40 as result of invoking this:
    Qt Code:
    1. void OpenGLWidget::paintGL()
    2. {
    3. int a = t.elapsed();
    4. t.start();
    5. qDebug()<<"Time out of painGL: "<<a;
    6. }
    To copy to clipboard, switch view to plain text mode 

    but it comes every thing, but not 40 ms.

    thanks!
    Last edited by bahbah30; 25th January 2011 at 13:12.

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

    Default Re: udateGL() with Nvidia&ATI

    I would expect everything but 40ms.
    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.


  11. The following user says thank you to wysota for this useful post:

    bahbah30 (25th January 2011)

  12. #11
    Join Date
    Dec 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default [solved]Re: udateGL() with Nvidia&ATI

    I got it!

    It was "vsync". I disabled vsync and it works how expected.

    @wysota: Thank you that you tried to find a solution (dziękuję)
    Last edited by bahbah30; 25th January 2011 at 19:07.

Similar Threads

  1. NVIDIA CUDA + Qt
    By redscorp in forum Qt Programming
    Replies: 3
    Last Post: 24th October 2010, 18:35
  2. openGL: pbuffer in thread and nvidia
    By ZHawk in forum Qt Programming
    Replies: 3
    Last Post: 25th June 2010, 17:09
  3. Problems with Nvidia (NVSG) and QVector.h
    By tas008 in forum Qt Programming
    Replies: 0
    Last Post: 19th May 2010, 10:31
  4. Replies: 0
    Last Post: 16th March 2010, 03:13
  5. QGLWidget, ATI & NVIDIA
    By pir in forum Qt Programming
    Replies: 3
    Last Post: 12th September 2006, 13:06

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.