We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2160

Summary: SDL_SetWindowBordered causing renderer to freeze up
Product: SDL Reporter: Kevin Wells <DarkOppressor>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 Keywords: target-2.0.4
Version: 2.0.0   
Hardware: x86_64   
OS: Windows 7   
URL: http://forums.libsdl.org/viewtopic.php?p=39913
Attachments: DxDiag with relevant system information

Description Kevin Wells 2013-10-18 21:02:09 UTC
Created attachment 1373 [details]
DxDiag with relevant system information

Overview:
Toggling to SDL_SetWindowBordered(screen,SDL_FALSE) twice causes screen to stop updating and rendering functions (SDL_RenderCopyEx, SDL_RenderFillRect, etc.) to cause a huge performance hit.

Steps to Reproduce:
1) This only occurs with the render driver set to direct3d, so: SDL_SetHint(SDL_HINT_RENDER_DRIVER,"direct3d")
Also, my window was 1280x720.

2a) Toggle the window border off twice with SDL_SetWindowBordered(screen,SDL_FALSE).
So if you create a window with SDL_WINDOW_BORDERLESS, it takes 4 calls to SDL_SetWindowBordered, toggling the value each time, to cause the problem. If you create a window without SDL_WINDOW_BORDERLESS, it takes 3 calls to SDL_SetWindowBordered, toggling the value each time, to cause the problem. 

OR

2b) Call SDL_SetWindowSize(screen,1280,720) (note this isn't even a different size from what the window started as)

Actual Results:
The renderer stops updating the screen. The screen is then forever frozen at the same place.
Also, SDL_RenderCopyEx, SDL_RenderFillRect, etc. all cause a huge performance hit once this happens. I'm updating the window's titlebar with FPS and such so I can see its performance, and it drops from ~100 to ~3 when this happens. If I toggle off rendering the FPS shoots back up. The screen, of course, remains frozen.

Expected Results:
The screen shouldn't freeze, and rendering function calls should not cause a huge performance hit.

Build Date and Hardware:
Stable 2.0.0 on Windows 7 Professional 64-bit (see attached DxDiag for details)

Additional Information:
I tried a variety of tweaks (playing with different SDL_HINT_'s) and could not find any way to prevent the problem from happening until I tried 'SDL_SetHint(SDL_HINT_RENDER_DRIVER,"opengl")' which pointed me to the direct3d render driver being the (a part of the?) culprit.
Just to be thorough I tried just calling 'SDL_SetWindowBordered(screen,SDL_FALSE)' without any 'SDL_SetWindowBordered(screen,SDL_TRUE)' in between, and nothing goes wrong there. You have to actually toggle the border on and off.
Comment 1 Ryan C. Gordon 2015-02-19 05:22:15 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!
Comment 2 Ryan C. Gordon 2015-04-07 04:57:58 UTC
(sorry if you get a lot of copies of this email, I'm marking several bugs at once)

Marking bugs for the (mostly) final 2.0.4 TODO list. This means we're hoping to resolve this bug before 2.0.4 ships if possible. In a perfect world, the open bug count with the target-2.0.4 keyword is zero when we ship.

(Note that closing a bug report as WONTFIX, INVALID or WORKSFORME might still happen.)

--ryan.
Comment 3 Sam Lantinga 2015-05-28 19:42:38 UTC
This appears to be fixed for 2.0.4
I ran testsprite2, and hit Ctrl-B to toggle window borders repeatedly.
Please reopen this bug if you're seeing the problem after the 2.0.4 release.

Thanks!