mirror of
https://github.com/brl/mutter.git
synced 2025-02-14 20:34:10 +00: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))
|
(int interval))
|
||||||
COGL_WINSYS_FEATURE_END ()
|
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,
|
COGL_WINSYS_FEATURE_BEGIN (255, 255,
|
||||||
copy_sub_buffer,
|
copy_sub_buffer,
|
||||||
"MESA\0",
|
"MESA\0",
|
||||||
|
@ -434,7 +434,8 @@ update_base_winsys_features (CoglRenderer *renderer)
|
|||||||
COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN,
|
COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
if (glx_renderer->glXWaitVideoSync)
|
if (glx_renderer->pf_glXWaitVideoSync ||
|
||||||
|
glx_renderer->pf_glXWaitForMsc)
|
||||||
COGL_FLAGS_SET (glx_renderer->base_winsys_features,
|
COGL_FLAGS_SET (glx_renderer->base_winsys_features,
|
||||||
COGL_WINSYS_FEATURE_VBLANK_WAIT,
|
COGL_WINSYS_FEATURE_VBLANK_WAIT,
|
||||||
TRUE);
|
TRUE);
|
||||||
@ -1285,14 +1286,32 @@ _cogl_winsys_wait_for_vblank (CoglContext *ctx)
|
|||||||
|
|
||||||
glx_renderer = ctx->display->renderer->winsys;
|
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->glXGetSyncValues (xlib_renderer->xdpy, drawable,
|
||||||
glx_renderer->glXWaitVideoSync (2,
|
&ust, &msc, &sbc);
|
||||||
(current_count + 1) % 2,
|
glx_renderer->glXWaitForMsc (xlib_renderer->xdpy, drawable,
|
||||||
¤t_count);
|
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…
x
Reference in New Issue
Block a user