renderer-native: Advertise _FEATURE_SWAP_THROTTLE

Because it is implemented and always on. By advertising this fact
the master clock is able to sync to the native refresh rate instead
of always using the fallback of 60.00Hz.

https://bugzilla.gnome.org/show_bug.cgi?id=781296
This commit is contained in:
Daniel van Vugt 2018-07-10 17:46:02 +08:00 committed by Jonas Ådahl
parent e9e4b2b72e
commit e8c27603dd

View File

@ -2082,6 +2082,13 @@ meta_renderer_native_init_egl_context (CoglContext *cogl_context,
COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN, COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN,
TRUE); TRUE);
/* COGL_WINSYS_FEATURE_SWAP_THROTTLE is always true for this renderer
* because we have the call to wait_for_pending_flips on every frame.
*/
COGL_FLAGS_SET (cogl_context->winsys_features,
COGL_WINSYS_FEATURE_SWAP_THROTTLE,
TRUE);
#ifdef HAVE_EGL_DEVICE #ifdef HAVE_EGL_DEVICE
if (renderer_gpu_data->mode == META_RENDERER_NATIVE_MODE_EGL_DEVICE) if (renderer_gpu_data->mode == META_RENDERER_NATIVE_MODE_EGL_DEVICE)
COGL_FLAGS_SET (cogl_context->features, COGL_FLAGS_SET (cogl_context->features,
@ -2717,8 +2724,12 @@ meta_renderer_native_create_onscreen (MetaRendererNative *renderer_native,
} }
onscreen = cogl_onscreen_new (context, width, height); onscreen = cogl_onscreen_new (context, width, height);
cogl_onscreen_set_swap_throttled (onscreen,
_clutter_get_sync_to_vblank ()); /* We have wait_for_pending_flips hardcoded, so throttling always. */
cogl_onscreen_set_swap_throttled (onscreen, TRUE);
if (!_clutter_get_sync_to_vblank ())
g_warning ("Request to disable sync-to-vblank is being ignored. "
"MetaRendererNative does not support disabling it.");
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), error)) if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), error))
{ {