Decorationless EGL apps are broken in toytoolkit

Chris Wilson chris at chris-wilson.co.uk
Mon Dec 12 06:04:14 PST 2011


On Wed, 30 Nov 2011 13:46:35 +0200, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> That's fun, because nowhere in the Wayland demos toytoolkit code we
> call eglSwapBuffers ourselves. The finger points at Cairo-egl.

Right, as pointed out we cannot call eglSwapBuffers outside of a valid
MakeCurrent. Unfortunately one side-effect of cairo flushing everything
prior to the swap caused the current context to be set to invalid.

Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Dec 12 13:52:27 2011 +0000

    gl: Set the destination for swap buffers, required by EGL at least
    
    EGL mandates that the current context be valid for a call to
    swapbuffers, and does not just operate upon the drawable passed in.  The
    current code prevents this as a side effect of calling flush decouples
    the current context (so that the state can be clobbered by the
    application without impacting upon Cairo). So when we try to swap, EGL
    complains.
    
    We can get the desired behaviour by setting the surface upon the
    context, thus calling MakeCurrent as necessary, and then flushing any
    pending operations before swapping. This has the positive side-effect
    of not clobbering our own state unnecessarily.
    
    Reported-by: Pekka Paalanen <ppaalanen at gmail.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the wayland-devel mailing list