[Spice-devel] [PATCH spice-gtk 3/7] egl: don't destroy wayland egl context

Pavel Grunt pgrunt at redhat.com
Mon May 23 09:43:19 UTC 2016


On Mon, 2016-05-23 at 11:36 +0200, Marc-André Lureau wrote:
> Hi
> 
> On Mon, May 23, 2016 at 10:13 AM, Pavel Grunt <pgrunt at redhat.com> wrote:
> > Hi Marc-André,
> > 
> > On Fri, 2016-05-20 at 17:16 +0200, Marc-André Lureau wrote:
> > > The egl context is from Gtk on Wayland. Destroy it only on X11.
> > > 
> > It deserves a comment in the code (like reference to spice_egl_init where
> > the
> > context is initialized).
> > 
> 
> ok
> 
> > Pavel
> > 
> > > Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
> > > ---
> > >  src/spice-widget-egl.c | 25 ++++++++++++++-----------
> > >  1 file changed, 14 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> > > index 7611b0b..fff2831 100644
> > > --- a/src/spice-widget-egl.c
> > > +++ b/src/spice-widget-egl.c
> > > @@ -364,10 +364,6 @@ void spice_egl_unrealize_display(SpiceDisplay
> > > *display)
> > >          d->egl.tex_pointer_id = 0;
> > >      }
> > > 
> > > -    if (d->egl.surface != EGL_NO_SURFACE) {
> > > -        eglDestroySurface(d->egl.display, d->egl.surface);
> > > -        d->egl.surface = EGL_NO_SURFACE;
> > > -    }
> > >      if (d->egl.vbuf_id) {
> > >          glDeleteBuffers(1, &d->egl.vbuf_id);
> > >          d->egl.vbuf_id = 0;
> > > @@ -378,14 +374,21 @@ void spice_egl_unrealize_display(SpiceDisplay
> > > *display)
> > >          d->egl.prog = 0;
> > >      }
> > > 
> > > -    if (d->egl.ctx) {
> > > -        eglDestroyContext(d->egl.display, d->egl.ctx);
> > > -        d->egl.ctx = 0;
> > > -    }
> > > +    if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
> 
> + /* egl.surface && egl.ctx are only created on x11, see
>            spice_egl_init() */
> 
> ok with that?

yes, thank you

Pavel

> 
> > > +        if (d->egl.surface != EGL_NO_SURFACE) {
> > > +            eglDestroySurface(d->egl.display, d->egl.surface);
> > > +            d->egl.surface = EGL_NO_SURFACE;
> > > +        }
> > > 
> > > -    eglMakeCurrent(d->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
> > > -                   EGL_NO_CONTEXT);
> > > -    eglTerminate(d->egl.display);
> > > +        if (d->egl.ctx) {
> > > +            eglDestroyContext(d->egl.display, d->egl.ctx);
> > > +            d->egl.ctx = 0;
> > > +        }
> > > +
> > > +        eglMakeCurrent(d->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
> > > +                       EGL_NO_CONTEXT);
> > > +        eglTerminate(d->egl.display);
> > > +    }
> > >  }
> > > 
> > >  G_GNUC_INTERNAL
> 
> 
> 


More information about the Spice-devel mailing list