[Mesa-dev] [RFC] primus: PoC client-side GPU offloading

Alexander Monakov amonakov at gmail.com
Sun Sep 2 06:12:07 PDT 2012


Greetings, Mesa hackers,

I've hacked together a small (~500 sloc) preloadable library that
implements OpenGL offloading by means of GLX forking, similar to
VirtualGL. The basic idea is to track contexts and drawables and
create shadow contexts and pbuffers on the secondary X server,
redirecting all GL commands there; on glXSwapBuffers, perform readback
and display. However, primus assumes that both X servers are on the
local machine, which allows to eliminate copying and use a direct
rendering context for displaying the rendered buffer as well. With
recent Mesa git, I see decent performance with i965 dri and nvidia
blob (it's cool that with a small hack it's possible to load both
libraries in one address space and use direct contexts from different
threads).

I have a few questions:

1. primus needs to load libglapi explicitly with RTLD_GLOBAL, otherwise
DRI modules (e.g. i965_dri.so) cannot find symbols defined in that library.
Is that how it's supposed to be? Should DRI modules link against libglapi?

2. How should window resizes be handled? Should I call XGetGeometry
every frame to check if size changed?

3. Is there a way to discover from what path the font was loaded when given
just a Font XID in glXUseXFont?

Even though this project may seem a little late given that PRIME has
gained traction, I hope that it may serve as a benchmark for PRIME
offloading, and maybe even as a real offloading solution in the
meantime given enough bugfixing effort.

The project is hosted at https://github.com/amonakov/primus

Thanks.
Alexander


More information about the mesa-dev mailing list