nV News Forums


nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   NVIDIA Solaris (http://www.nvnews.net/vbulletin/forumdisplay.php?f=45)
-   -   Creating many QGLWidgets causes GLXBadDrawable error in X Server (http://www.nvnews.net/vbulletin/showthread.php?t=102486)

cnsiva 11-16-07 05:12 AM

Creating many QGLWidgets causes GLXBadDrawable error in X Server

I have a Qt application that creates and shows many QGLWidgets, mostly as separate windows. In fact, there is one QGLWidget as the Central Widget of Main Window, three to four more as Widgets in a UI file (that also contains other Widgets and Layouts), and several more as separate Windows. The application allows dynamic/interactive creation of new QGLWidget Windows.

After creating a certain number (about 10 to 20) of such QGLWidget Windows, trying to create another one causes X Server to report GLXBadDrawable error with the below details. The error is reported when the call to "show ()" on the newly created QGLWidget Window is made.

X Error: GLXBadDrawable 159
Extension: 145 (Unknown extension)
Minor opcode: 5 (Unknown request)
Resource id: 0x22005eb
QGLContext::makeCurrent (): Failed.

The newly-created QGLWidget Window shows up with its Window Title and Frame, but nothing inside is shown. After this point, the CPU utilization is full and the X Server freezes. Sometimes the X Server crashes and restarts.

Could you please hint what are possible reasons for this behavior?

Qt 4.3.0 Commercial Edition for Solaris (X11)
Solaris 10 (SunOS 5.10)
NVidia Quadro FX 1400 video card with its OpenGL driver
gcc 4.1.1 compiler

The same application runs fine allowing creation of several QGLWidget Windows on Windows XP with Qt 4.3.0, NVidia Quadro FX 1400 video card with its OpenGL driver, and MinGW or MSVC compiler.

cnsiva 12-04-07 04:48 AM

Re: Creating many QGLWidgets causes GLXBadDrawable error in X Server
This is fixed..... (nana2)

The problem, as indicated by the X Server log file, is with the default limit on number of shared memory IDs. At some point after creating some QGLWidget Windows, the system was exhausted of all shared memory IDs. Therefore X Server couldn't obtain a new shared memory ID, and it reported it in the X Server log file.

The default limit on number of shared memory IDs on Solaris seems to be 128, which is soon exhausted when we create multiple QGLWidget Windows. One QGLWidget Windows approximately consumes two shared memory IDs (-- perhaps Qt, or the X Server, or the Solaris system creates these shared memories for it's internal use).
To check the shared memory ID limit execute:

prctl -n project.max-shm-ids $$

The practical solution is to simply increase the limit of shared memory IDs. We increased the limit for "privileged resource control type" by adding the following entry to "/etc/project" file:

tcsh:> cat /etc/project

There might be other ways to increasing the limit. The above change assumes that the user is associated with a "project" named "default" (see Solaris command "prctl" for more information).

After making this change we could create at least three times more QGLWidget Windows. Increasing it to 1024, will allow nearly double that of 512, and so on.


wald 01-31-08 06:40 AM

Re: Creating many QGLWidgets causes GLXBadDrawable error in X Server
We observe a similar thing under linux (driver 100.14.x)

Creating QGLWidgets stops working after about 170 Widgets.
(Same error message)
They are all sharing GL-contexts with one master widget.

For some reason the 169.07 diver is working better.
Either it is using less resources or it increases the limit.

My Question is:
Which kind of resoure is the limit here?
(It does not seem to be shared memory shm.)
How can I increase the limit under Linux?
Is it possible to determine the current limit and the current usage?


infinihertz 02-28-08 01:43 PM

Re: Creating many QGLWidgets causes GLXBadDrawable error in X Server
With the new 169.12 drivers under Linux (Fedora 8), I get a similar error message when trying to show a second (!) GL window. Only showing one works fine.

X Error: GLXBadDrawable 156
Extension: 143 (Uknown extension)
Minor opcode: 11 (Unknown request)
Resource id: 0x1800c87

This is with compiz running. If I disable compiz, I can show a second window. I don't have that many windows open though, so even if compiz manages them all as GL windows it should still be less than 20 (I think).

I will try reverting to 169.09 to see if that's any better, but I'm not expecting it to be.

infinihertz 02-28-08 01:52 PM

Re: Creating many QGLWidgets causes GLXBadDrawable error in X Server
As a follow-up to myself, 169.09 doesn't appear to have the issue, at least not at as low of a threshold. I was able to open many windows with compiz and open my QGLWidget instances fine.

Hopefully it's not something that gets worse over time from some sort of memory leak or anything; I'll be paying attention to that.

All times are GMT -5. The time now is 01:56 AM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.