[cogl/wip/rib/frame-synchronization: 18/32] Prefer OML_sync_control over SGI_video_sync when waiting for swap
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/rib/frame-synchronization: 18/32] Prefer OML_sync_control over SGI_video_sync when waiting for swap
- Date: Tue, 15 Jan 2013 17:19:26 +0000 (UTC)
commit 715cd98dfee854cb9b96283003e05c855cf519fa
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Mon Nov 12 11:52:31 2012 -0500
Prefer OML_sync_control over SGI_video_sync when waiting for swap
When we block waiting for the swap, prefer doing that using
glXWaitForMsc() from OML_sync_control because that returns a system
time value for the precise time of the swap.
cogl/winsys/cogl-winsys-glx-feature-functions.h | 23 +++++++++++++++
cogl/winsys/cogl-winsys-glx.c | 34 ++++++++++++++++++-----
2 files changed, 50 insertions(+), 7 deletions(-)
---
diff --git a/cogl/winsys/cogl-winsys-glx-feature-functions.h b/cogl/winsys/cogl-winsys-glx-feature-functions.h
index 71fd827..837b22b 100644
--- a/cogl/winsys/cogl-winsys-glx-feature-functions.h
+++ b/cogl/winsys/cogl-winsys-glx-feature-functions.h
@@ -84,6 +84,29 @@ COGL_WINSYS_FEATURE_FUNCTION (int, glXSwapInterval,
(int interval))
COGL_WINSYS_FEATURE_END ()
+COGL_WINSYS_FEATURE_BEGIN (sync_control,
+ "OML\0",
+ "sync_control\0",
+ 0,
+ 0,
+ 0)
+COGL_WINSYS_FEATURE_FUNCTION (Bool, glXGetSyncValues,
+ (Display* dpy,
+ GLXDrawable drawable,
+ int64_t* ust,
+ int64_t* msc,
+ int64_t* sbc))
+COGL_WINSYS_FEATURE_FUNCTION (Bool, glXWaitForMsc,
+ (Display* dpy,
+ GLXDrawable drawable,
+ int64_t target_msc,
+ int64_t divisor,
+ int64_t remainder,
+ int64_t* ust,
+ int64_t* msc,
+ int64_t* sbc))
+COGL_WINSYS_FEATURE_END ()
+
COGL_WINSYS_FEATURE_BEGIN (copy_sub_buffer,
"MESA\0",
"copy_sub_buffer\0",
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index 9083b8e..2836dbe 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -525,7 +525,8 @@ update_winsys_features (CoglContext *context, GError **error)
FALSE);
}
- if (glx_renderer->pf_glXWaitVideoSync)
+ if (glx_renderer->pf_glXWaitVideoSync ||
+ glx_renderer->pf_glXWaitForMsc)
COGL_FLAGS_SET (context->winsys_features,
COGL_WINSYS_FEATURE_VBLANK_WAIT,
TRUE);
@@ -1224,14 +1225,33 @@ _cogl_winsys_wait_for_vblank (void)
glx_renderer = ctx->display->renderer->winsys;
- if (glx_renderer->pf_glXGetVideoSync)
+ if (glx_renderer->pf_glXWaitForMsc ||
+ glx_renderer->pf_glXGetVideoSync)
{
- uint32_t current_count;
- glx_renderer->pf_glXGetVideoSync (¤t_count);
- glx_renderer->pf_glXWaitVideoSync (2,
- (current_count + 1) % 2,
- ¤t_count);
+ if (glx_renderer->pf_glXWaitForMsc)
+ {
+ CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
+ Drawable drawable = glx_onscreen->glxwin;
+ int64_t ust;
+ int64_t msc;
+ int64_t sbc;
+
+ glx_renderer->pf_glXGetSyncValues (xlib_renderer->xdpy, drawable,
+ &ust, &msc, &sbc);
+ glx_renderer->pf_glXWaitForMsc (xlib_renderer->xdpy, drawable,
+ 0, 2, (msc + 1) % 2,
+ &ust, &msc, &sbc);
+ }
+ else
+ {
+ uint32_t current_count;
+
+ glx_renderer->pf_glXGetVideoSync (¤t_count);
+ glx_renderer->pf_glXWaitVideoSync (2,
+ (current_count + 1) % 2,
+ ¤t_count);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]