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

Marc-André Lureau marcandre.lureau at gmail.com
Wed Jun 14 16:18:45 UTC 2017


On Thu, Jun 8, 2017 at 3:39 PM Marc-André Lureau <marcandre.lureau at gmail.com>
wrote:

> Hi
>
> On Thu, Jun 8, 2017 at 12:55 PM Pavel Grunt <pgrunt at redhat.com> wrote:
>
>> On Thu, 2017-06-08 at 00:55 +0400, marcandre.lureau at redhat.com wrote:
>> > From: Marc-André Lureau <marcandre.lureau at redhat.com>
>> >
>> > 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 at redhat.com>
>> > ---
>> >  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.
>

ack with that?
-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170614/bb80f859/attachment-0001.html>


More information about the Spice-devel mailing list