Multiple windows, no context switching. Possible?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple windows, no context switching. Possible?

Pragmataraxia
I'm writing an application that (among other things) displays feeds from Gig-e cameras.  I am able to load the current frame from each camera as a texture, do all the OGL stuff I want to do, then paint each image on a separate quad and it works fine... if all my quads are in the same window.

What I want to do is have a separate window for each quad, but if I do this, the driver responsible for retrieving frames from the cameras starts to drop frames.  I can do two cameras in one window at 100Hz with no problem, but two windows at 5Hz, and I'm losing frames all over the place.  I have to assume then that there is a context switch occurring to move from one window to the next that is starving the transport from the cameras.

This is the history of my attempts thus far:
- GLCanvas for each of the AWT windows.
- GLCanvas for each of the AWT windows each created from a shared GLContext.
- GLWindow for each camera.
- GLWindow for each camera with shared Screen.

So far, I haven't noticed any detectable difference in the phenomena with any of these attempts, which makes me think that whatever context switch is causing the problem is still present with each of these strategies.

I would very much like to find a solution eventually, though in the mean time I'm going to have to implement moving/resizing quads within a single window until I have a breakthrough.  Does anyone have any immediate guess at how to get around the problem?
Reply | Threaded
Open this post in threaded view
|

Re: Multiple windows, no context switching. Possible?

gouessej
Administrator
Hi

Use NEWT instead of AWT if you want to have a chance to avoid some useless context changes. You'll probably need to use shared contexts anyway. There is probably something wrong in your code if you loose so much frames...
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Multiple windows, no context switching. Possible?

Pragmataraxia
Also of interest was that I could have the simplest C program doing nothing but checking the data received from the camera API for dropped frames, and a Java program doing nothing but animating a polygon in two windows, and it would still cause camera frames to drop even though CPU usage for both programs was basically nothing.

I had switched to GLWindow specifically because of all the similar advice to move to NEWT on all the multi-window topics I saw, and while the move may be necessary, it certainly wasn't sufficient.

What did turn out to be sufficient was replacing Nouveau with the the proprietary NVidia blob.

I could not tell you what was happening that would cause a JVM doing hardly anything to be able to disrupt the low-level receipt of network frames in an unrelated process (running as root, with niceness -10, no less!), but I can tell you that it doesn't happen when using the proprietary NVidia drivers.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple windows, no context switching. Possible?

gouessej
Administrator
Thank you for the tip but maybe it would be fine to report this problem of performance upstream, wouldn't it?
Julien Gouesse | Personal blog | Website