From cb40a1c510245ed2a1691a63f9ac3c104932429f Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Sun, 11 Feb 2024 02:17:46 +0200 Subject: [PATCH] output: Add meta_output_info_get_min_refresh_rate() This function gets the minimum refresh rate of an output if it was found in EDID. Part-of: --- src/backends/meta-output.c | 19 +++++++++++++++++++ src/backends/meta-output.h | 3 +++ 2 files changed, 22 insertions(+) diff --git a/src/backends/meta-output.c b/src/backends/meta-output.c index 3e8234933..b40ce2798 100644 --- a/src/backends/meta-output.c +++ b/src/backends/meta-output.c @@ -509,6 +509,25 @@ meta_output_set_privacy_screen_enabled (MetaOutput *output, return TRUE; } +gboolean +meta_output_info_get_min_refresh_rate (const MetaOutputInfo *output_info, + int *min_refresh_rate) +{ + int min_vert_rate_hz; + + if (!output_info->edid_info) + return FALSE; + + min_vert_rate_hz = output_info->edid_info->min_vert_rate_hz; + + if (min_vert_rate_hz <= 0) + return FALSE; + + *min_refresh_rate = min_vert_rate_hz; + + return TRUE; +} + void meta_output_set_color_space (MetaOutput *output, MetaOutputColorspace color_space) diff --git a/src/backends/meta-output.h b/src/backends/meta-output.h index c20d83a1b..bfd32e21a 100644 --- a/src/backends/meta-output.h +++ b/src/backends/meta-output.h @@ -195,6 +195,9 @@ META_EXPORT_TEST void meta_output_info_parse_edid (MetaOutputInfo *output_info, GBytes *edid); +gboolean meta_output_info_get_min_refresh_rate (const MetaOutputInfo *output_info, + int *min_refresh_rate); + G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaOutputInfo, meta_output_info_unref) #define META_TYPE_OUTPUT (meta_output_get_type ())