mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 09:00:42 -05:00
output: Add a function to check if VRR is enabled for the output
An output with enabled VRR requires that the mode is a VRR mode which also means that VRR is supported. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3646>
This commit is contained in:
parent
91e3180985
commit
51811ec7b3
@ -589,6 +589,28 @@ meta_output_peek_rgb_range (MetaOutput *output)
|
||||
return priv->rgb_range;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_output_is_vrr_enabled (MetaOutput *output)
|
||||
{
|
||||
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||
MetaCrtc *crtc = priv->crtc;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcModeInfo *crtc_mode_info;
|
||||
|
||||
if (!crtc)
|
||||
return FALSE;
|
||||
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
g_assert (crtc_config != NULL);
|
||||
g_assert (crtc_config->mode != NULL);
|
||||
|
||||
crtc_mode_info = meta_crtc_mode_get_info (crtc_config->mode);
|
||||
g_assert (crtc_mode_info != NULL);
|
||||
|
||||
return crtc_mode_info->refresh_rate_mode ==
|
||||
META_CRTC_REFRESH_RATE_MODE_VARIABLE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_init (MetaOutput *output)
|
||||
{
|
||||
|
@ -271,6 +271,8 @@ MetaOutputHdrMetadata * meta_output_peek_hdr_metadata (MetaOutput *output);
|
||||
META_EXPORT_TEST
|
||||
MetaOutputRGBRange meta_output_peek_rgb_range (MetaOutput *output);
|
||||
|
||||
gboolean meta_output_is_vrr_enabled (MetaOutput *output);
|
||||
|
||||
void meta_output_add_possible_clone (MetaOutput *output,
|
||||
MetaOutput *possible_clone);
|
||||
|
||||
|
@ -1740,40 +1740,19 @@ update_frame_sync_mode (MetaOnscreenNative *onscreen_native,
|
||||
onscreen_native->frame_sync_mode = sync_mode;
|
||||
}
|
||||
|
||||
static MetaFrameSyncMode
|
||||
get_applicable_sync_mode (MetaOnscreenNative *onscreen_native)
|
||||
{
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcModeInfo *crtc_mode_info;
|
||||
|
||||
crtc_config = meta_crtc_get_config (onscreen_native->crtc);
|
||||
g_assert (crtc_config != NULL);
|
||||
g_assert (crtc_config->mode != NULL);
|
||||
|
||||
crtc_mode_info = meta_crtc_mode_get_info (crtc_config->mode);
|
||||
g_assert (crtc_mode_info != NULL);
|
||||
|
||||
if (crtc_mode_info->refresh_rate_mode ==
|
||||
META_CRTC_REFRESH_RATE_MODE_FIXED)
|
||||
return META_FRAME_SYNC_MODE_DISABLED;
|
||||
|
||||
return onscreen_native->requested_frame_sync_mode;
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_update_frame_sync_mode (MetaOnscreenNative *onscreen_native,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
MetaFrameSyncMode applicable_sync_mode;
|
||||
MetaFrameSyncMode sync_mode = onscreen_native->requested_frame_sync_mode;
|
||||
|
||||
applicable_sync_mode = get_applicable_sync_mode (onscreen_native);
|
||||
if (!meta_output_is_vrr_enabled (onscreen_native->output))
|
||||
sync_mode = META_FRAME_SYNC_MODE_DISABLED;
|
||||
|
||||
if (G_LIKELY (applicable_sync_mode == onscreen_native->frame_sync_mode))
|
||||
if (G_LIKELY (sync_mode == onscreen_native->frame_sync_mode))
|
||||
return;
|
||||
|
||||
update_frame_sync_mode (onscreen_native,
|
||||
frame,
|
||||
applicable_sync_mode);
|
||||
update_frame_sync_mode (onscreen_native, frame, sync_mode);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user