Skip to content

WIP: GLX Extension to control GLXVND dispatching for PRIME GPU offloading

For GPU offloading in libglvnd, where individual clients can run with an alternate GPU and client-side vendor library, we'd need some way for that alternate vendor library to communicate with its server-side counterpart. Normally, the server's GLXVND layer would dispatch any GLX requests to whichever driver is running an X screen. This is a GLX extension that allows a client to tell the server to send GLX requests to a different driver instead.

The basic idea is that the server keeps a separate (screen -> GLXServerVendor) mapping for each client. The current global mapping is used as the default for each new client, but the client can send a request to change its own mapping. That way, if the client uses a different vendor library, then the client-side vendor can arrange for any GLX requests to go to the matching server-side driver.

The extension uses Atoms as an ID to identify each GLXServerVendor, using a string provided by the driver. That way, the client-side driver can know which Atom it needs to use without having to define an extra query. The client can send a request with a screen number and a vendor ID to tell the server to dispatch any GLX requests for that screen to the specified vendor. A client can also send None as a vendor ID to revert to whatever GLXServerVendor would handle that screen by default.

I also added a GLXVendorPrivate/GLXVendorPrivateWithReply-style request, which sends a request to a specific vendor based on a vendor ID, without having to worry about which vendor is assigned to a screen at the moment. Strictly speaking, a vendor library could get the same result by adding a regular GLXVendorPrivate request, and providing a dispatch function that always routes the request to itself, but that seems like it's more of an implementation detail of GLXVND.

Also, this extension doesn't define any errors or queries to check whether a GLXServerVendor can support a given screen. These requests would be sent by a client-side vendor library (not by libglvnd or an application), so each driver would be responsible for figuring out on its own which screens it can support.

This is a rough draft of the extension spec: GLX_EXT_server_vendor_select.txt

Merge request reports