SDL2 updates stop after screenblank

Here is a demonstration of a problem we are seeing were SDL window updates appear to stop after a wake from screenblank on Windows 10.

After waking from the blank (e.g. by pressing SHIFT) the debug output shows the main loop is still running, but the main window is ‘frozen’ on a single frame. This doesn’t happen every time, but is pretty much guaranteed within 10 attempts.

running from the command line allows a different renderer to be specified, and if set to ‘software’ the problem does not occur.

Doing something that causes Windows to change something (e.g. pressing the start key to open the start menu or hovering over a window close button to pop up the “close” tooltip) will restore the updating.

The presence of other programs seems to affect the manifestation of this bug. e.g. if Notepad is running, then the problem will still happen. However if Alarms & Clock is running, then even if it’s on a static stopwatch display, then the problem will not occur - however if it’s subsequently minimised, then the problem will re-appear.

We are cross-compiling using mxe.cc and are currently on SDL2 2.0.10

/usr/local/opt/mxe.master/usr/bin/i686-w64-mingw32.static-g++ screensaver-nvidia-problem.cc -o scree
nsaver-nvidia-problem.exe -L /usr/local/opt/mxe.master/usr/i686-w64-mingw32.static/lib -l mingw32 -l
SDL2 -l SDL2main -l setupapi -l samplerate -l winmm -l gdi32 -l ole32 -l uuid -l imm32 -l version -
l oleaut32

The problem appears to be exclusive to NVidia hardware.

Can anyone help pinpoint what’s happening here?

Thanks,

screensaver-nvidia-problem.cc (6.4 KB)

edit: the problem appears to clear using ‘direct3d11’. Still NVidia specific.

screensaver-nvidia-problem.cc (6.6 KB)

Slightly modified source to force a screen blank on pressing SPACE which makes testing a whole lot easier

Try handling events SDL_RENDER_DEVICE_RESET and SDL_RENDER_TARGETS_RESET, https://wiki.libsdl.org/SDL_EventType

Hi,
Thanks for response. No luck with those events, a shame as they sounded promissing!

Here’s a complete log of event type from startup to ‘freeze’

Create surface
direct3d: Fill Main window, size = 800 x 600
Update ‘Main window’
Clear ‘Main window’
Copy ‘Main window’
Present ‘Main window’
SDL_EVENT 1100 - SDL_AUDIODEVICEADDED
SDL_EVENT 1100 - SDL_AUDIODEVICEADDED
SDL_EVENT 0200 - SDL_WINDOWEVENT
SDL_EVENT 0200 - SDL_WINDOWEVENT
SDL_EVENT 0302 - SDL_TEXTEDITING
SDL_EVENT 0200 - SDL_WINDOWEVENT
SDL_EVENT 0400 - SDL_MOUSEMOTION
SDL_EVENT 0200 - SDL_WINDOWEVENT
SDL_EVENT 0200 - SDL_WINDOWEVENT
SDL_EVENT 0400- SDL_MOUSEMOTION
SDL_EVENT 0200 - SDL_WINDOWEVENT
SDL_EVENT 0300 - SDL_KEYDOWN (SPACE to blank screen)
SDL_EVENT 0303 - SDL_TEXTINPUT
SDL_EVENT 0301 - SDL_KEYUP
SDL_EVENT 0300 - SDL_KEYDOWN (SHIFT to unblank screen)
SDL_EVENT 0301 - SDL_KEYUP