if (glamor_ctx->get_count++)
return;
- if (glamor_ctx->ctx != eglGetCurrentContext()) {
- eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE,
- EGL_NO_SURFACE, EGL_NO_CONTEXT);
- if (!eglMakeCurrent(glamor_ctx->display,
- EGL_NO_SURFACE, EGL_NO_SURFACE,
- glamor_ctx->ctx)) {
- FatalError("Failed to make EGL context current\n");
- }
+ eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE,
+ EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ if (!eglMakeCurrent(glamor_ctx->display,
+ EGL_NO_SURFACE, EGL_NO_SURFACE,
+ glamor_ctx->ctx)) {
+ FatalError("Failed to make EGL context current\n");
}
}
static void
glamor_glx_get_context(struct glamor_context *glamor_ctx)
{
- GLXContext old_ctx;
-
if (glamor_ctx->get_count++)
return;
- old_ctx = glXGetCurrentContext();
- if (old_ctx == glamor_ctx->ctx)
- return;
-
glXMakeCurrent(glamor_ctx->display, glamor_ctx->drawable_xid,
glamor_ctx->ctx);
}
static inline void
glamor_get_context(glamor_screen_private * glamor_priv)
{
- glamor_priv->ctx.get_context(&glamor_priv->ctx);
+ if (lastGLContext != &glamor_priv->ctx) {
+ lastGLContext = &glamor_priv->ctx;
+ glamor_priv->ctx.get_context(&glamor_priv->ctx);
+ }
}
static inline void