Skip to content

android: build Xwayland with GLX, so a GL guest can reach the shim - #5

Open
joshuatam wants to merge 1 commit into
gamenative-xwayland-24.1.15from
feat/glx-for-kopper
Open

joshuatam wants to merge 1 commit into
gamenative-xwayland-24.1.15from
feat/glx-for-kopper

Conversation

@joshuatam

@joshuatam joshuatam commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

A GL guest's libGL presents through GLX, and Mesa's kopper — the zink path that
hands frames to the Vulkan WSI instead of copying them through XShmPutImage —
lives in the GLX frontend and initialises against the server's GLX extension.

This tree was built with -Dglx=false, so there is no such extension. Wine's X11
driver papers over it under __ANDROID__ (hence WINE_X11FORCEGLX in the app's
environment), but a kopper client has nothing to bind to. The only GL path that
worked was the shm copy, whose frames never create a VkSurfaceKHR — so they
never meet the ICD shim's swapchain, acquire cap, generation or release notes. A
GL title was invisible to the whole present path.

Change

-Dglx=true. Server-side GLX does not force any client to use it: a client that
keeps presenting through XShmPutImage still can, so the existing GL path is
behaviourally unchanged.

GLX needs the libGL headers, and the termux build prefix ships the protocol ones
(glxproto.h, glxtokens.h, GL/internal/dri_interface.h) without GL/gl.h,
GL/glx.h or GL/glext.h — the build otherwise fails deep inside
glx/createcontext.c. The script now checks for all four up front and names the
missing file.

Measured

Build: 2 413 920 B, 1132 GLX strings in the binary, glxdri2 compiled in.

End to end on Retroid Pocket Nova (Adreno 740), SteamWorld Dig 2 under gamescope,
after the matching GL stack landed on the gamescope side:

Dig2.exe       maps gamescope/lib/gl/libGL.so.1.2.0  (kopper GLX frontend)
gn-vkshim      proxy swapchain create: 3 images for asked=3 ceiling=8
               present mode: declared=fifo cap=60 acquire=60 generate=0
screen         game content, HUD 60.0 fps, LIMITED BY: FPS CAP
VkSurfaceKHR   created from a GL client for the first time

Needs the gamescope side of this to be useful — the payload has to carry the GL
stack that can reach a GLX server. Companion: GameNative/gamescope#41.

Verified on that device only; no other Android GPU has been tried.

A GL guest's libGL presents through GLX, and Mesa's kopper -- the zink path that
hands its frames to the Vulkan WSI instead of copying them through XShmPutImage --
lives in the GLX frontend and initialises against the server's GLX extension. With
`-Dglx=false` there is no such extension: wine's X11 driver fakes one under
__ANDROID__ (hence WINE_X11FORCEGLX in the app's environment), and a kopper client
has nothing to bind to, so the only GL path that worked was the shm copy — whose
frames never create a VkSurface and therefore never meet the ICD's swapchain, cap,
generation or release notes.

Measured on the build: 1132 GLX strings in the binary, glxdri2 compiled in.

The headers this needs are not all in the termux prefix: it ships glxproto.h,
glxtokens.h and GL/internal/dri_interface.h but not GL/gl.h, GL/glx.h or
GL/glext.h, so the build otherwise fails inside glx/createcontext.c. The script now
checks for all four and names the missing one.

Server-side GLX does not force a client to use it: a client that keeps presenting
through XShmPutImage still can, so the existing GL path is unchanged by this.
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