Fix ROCKNIX RK3326 SDL menu segfault by falling back to system SDL2 - #90
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the ROCKNIX RK3326 segfault where the SDL menu crashed back to EmulationStation on launch.
Root cause
The pygame-ce wheel ships its own private
libSDL2-2-<hash>.0.so.0.3200.10, but that SDLdlopens the system'slibEGL.so.1,libwayland-client.so.0,libwayland-egl.so.1andlibdecor-0.so.0. That hybrid stack segfaults insidepygame.display.set_mode()on RK3326 with the libmali blob. ROCKNIX's own/usr/lib/libSDL2-2.0.so.0, which every emulator on the device already uses, works fine.The crash is a native SIGSEGV, so no Python handler could ever catch it, and the driver-fallback loop couldn't help because driver choice was never the problem.
This also retires the earlier theory that the vendored pygame build had to be swapped. The pygame-ce swap did fix a different device (Anbernic RG DS, Mali-G52, #55) but never RK3326, because pygame was not the culprit.
Changes
tool-launcher.sh<driver>|<preload>combinations and caches the first survivor inrocknix_sdl_attempt. The bundled SDL is still attempted first, so devices where it already works are unaffected.menu-stdout.log. Previously these were discarded entirely, which is why months of logs never showed the cause — a native SDL crash leaves no Python traceback, so that output was the only record.sdl-doctor.sh+sdl_probe.py(new)A diagnostic installed as a second Tools entry. Runs window creation across a matrix of SDL configurations, capturing stdout, stderr, decoded exit signal and filtered
dmesgper attempt, plus an environment survey. TheSDL_VIDEODRIVER=dummycontrol probe is what identified the fault as the GPU/wayland path rather than pygame itself.Verification
Diagnostic output from an affected device (GKD Pixel 2,
HW_DEVICE="RK3326"):Attempt ordering verified across all three cache states: fresh affected device recovers after one crash and caches; returning device goes straight to the working combination; devices where the bundled SDL works keep their current behavior.
Confirmed working end-to-end on-device by the reporter, so SDL_ttf and SDL_image are fine under the preload, not just base SDL.
Does not address the separate RG DS dual-screen rendering issue in #55, which remains open.
SDL Doctor is opt-in
The diagnostic scripts always ship in the bundle, but the Tools entry is only created when the toggle at the top of the generated installer is flipped:
INSTALL_SDL_DOCTOR="${INSTALL_SDL_DOCTOR:-false}"So a normal install is unchanged and no extra Tools entry appears. For a support case, the reporter edits that one line to
true(or runsINSTALL_SDL_DOCTOR=true ./RAOfflineProxy-...-Install.sh) — no rebuild needed. Switching it back off removes the entry again rather than leaving a stale one behind.