Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: OpenGL on Windows (high CPU usage)

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2018
    Posts
    9

    OpenGL on Windows (high CPU usage)

    Hi there, I help develop an open-source DAW called Mixbus

    Like most DAW's it supports plugins. On Windows, the most common format (for audio plugins) is VST although others also exist (AAC / LV2 / LUA and a few others).

    Many of our users have complained about very high CPU usage when launching certain plugins. If the CPU is normally running at 10%, launching just 1 x instance of the plugin will make that shoot up to 30%. A 2nd instance increases it to 50% and so on. Before long (with just a few plugins open) the whole app will crash.

    After 2 months of testing we've finally realised that the common factor (for all the affected plugins) is that they all use OpenGL. And yet I thought the whole point of OpenGL was to use hardware acceleration (and therefore minimize CPU usage)?

    Does OpenGL simply not work on Windows? Or could the plugin devs be misusing it somehow (or misunderstanding it maybe)? Or is there more to all this than simply installing OpenGL drivers and hoping it'll all work?

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,511
    Quote Originally Posted by johne53 View Post
    ...open-source DAW called Mixbus ... supports plugins.
    Many of our users have complained about very high CPU usage when launching certain plugins.
    1 x instance of the plugin will make that shoot up to 30%.
    A 2nd instance increases it to 50% and so on.

    After 2 months of testing we've finally realised that the common factor (for all the affected plugins) is that they all use OpenGL.
    That's an interesting data point. But now you need to look deeper for correlations beyond that.

    And yet I thought the whole point of OpenGL was to use hardware acceleration (and therefore minimize CPU usage)?
    OpenGL is just an API. By itself, it doesn't do anything and can't cause performance problems. It's a spec.

    Graphics drivers (from the GPU vendors, CPU vendors, and 3rd parties) develop graphics drivers that implement that spec. Users develop applications that sit on top of those drivers to make use of GPUs and CPUs via the graphics driver (yes, CPUs; some graphics drivers run on the CPU). These drivers, the apps that sit on top of them, and the underlying hardware are what determine the performance, good or bad.

    Does OpenGL simply not work on Windows?
    Some vendors' graphics drivers and GPUs work exceptionally well on Windows. Performance problems can sometimes be driver related. However...

    It's more common for graphics performance problems to come from inefficient usage of the OpenGL API from the application (the plugins in this case).

    Or could the plugin devs be misusing it somehow (or misunderstanding it maybe)?
    This seems more likely. In any case, what you're looking for is correlations between specific graphics drivers and/or app plugins with the performance problem you're seeing. Then you can dig deeper and see why that correlation exists.

    You can go a long way toward identifying these correlations by capturing, in addition to the plugin names and versions, the graphics driver names and versions and the underlying GPU or CPU being used. For information on how to do this, see the GL_RENDERER, GL_VENDOR, and GL_VERSION string queries here:


    After creating a GL context, you can make these queries and log the results. To get a sample of what some of the GL_RENDERER and GL_VERSION strings look like, see this link:

    Last edited by Dark Photon; 10-11-2018 at 06:00 AM.

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2018
    Posts
    9
    Thanks for the info and links (I'll try them a bit later...)

    I'm working on Windows - but in the meantime, one of the Linux devs just told me that (for Linux) it usually isn't enough to just install the OpenGL drivers. There's usually some kind of app to launch (presumably from the card manufacturer?) which will check for hardware acceleration and allow you to activate or deactivate it (i.e. the OpenGL driver won't necessarily do this automatically) Any idea if there's something similar needed on Windows?

    I'm using NVidia GeForce graphics (8400GS). It's old by modern standards but it supports hardware acceleration AFAIK.

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,511
    Quote Originally Posted by johne53 View Post
    Any idea if there's something similar needed on Windows?
    I'm not an expert there, but I have read that if the graphics drivers aren't installed properly on Windows, it can fall back to Microsoft's GDI implementation, which implements OpenGL 1.1 on the CPU (not on the GPU):




    Hopefully someone with more knowledge here will chime in. Most GL apps nowadays won't even function on that driver, but if they do, the performance will be poor.

    Also, my vague recollection is that on Windows if the app requests a pixel format for the window that the GPU driver doesn't support, Windows will fall back to using Microsoft's OpenGL 1.1 GDI driver rather than the GPU vendor's graphics driver.
    Last edited by Dark Photon; 10-11-2018 at 12:07 PM.

  5. #5
    Junior Member Newbie
    Join Date
    Oct 2018
    Posts
    9
    Thanks again Dark Photon. I've only just woken up over here but I'll follow those links after I've had some breakfast !

    BTW - I'd also read about problems with the standard Microsoft driver so just before posting here, I installed NVidia's official driver (which tells me I'm now running OpenGL ver 3.3).

    I'll also check if there's an NVidia forum somewhere. Maybe that'd be the best place to find out if my card supports hardware acceleration (and how to check if it's enabled).

    Thanks again for all your help.

    P.S. - message to the forum moderators... your Captcha app doesn't seem to work with Internet Explorer

  6. #6
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,511
    Quote Originally Posted by johne53 View Post
    BTW - I'd also read about problems with the standard Microsoft driver so just before posting here, I installed NVidia's official driver (which tells me I'm now running OpenGL ver 3.3).
    Sounds good. Are you able to repro the perf issue with some plugins on that system? Just keep in mind that that GPU is 11 years old (which is ancient in GPU terms).

    I'll also check if there's an NVidia forum somewhere.
    There are these two that I know about:


    However, I've generally gotten better responses to my OpenGL and GPU-related questions here than on the NVidia forums. Plus you can't beat this site for the awesome search history (OpenGL-related posts going back to the early 2000s). So don't feel like you can't post in both places (here and on one of their forums).

    Maybe that'd be the best place to find out if my card supports hardware acceleration (and how to check if it's enabled).
    Pretty much any NVidia GPU is going to support hardware acceleration, and their drivers are of excellent quality IMO. As an easy first check, you can see if someone else has submitted an entry for the GPU/driver here:


    Just type in the GPU model name in the "Renderer" column. This can also be a useful reference, though it doesn't directly answer your question:


    However, probably the best test is to go to the NVidia driver download page:


    select your GPU and OS, and see if you can download drivers for it.

    P.S. - message to the forum moderators... your Captcha app doesn't seem to work with Internet Explorer
    I sent an IM to the admin about this. Thanks for the heads-up!

  7. #7
    Administrator Regular Contributor Khronos_webmaster's Avatar
    Join Date
    Apr 2007
    Location
    Montreal
    Posts
    184
    Perhaps time to move to MS Edge?
    Webmaster Khronos.org and OpenGL.org

  8. #8
    Junior Member Newbie
    Join Date
    Oct 2018
    Posts
    9
    Quote Originally Posted by Dark Photon View Post

    Just type in the GPU model name in the "Renderer" column. This can also be a useful reference, though it doesn't directly answer your question:
    Hmmm... no matter what I type in the Renderer column, I just see an error message saying:- Warning: mysql_fetch_row() expects parameter 1 to be resource, Boolean


    Quote Originally Posted by Dark Photon View Post

    select your GPU and OS, and see if you can download drivers for it.
    Yes, I did that a couple of days ago - and I also found from somewhere (here maybe?) a utility called the OpenGL Extensions Viewer. That utility gives me lots of information about the status of OpenGL on my system but the one thing it doesn't seem to tell me is whether my OpenGL driver is making use of the hardware acceleration features offered by my card. Given how important this is for OpenGL I'm quite amazed that it's so difficult to find this out...
    Last edited by johne53; 10-12-2018 at 06:10 AM.

  9. #9
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    6,046
    Quote Originally Posted by johne53 View Post
    That utility gives me lots of information about the status of OpenGL on my system but the one thing it doesn't seem to tell me is whether my OpenGL driver is making use of the hardware acceleration features offered by my card. Given how important this is for OpenGL I'm quite amazed that it's so difficult to find this out...
    There's no point in asking the driver that question, since it can basically lie anyway and you'd never know.

    You should assume (for core OpenGL features) that if the implementation supports something, then it does so as fast as it could support it. That may not always be true, but it's a good enough starting point.

    Your problem is that essentially someone else is slowing down your program (possibly due to pathological use of an API) and you have no way to stop them. That's not really a problem you can query a driver to resolve.

  10. #10
    Junior Member Newbie
    Join Date
    Oct 2018
    Posts
    9
    Thanks Alfonse - if the problematic plugins all came from the same manufacturer I'd be inclined to agree with you but in fact, they come from different sources. The common factor is that the problematic ones all use OpenGL.

    To me, this suggests that something about OpenGL isn't working as it should. And when I see a big surge in CPU activity (as each OpenGL window opens) it suggests that maybe they aren't using hardware acceleration for some reason. I'd just hoped there'd be a way to find out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •