Can EGL application run in console mode?

I want to implement an opengl application that generates images and I view the image through a webpage.

the app is meant to run on a Linux server that has no display, no x windows, but with gpu.

I know egl can use pixmap or pbuffer as render targets.

but the eglGetDisplay function bothers me, it looks like I still need to have a display attached to make it work?

does egl work without display and xwindows or wayland?

+3


source to share


2 answers


This is a recurring question. TL; DR: With the current Linux graphics driver model, it is not possible to use the GPU with traditional drivers without running the X server. If the GPU is supported by KMS + DRM + DRI, you can do this. (EDIT :) Also in 2016, Nvidia finally introduced truly mute OpenGL support in their drivers via EGL.


The long history is that, technically, GPUs are perfectly capable of rendering an off-screen buffer without connecting a display or a running graphics server. However, due to the history of the graphics driver and the design of the environment, this is not possible, but failed for a long time. The assumption then (when graphics were first introduced by Linux) was: "The graphics device is designed to deliver an image to the screen." That a graphics card could be used as an acceleration coprocessor didn't even show the idea.

Add to that that until a few years ago, the Linux kernel didn't know how to talk to graphics devices (other than a dumb framebuffer somewhere in the system address space). The X server was what was discussed with GPUs, so you had to start it. And the early developers of the X server made the assumption that there was a person between the keyboard and the chair.




So what are your options:

In short, if you are using an NVidia GPU: Just start the X server. You don't need a complete desktop environment. You can even save yourself the trouble of launching a window manager. Just ask the X server to approve VT and be active. Nvidia drivers now support headless OpenGL contexts via EGL.

If you are using AMD or Intel GPU, you can talk to him directly. Either via EGL or via KMS (Google for something called kmscube

, when you try it, make sure you turn off your X server first before the VT text, otherwise you will run into an X server). I haven't tried it yet, but the example could be tailored kmscube

so that it uses the GPU to render to an offscreen buffer, without switching VT to graphics mode, or to any graphics output on the display framebuffer at all.

+6


source


As datenwolf said, you can create a framebuffer without using x with AMD and Intel GPUs. as iam using AMD graphics card with EGL and iam is able to create framebuffer and draw iam on it. With Mesa Library can be configured without x u.



0


source







All Articles