# sdl12-compat: DisplayYUVOverlay: honor AllowThreadedDraws

**URL:** <https://discourse.libsdl.org/t/sdl12-compat-displayyuvoverlay-honor-allowthreadeddraws/69321>\
**Category:** SDL Commits\
**Created:** [September 15, 2026, 4:46pm UTC](https://discourse.libsdl.org/t/sdl12-compat-displayyuvoverlay-honor-allowthreadeddraws/69321 "2026-09-15T16:46:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [September 15, 2026, 4:46pm UTC](https://discourse.libsdl.org/t/sdl12-compat-displayyuvoverlay-honor-allowthreadeddraws/69321/1 "2026-09-15T16:46:59Z")

</div>

> <https://github.com/libsdl-org/sdl12-compat/commit/a39e3a70f774ed688f0cbd67a40aa4e67a0320eb>
>
> Currently, if SMPEG calls SDL\_DisplayYUVOverlay() from a worker thread,
> ie not t…he thread which called SDL\_SetVideoMode(),
> frames accumulate until the main thread eventually pumps events.
> The result is a video where audio playback remains normal but only
> a few video frames are visibly presented per second.
> 
> Re-use the SDL12COMPAT\_ALLOW\_THREADED\_DRAWS hint already used by
> SDL\_UpdateRects(), this fixes the stuttering intro video in
> LGP's "Majesty: The Fantasy Kingdom Sim"

```diff
From a39e3a70f774ed688f0cbd67a40aa4e67a0320eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Noel?= <[EMAIL REDACTED]>
Date: Tue, 15 Sep 2026 12:26:55 +0200
Subject: [PATCH] DisplayYUVOverlay: honor AllowThreadedDraws

Currently, if SMPEG calls SDL_DisplayYUVOverlay() from a worker thread,
ie not the thread which called SDL_SetVideoMode(),
frames accumulate until the main thread eventually pumps events.
The result is a video where audio playback remains normal but only
a few video frames are visibly presented per second.

Re-use the SDL12COMPAT_ALLOW_THREADED_DRAWS hint already used by
SDL_UpdateRects(), this fixes the stuttering intro video in
LGP's "Majesty: The Fantasy Kingdom Sim"
---
 src/SDL12_compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 616a0ea4a..c32a77a9b 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -8212,7 +8212,7 @@ SDL_DisplayYUVOverlay(SDL12_Overlay *overlay12, SDL12_Rect *dstrect12)
     for (overlay = QueuedDisplayOverlays.next; overlay != NULL; overlay = overlay->next) {
         if (overlay->overlay12 == overlay12) { /* trying to draw the same overlay twice in one frame? Dump the current surface and overlays to the screen now. */
             /* Force an update of the screen. */
- if (ThisIsSetVideoModeThread) {
+ if (ThisIsSetVideoModeThread || AllowThreadedDraws) {
                 if (VideoSurfaceUpdatedInBackgroundThread) {
                     SDL_Flip(VideoSurface12); /* this will update the texture and present. */
                 } else if (VideoSurfacePresentTicks) {

```
