Headless rendering with PVR SGX530, EGL, OpenGL - is it supported?

Hello, does the PowerVR SGX530 egl implementation support GPU rendering to a pbuffer or similar without any physical display attached or windowing system installed? I could not find PVR egl extensions which support this…though I may be looking in the wrong place.

eglQueryDevicesEXT et. al. appear to support the type of thing I am describing
https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_device_enumeration.txt
, but dont appear to be supported by PVR(?).

Should I be using a different approach?

I am targeting the Beagle Bone Black (AM335x Cortex A8, PowerVR SGX530).

Cheers.

Hi,

I don’t have that device with me, can you please post information returned by these calls?
You might need a display for this :slight_smile:
eglQueryString(display, EGL_EXTENSIONS);
eglQueryString(display, EGL_VERSION);
glGetString(GL_EXTENSIONS);
glGetString(GL_RENDERER);

It should be just a matter of technicality. Eg. get an EGL display from somewhere, then:
eglInitialize(display, …)
eglChooseConfig(display, …);
eglBindAPI(EGL_OPENGL_ES_API);
EGLContext context = eglCreateContext(display, …);
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, context));

and then just create an GL Framebuffer object and render to it. You would end frames with glFinish.

thank you,
Marton

I have also been trying to do some headless rendering on a SGX530 (on a Pocketbeagle).

I’ve found that creating a valid EGL context is the hardest thing and without a display connected, i haven’t managed to do it.

My understanding is that you have to create a GBM device, something like:

int32_t fd = open("/dev/dri/renderD128", O_RDWR);
struct gbm_device *gbm = gbm_create_device(fd);

However, this prints out:

PVR:(Error): [22682->22682] <gbm_pvr_create_device():592|ERROR> Failed to create
DBM device: No such device [0, ]

Can you confirm that this is because no display is connected?

Does this mean it’s not possible to do headless rendering?

Hi whg,

I’ll be taking a look at the issue you’re facing and I’ll get back you ASAP. I understand you’ve been trying to get headless rendering to work on both the BeagleBone Black and The BeagleBoard pocket, correct?

In the meantime, would you mind sharing which BeagleBoard image you are currently using?

Omar.

Sorry about the delay… I’ve only been trying this on the Pocketbeagle.

The image I’m using was made by Robert McNeel (who makes all the beaglebone images) and can be found at:

https://rcn-ee.net/rootfs/bb.org/testing/2020-04-04/stretch-imgtec/

It’s a debian 9 image with all the Imagination things included, apparently.

I am also having the same kind of problem. First I tried to use MESA libraries on a regular Debian Image but got obviously some terrible issues when trying to do so.

Then I tried using the image mentioned above and was still unable to successfully create a context. Seems like even though a render node is created, the PVR libraries fail to acknowledge it as a valid GBM device candidate.

Hi jduchniewicz,

Many thanks for your message and welcome to the PowerVR Developer Forum!

We’ll look into your issue. We would like to know what kind of device are you working on
(model, DDK version, OS). In case you’re working with a Beagle Bone, please download and try the image recommended by Imagination Technologies, which is the one called AM3358 Debian 9.12 2020-04-06 4GB SD ImgTec from BeagleBoard.org - latest-images.

Best regards,
Alejandro

Hi Alejandro,

I am using the BBB Rev C. with the Image you proposed. No additional libraries installed and using PVR rendering backend via EGL.

The error is as follows:

PVR:(Error): WSEGL_InitialiseDisplay: Failed to create output [0, ]

Triggered by the following code:

    int ret = 0;
    int major, minor;

    g_helper.gbd_fd = open("/dev/dri/renderD128", O_RDWR);
    if (g_helper.gbd_fd <= 0)
        ERR("Could not open device");

    g_helper.gbm = gbm_create_device(g_helper.gbd_fd);
    if (!g_helper.gbm)
        ERR("Could not create GBM device");

    g_helper.display = eglGetDisplay((EGLNativeDisplayType)g_helper.gbm);
    if (!g_helper.display)
        ERR("Could not create display");

    if (eglInitialize(g_helper.display, &major, &minor) == 0)
        ERR("Could not initialize display");

For now I will try to circumvent the issue by using a headless ghost HDMI, but ideally we would like the users of BBB to be able to utilize bare BBB for GPU usage.

Hi jduchniewicz,

Thanks for your detailed report, with this information we should be able to reproduce the issue and look for a solution. We will come back as soon as we have information about it.

Best reagrds,
Alejandro

1 Like

Hi Alejandro,

Any update on the issue? For now all works fine with the ghost plug. However, I would want the users to be able to use BBB without needing additional hardware (the ghost plug). I tried removing it and could not do computations due to the error I pasted above.

Jakub

Hi jduchniewicz,

We are asking the SGX Team about this, we will come back to you as soon as we have an answer.

Best regards,
Alejandro

Hi, Jakub,

You can create a PBuffer surface and render to it without using the display HW at all. This is achieved by choosing an EGL config using individual component widths in config attributes and EGL_SURFACE_TYPE=EGL_PBUFFER_BIT.

Here’s an example on how to achieve that:

EGLint cfg_attribs[] = {EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
              EGL_ALPHA_SIZE, 8, EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
              EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE};

eglChooseConfig(dpy, cfg_attribs, &config, 1, &config_count);

Only set EGL_WIDTH, EGL_HEIGHT in attrib_list argument of eglCreatePbufferSurface().

EGLint pbuf[] = {EGL_WIDTH, WINDOW_WIDTH, EGL_HEIGHT, WINDOW_HEIGHT, EGL_NONE};

EGLSurface surface = eglCreatePbufferSurface (dpy, config, pbuf);

You can then use these PBuffer surfaces instead of window surfaces in the application’s GLES2 contexts.

Cheers,
Omar.

© Imagination Technologies Limited. All rights reserved.
Privacy PolicyTerms & ConditionsTrademarksCookies