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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

----- 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?

> 
> 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?

>  src/spice-widget.c | 42 +++++++++++++++++++-----------------------
>  1 file changed, 19 insertions(+), 23 deletions(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index c7dd553..feb2bcc 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -563,28 +563,6 @@ gl_area_realize(GtkGLArea *area, gpointer user_data)
>  #endif
>  #endif
>  
> -static void
> -drawing_area_realize(GtkWidget *area, gpointer user_data)
> -{
> -#ifdef GDK_WINDOWING_X11
> -    SpiceDisplay *display = SPICE_DISPLAY(user_data);
> -    GError *err = NULL;
> -
> -    if (!GDK_IS_X11_DISPLAY(gdk_display_get_default()))
> -        return;
> -
> -    if (!spice_egl_init(display, &err)) {
> -        g_critical("egl init failed: %s", err->message);
> -        g_clear_error(&err);
> -    }
> -
> -    if (!spice_egl_realize_display(display, gtk_widget_get_window(area),
> &err)) {
> -        g_critical("egl realize failed: %s", err->message);
> -        g_clear_error(&err);
> -    }
> -#endif
> -}
> -
>  static void spice_display_init(SpiceDisplay *display)
>  {
>      GtkWidget *widget = GTK_WIDGET(display);
> @@ -599,7 +577,6 @@ static void spice_display_init(SpiceDisplay *display)
>  
>      g_object_connect(area,
>                       "signal::draw", draw_event, display,
> -                     "signal::realize", drawing_area_realize, display,
>                       NULL);
>      gtk_stack_add_named(d->stack, area, "draw-area");
>      gtk_widget_set_double_buffered(area, true);
> @@ -2633,8 +2610,27 @@ G_GNUC_INTERNAL
>  void spice_display_widget_gl_scanout(SpiceDisplay *display)
>  {
>      SpiceDisplayPrivate *d = display->priv;
> +    GError *err = NULL;
>  
>      SPICE_DEBUG("%s: got scanout",  __FUNCTION__);
> +
> +    if (!d->egl.context_ready) {
> +        if (!spice_egl_init(display, &err)) {
> +            g_critical("egl init failed: %s", err->message);
> +            g_clear_error(&err);
> +        }
> +

Because spice_egl_init() is already called in gl_area_realize in this case.

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.


> +#ifdef GDK_WINDOWING_X11
> +        if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
> +            GtkWidget *area = gtk_stack_get_child_by_name(d->stack,
> "draw-area");
> +            if (!spice_egl_realize_display(display,
> gtk_widget_get_window(area), &err)) {
> +                g_critical("egl realize failed: %s", err->message);
> +                g_clear_error(&err);
> +            }
> +        }
> +#endif
> +    }
> +
>      set_egl_enabled(display, true);
>  
>      if (d->egl.context_ready) {
> --
> 2.7.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]