0

I'm trying to understand how this works. So there are 2 types of applications - X apps and OpenGL apps. X apps draw to the screen using Xlib but do OpenGL somehow bypass X completely and render directly to the GPU? How does it do that?

If both X and OpenGL are running - how does my computer know which one to render to the screen? Is there some priority level? While X is running, can I bypass it and draw over it? That seems to be what OpenGL apps are doing if I understand it correctly.

1
  • 1
    There are some nice diagrams on wikipedia aiglx showing the progression of direct rendering. It needs a Direct Rendering Manager, see DRM. Commented May 7, 2021 at 12:08

1 Answer 1

0

OpenGL apps do not "bypass X", they ask X to provide a surface, and draw on it. Then X decides how to project that surface to the screen. Sometimes, if the app has frozen, you can see the surface when moving the windows, as a bright green rectangle.

You could draw directly on the screen before. However, now we have compositing window managers which, in a sense, do it themselves. So, while the API to draw on screen is likely still available, the WM will simply overpaint your stuff, 60 times per second.

2
  • Well according to this, OpenGL apps like 3D games do not use X - i.sstatic.net/yZSjs.png Commented May 7, 2021 at 11:37
  • Also according to this phoronix.com/forums/forum/linux-graphics-x-org-drivers/… - "rendering can be done in two ways -- "indirect" through the same X protocol as text and 2d graphics, or "direct" which bypasses the X protocol and lets the application talk directly to the graphics driver." Commented May 7, 2021 at 11:40

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.