blank window fix
rpg maker games, electron apps and browsers open under crossover as an empty window: the macos title bar is there, the picture never comes. the app is running. its drawing process is not: it crashes on its first frame. this makes the app draw inside its own process.
symptom
a game or an app starts, its process stays alive, the window shows a title bar over a blank area. it happens with everything built on chromium: nw.js games (rpg maker mv and mz), electron apps, chrome and edge.
cause
chromium does not draw in the process that owns the window. it starts a second one, the gpu process, and that one presents into the first one's window. wine's mac driver keeps window data per process and has none for a window that belongs to somebody else. d3dmetal asks for it and uses the answer without checking:
Received fatal exception EXCEPTION_ACCESS_VIOLATION
Backtrace:
WineSwapchainCallbacks::InitializeForHWND(void*, DXGI_SWAP_CHAIN_DESC1 const*, D3D12_RESOURCE_DESC&) +51
The GPU process has crashed 1 time(s)
The GPU process has crashed 2 time(s)
The GPU process has crashed 3 time(s)after the third crash chromium stops trying and falls back to software drawing, which still runs in the second process and still cannot reach the window. an rpg maker game then reports Your browser does not support WebGL to a window nobody sees.
what was checked
crossover 26.0, a bottle on the d3dmetal backend, each app started with no extra options.
| app | stock | fixed |
|---|---|---|
| rpg maker mz game (nw.js) | empty window, gpu process crashed 3 times | draws, no gpu process |
| vortex 2.6.3 (electron) | empty window, gpu process crashed 3 times | draws, no gpu process |
| edge 155 | empty window, gpu process crashed 3 times | draws, webgl works, no gpu process |
the fix
chromium has a switch for this, --in-process-gpu: the gpu work runs on a thread of the process that owns the window. steam passes it to its own chromium under wine. every other app would need it added by hand, in a place that differs per app.
so the switch is added where every windows program gets its command line: wine's ntdll, before any windows code runs. a wrapper replaces the unix side of ntdll.so, re-exports the real one, and when a chromium main process starts, appends the switches to its command line.
// no --type= switch: a main process, not one of chromium's children
// icudtl.dat next to the program: chromium ships its data under that name
if (!contains(line, chars, "--type=") && is_chromium(dir))
append(cmd, " --in-process-gpu --no-sandbox");--no-sandbox goes with it. chromium's sandbox does not start its page processes under wine: edge showed its toolbar and no page until the sandbox was off.
what changes on disk
lib/wine/x86_64-unix/ntdll.sobecomes the wrapperntdll.so.origis the untouched originalntdll_real.sois the copy the wrapper loads
limits
- applies to apps started after the change. the bottle does not have to restart.
- the sandbox is off for these apps, and chrome and edge say so in a bar under the toolbar.
- a program counts as chromium when
icudtl.datsits next to it, or in a version folder beside it. apps on qt webengine keep that file elsewhere and are not covered. - a game that only uses chromium for an in-game overlay gets the switches too.
- apps that draw their own title bar still get the macos one on top of it. that is a separate problem.
- checked on the d3dmetal backend and crossover's x86_64 wine. a preview build's arm64 wine is left alone.