Skip to content

freedreno/kgsl: try dma-buf export before shadowing#91

Draft
lfdevs wants to merge 1 commit into
dev/adreno-mainfrom
test/fix-termux-weston-xwayland-vulkan
Draft

freedreno/kgsl: try dma-buf export before shadowing#91
lfdevs wants to merge 1 commit into
dev/adreno-mainfrom
test/fix-termux-weston-xwayland-vulkan

Conversation

@lfdevs

@lfdevs lfdevs commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Note

This PR will not be merged, because although it resolves the issue of running "Weston (Anland) + XWayland + Vulkan" under Termux native and has almost no impact on the performance of KWin (Anland) under Termux native, it will cause the performance of KWin (Anland) accelerated by Freedreno & Turnip drivers inside PRoot/Chroot containers to drop significantly on certain GPU models (such as Adreno 730).

If you need to resolve the issue of running "Weston (Anland) + XWayland + Vulkan" under Termux native, you can find the corresponding build artifacts here: https://github.com/lfdevs/termux-packages/actions/runs/29795986556?pr=17#artifacts

Currently, using Anland: Termux and drivers built by this project in Termux native, and under a Weston session, running applications with the XWayland + Vulkan combination will crash. The key logs are as follows. This PR aims to resolve this issue.

linux-dmabuf: created wl_buffer from KGSL dmabuf
../src/src/gallium/drivers/freedreno/a6xx/fd6_texture.cc:854: struct fd6_texture_state *fd6_texture_state(struct fd_context *, mesa_shader_stage) [CHIP = A8XX]: assertion "state->view_rsc_seqno[i] == seqno" failed

The Weston Termux package with the added Anland 5.13 backend comes from: lfdevs/termux-packages#14


Imported KGSL BOs can already carry a valid dma-buf fd even when the pipe resource was not created with PIPE_BIND_SHARED. Shadowing such resources before attempting export unnecessarily replaces their backing storage and can leave cached texture state referring to the old resource sequence number.

Keep the LINEAR modifier requirement, but try the normal export path first. Native KGSL BOs that cannot be exported still fall back to a shared linear shadow resource. This avoids Xwayland aborts when presenting imported Vulkan DRI3 buffers.

Imported KGSL BOs can already carry a valid dma-buf fd even when the
pipe resource was not created with PIPE_BIND_SHARED. Shadowing such
resources before attempting export unnecessarily replaces their backing
storage and can leave cached texture state referring to the old resource
sequence number.

Keep the LINEAR modifier requirement, but try the normal export path
first. Native KGSL BOs that cannot be exported still fall back to a
shared linear shadow resource. This avoids Xwayland aborts when
presenting imported Vulkan DRI3 buffers.
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