Shared OpenGL ES Context between screens

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Shared OpenGL ES Context between screens

1,909 Views
Richard2
Contributor III

We have an IMX6 Quad, and there is some OpenGLES content we wish to share between applications.

According to several posts on this forum, we could use the Virtual Framebuffer driver to do this.

However, I have been unable to create a shared OpenGLES/EGL context that covers two screens - whether two physical and or a physical and a virtual.

I start by creating the initial context on the 'physical' screen.

I then create a context on the 'virtual' screen that should share this first context.

virt_display = fbGetDisplayByIndex(virtdispIndex);

eglvdisplay  = eglGetDisplay (virt_display);

eglInitialize (eglvdisplay, NULL, NULL); eglChooseConfig (eglvdisplay, m_configAttribs, &eglconfig, 1, &numconfigs);

EGLNativeWindowType  native_window = fbCreateWindow(virt_display, x, y, width, height);

eglsurface = eglCreateWindowSurface (eglvdisplay, eglconfig, native_window, NULL);

glcontext = eglCreateContext (eglvdisplay, eglconfig, shared_context, ContextAttribList);

This always throws the error "EGL_BAD_CONTEXT"

Is this actually possible to do, or is the previous suggestion actually bogus?

0 Kudos
4 Replies

1,110 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello Richard,

Virtual FrameBuffer is not supported any more on latest GPU drivers. However the main idea to develop Virtual FB was due to Vivante previous drivers implementation not supporting zero-copy https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_image.txt. that is supported in latest driver (from driver version 4.6 an up).

So I would recommend to use standard methods of pbuffer or EGLImage.

You can check more information about gpu memory allocators and system virtual pools on the i.MX6 Graphics User guide under your BSP documentation folder.

Hope this helps

0 Kudos

1,110 Views
Richard2
Contributor III

Thanks, I shall discard the Virtual Framebuffer approach.

Unfortunately the i.MX 6 Graphics Users Guide (yocto 3.14.52_1.1.0 and older) says nothing at all about EGLImage or pbuffers, and the Khronos documentation is fairly opaque.

Can you please point me towards some Linux examples of EGLImage?

While I have found a couple of Android examples, these rely on Android-specific items and I have been unable to find anything for Linux.

For this particular usage I only need to reference the same GPU-side texture resource in the two contexts.

The texture is a FBO target used by the GPU in Context A, and then rendered to screen in Context B.

0 Kudos

1,110 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi Richard,

Did you try to test the GPU SDK samples?:

i.MX6Q|i.MX 6Quad Processors|Quad Core|NXP

Regards

0 Kudos

1,110 Views
Richard2
Contributor III

Can you be more specific?
Which SDK and which samples do you mean?

That link contains hundreds of things that might or might not be relevant.

gpu_sdk_v1.00.tar.gz, specifically recommends using the virtual framebuffer, so is clearly outdated.

fsl-gpu-sdk-2.2.tgz is some kind of custom binary package which I cannot extract.

0 Kudos