ydirson / gl-streaming

streaming opengl commands, for the benefit of virtual machines
BSD 3-Clause "New" or "Revised" License
6 stars 0 forks source link

Viability of alternatives like VirtualGL or Google's gfxstream? #1

Open ghost opened 3 years ago

ghost commented 3 years ago

Hello, I just came across the Qubes Discourse post regarding this, and I wanted to provide input on my own efforts to achieve 3D acceleration in Qubes.

unknown

I am currently running 3D accelerated applications on Qubes by using a GPU passed directly to a VM running a separate X server and using VirtualGL to bridge the Qubes X server :0 and the new accelerated X server together, applications can be rendered via existing Qubes infrastructure with input and audio working correctly compared to other solutions described on the internet, albeit because qubes can't capture VM cursors some 3D camera systems do not function correctly. An issue was raised on the Qubes' issue tracker (https://github.com/QubesOS/qubes-issues/issues/4986) but there hasn't been any meaningful activity on it.

VirtualGL also has an EGL implementation, but I could not get it to work Fedora 33 and Debian 10's Mesa is too old and is missing the EGL extensions required. I tested it on a custom Ubuntu TemplateVM and it worked, so I believe it will be viable in the future to not have to run a secondary X server, and be able to contact the GPU directly via EGL.

I believe it may be possible to use Qubes' RPC functions with qrexec to transfer graphics commands to a remote qube that holds a graphics device but I am not knowledgeable enough on the workings of it.

Another issue is that VirtualGL does not support Vulkan forwarding, and the developer appears to not be interested in implementing it at the moment due to complexity. Therefore it may be worth to explore alternatives that do, such as Google's gfxstream. It supports code forwarding over network sockets if I understand correctly, which could probably be leveraged easily via qrexec.

I am ultimately useless at providing a meaningful practical implementation, I have no formal programming experience and can only provide insight on a design proposal. It is interesting to see so much activity regarding this lately and I feel like it's the last dealbreaker of Qubes for many people.

ydirson commented 3 years ago

As it happens, my search had not uncovered those two project when looking for prior work. Here is my understanding from the projects overviews, especially in what they differ from what I've in mind.

Their primary and common advantage is that they are already available, and apparently advanced enough to be used right now.

VirtualGL

gl-streaming OTOH uses what they call the "Old School Approach: Indirect Rendering". This surely has drawbacks, but the VirtualGL approach just won't allow to have the GPU and the app in different qubes

gfxstream aka. vulkan-cereal

All in all, would requires some dedication to be able to test anything, as well as to dig into the amount of code to understand if it fits at all.

ghost commented 3 years ago

I see, my intention would have been to use either of these as a scaffolding infrastructure paired with special Qubes' tools. I will also agree that Google's documentation is sparse and messy, and navigating their repositories feels quite challenging. Thanks for taking the time to write out this explanation.