Re: [PATCH spice-gtk 3/5] widget: skip spice_egl_resize_display() if context is not ready

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

 



Hi

On Thu, Jun 8, 2017 at 12:55 PM Pavel Grunt <pgrunt@xxxxxxxxxx> wrote:
On Thu, 2017-06-08 at 00:55 +0400, marcandre.lureau@xxxxxxxxxx wrote:
> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
>
> And call spice_egl_resize_display() when initializing the context.
>
> This fixes the "Couldn't find current GL or GLX context" error for
> me
> on X11. I thought first it was somehow related to commit
> a395ac59447de
> "spice-widget: init egl only after first gl_scanout", but reverting
> it
> didn't solve the problem, there are other timing changes, probably
> at
> gtk level.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> ---
>  src/spice-widget.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index d948c6d..319d867 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -1329,7 +1329,7 @@ static void set_egl_enabled(SpiceDisplay
> *display, bool enabled)
>                                           enabled ? "gl-area" :
> "draw-area");
>      }
>
> -    if (enabled) {
> +    if (enabled && d->egl.context_ready) {
>          spice_egl_resize_display(display, d->ww, d->wh);
>      }
>
> @@ -2863,6 +2863,8 @@ void
> spice_display_widget_gl_scanout(SpiceDisplay *display)
>              g_critical("egl realize failed: %s", err->message);
>              g_clear_error(&err);
>          }
> +
> +        spice_egl_resize_display(display, d->ww, d->wh);
>      }

I am bit lost with this commit. next call is set_egl_enabled(display,
true); which calls spice_egl_resize_display() (conditionally).

We can't call spice_egl_resize_display() if the egl/gl context isn't ready.

set_egl_enabled() is for the widget to switch to the egl display. Perhaps we should rename the function switch_to_egl_display().

This function is called whenever we get gl drawing command from spice server. But the egl/gl context may not be ready at that time. So that function must still be run to switch the display, but has to delay any gl call to when the gl context is realied. That's why we add spice_egl_resize_display() there, to do the remaining egl setup.

I can add this to the commit message.
--
Marc-André Lureau
_______________________________________________
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]