From 9ab84c503dbeb5db3b2c4f1ecd8d27f2e4500d84 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 25 Feb 2020 20:53:02 +0000 Subject: [PATCH 1/2] refine 4315 a bit. At least on windows, an overlay needs to be locked before the real pitch data is returned instead of a wild pointer Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4334 --- src/gui/sdlmain.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 84cee0f3..291387c9 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -900,13 +900,18 @@ dosurface: if (!(flags & GFX_CAN_32) || (flags & GFX_RGBONLY)) goto dosurface; if (!GFX_SetupSurfaceScaled(0,0)) goto dosurface; sdl.overlay = SDL_CreateYUVOverlay(width * 2, height, SDL_UYVY_OVERLAY, sdl.surface); - - if (sdl.overlay && sdl.overlay->pitches[0] < 4 * width) { - // We get a distorted image in this case. Cleanup and go to surface. - LOG_MSG("SDL: overlay pitch is too small. (%u < %" sBitfs(u) ")", sdl.overlay->pitches[0], width * 4); - SDL_FreeYUVOverlay(sdl.overlay); - sdl.overlay = 0; + + if (sdl.overlay && SDL_LockYUVOverlay(sdl.overlay) == 0) { + //Need to lock in order to get real pitchdata (at least on windows with dx backend) + if (sdl.overlay->pitches[0] < 4 * width) { + // We get a distorted image in this case. Cleanup and go to surface. + LOG_MSG("SDL: overlay pitch is too small. (%u < %" sBitfs(u) ")", sdl.overlay->pitches[0], width * 4); + SDL_UnlockYUVOverlay(sdl.overlay); + SDL_FreeYUVOverlay(sdl.overlay); + sdl.overlay = 0; + } else SDL_UnlockYUVOverlay(sdl.overlay); } + if (!sdl.overlay) { LOG_MSG("SDL: Failed to create overlay, switching back to surface."); goto dosurface; From 11c380aabae3b75d27c3183c6e1bab7ef16897b2 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Wed, 11 Mar 2020 19:54:24 +0000 Subject: [PATCH 2/2] 0.74-3:mac os x default output change also in trunk now Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4335 --- src/gui/sdlmain.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 291387c9..3ef9291d 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -2207,7 +2207,13 @@ void Config_Add_SDL() { "ddraw", #endif 0 }; + + +#if C_OPENGL && defined(MACOSX) + Pstring = sdl_sec->Add_string("output",Property::Changeable::Always,"opengl"); +#else Pstring = sdl_sec->Add_string("output",Property::Changeable::Always,"surface"); +#endif Pstring->Set_help("What video system to use for output."); Pstring->Set_values(outputs);