PDA

View Full Version : Gracefully handling remote desktop connection



Sinsanity
01-27-2010, 09:04 AM
I have a program which uses openGL to accelerate the display of a large bitmap rotated in 3d, in a subcontrol of the UI.

Creating the ogl context, the rendering, etc is all done in a spawned thread. However, when a user connects to the PC while the app was running, we need a way to cleanly restart the openGL thread.
What we were doing was waiting on the WM_WTS_SESSION_CHANGE message, then sending a signal to the render thread telling it to stop and kill the rendering context. Then we destroy the window, create a new window, and spawn a new render thread, which then uses the software renderer.

However, using nvidia cards, this leads to massive system slowdown after switching from local -> remote, then back to local. (Traced to the SwapBuffers call).

Using an ATI card with newest drivers, the call to SwapBuffers hangs when the remote desktop connection is created, not allowing us to cleanly terminate the worker thread. If we log in locally, then the call completes.

Does anyone know if this is even the correct method of dealing with remote connection issues, or how to ensure the system performance doesn't degrade?

Sinsanity
02-02-2010, 03:36 AM
Any ideas? DO you need more information?

dirk103
02-08-2010, 02:32 PM
I have two Angelfish and two Ghost Shrimp.

Stephen A
02-08-2010, 02:48 PM
What happens if you suspend the hardware accelerated context while the user is logged in (without destroying it) and then simply resuming operation after he logs out?

Other than that, I'd suggest contacting Nvidia and AMD support directly. Maybe someone here has an idea, but it would probably be faster to ask the people who develop the drivers, too (this is a pretty uncommon use-case).

Sinsanity
02-10-2010, 07:25 AM
The context suspends itself, because the render thread hangs in SwapBuffers, and the call does not return until the user is logged in again locally. I now check for the remote desktop connection state in the render loop before that call so I never call it under conditions where it would hang. What you suggested would be an alternative but it cannot be terminated remotely easily.

I have tried contacting both ati and nvidia, nvidia got back to me the same day and are presumably looking into the problem, ATI has not replied.

Stephen A
02-10-2010, 10:05 AM
I now check for the remote desktop connection state in the render loop before that call so I never call it under conditions where it would hang.
Creative solution, nice!


I have tried contacting both ati and nvidia, nvidia got back to me the same day and are presumably looking into the problem, ATI has not replied.
Typical. :)