fix: prevent black screen by setting surface event before format change - #354
fix: prevent black screen by setting surface event before format change#354winnerspiros wants to merge 1 commit into
Conversation
When the surface is born as RGB565 on Vulkan, the RGB565 guard in SurfaceChanged calls SetFormat(RGBA8888) to trigger a surface recreate. Previously, this reset surfaceEvent and returned early, blocking the draw thread on surfaceEvent.Wait(5000) while the UI thread was stuck in the synchronous SetFormat call. This blocked the entire managed runtime from sending heartbeats, causing the native watchdog to fire at 10s and producing a black screen. The fix sets surfaceEvent BEFORE calling SetFormat, so the draw thread can proceed with the current (soon-to-be-recreated) surface. The new surface triggers another SurfaceChanged which sets surfaceEvent again with the correct RGBA8888 format. Fixes the issue where the APK shows a black screen after the last build.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adjusts the Vulkan RGB565 recovery synchronization in ChangesVulkan RGB565 Recovery Synchronization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes The change involves careful synchronization logic with threading implications. Understanding the interaction between Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing — the fix introduces a data race between the draw thread reading surfaceGlobalRef and SurfaceDestroyed freeing it. The correct fix needs to handle the surface lifecycle more carefully. |
See commit message for details. Fixes black screen on launch caused by surface format change blocking the draw thread.
Summary by CodeRabbit