clutter: Add vblank duration to ClutterStageView

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
This commit is contained in:
Ivan Molodetskikh 2021-01-06 15:18:26 +03:00 committed by Marge Bot
parent 2d939754b1
commit d10567ea3e
2 changed files with 18 additions and 0 deletions

View File

@ -43,6 +43,7 @@ enum
PROP_USE_SHADOWFB, PROP_USE_SHADOWFB,
PROP_SCALE, PROP_SCALE,
PROP_REFRESH_RATE, PROP_REFRESH_RATE,
PROP_VBLANK_DURATION_US,
PROP_LAST PROP_LAST
}; };
@ -79,6 +80,7 @@ typedef struct _ClutterStageViewPrivate
cairo_region_t *redraw_clip; cairo_region_t *redraw_clip;
float refresh_rate; float refresh_rate;
int64_t vblank_duration_us;
ClutterFrameClock *frame_clock; ClutterFrameClock *frame_clock;
struct { struct {
@ -1298,6 +1300,9 @@ clutter_stage_view_get_property (GObject *object,
case PROP_REFRESH_RATE: case PROP_REFRESH_RATE:
g_value_set_float (value, priv->refresh_rate); g_value_set_float (value, priv->refresh_rate);
break; break;
case PROP_VBLANK_DURATION_US:
g_value_set_int64 (value, priv->vblank_duration_us);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
} }
@ -1341,6 +1346,9 @@ clutter_stage_view_set_property (GObject *object,
case PROP_REFRESH_RATE: case PROP_REFRESH_RATE:
priv->refresh_rate = g_value_get_float (value); priv->refresh_rate = g_value_get_float (value);
break; break;
case PROP_VBLANK_DURATION_US:
priv->vblank_duration_us = g_value_get_int64 (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
} }
@ -1500,5 +1508,14 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS); G_PARAM_STATIC_STRINGS);
obj_props[PROP_VBLANK_DURATION_US] =
g_param_spec_int64 ("vblank-duration-us",
"Vblank duration (µs)",
"The vblank duration",
0, G_MAXINT64, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, PROP_LAST, obj_props); g_object_class_install_properties (object_class, PROP_LAST, obj_props);
} }

View File

@ -1217,6 +1217,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
"use-shadowfb", use_shadowfb, "use-shadowfb", use_shadowfb,
"transform", view_transform, "transform", view_transform,
"refresh-rate", crtc_mode_info->refresh_rate, "refresh-rate", crtc_mode_info->refresh_rate,
"vblank-duration-us", crtc_mode_info->vblank_duration_us,
NULL); NULL);
if (META_IS_ONSCREEN_NATIVE (framebuffer)) if (META_IS_ONSCREEN_NATIVE (framebuffer))