Bug 6091 - Windows 7/8 - SDL_VIDEODRIVER=directx freezes the OS on breakpoint
Status: RESOLVED INVALID
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: GIT MASTER
Hardware: PC other
: P3 normal
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2014-02-10 11:38 EST by Stig M. Halvorsen
Modified: 2021-11-02 15:31:33 EDT
2 users (show)

See Also:



Description Stig M. Halvorsen 2014-02-10 11:38:40 EST
Windows 7/8 - gdb 7.6.1 through MinGW & Visual Studio 2013 visual debugger.

Line 692 in ./code/sys/sys_win32.c sets SDL's videodriver to DirectX; _putenv( "SDL_VIDEODRIVER=directx" );

This will according to the following post make SDL use DirectX 5: http://forums.libsdl.org/viewtopic.php?p=16331&sid=8508972276269f2aea743100255e48e6#16336. Anyways, it doesn't handle breakpoints very well as a I believe a dead-lock situation occurs. Try "break Com_Frame" and run it. It is the same thing in Visual Studio and its Visual Profiler.

The mouse either lags or freeze and you will need to alt-tab back to terminal in order to kill the application. It freezes entire Visual Studio, and it freezes the entire OS if you run it in Windows on Macbook Pro hardware.

SOLUTION: remove the entire line so it defaults to windib or set it to windib directly.

NB: It works but has a strange artifact! The startup cinematic plays only for a couple of seconds before it is interrupted, followed by a vid_restart and direct jump into the main menu.

The best would be to find a solution to the artifact, but a temporary fix that also allows debugging would be to set it to windib for debug builds and keep it at directx for release:

----------
void Sys_GLimpInit( void )
{
#ifndef DEDICATED
	if( !SDL_VIDEODRIVER_externallySet )
	{
		// It's a little bit weird having in_mouse control the
		// video driver, but from ioq3's point of view they're
		// virtually the same except for the mouse input anyway
		if( Cvar_VariableIntegerValue( "in_mouse" ) == -1 )
		{
			// Use the windib SDL backend, which is closest to
			// the behaviour of idq3 with in_mouse set to -1
			_putenv( "SDL_VIDEODRIVER=windib" );
		}
		else
		{
#ifdef NDEBUG
			// Use the DirectX SDL backend
			_putenv( "SDL_VIDEODRIVER=directx" );
#else
			_putenv( "SDL_VIDEODRIVER=windib" );
#endif
		}
	}
#endif
}
----------
Comment 1 Stig M. Halvorsen 2014-02-10 11:40:55 EST
FYI: mouse input is really messed up on if you play Quake III Arena in WIndows on a Macbook Pro. The presented fix resolves that issue! It might also solve the mouse related issue reported earlier: https://bugzilla.icculus.org/show_bug.cgi?id=6050
Comment 2 Stig M. Halvorsen 2014-03-14 03:52:33 EDT
The artifact caused by the fix occurs because windib for some reason triggers a SDL_VIDEORESIZE event in IN_ProcessEvents() in /code/sdl/sdl_input.c at the first run of the engine's game loop, causing a vid_restart after 1s. This might be a SDL 1.2.15 issue, but I doubt they'll fix it due to the latest SDL2.

The following proposition is a workaround that disables window resize for debug builds (on Windows), but I think it is worth the price of regaining debugging capabilities. Line 944 in /code/sdl/sdl_input.c:

#if defined(NDEBUG) || !defined(_WIN32)
  /* wait until user stops dragging for 1 second, so
     we aren't constantly recreating the GL context while
     he tries to drag...*/
  vidRestartTime = Sys_Milliseconds() + 1000;
#endif
Comment 3 Zack Middleton 2014-08-26 21:39:33 EDT
ioq3 now uses SDL 2 and no longer sets SDL_VIDEODRIVER. If there are still issues, please create a new issue.