-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access the GPU without going through an X server #10
Comments
This would be awesome |
This functionality is indeed available in the latest nVidia driver, but I don't have it fully working yet. I can access the GPU device through EGL without an X server, create a Pbuffer, and (seemingly) render something to it, but I can't make glReadPixels() function properly, and I'm a little fuzzy on how double buffering and stereo can be implemented, as it seems like EGL doesn't support double buffered or stereo Pbuffers. Emulating double buffering and stereo using multiple single-buffered Pbuffers is certainly possible, but it would greatly increase the complexity of VirtualGL. Waiting for feedback from nVidia. |
After discussing at length with nVidia, it appears that there are a couple of issues blocking this: ISSUE:
SOLUTION:
ISSUE:
POSSIBLE SOLUTIONS:
|
Simple program to demonstrate OpenGL rendering without an X server: |
Popping the stack on this old thread, because I've started re-investigating how best to accomplish this, and I've been tinkering with some code over the past few days to explore what's now possible, since it's been two years since I last visited it. AFAICT (awaiting nVidia's confirmation), the situation is still the same with respect to EGL, which is that multi-view Pbuffers don't exist. That leaves us with the quandary of how to emulate these GLX features:
Features that will likely have to be relegated to the legacy GLX back end only:
As you can see, this is already a potential compatibility minefield. It at least becomes a manageable minefield if we are able to retain the existing GLX Pbuffer back end and simply add an EGL Pbuffer back end to it (i.e. if a multi-view EGL Pbuffer extension is available.) That would leave open the possibility of reverting to the GLX Pbuffer back end if certain applications don't work with the EGL Pbuffer back end. However, since I can think of no sane way to use FBOs for the EGL back end without also using them for the GLX back end, if we're forced to use FBOs, essentially everything we currently know about VirtualGL's compatibility with commercial applications would have to be thrown out the window. Emulating Pbuffers with FBOs is so potentially disruptive to application compatibility that I would even entertain the notion of introducing a new interposer library just for the EGL back end, and retaining the existing interposers until the new back end can be shown to be as compatible (these new interposers could be selected in vglrun based on the value of Maybe I'm being too paranoid, but in the 13 years I've been maintaining this project, I've literally seen every inadvisable thing that an application can possibly do with OpenGL or GLX. A lot of commercial OpenGL ISVs seem to have the philosophy that, as long as their application works on the specific platforms they support, it doesn't matter if the code is brittle, non-future-proof, or if it only works by accident because the display is local and the GPU is fast. Hence my general desire to not introduce potential compatibility problems into VirtualGL. The more we try to interpose the OpenGL API, the more problems we will potentially encounter, since that API changes a lot more frequently than GLX. There is unfortunately no inexpensive way to test a GLX/OpenGL implementation for conformance problems (accessing the Khronos comformance suites requires a $30,000 fee), and whereas some of the companies reselling VirtualGL in their own products have access to a variety of commercial applications for testing, I have no such access personally. |
Relabeling as "funding needed", since there is no way to pay for this project with the General Fund unless a multi-view Pbuffer extension for EGL materializes. |
I'm thinking about funding this specific project. How do I do that? I'm happy to discuss offline, including the specifics around amount needed, etc. No corporate agenda other than interest in this feature and willingness to fund it (the OpenGL offload without X server). |
@nimbixler please contact me offline: https://virtualgl.org/About/Contact. At the moment, it doesn't appear that nVidia is going to be able to come up with a multibuffer EGL extension, so this project is definitely doable but is likely to be costly. However, I really do think it's going to be necessary in order to move VGL forward, and this year would be a perfect time to do it. |
Pushed to a later release of VirtualGL, since 2.6 beta will land this month and there is no funding currently secured for this project. |
Re-tagging as "funding needed." I've completed the groundwork (Phase 1), which is now in the dev branch (with relevant changes that affect the stable branch placed in master.) However, due to budgetary constraints with the primary company that is sponsoring this, it appears that I'm going to need to split cost on the project across multiple companies in order to make it land in 2019. Phase 1
Phase 2Implementing the EGL back end
|
@nimbixler did you get my e-mail? We could use any funding help you can muster on this. |
This is amazing first step, openGL direct rendering without Xserver is a essential feature for HPC world. Let met explain me, Im working with virtualGL/turboVNC/noVNC for deploy a remote visualization service in a cluster HPC across a single node for remote viz, because the other nodes are used for compute mode with Cuda and another tools, What those mean? If we need to run a Xorg instance for remote viz in a GPU process, this GPU can not be shared for compute mode and X windows system, (the user should be aware of certain limitations with handling both activities simultaneously on a single GPU. If no consideration is given to managing both sets of tasks simultaneously, the system may experience disturbances and hangs in the X Window system, leading to an interruption of processing X-related tasks, such as display updates and rendering.). Then the hpc world need a separate cluster for HPC, running X 3D server on every node for this service. This isn't good approach, the hardware requirements are very big. Share the same GPU with X windows system and GPGPU compute mode let fusion the both cluster in a single layer. Now the inSITU visualization need this approach for good performance and share resources over the cluster will minimize the costs. the EGL remote hardware rendering and future webassembly service with h.264 coding are a good combination. Im sorry for my poor english. :) |
I have been looking at WebAssembly in the context of designing an in-browser TurboVNC viewer. So far, it seems to be not fully baked. I've gotten as far as building libjpeg-turbo (which requires disabling its SIMD extensions, since WASM doesn't support SIMD instructions yet) and LibVNCClient into WebAssembly code and running one of the LibVNCClient examples in a browser, but the WebAssembly sockets-to-WebSockets emulation layer doesn't work properly, and the program locks up the browser. |
There is a github project that tray to resolve this issue, simd proposal based to SIMD.JS. I Think. 🤔 |
NOTE: VirtualBox also doesn't work with the EGL back end yet (3D applications running in the guest display a black window.) I do notice that there are some named framebuffer functions in OpenGL 4.6 that I will probably have to interpose at some point, since some of those functions are allowed to operate on the default framebuffer (in which case it will be necessary for VGL to redirect the operation to the default FBO.) However, apitrace doesn't reveal that any of the failing applications are using those functions. |
All Qt5 demos are now working, as is VirtualBox, so the only remaining known issues are:
Closing this issue. Please feel free to add comments confirming that a particular application works with the EGL back end, but if something doesn't work, please open a new issue. Thanks. |
I am suffering from the "nvidia-container-cli: initialization error: nvml error: insufficient permissions", so is the current suggested solution is not to restrict the permission to vglusers group? |
No, it should still work if the permissions are restricted, as long as your user account is a member of |
No, didn't work for me even though I was a member of the vglusers and can run everything vgl related no problem. This is an access-restricted system, so removing the permissions is not a deal breaker for me. I also should note that this is with the stable 2.6.3, not with development branch. |
@muratmaga It works fine for me. Also, this isn't the right place to discuss any issues that are unrelated to the EGL back end. This thread is closed, so any further problems should be filed as a new issue.
|
https://github.com/ehfd/docker-nvidia-egl-desktop MATE Desktop container for NVIDIA GPUs without using an X Server, directly accessing the GPU with EGL to emulate GLX using VirtualGL and TurboVNC. Does not require |
@ehfd Yes, I know. Please refer to my examples here: |
The EGL back end should now mostly work with the AMDGPU and nouveau drivers. The only remaining failures with those drivers are in fakerut's multi-threaded tests. Since those same tests work fine with nVidia's EGL implementation, I'm not yet convinced that the failures with Mesa-based drivers are due to a bug in the EGL back end. They may simply be due to stricter behavior on the part of Mesa. When I have time, I'll investigate that issue more thoroughly. |
Correction: 59093fa fixed the fakerut multithreaded test failures with Mesa-based drivers. nouveau seems to have thread safety issues in general, and those manifest with the GLX back end as well, but the EGL back end now fully works with AMDGPU and fully works with nouveau minus those thread safety issues, which are out of our control. |
Do you think this functionality would work with embedded system like nvidia jetson nano? I have been using VirtualGL in the device through X server, but having it with EGL would be nice. I don't know much about how the different, but can help find out in the jetson forums if I knew what is required to make it works. P.S. Thanks for a wonderful work on VirtualGL. |
No idea. I have no experience with that hardware. But the fundamental purpose of VirtualGL is to remotely display 3D applications from high-spec servers in the machine room or the cloud to low-spec clients, not the other way around. |
I've just happened to have a Jetson running, so wait for a while and I'll tell you where I got. Apparently, there are no arm64 binary builds, so I'm building libjpeg-turbo and once I'll have it, I'll try virtualgl. |
It works (at least for simple stuff like glxgears):
Here are debs built for L4T 32.4: I tested it on Xavier NX, but it should be very similar to Nano. To build the packages, no special configuration was needed. |
The
to get it. This should be configurable permanently from |
Wow, thanks a lot for testing it, the deb, and the modprobe trick. I tested it on the jetson nano (jetson-nano-jp451-sd-card-image) and it works!! glxgears
glxspheres64
Btw, which branch or commit is the build? |
It's the tip of |
@peci1 Hi, do you know why we need to use xvfb-run here? Without xvfb, I kept getting "Could not open display" error message. I thought VirtualGL can run with EGL without any open display. |
@duongnb09 EGL eliminates the need for a 3D X server. You still need a 2D X server. In the example above, Xvfb is used as a headless 2D X server solely for testing purposes. Normally the 2D X server would be an X proxy, such as TurboVNC, that transmits its display to the client. (The 2D X server could also be on the client, if you are using the VGL Transport rather than an X proxy.) Refer to the User's Guide for definitions of all of the terms I just used. |
@dcommander Thanks for the explanation! I have a follow-up question about this. I want to use VirtualGL in the headless mode with EGL. Can we just setup TurboVNC server to create a display and then use VirtualGL with |
@duongnb09 Yes, you can use the TurboVNC Server as a 2D X server. That is, in fact, the recommended combination. (TurboVNC and VirtualGL were designed as companion products.) VirtualGL will automatically use the display specified in |
There are spurious rumors that this either already is possible or will be possible soon with the nVidia drivers, by using EGL, but it is unclear exactly how (the Kronos EGL headers still seem to indicate that Xlib is required when using EGL on Un*x.) As soon as it is possible to do this, it would be a great enhancement for VirtualGL, since it would eliminate the need for a running X server on the server machine. I already know basically how to make such a system work in VirtualGL, because Sun used to have a proprietary API (GLP) that allowed us to accomplish the same thing on SPARC. Even as early as 2007, we identified EGL as a possible replacement for GLP, but Linux driver support was only available for it recently, and even where it is available, EGL still seems to be tied to X11 on Un*x systems. It is assumed that, eventually, that will have to change in order to support Wayland.
The text was updated successfully, but these errors were encountered: