Pierre Vorhagen

Sharing graphics buffers between processes

Discussion created by Pierre Vorhagen on Mar 1, 2012
Latest reply on Mar 2, 2012 by Pierre Vorhagen


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,

Pierre Vorhagen