eglCreateImageKHR for nested Mir

Alexandros Frantzis alexandros.frantzis at
Fri Sep 6 18:24:16 UTC 2013

Hi all,

I have been working on eglCreateImageKHR for the Mir EGL platform in
Mesa, using gbm_bo as the "native pixmap" type (EGL_NATIVE_PIXMAP_KHR).
This is needed by nested Mir, but could also be useful in general.

The current state of the (still very hacky) WIP can be found at:



(it is the diff against branch

I have run into the following problem: when a client connects to the
nested mir server, it fails almost immediately because of what seems to
be a problem referencing a buffer that was created earlier. In
particular, we create gbm_bos (using GEM objects internally) for the
buffers backing the surface of the client, but, sometimes, when trying
to reference these GEM objects, e.g. when trying to create an EGLImage
for them we can't find them anymore!

An interesting observation is that if the client submits the first 3
buffers slowly (which trigger the gbm_bo creation and EGLImage
initialization and rendering on the server), the problem doesn't occur,
which indicates that there is some kind of synchronization problem.

For anyone interested, things to try with the code above:

!!! Make sure you run against the modified Mesa
(e.g. set your LD_LIBRARY_PATH)

First run the host server:
$ sudo LD_LIBRARY_PATH=... bin/mir_demo_server_basic -f /tmp/mir_host

Run the nested server:
$ sudo LD_LIBRARY_PATH=... bin/mir_demo_server_basic --nested-mode /tmp/mir_host --enable-input off

Run a normal client and watch the nested server crash:
$ sudo LD_LIBRARY_PATH=...  bin/mir_demo_client_egltriangle

Run an (initially) slow client and watch it work (I have modified this
example to start slow and speed up):
$ sudo LD_LIBRARY_PATH=...  bin/mir_demo_client_scroll

To aid the investigation I created a client that stresses multi-threaded
gbm_bo and EGLImage creation and rendering, trying to approximate nested
mir behavior, but I can't get it to fail! :
$ sudo LD_LIBRARY_PATH=...  bin/mir_demo_client_egl_image -m /tmp/mir_host

Thoughts welcome :)

Note that I have only tried this on an Intel GPU. It would be interesting
to see if the behavior is different with Radeon or Nouveau.


More information about the Mir-devel mailing list