Page MenuHome

OpenGL headless rendering
Confirmed, NormalPublicTO DO

Description

This depends on T54633 and should be tackled afterwards.

We should allow OpenGL rendering on headless system (servers without display setup).

Resources on the subject are few but it seems our best shot is to use EGL. We need to assess the support of EGL across our target platforms, and the opengl features it provides.

Revisions and Commits

Event Timeline

Clément Foucault (fclem) lowered the priority of this task from 90 to Normal.Apr 16 2018, 12:21 PM
Clément Foucault (fclem) created this task.
Dalai Felinto (dfelinto) renamed this task from Opengl headless rendering to OpenGL headless rendering.Apr 16 2018, 12:25 PM

So after trying a few things on a standalone test application, we manage to create a EGL context with GL 4.6 on an Nvidia + Linux + Proprietary drivers workstation.
But we did not succeed on a AMD + Linux + Opensource drivers, only giving us a GL 3.0 context at most.

So this is highly platform dependant and might need more work to get it working nicely.

There is already an EGL backend to GHOST but it's targeted at GLES and outdated.

So we can divide this into 2 tasks:

  • Create compatible GL > 3.3 context with EGL (with maximum platform compatibility).
  • Add offscreen context functions to EGL backends.

This is not a really hard task but it is not a priority for now. So postponing for now.

Here is the test application we used : P671

Thanks @Sergey Sharybin (sergey) for helping me on this one.

AMD guy here.

You need to request the Core profile for older versions of our open source driver. If you don't, you'll get the compatibility profile which is mainly used by legacy applications.

The original plan was to keep the Core profile version at GL 4.5 and the Compatibility profile version at GL 3.0 forever, but we changed our minds and started adding Compatibility profile support last year:
Mesa 18.0: OpenGL 3.0
Mesa 18.1: OpenGL 3.1
Mesa 18.2: OpenGL 4.4
Mesa 18.3: OpenGL 4.5

You are shooting yourselves in the foot by using the Compatibility (default) profile. The Core profile is slightly faster if you are CPU-bound.

as informative:
AMD Guy, Marek Olsak write on T69853 comments:

Mesa drivers now support the Compatibility profile on AMD hw starting with the AMD GCN architecture, so you don't need the Core profile anymore.

getshi (getshi) added a comment.EditedDec 17 2019, 9:27 AM

I wanted to comment on the importance of this by giving an example.

I'm working in research, where we build prototypes of new simulation methods usually as stand-alone applications (because that's the fastest way, or because there's libraries to extend, etc.), and they are usually equipped with no or only trivial rendering. Writing them directly in tools such as blender is often too big of an overhead. However, previewing rendered animations of tons of simulations (done outside blender in prototypes with only simple or no rendering) can be vital; using blender's shader nodes, modifier stack, and general layouting would be an amazing tool for that. Eevee renderings can look amazing at a fraction of the cost of cycles renderings, and for the purpose of previewing any sort of animation this can be a crucial timesaver.

For now, I am stuck with rendering on my workstation, even though I would have multiple gpu machines available in a cluster but without displays.

Bringing back EGL support and adding offscreen rendering support to it is being worked on here: D6585: X11 EGL context

Bringing back EGL support and adding offscreen rendering support to it is being worked on here: D6585: X11 EGL context

Yes, that is definitely possible with EGL. I implemented that once for another project: https://github.com/stevenlovegrove/Pangolin/blob/master/src/display/device/display_headless.cpp

However, this should be done in a separate GHOST implementation which does not use any windowing system. This would then allow you to build Blender without any window system dependencies (X11 / Wayland) and run it on a server. I am not sure about GLX dependencies though, the GLEW package in Ubuntu is linked against GLX (libGLX.so).

Clément Foucault (fclem) changed the subtype of this task from "Report" to "To Do".Thu, Jan 30, 2:24 PM