Skip to content

display: synchronize macOS SDL window creation - #114

Open
Jerome Haxhiaj (jeromehaxhiaj-qti) wants to merge 1 commit into
qualcomm:mainfrom
jeromehaxhiaj-qti:fix_macos_display
Open

display: synchronize macOS SDL window creation#114
Jerome Haxhiaj (jeromehaxhiaj-qti) wants to merge 1 commit into
qualcomm:mainfrom
jeromehaxhiaj-qti:fix_macos_display

Conversation

@jeromehaxhiaj-qti

Copy link
Copy Markdown
Contributor

The GL switch path invokes the window-create callback and then immediately creates the SDL GL context, initializes the QEMU GL shader, and creates the surface texture. The macOS display bridge previously used fork_on_systemc(), so the callback could return before the SystemC thread had created the native SDL window. This allowed GL setup and the first framebuffer update to race with window creation and could leave an invalid display state or crash during GL refresh.

After simulation starts, release QEMU's I/O-thread lock while synchronously running the window-create operation on the SystemC thread, then reacquire the lock before returning to the GL switch path. This preserves the required macOS main-thread affinity while guaranteeing that the window exists before context and texture creation continue.

During elaboration, retain the non-blocking behavior to avoid waiting for a SystemC job before the simulation kernel is running.

The GL switch path invokes the window-create callback and then immediately
creates the SDL GL context, initializes the QEMU GL shader, and creates the
surface texture. The macOS display bridge previously used
fork_on_systemc(), so the callback could return before the SystemC thread had
created the native SDL window. This allowed GL setup and the first framebuffer
update to race with window creation and could leave an invalid display state
or crash during GL refresh.

After simulation starts, release QEMU's I/O-thread lock while synchronously
running the window-create operation on the SystemC thread, then reacquire the
lock before returning to the GL switch path. This preserves the required
macOS main-thread affinity while guaranteeing that the window exists before
context and texture creation continue.

During elaboration, retain the non-blocking behavior to avoid waiting for a
SystemC job before the simulation kernel is running.

Signed-off-by: Jerome Haxhiaj <jhaxhiaj@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant