Posts: 192
Joined: Thu Sep 10, 2015 4:26 pm

Offline OpenGL render target - is it possible?

Sat Aug 03, 2019 1:23 pm

As in the topic title.

Is it possible to allocate a memory for an offline framebuffer and then tell egl? gbm? drm? to render there? May be without X running :)

PS: On RPi4 :) / FKMS

Posts: 29
Joined: Sat Sep 23, 2017 10:43 am

Re: Offline OpenGL render target - is it possible?

Sat Aug 03, 2019 2:49 pm

It should be possible, I'm working my way through this now. I did this with the PI3 B+ with success but a few things are a bit different using the PI4 with the new driver. I used 6by9 github project X11_export for reference as it shows how to create an offline buffer using vcsm and get it's fd. The project also shows how to create an opengl texture from the vcsm fd. The part that isn't shown is to tie the texture to an opengl framebufferobject (fbo) which would be the last step allowing you to render directly to that offline buffer. You can get access to the offline buffer by doing a mmap.

by the way these are the list of valid import buf fourcc (EGL_LINUX_DRM_FOURCC_EXT) I was able to get EGL to query for using eglQueryDmaBufFormats (I had to use eglGetProcAddress to use this function).

Code: Select all

DMA Supported Formats: 10
------Dma Supported Formats List (fourcc) found in usr/include/libdrm/drm_fourcc.h-----
0x30334241 - AB30
0x34325241 - AR24
0x34324241 - AB24
0x34325258 - XR24
0x34324258 - XB24
0x36314752 - RG16
0x20203852 - R8
0x20363152 - R16
0x38385247 - GR88
0x32335247 - GR32
*fixed link to the github branch mentioned.

Return to “OpenGLES”