SDL-1.2: atari:video:xbios: show warning if using shadow buffer

From af6927fe3c6a22f129b0a0a6a5f7e5069140b461 Mon Sep 17 00:00:00 2001
From: Miro Kropacek <[EMAIL REDACTED]>
Date: Sun, 30 Jun 2024 00:08:06 +0200
Subject: [PATCH] atari:video:xbios: show warning if using shadow buffer

On Atari it's very dangerous as it may lead to a redundant fullscreen
copy for each frame.
---
 src/video/xbios/SDL_xbios.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/video/xbios/SDL_xbios.c b/src/video/xbios/SDL_xbios.c
index c1345027..5752197e 100644
--- a/src/video/xbios/SDL_xbios.c
+++ b/src/video/xbios/SDL_xbios.c
@@ -83,6 +83,8 @@ static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
 static void XBIOS_GL_SwapBuffers(_THIS);
 #endif
 
+static SDL_bool shadow_warning_shown;
+
 /* Xbios driver bootstrap functions */
 
 static long cookie_vdo;
@@ -564,6 +566,11 @@ static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
 	/* SDL_UpdateRects() already added surface->offset_[xy] to each rect's coordinates */
 	SDL_Surface *surface = this->screen;
 
+	if (this->shadow && !shadow_warning_shown) {
+		fprintf(stderr, "Warning: shadow buffer in use, add SDL_HWSURFACE to your SDL_SetVideoMode()\n");
+		shadow_warning_shown = SDL_TRUE;
+	}
+
 	/*
 	 * SDL_LockSurface() adds surface->offset to surface->pixels
 	 * NOTE: documentation explicitly discourages to call this
@@ -656,6 +663,11 @@ static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface)
 	int src_offset = (surface->locked ? 0 : surface->offset);
 	int dst_offset;
 
+	if (this->shadow && !shadow_warning_shown) {
+		fprintf(stderr, "Warning: shadow buffer in use, add SDL_HWSURFACE to your SDL_SetVideoMode()\n");
+		shadow_warning_shown = SDL_TRUE;
+	}
+
 	if (XBIOS_current->flags & XBIOSMODE_C2P) {
 		int doubleline = (XBIOS_current->flags & XBIOSMODE_DOUBLELINE ? 1 : 0);