Skip to main content
GameDev.net gamedev.net
🔒 Locked

Trouble with very slow rendering with nvidia under Linux

Started by floatingwoods Feb 5, 2013 at 10:55 AM 11 replies 9.7k views
Original Post
floatingwoods
floatingwoods

Hello,

I have a cross-platform openGl application that works fine with most graphic cards. However, there are rare cases when rendering is very slow under following conditions:

- Linux (Ubuntu)

- Nvidia card (e.g. Nvidia NVS 5200 M)

The application runs a single thread (the main thread), and turns vsync off at the beginning (following is the Linux code to turn Vsync off):


typedef int (APIENTRY * AAAAGLSWAPINTERVALEXTPROC)(int);
AAAAGLSWAPINTERVALEXTPROC wglSwapIntervalEXT=(AAAAGLSWAPINTERVALEXTPROC)glXGetProcAddress((const GLubyte*)"glXSwapIntervalSGI");
if (wglSwapIntervalEXT)
{
    wglSwapIntervalEXT(0);
}

Rendering gets very slow because following functions seems to be blocking for several ms even with an almost empty scene content:


openglWidget->swapBuffers(); // Qt command

or/and

openglWidget->doneCurrent(); // Qt command

It seems that VSync could not be turned off! More strange is that following command:


export __GL_SYNC_TO_VBLANK=1

improves the rendering speed (but still takes around 40-50 ms for each frame).

what is going on here? Other platforms or other graphic cards do not have any problem at all. It is critical to be able to render as quickly as possible (disable vsync) for various reasons (e.g. rendering for generation of movie files).

Thanks for any insight!!

Ashaman73
Ashaman73

I'm not a linux expert, but under windows you often have the option to set the driver settings to overwrite application settings, including the vsync. Therefor check if your driver settings first.

jmakitalo
jmakitalo

Which drivers are you using? The default open source drivers have poor 3D performance, so make sure you have the nvidia's closed drivers installed.

V-man
V-man

You should get information with glGetString and also, make sure you have the drivers from nvidia installed and not MESA3D or some other software junk.

Bregma
Bregma
This is a known bug in nVidia's binary blob drivers.

nVidia has been working with Valve to fix a number of performance issues. A newer (experimental) version 310 of the driver is available in the Ubuntu archives for testing with: it may solve this particular problem. On quantal this is the nvidia-experimental-310 package and on raring it's just nvidia-310. Try that and see if it solves your problem: you can always return to the default nvidia-current package if there are other problems.
Stephen M. Webb
Professional Free Software Developer
Bregma
Bregma

Driver 313.09 is out already.

I strongly do not recommend installing nVidia drivers directly from nVidia into Ubuntu.

(1) The nVidia drivers directly from Ubuntu are not packaged correctly: they follow the methodology of stomping all over your system without respect to the Ubuntu packaging, and it's difficult or impossible to back them out without reinstalling your system.

(2) Ubuntu tests the drivers before packaging them, and does not distribute drivers with known breakage (instead, they work with nVidia to remedy the situation in another driver release -- Canonical actually has full-time people working with nVidia to help with this).

Of course, it's your system. If you break it, you get to keep both halves.
Stephen M. Webb
Professional Free Software Developer
TheChubu
TheChubu

Of course, it's your system. If you break it, you get to keep both halves.

That's why I have /home on a separate partition :D

I did broke the graphical desktop environment a few times on Debian, just delete the nVidia script that blacklists nouveau and it works again. It wasn't because the drivers though, I had driver packages from Debian that conflicted with the ones I downloaded from nVidia.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"   My journals: dustArtemis ECS framework and 
Bregma
Bregma

I did broke the graphical desktop environment a few times on Debian, just delete the nVidia script that blacklists nouveau and it works again. It wasn't because the drivers though, I had driver packages from Debian that conflicted with the ones I downloaded from nVidia.

The "package conflict" is because Debian installs various libraries using DEB packaging and the dpkg-alternatives system, symlinking driver-specific OpenGL shared objects so they get picked up at run time. The nVidia installer does not use packaging and simply clobbers the links with real libraries. You can tweak in the kernel modules all you want, you're effectively blixened once the packaging has been clobbered unless you carefully manually remove and re-symlink all the libraries as well. Don't miss one. Also, don't forget to remove the several-versions-out-of-date xorg.conf that nVidia installs.
Stephen M. Webb
Professional Free Software Developer
TheChubu
TheChubu

The "package conflict" is because Debian installs various libraries using DEB packaging and the dpkg-alternatives system, symlinking driver-specific OpenGL shared objects so they get picked up at run time. The nVidia installer does not use packaging and simply clobbers the links with real libraries

Yep, I know. Had to delete a few soft links here and there (pretty much the standard approach to installing newer GCC versions too) Re installing the Debian packages should remake all the links if you want to go back. Dunno why is a big issue.

Anyway, whatever suits your boat. Its fun to me to install new drivers and see what's new. Somebody may want to wait until everything just works, its fine by me.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"   My journals: dustArtemis ECS framework and 
Bregma
Bregma


The "package conflict" is because Debian installs various libraries using DEB packaging and the dpkg-alternatives system, symlinking driver-specific OpenGL shared objects so they get picked up at run time. The nVidia installer does not use packaging and simply clobbers the links with real libraries

Yep, I know. Had to delete a few soft links here and there (pretty much the standard approach to installing newer GCC versions too) Re installing the Debian packages should remake all the links if you want to go back. Dunno why is a big issue.

Anyway, whatever suits your boat. Its fun to me to install new drivers and see what's new. Somebody may want to wait until everything just works, its fine by me.

Installing the Debian package will not restore the symlinks. That was my point. It will simply fail.

I don't have a problem if you like to install third-party software and tweak your system, or if you like to customize the kernel and build your own gcc -- I do it all the time. Where the problem happens is when I have to spend time addressing complaints from someone because "someone on a forum somewhere on the web told me to do it this way and it broke my system, and now it's broken, it's your fault and Ubuntu sucks, tell me how to fix it right now."

So, anyone can go ahead and munge their system. I still strongly recommend against doing so unless you already know how to recover, in which case you probably wouldn't be asking here for advice.

Stephen M. Webb
Professional Free Software Developer
floatingwoods
floatingwoods

Thanks a lot for all the pertinent replies. I'll try to look at all those possible reasons.

Cheers!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.