mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
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. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 1e8114aabc78b90373d3d5f3f7c0224f8786e399)
This commit is contained in:
parent
013548c109
commit
5ce058c0e5
@ -129,6 +129,29 @@ COGL_WINSYS_FEATURE_FUNCTION (int, glXSwapInterval,
|
||||
(int interval))
|
||||
COGL_WINSYS_FEATURE_END ()
|
||||
|
||||
COGL_WINSYS_FEATURE_BEGIN (255, 255,
|
||||
sync_control,
|
||||
"OML\0",
|
||||
"sync_control\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 (255, 255,
|
||||
copy_sub_buffer,
|
||||
"MESA\0",
|
||||
|
@ -434,7 +434,8 @@ update_base_winsys_features (CoglRenderer *renderer)
|
||||
COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN,
|
||||
TRUE);
|
||||
|
||||
if (glx_renderer->glXWaitVideoSync)
|
||||
if (glx_renderer->pf_glXWaitVideoSync ||
|
||||
glx_renderer->pf_glXWaitForMsc)
|
||||
COGL_FLAGS_SET (glx_renderer->base_winsys_features,
|
||||
COGL_WINSYS_FEATURE_VBLANK_WAIT,
|
||||
TRUE);
|
||||
@ -1285,14 +1286,32 @@ _cogl_winsys_wait_for_vblank (CoglContext *ctx)
|
||||
|
||||
glx_renderer = ctx->display->renderer->winsys;
|
||||
|
||||
if (glx_renderer->glXGetVideoSync)
|
||||
if (glx_renderer->glXWaitForMsc ||
|
||||
glx_renderer->glXGetVideoSync)
|
||||
{
|
||||
uint32_t current_count;
|
||||
if (glx_renderer->glXWaitForMsc)
|
||||
{
|
||||
CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
|
||||
Drawable drawable = glx_onscreen->glxwin;
|
||||
int64_t ust;
|
||||
int64_t msc;
|
||||
int64_t sbc;
|
||||
|
||||
glx_renderer->glXGetVideoSync (¤t_count);
|
||||
glx_renderer->glXWaitVideoSync (2,
|
||||
(current_count + 1) % 2,
|
||||
¤t_count);
|
||||
glx_renderer->glXGetSyncValues (xlib_renderer->xdpy, drawable,
|
||||
&ust, &msc, &sbc);
|
||||
glx_renderer->glXWaitForMsc (xlib_renderer->xdpy, drawable,
|
||||
0, 2, (msc + 1) % 2,
|
||||
&ust, &msc, &sbc);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t current_count;
|
||||
|
||||
glx_renderer->glXGetVideoSync (¤t_count);
|
||||
glx_renderer->glXWaitVideoSync (2,
|
||||
(current_count + 1) % 2,
|
||||
¤t_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user