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

**URL:** <https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922>\
**Category:** PowerVR Insider\
**Created:** [May 2, 2019, 4:27pm UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922 "2019-05-02T16:27:39Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mvmvm](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@mvmvm](https://forums.imgtec.com/u/mvmvm)\
**Post date:** [May 2, 2019, 4:27pm UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/1 "2019-05-02T16:27:39Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![MartonTamas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/martontamas/32/297_2.png) [@MartonTamas](https://forums.imgtec.com/u/MartonTamas)\
**Post date:** [May 3, 2019, 7:37am UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/2 "2019-05-03T07:37:08Z")

</div>

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 🙂  
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

---

<div class="post-metadata">

**Author:** ![whg](https://avatars.discourse-cdn.com/v4/letter/w/d78d45/32.png) [@whg](https://forums.imgtec.com/u/whg)\
**Post date:** [April 24, 2020, 3:35pm UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/3 "2020-04-24T15:35:30Z")

</div>

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:

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

```

However, this prints out:

```auto
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?

---

<div class="post-metadata">

**Author:** ![omarzohdi](https://avatars.discourse-cdn.com/v4/letter/o/6de8d8/32.png) [@omarzohdi](https://forums.imgtec.com/u/omarzohdi)\
**Post date:** [April 29, 2020, 1:59pm UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/4 "2020-04-29T13:59:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![whg](https://avatars.discourse-cdn.com/v4/letter/w/d78d45/32.png) [@whg](https://forums.imgtec.com/u/whg)\
**Post date:** [May 11, 2020, 9:52am UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/5 "2020-05-11T09:52:23Z")

</div>

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/](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.

---

<div class="post-metadata">

**Author:** ![jduchniewicz](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jduchniewicz](https://forums.imgtec.com/u/jduchniewicz)\
**Post date:** [June 28, 2021, 3:31pm UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/6 "2021-06-28T15:31:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AlejandroC](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@AlejandroC](https://forums.imgtec.com/u/AlejandroC)\
**Post date:** [June 28, 2021, 4:40pm UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/7 "2021-06-28T16:40:25Z")

</div>

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](https://beagleboard.org/latest-images).

Best regards,  
Alejandro

---

<div class="post-metadata">

**Author:** ![jduchniewicz](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jduchniewicz](https://forums.imgtec.com/u/jduchniewicz)\
**Post date:** [July 6, 2021, 7:39am UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/8 "2021-07-06T07:39:37Z")

</div>

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:

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

```

Triggered by the following code:

```auto
    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.

---

<div class="post-metadata">

**Author:** ![AlejandroC](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@AlejandroC](https://forums.imgtec.com/u/AlejandroC)\
**Post date:** [July 7, 2021, 7:23am UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/9 "2021-07-07T07:23:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jduchniewicz](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jduchniewicz](https://forums.imgtec.com/u/jduchniewicz)\
**Post date:** [August 4, 2021, 4:56pm UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/10 "2021-08-04T16:56:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AlejandroC](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@AlejandroC](https://forums.imgtec.com/u/AlejandroC)\
**Post date:** [August 6, 2021, 4:17pm UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/11 "2021-08-06T16:17:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![omarzohdi](https://avatars.discourse-cdn.com/v4/letter/o/6de8d8/32.png) [@omarzohdi](https://forums.imgtec.com/u/omarzohdi)\
**Post date:** [August 9, 2021, 12:12pm UTC](https://forums.imgtec.com/t/headless-rendering-with-pvr-sgx530-egl-opengl-is-it-supported/2922/12 "2021-08-09T12:12:32Z")

</div>

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:

```auto
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().

```auto
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.
