Reusing wl_egl_window for multiple EGL surfaces

Virtual Presence virtualpresence.ucla at
Mon Oct 27 10:15:20 PDT 2014

I see. Thank you for the info. What i am trying to do is have multiple
contexts with its own EGLSurface but sharing the same "window" or
wl_surface on wayland, where one thread renders a gl_triangle and the other
rendering gears. This was a simple client to teach myself queues and IPC of
wayland, ofcourse it doesnt reflect "real world" clients. So with this
setup i was wondering if a resize on the wl_egl_window will seamlessly take
effect on both EGLSurfaces. Since there is no spec could it be possible
that different wayland EGL implementations will have different
interpretations on if/how to reuse the wl_egl_window OR are implementations
explicitly discouraged, may be to prevent themselves from blowing up in
weird ways, from reusing the same wl_egl_window concurrently? Also i am
assuming reuse of the wl_egl_window non-concurrently is permitted and wont
have issues?

On Mon, Oct 27, 2014 at 12:36 AM, Pekka Paalanen <ppaalanen at>

> On Sat, 25 Oct 2014 17:14:32 -0700
> Virtual Presence <virtualpresence.ucla at> wrote:
> > Hi,
> >
> > I am writing a simple multi-threaded multi-context GLES2 Wayland client.
> As
> > required by Wayland and MESA EGL bindings i do create a wl_egl_window to
> > pass on to EGL window surface creation. I was wondering if there is any
> > spec or rule that disallows reuse of the same wl_egl_window for multiple
> > EGLWindowSurface. I was wondering if i could use the same underlying
> > wl_egl_window resize bindings to cause multiple resizes. If i cannot do
> the
> > same i would like to know of a spec/rule/guide (say like an EGL spec)
> that
> > lists all the creation, management, deletion and usage of this object.
> Hi,
> I cannot understand what you could possibly achieve by creating several
> EGLSurfaces for the same window. What do you want to do?
> Are you perhaps attempting to render different parts of a single window
> in different GL contexts and so using different EGLSurfaces with some
> clipping magic? Maybe relying that GLX (not EGL IIRC!) required the
> color buffers to be shared between clients/contexts?
> Or do you simply want a dummy EGLSurface for each context, and then use
> FBOs to do the work, without ever calling eglSwapBuffers except for the
> one context that actually draws in the window? Because there are no
> Pixmaps in EGL Wayland?
> I can't quote a spec off-hand, but I know the EGL Wayland platform does
> not support "partial" rendering. Every time you call eglSwapBuffers,
> the whole buffer content must be valid, as the display server is free
> to take the whole buffer as the new window contents. That's actually a
> Wayland specification: every buffer must be completely drawn, as the
> display server is allowed to use all of it, even if the associated
> damage is only a part of it.
> So, I don't think it is explicitly forbidden anywhere to create several
> EGLSurfaces for the same wl_egl_window, but it just doesn't make sense.
> The different (E)GL contexts using the different EGLSurfaces would be
> fighting over whose buffer ends up on screen. As such, I expect that
> case to be untested, and so likely hit bugs.
> FWIW, you'd be looking for an EGL Wayland platform specification, and
> one has not been written AFAIK, as has not been written for many of the
> other platforms either.
> Thanks,
> pq
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the wayland-devel mailing list