[Spice-devel] [spice-gtk PATCH v2] spice-widget: init egl only after first gl_scanout

Jonathon Jongsma jjongsma at redhat.com
Wed Jul 27 16:19:46 UTC 2016


On Wed, 2016-07-27 at 10:31 -0400, Marc-André Lureau wrote:
> Hi
> 
> ----- Original Message -----
> > 
> > 
> > ----- Original Message -----
> > > 
> > > When using GtkDrawingArea and EGL was not used, it was still
> > > initialized.
> > > This produced warning messages on systems where EGL is not
> > > supported.
> > 
> > Not sure it's really a big problem since we require GL anyway.
> > 
> > Which system doesn't support egl?
> > 
> > For example when running the client in virtual machine.
> > The point is, that we shouldn't initialize EGL, if we are not going
> > to use
> > it.
> 
> I thought gtk required gl anyway these days, doesn't it? it's quite
> minor imho, we could lower it to a debug message during init, and a
> critical if GL scanout is actually being used and EGL init failed.
> 
> > 
> > 
> > > 
> > > 
> > > Move spice_egl_init from drawing_area_realize to gl_scanout.
> > > Drawing_area_realize is no longer needed.
> > > ---
> > > Changes since v1:
> > > - changed from recursive call to if check
> > > - moved set_egl_enabled(display, true); after initialisation is
> > > finished
> > > ---
> > 
> > Have you checked the behaviour on wayland?
> > 
> > Yes, it's working correctly in wayland.
> > 
> > 
> > Because spice_egl_init() is already called in gl_area_realize in
> > this case.
> > 
> > Well spice_egl_init() sets context_ready to true, so it should
> > never be
> > called twice.
> 
> Ok, I would keep it under the GDK_IS_X11_DISPLAY condition, not
> necessary to call it here when using gtkglarea.
>  
> > 
> > 
> > Furthermore, there is no guarantee that the widget is realized when
> > spice_display_widget_gl_scanout() is called, which would results in
> > other
> > warnings/criticals messages.
> > 
> > This could potentionally be a problem. Does
> > spice_egl_realize_display()
> > require the widget to be fully realized before the call?
> 
> Yes, on x11 at least, iirc, you must have a realized X window.
> 
> > 
> > Also wouldn't it be better, to move all of the EGL code to
> > GtkGLArea, instead
> > of GtkDrawArea even for X11?
> 
> It would, but unfortunately, gtkglarea doesn't use EGL on X11 (egl is
> needed to import the dmabuf). So we need this weird EGL on top of
> drawingarea code.
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


By the way, this egl initialization in the realize handler is actually
breaking spice-gtk with newer gtk+ (specifically gtk+ master). The
cairo widget stops redrawing until the widget gets resized, and then it
freezes again until the next resize. When I commented out the egl init,
the issue disappeared. This patch also fixes this issue.




More information about the Spice-devel mailing list