[cairo-commit] src/cairo-egl-context.c src/cairo-glx-context.c
Martin Robinson
mrobinson at kemper.freedesktop.org
Thu Jan 24 18:13:13 PST 2013
src/cairo-egl-context.c | 13 ++++---------
src/cairo-glx-context.c | 13 ++++---------
2 files changed, 8 insertions(+), 18 deletions(-)
New commits:
commit 7054c9969cb0e41845635d6658935da223899f08
Author: Henry Song <henry.song at samsung.com>
Date: Wed Jan 16 15:32:32 2013 +0100
gl: Don't query the display when checking if the context changed
If display has changed, the associated context must change. A
context is tied a display so we can avoid this check, eliminating
unnecessary work during context acquisition and release.
diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c
index 12924cc..ba8f60f 100644
--- a/src/cairo-egl-context.c
+++ b/src/cairo-egl-context.c
@@ -50,7 +50,6 @@ typedef struct _cairo_egl_context {
EGLSurface dummy_surface;
- EGLDisplay previous_display;
EGLContext previous_context;
EGLSurface previous_surface;
} cairo_egl_context_t;
@@ -66,9 +65,8 @@ static cairo_bool_t
_context_acquisition_changed_egl_state (cairo_egl_context_t *ctx,
EGLSurface current_surface)
{
- return !(ctx->previous_display == ctx->display &&
- ctx->previous_surface == current_surface &&
- ctx->previous_context == ctx->context);
+ return ctx->previous_context != ctx->context ||
+ ctx->previous_surface != current_surface;
}
static EGLSurface
@@ -85,18 +83,15 @@ _egl_get_current_surface (cairo_egl_context_t *ctx)
static void
_egl_query_current_state (cairo_egl_context_t *ctx)
{
- ctx->previous_display = eglGetCurrentDisplay ();
ctx->previous_surface = eglGetCurrentSurface (EGL_DRAW);
ctx->previous_context = eglGetCurrentContext ();
/* If any of the values were none, assume they are all none. Not all
drivers seem well behaved when it comes to using these values across
multiple threads. */
- if (ctx->previous_surface == EGL_NO_SURFACE
- || ctx->previous_display == EGL_NO_DISPLAY
- || ctx->previous_context == EGL_NO_CONTEXT) {
+ if (ctx->previous_surface == EGL_NO_SURFACE ||
+ ctx->previous_context == EGL_NO_CONTEXT) {
ctx->previous_surface = EGL_NO_SURFACE;
- ctx->previous_display = EGL_NO_DISPLAY;
ctx->previous_context = EGL_NO_CONTEXT;
}
}
diff --git a/src/cairo-glx-context.c b/src/cairo-glx-context.c
index ebe5360..3761b90 100644
--- a/src/cairo-glx-context.c
+++ b/src/cairo-glx-context.c
@@ -53,7 +53,6 @@ typedef struct _cairo_glx_context {
Window dummy_window;
GLXContext context;
- Display *previous_display;
GLXDrawable previous_drawable;
GLXContext previous_context;
@@ -70,9 +69,8 @@ static cairo_bool_t
_context_acquisition_changed_glx_state (cairo_glx_context_t *ctx,
GLXDrawable current_drawable)
{
- return !(ctx->previous_display == ctx->display &&
- ctx->previous_drawable == current_drawable &&
- ctx->previous_context == ctx->context);
+ return ctx->previous_drawable != current_drawable ||
+ ctx->previous_context != ctx->context;
}
static GLXDrawable
@@ -90,17 +88,14 @@ static void
_glx_query_current_state (cairo_glx_context_t * ctx)
{
ctx->previous_drawable = glXGetCurrentDrawable ();
- ctx->previous_display = glXGetCurrentDisplay ();
ctx->previous_context = glXGetCurrentContext ();
/* If any of the values were none, assume they are all none. Not all
drivers seem well behaved when it comes to using these values across
multiple threads. */
- if (ctx->previous_drawable == None
- || ctx->previous_display == None
- || ctx->previous_context == None) {
+ if (ctx->previous_drawable == None ||
+ ctx->previous_context == None) {
ctx->previous_drawable = None;
- ctx->previous_display = None;
ctx->previous_context = None;
}
}
More information about the cairo-commit
mailing list