Primus: Client-Side GPU Offloading In 500 Lines Of Code

The PRIME / DRI2 offloading work was invasive to the xorg-server and DDX drivers with various changes being required in order to ultimately support technologies like NVIDIA Optimus. Meanwhile an independent developer has come along and wrote his own lightweight, client-side offloading implementation inspired by PRIME. Alexander Monakov introduced "Primus" to the world on Sunday.
Primus is more like VirtualGL rather than the full PRIME solution as it just deals with GLX forking for handling OpenGL offloading. Primus comes down to a ~500 lines of code pre-loadable library. This library tracks contexts and drawables and creates shadow contexts and pbuffers on a secondary X.Org Server to where OpenGL commands are redirected. Upon calling glXSwapBuffers, the contents from the secondary X.Org Server are ready and displayed. This basic implementation has been tested on a system with Intel and NVIDIA graphics while reportedly seeing "decent performance" out of the Primus library.
As far as the motive on working out this solution late in the game, "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."
More details can be found in this mailing list message.
8 Comments