Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: SDL probe in child process, SDL off until dlsym refactor

Binary crash from linker loading libSDL3→libgbm→iris_dri.so before
main(). Needs dlsym-based loading to avoid link-time dep. SDL off
in oven builds for now. Probe improvements kept for future use.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+14 -19
+14 -19
fedac/native/src/drm-display.c
··· 21 21 22 22 extern void ac_log(const char *fmt, ...); 23 23 24 - // Probe whether SDL3 can init without crashing (runs in a child process) 24 + // Probe whether SDL3 can load + init without crashing (runs in a child process). 25 + // This catches missing DRI drivers, GBM failures, and segfaults in Mesa. 25 26 static int sdl_probe_safe(void) { 26 27 pid_t pid = fork(); 27 28 if (pid < 0) return 0; // fork failed, skip SDL 28 29 if (pid == 0) { 29 - // Child: try SDL_Init, exit 0 on success, 1 on failure, crash = signal 30 - if (getpid() != 1) // never true in child, but set env anyway 31 - setenv("SDL_VIDEO_DRIVER", "kmsdrm", 0); 30 + // Child: try dlopen + SDL_Init. If anything crashes, parent sees the signal. 31 + void *lib = dlopen("libSDL3.so.0", RTLD_LAZY); 32 + if (!lib) _exit(2); // SDL not available 33 + dlclose(lib); 34 + setenv("SDL_VIDEO_DRIVER", "kmsdrm", 0); 35 + setenv("LIBGL_DRIVERS_PATH", "/lib64/dri", 0); 36 + setenv("GBM_DRIVERS_PATH", "/lib64/dri", 0); 37 + setenv("MESA_LOADER_DRIVER_OVERRIDE", "iris", 0); 32 38 int ok = SDL_Init(SDL_INIT_VIDEO) ? 0 : 1; 33 39 if (!ok) SDL_Quit(); 34 40 _exit(ok); ··· 37 43 int status = 0; 38 44 waitpid(pid, &status, 0); 39 45 if (WIFSIGNALED(status)) { 40 - ac_log("[sdl3] Probe crashed (signal %d) — skipping SDL3\n", 46 + ac_log("[sdl3] Probe crashed (signal %d) — falling back to DRM\n", 41 47 WTERMSIG(status)); 42 48 return 0; 43 49 } 44 50 if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { 45 51 return 1; 46 52 } 47 - ac_log("[sdl3] Probe failed (exit %d) — skipping SDL3\n", 48 - WIFEXITED(status) ? WEXITSTATUS(status) : -1); 53 + int code = WIFEXITED(status) ? WEXITSTATUS(status) : -1; 54 + ac_log("[sdl3] Probe failed (exit %d) — falling back to DRM\n", code); 49 55 return 0; 50 56 } 51 57 52 58 static ACDisplay *sdl_init(void) { 53 - // Check if libSDL3 is even loadable 54 - void *sdl_lib = dlopen("libSDL3.so.0", RTLD_LAZY | RTLD_NOLOAD); 55 - if (!sdl_lib) { 56 - sdl_lib = dlopen("libSDL3.so.0", RTLD_LAZY); 57 - if (!sdl_lib) { 58 - ac_log("[sdl3] libSDL3.so.0 not found — skipping\n"); 59 - return NULL; 60 - } 61 - } 62 - dlclose(sdl_lib); 63 - 64 - // Probe in a child process to catch segfaults 59 + // Probe in a child process first — catches segfaults from broken DRI/GBM 65 60 if (!sdl_probe_safe()) return NULL; 66 61 67 62 // Set KMSDRM hints for bare metal (no X11/Wayland)