Can godot render directly to frame buffer without X on linux?

Can the current stable version of godot render directly to the framebuffer on linux without requiring x server?

1 Like

Not yet: Add display driver to support Linux DRM/KMS environment · Issue #6364 · godotengine/godot-proposals · GitHub

Out of curiosity, what do you need this for?

1 Like

for a hardware device application where I cannot run an x server.

i have some existing drm/kms code i could use but it uses EGL and creates an opengles context. this was from another platform which had a gpu.

this new device does not have a gpu. just a simple framebuffer i need to write to.

Godot requires hardware acceleration (OpenGL 3.3, OpenGL ES 3.0 or Vulkan 1.0). Godot does not have a software renderer, so it sounds like Godot wouldn’t be a good fit for your use case. You could use llvmpipe or Lavapipe, but these are extremely slow solutions compared to a purpose-built software renderer.

what about mesa GL software renderer, would that be too slow?

In my personal experience, OpenGL does not lend itself to performant software rendering. I think you would be better off creating your own graphics system for your new device.

1 Like

Software OpenGL can work OK for basic 2D projects at low viewport resolutions (up to 1280x720, preferably lower), but anything more complex will struggle to reach even 10 FPS, especially on slower CPUs.

via mesa?

Yes, it doesn’t really matter which software rendering backend you use (llvmpipe, softpipe, swrast [which was removed in Mesa 22.0]). Like Vulkan, OpenGL is just not designed to run efficiently on a CPU; it was always designed around GPUs.

Purpose-built software renderers can easily be 10× faster than software OpenGL, but given how rarely they are needed nowadays, they wouldn’t be a good fit for inclusion in Godot. That said, it’s technically possible to fork Godot and write a software renderer.

Got it. Is OpenGL really used at the core of godot? Or is OpenGL just used in the display drivers? The reason I ask this is to understand how efficient a software renderer could be if I wrote one. I don’t need 3D graphics. I’m just doing 2D stuff.

OpenGL/Vulkan are implemented in rendering drivers, which use a context spawned by a display driver – on Linux, this is X11 or Wayland starting from 4.3.

If you were to implement a software rendering driver, you would also need to write code to spawn a window that can be drawn to without creating an OpenGL/Vulkan context. This needs to be done for each platform you want to run Godot on, as spawning windows is platform-specific.

More information in the Custom platform ports and Internal rendering architecture documentation.

@Calinou pinged me as I work on this area of the engine.

Agree with the points made earlier in this thread.

Godot servers (and entire engine) are designed for hardware accelerated APIs. So an existing “off the shelf” software renderer for e.g. OpenGL is by far the easiest path to something working (although likely slow).

The reason I ask this is to understand how efficient a software renderer could be if I wrote one. I don’t need 3D graphics. I’m just doing 2D stuff.

This is hard to answer without knowing your programming experience. It is not a trivial undertaking.

But in short: likely not very efficient, as Godot isn’t designed for this. It has freeform float coordinates / scale / rotation, which requires lots of per pixel work (if source to destination is not 1:1). Also requires runtime compiled custom shaders.