sdl12_compat/0001-Set-pixels-in-SDL_CreateYUVOverlay-Fix-164.patch
Jan Engelhardt 744ab7058f - Add 0001-SDL_GetWMInfo-work-like-1.2-when-SDL_SetVideoMode-ha.patch
to unbreak use with schismtracker.
- Add 0001-Set-pixels-in-SDL_CreateYUVOverlay-Fix-164.patch
  to unbreak use with MPlayer.
- Hot enable sdl12-compat to be the SDL1 replacement [boo#1198182]

OBS-URL: https://build.opensuse.org/package/show/games/sdl12_compat?expand=0&rev=7
2022-05-16 12:44:32 +00:00

40 lines
1.3 KiB
Diff

From f4980108b0fbe59e04aaba6b18be760a607ab923 Mon Sep 17 00:00:00 2001
From: David Gow <david@ingeniumdigital.com>
Date: Mon, 7 Mar 2022 16:01:50 +0800
Subject: [PATCH] Set 'pixels' in SDL_CreateYUVOverlay() (Fix #164)
Some applications, such as mplayer with -vo sdl will access the 'pixels'
member of an SDL_Overlay immediately after creating it, without ever
locking it. This works on (at least some backends for) SDL 1.2, but
crashed on sdl12-compat, as pixels remained unset until
SDL_LockYUVOverlay() is called.
Set pixels in SDL_CreateYUVOverlay(), as well as hwdata->dirty, which
makes it possible to have a working YUV overlay without ever
locking/unlocking it. This is required for mplayer's sdl vo backend to
function.
Fixes issue #164
---
src/SDL12_compat.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index b3a411e..b5a851b 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -6337,6 +6337,10 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format12, SDL12_Surface *display12)
retval->hw_overlay = 1;
retval->pitches = hwdata->pitches;
+ /* Some programs (e.g. mplayer) access pixels without locking. */
+ retval->pixels = hwdata->pixels;
+ hwdata->dirty = SDL_TRUE;
+
return retval;
}
--
2.36.1