Sharing graphics buffers between processes

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

Sharing graphics buffers between processes

5,161 Views
PierreVorhagen
Contributor I

Hello,

I need help! :)

I am working on an i.MX515 board. The main application is a webkit-based browser, that currently runs on Qt 4.7.3, and we would like full OpenGL acceleration, with a basic windowing system, but without X.

I cross-compiled Qt 5 (originally Qt 4.8, but Qt 5 is more interesting for its modularity and QPA integration) and hope to be able to make full use of the i.MX hardware acceleration. To achieve this, the new Qt platforms system (QPA) is perfectly suited.

After further investigation, I tried ou the EglFS platform plugin, and OpenGL runs more or less smoothly, although classic widget elements like sliders, buttons, decorations, don't display well, but that's not really the issue.

Finally, I settled on the Wayland plugin & compositor system, because of its very elegant design and vast possibilities, as well as its low overhead compared to X.

The problem is the following; as stated on the Wayland website, it relies on an EGL extension to be able to share window surface buffers between clients and the server.

Techincally, (I cite) the EGL stack is expected to define a vendor-specific protocol extension that lets the client side EGL stack communicate buffer details with the compositor in order to share buffers. This is the Mesa spec for this extension.

Now, I am aware that the libEGL for my board does not offer this extension, but even if I was to write my own workaround to this, or if I simply wanted to design my own windowing system, I still need an efficient way to share buffers between processes.

I have searched for this in the different EGL headers provided, as well as in the given examples or other internet resources, but I can't seem to find a way to allocate and share GPU memory between processes.

If I have understood this correctly, some sort of mmap() on graphics memory would be ideal, since an application could render into it, off-screen, and pass the descriptor to the server process, which could do the on-screen comositing and display.

I did some tests and rendered off-screen into an OpenGL framebuffer object, the associated texture can then be passed around somehow, and be re-drawn to the screen by another process. From the Khronos forums: "Wayland creates and binds a GL FBO, attaches a color & depth render buffer and sets the color render buffer storage to an EGLImage, using an extension called glEGLImageTargetRenderbufferStorageOES"

So, please, is there any way this is possible with this board? If I understand this correctly, it is the sole missing key to an efficient lightweight windowing system without X.  (Are there undocumented calls to do this? Is there an API to access these functions? Maybe a contractually agreed-upon access to the libEGL source code? I don't know what is possible...)

Thank you very much for your help,
regards,

Pierre Vorhagen

0 Kudos
4 Replies

1,813 Views
PierreVorhagen
Contributor I

No problem, but I'm quite sre that this is possible... The driver probably has roughly the need buffer sharing, if it supports any compositing window system. The problem is that I'm not familiar enough with it, and I'd need the advice of someone that really knows about the internals of this driver, or someone who has done something similar before...

PS: Is there possibly a mailing list I should/could address these questions to?

0 Kudos

1,813 Views
PrabhuSundarara
NXP Employee
NXP Employee

sorry my wrong. The external buffer I mean is the buffer allocated in central memory. It don't think GPU driver will allow to share  GPU memory area between different processes(security concerns). May be you need to reconsider the logic.

0 Kudos

1,813 Views
PierreVorhagen
Contributor I

Thank you for your reply.

I will have to investigate on EGL_NATIVE_PIXMAP_KHR and how to use it. (I am not so familiar with EGL yet...)

I just quickly read the specs, and I think this is merely an extension allowing for a common Image type between different APIs, but this does not resolve the problem of sharing said EGLImage between different processes.

You say "Allocate a external buffer and create eglImage using eglCreateImageKHR(EGL_NATIVE_PIXMAP_KHR). I suppose the external buffer can be shared between the process."

What do you mean by external buffer? Something like a shm? That is precisely my question... how can I allocate and share an external buffer? But this buffer has to be in GPU RAM, so that I can render into it directly (or direcly write an EGLImage into it in other words) and read out of it directly in another process. I don't want to have to pass via a buffer allocated in central memory, solely managed by the CPU.

The whole point is the sharing of an Image, or whatever actually, but via the graphics chip. I am sorry if I was a unclear on that, I think that I am missing an important mechanism that exists to do this... this "external buffer" which you talk about...

0 Kudos

1,813 Views
PrabhuSundarara
NXP Employee
NXP Employee

MX51 EGL has EGL_KHR_base_image support, but does not have WL_bind_wayland_display extension support.

 

I'm not sure I understand the problem completely, as a workaround. MX51 EGL supports KHR_image_pixmap extension.

Allocate a external buffer and create eglImage using eglCreateImageKHR(EGL_NATIVE_PIXMAP_KHR). I suppose the external buffer can be shared between the process.

0 Kudos