[PATCH] glamor: Make our EGL context current before calling into GL in glamor_init

Dave Airlie airlied at gmail.com
Wed Jul 22 00:49:05 PDT 2015


On 22 July 2015 at 16:37, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> Without this, the context of another screen may be current, or no context
> at all if glamor_egl_init failed for another screen.

Looks good

Reviewed-by: Dave Airlie <airlied at redhat.com>
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>  glamor/glamor.c | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/glamor/glamor.c b/glamor/glamor.c
> index 6dcc259..439906a 100644
> --- a/glamor/glamor.c
> +++ b/glamor/glamor.c
> @@ -457,6 +457,20 @@ glamor_init(ScreenPtr screen, unsigned int flags)
>          goto fail;
>      }
>
> +    glamor_priv->saved_procs.close_screen = screen->CloseScreen;
> +    screen->CloseScreen = glamor_close_screen;
> +
> +    /* If we are using egl screen, call egl screen init to
> +     * register correct close screen function. */
> +    if (flags & GLAMOR_USE_EGL_SCREEN) {
> +        glamor_egl_screen_init(screen, &glamor_priv->ctx);
> +    } else {
> +        if (!glamor_glx_screen_init(&glamor_priv->ctx))
> +            goto fail;
> +    }
> +
> +    glamor_make_current(glamor_priv);
> +
>      if (epoxy_is_desktop_gl())
>          glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP;
>      else
> @@ -579,18 +593,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
>
>      glamor_set_debug_level(&glamor_debug_level);
>
> -    glamor_priv->saved_procs.close_screen = screen->CloseScreen;
> -    screen->CloseScreen = glamor_close_screen;
> -
> -    /* If we are using egl screen, call egl screen init to
> -     * register correct close screen function. */
> -    if (flags & GLAMOR_USE_EGL_SCREEN) {
> -        glamor_egl_screen_init(screen, &glamor_priv->ctx);
> -    } else {
> -        if (!glamor_glx_screen_init(&glamor_priv->ctx))
> -            goto fail;
> -    }
> -
>      glamor_priv->saved_procs.create_screen_resources =
>          screen->CreateScreenResources;
>      screen->CreateScreenResources = glamor_create_screen_resources;
> --
> 2.1.4
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list