Gracefully handling remote desktop connection

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?

Any ideas? DO you need more information?

I have two Angelfish and two Ghost Shrimp.

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).

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.

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. :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.