OpenGL multiple window context slowdown?

  • Follow


Hello all,
   I was wondering if anyone here has experience OpenGL slowdown on
multiple windows. I have a small test harness which basically creates
windows in a separate threads. On my nvidia 7600go, it seems like then
15th subsequent window or thereabouts will slowdown rendering
dramatically.
  I've tried opening and closing windows one at a time, and it still
happens (15th window onwards.. major slowdown). Running under the
debugger I see that there are other threads that have been created
(not mine) which are still hanging around. Freezing this threads seems
to make the OpenGL window run at normal speeds again.
  Does anyone have any idea? I can email the source code, if anyone
needs it. It's just a simple test case to test multiple windows
creation. Each window run in it's on thread and has it's own opengl
context. There is no sharing of context. Context are deleted when the
window closes.

Thanks

Kevin Yoon

0
Reply kevinyoon69 (1) 10/29/2007 8:21:48 AM

 kevinyoon69@gmail.com wrote:

> Hello all,
>    I was wondering if anyone here has experience OpenGL
>    slowdown on
> multiple windows. I have a small test harness which basically
> creates windows in a separate threads. On my nvidia 7600go, it
> seems like then 15th subsequent window or thereabouts will
> slowdown rendering dramatically.

Big Surprise, eh?

You know, that all consumer GPUs before the G80 series could only
process one primitive at a time, with only one context being
active.

I presume, that the performance on a G80 is a lot better, as
those are highly parallel streaming processors and actually
_CAN_ do multithreaded rendering.

However multithreaded rendering will always be slower than a
clean single threaded rendering solution (the driver will split
up the rendering commands into parallel executed batches, to
fully utilize the GPU).

Just the usual advice here: OpenGL and (process level)
multithreading don't mix.

Wolfgang Draxinger
-- 
E-Mail address works, Jabber: hexarith@jabber.org, ICQ: 134682867

0
Reply Wolfgang 10/29/2007 8:31:59 AM


On Oct 29, 4:31 pm, Wolfgang Draxinger <wdraxin...@darkstargames.de>
wrote:
>  kevinyoo...@gmail.com wrote:
> > Hello all,
> >    I was wondering if anyone here has experience OpenGL
> >    slowdown on
> > multiple windows. I have a small test harness which basically
> > creates windows in a separate threads. On my nvidia 7600go, it
> > seems like then 15th subsequent window or thereabouts will
> > slowdown rendering dramatically.
>
> Big Surprise, eh?
>

I think you misunderstood the problem. Obviously if I have a lot of
opengl windows rendering will slowdown. That's logical.
However, what I'm saying is the following:
Create an opengl window, then close it, then create another one then
close it.. so on and so forth.
After a while, the created opengl window will slowdown.


> You know, that all consumer GPUs before the G80 series could only
> process one primitive at a time, with only one context being
> active.
Only one context is active at any one time in the above scenario. All
I'm doing is creating and destroying opengl windows.

Under the debugger, I see additional threads created, which are not
destroyed or cleaned up. These threads are presumably created by
opengl32.dll.
And I do call wglDeleteContext, when the window is destroyed.


>
> I presume, that the performance on a G80 is a lot better, as
> those are highly parallel streaming processors and actually
> _CAN_ do multithreaded rendering.
>



> However multithreaded rendering will always be slower than a
> clean single threaded rendering solution (the driver will split
> up the rendering commands into parallel executed batches, to
> fully utilize the GPU).
>
> Just the usual advice here: OpenGL and (process level)
> multithreading don't mix.
>

I fully understand the problems with multithreading and having only
one context active to a single thread at anyone time.
Especially under windows, but the behaviour here is definitely not
that, as each thread has its own context. And not only that, only one
thread
is active at any time as I'm only creating one window and destroying
it before I create another window.


> Wolfgang Draxinger
> --
> E-Mail address works, Jabber: hexar...@jabber.org, ICQ: 134682867



cheers

Kevin

0
Reply kevinyoon69 10/29/2007 9:28:12 AM

 kevinyoon69@gmail.com wrote:

> I think you misunderstood the problem. Obviously if I have a
> lot of opengl windows rendering will slowdown. That's logical.
> However, what I'm saying is the following:
> Create an opengl window, then close it, then create another one
> then close it.. so on and so forth.
> After a while, the created opengl window will slowdown.

Check the memory usage of your system (in this case the Windows
Task Manager is quite accurate). Start the program, then
terminate it. Of the memory usage increases with each iteration
you've probably found a driver bug you should file at NVidia.

If the memory usage does not increase, open and close windows
within your program multiple times (make sure that any garbage
collector you might use (or not) runs, and everything gets
freed). If the memory usage still increases you've got a memory
leak somewhere, possibly not freeing any OpenGL context related
handles the program still might hold.

If that is the case you've to track the problem down in your
program. For resource allocation related problems I found the
following method being very usefull: Put some printf (or
similair) statements to each resource allocation, and
deallocation and use some start/stop characters, so that you can
use the code folding feature, or the brace matching of any good
editor to determine which allocation gets no apropriate
deallocation.

E.g.
printf("allocating OpenGLContext in function %s in source %s
line %d {\n", "function", __FILE__, __LINE__);
..
..
..
printf("} freeing OpenGLContext\n");

Wolfgang Draxinger
-- 
E-Mail address works, Jabber: hexarith@jabber.org, ICQ: 134682867

0
Reply Wolfgang 10/29/2007 10:10:54 AM

3 Replies
145 Views

(page loaded in 0.108 seconds)


Reply: