From 5818592a18e1103444291e3bc5a54fb2601595b2 Mon Sep 17 00:00:00 2001 From: "prompt.ac/@jeffrey" Date: Sun, 19 Apr 2026 20:43:25 -0700 Subject: [PATCH] =?UTF-8?q?native:=20skip=20SDL3=20path=20by=20default=20?= =?UTF-8?q?=E2=80=94=20opt=20in=20via=20AC=5FUSE=5FSDL=3D1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SDL3 was always-attempted at boot with crash-recovery fallback. The dlopen + Mesa DRI loader + SDL_Init + window/renderer creation costs real time on every cold boot and offers no measurable visual benefit on the hardware we ship — DRM dumb buffers do the same thing faster and don't pull a GLES context full of failure modes (the partial-init state when SDL starts but Mesa's renderer doesn't was almost certainly the source of the "garbled chars on boot" the user reported). Now opt-in via AC_USE_SDL=1. Default = straight to DRM. The whole SDL3 loader code path is preserved (sdl_init/sdl_load/crash handler) for when we want it back; it just doesn't run. Co-Authored-By: Claude Opus 4.7 (1M context) --- fedac/native/src/drm-display.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/fedac/native/src/drm-display.c b/fedac/native/src/drm-display.c index 6e2c005326..0c750c36ca 100644 --- a/fedac/native/src/drm-display.c +++ b/fedac/native/src/drm-display.c @@ -387,9 +387,21 @@ static int create_dumb_buffer(ACDisplay *d, int idx) { ACDisplay *drm_init(void) { extern void ac_log(const char *fmt, ...); ac_log("[drm] drm_init() start\n"); - ACDisplay *sdl = sdl_init(); - if (sdl) return sdl; - ac_log("[drm] SDL3 failed, falling back to DRM dumb buffers\n"); + // SDL3 is now opt-in (was always-attempt with crash-recovery). The + // dlopen + Mesa DRI load + SDL_Init + window/renderer creation take + // 100s-of-ms even on cached cold-boot, with no measurable visual + // benefit on the supported hardware. Skip it unless AC_USE_SDL=1 + // explicitly. Going straight to DRM dumb buffers shaves real time + // off boot and removes a class of partial-init "garbled char" bugs + // that surface when SDL3 starts but Mesa's GLES context doesn't. + const char *use_sdl = getenv("AC_USE_SDL"); + if (use_sdl && use_sdl[0] == '1') { + ACDisplay *sdl = sdl_init(); + if (sdl) return sdl; + ac_log("[drm] SDL3 failed, falling back to DRM dumb buffers\n"); + } else { + ac_log("[drm] SDL3 path skipped (set AC_USE_SDL=1 to enable)\n"); + } ACDisplay *d = calloc(1, sizeof(ACDisplay)); if (!d) { ac_log("[drm] calloc failed\n"); return NULL; } -- 2.51.2