hal-gal: fix EGL_BAD_ACCESS after first frame by moving capture off init thread#142
Conversation
…nit thread HAL_GAL_CaptureFrameBuffer() was being called once during capture_init(), which runs on the caller's setup thread. However, actual frame capture happens later via capture_acquire_frame(), invoked from unicapture's dedicated capture thread spawned in unicapture_start(). HAL_GAL_Init() appears to bind an EGL/GL context to the calling thread, and that binding is thread-affine. Capturing a frame during init bound the context to the wrong thread, causing every subsequent capture from the real worker thread to fail with EGL_BAD_ACCESS (0x3002). Removing the init-time capture call means the surface is only ever captured from the capture thread, fixing continuous capture after the first frame.
Hi, that looks good, and it makes sense to remove the init-time capture call. |
|
@sundermann |
HAL_GAL_CaptureFrameBuffer() was being called once during capture_init(), which runs on the caller's setup thread. However, actual frame capture happens later via capture_acquire_frame(), invoked from unicapture's dedicated capture thread spawned in unicapture_start().
HAL_GAL_Init() appears to bind an EGL/GL context to the calling thread, and that binding is thread-affine. Capturing a frame during init bound the context to the wrong thread, causing every subsequent capture from the real worker thread to fail with EGL_BAD_ACCESS (0x3002).
Removing the init-time capture call means the surface is only ever captured from the capture thread, fixing continuous capture after the first frame.