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

Without this, the context of another screen may be current, or no context
at all if glamor_egl_init failed for another screen.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 0a458a908e)
This commit is contained in:
Michel Dänzer 2015-07-22 15:37:23 +09:00 committed by Adam Jackson
parent a420301a8b
commit 92effabee1
1 changed files with 14 additions and 12 deletions

View File

@ -379,6 +379,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
@ -463,18 +477,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;