Skip to content

icd_shim: keep Xwayland on the payload driver - #70

Open
borodatych wants to merge 1 commit into
GameNative:masterfrom
borodatych:fix/xwayland-payload-driver
Open

borodatych wants to merge 1 commit into
GameNative:masterfrom
borodatych:fix/xwayland-payload-driver

Conversation

@borodatych

Copy link
Copy Markdown

Problem

Under gamescope, Xwayland's glamor renders through zink on this shim, and the shim loads the driver from ADRENOTOOLS_DRIVER_PATH — the container's Turnip.
Importing client buffers there leaks one dma-buf fd per buffer.

Measured on an AYN Thor (Adreno 740), with the Ubisoft Connect (CEF) launcher open:

  • Xwayland: 758 → 3199 dma-buf fds in 40 s; Android killed the app within ~3 minutes.
  • X clients hold only 1–4 pixmaps each (XRes), and gamescope releases every wl_buffer (WAYLAND_DEBUG: 2584 attach, 2581 release), so the fds pile up inside Xwayland's driver.
  • Turnip v26.2.0 R4 and 26.0.0 R8 both leak; the payload's own libvulkan_freedreno.so does not.

Fix

Only the Xwayland process skips try_adrenotools() and stays on the payload driver.
Games keep the container's driver.

GN_VKSHIM_NO_ADRENOTOOLS=1 on the whole container is not a substitute: guest launchers stop rendering with it.

Tested

  • On device with payload 20261105.4: Xwayland holds 9–18 dma-buf fds and the count stays flat for minutes; the game still loads the container's Turnip.
  • cargo build --release --locked and cargo clippy for adrenotools_gamescope with -D warnings: clean.

Xwayland's glamor renders through zink on this shim, and the shim loads
whatever ADRENOTOOLS_DRIVER_PATH points at, i.e. the container's Turnip.
Importing client buffers there leaks one dma-buf fd per buffer: on an
AYN Thor (Adreno 740) Xwayland went from 758 to 3199 dma-buf fds in 40 s
under a CEF launcher, and Android killed the app within ~3 minutes.
Turnip v26.2.0 R4 and 26.0.0 R8 both leak; the payload's own driver
does not (Xwayland holds 9-18 buffers and the count stays flat).

Turning adrenotools off for the whole container is not an option: guest
launchers stop rendering. So only the Xwayland process skips
try_adrenotools; games keep the container driver.
@joshuatam

Copy link
Copy Markdown
Collaborator

Problem

Under gamescope, Xwayland's glamor renders through zink on this shim, and the shim loads the driver from ADRENOTOOLS_DRIVER_PATH — the container's Turnip. Importing client buffers there leaks one dma-buf fd per buffer.

Measured on an AYN Thor (Adreno 740), with the Ubisoft Connect (CEF) launcher open:

  • Xwayland: 758 → 3199 dma-buf fds in 40 s; Android killed the app within ~3 minutes.
  • X clients hold only 1–4 pixmaps each (XRes), and gamescope releases every wl_buffer (WAYLAND_DEBUG: 2584 attach, 2581 release), so the fds pile up inside Xwayland's driver.
  • Turnip v26.2.0 R4 and 26.0.0 R8 both leak; the payload's own libvulkan_freedreno.so does not.

Fix

Only the Xwayland process skips try_adrenotools() and stays on the payload driver. Games keep the container's driver.

GN_VKSHIM_NO_ADRENOTOOLS=1 on the whole container is not a substitute: guest launchers stop rendering with it.

Tested

  • On device with payload 20261105.4: Xwayland holds 9–18 dma-buf fds and the count stays flat for minutes; the game still loads the container's Turnip.
  • cargo build --release --locked and cargo clippy for adrenotools_gamescope with -D warnings: clean.

Hi @borodatych thanks for the suggestion, could you confirm whether the leak is only happening when using with Ubisoft Connect launcher?

@utkarshdalal

Copy link
Copy Markdown
Contributor

@joshuatam maybe any CEF launcher? But afaik they don't really work well in GN anyway

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.

3 participants