[mutter] output-kms: Add max_bpc support



commit f19b350c9481e9cc22a2143e758f292e2592a444
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Thu Jun 9 18:49:05 2022 +0800

    output-kms: Add max_bpc support
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>

 src/backends/native/meta-output-kms.c | 38 +++++++++++++++++++++++++++++++++++
 src/backends/native/meta-output-kms.h |  3 +++
 2 files changed, 41 insertions(+)
---
diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c
index 5e572e27b2..2062a20cf7 100644
--- a/src/backends/native/meta-output-kms.c
+++ b/src/backends/native/meta-output-kms.c
@@ -97,6 +97,36 @@ meta_output_kms_set_underscan (MetaOutputKms *output_kms,
     }
 }
 
+void
+meta_output_kms_set_max_bpc (MetaOutputKms *output_kms,
+                             MetaKmsUpdate *kms_update)
+{
+  MetaKmsConnector *kms_connector = output_kms->kms_connector;
+  const MetaKmsRange *range;
+
+  range = meta_kms_connector_get_max_bpc (kms_connector);
+  if (range)
+    {
+      MetaOutput *output = META_OUTPUT (output_kms);
+      unsigned int max_bpc;
+
+      if (!meta_output_get_max_bpc (output, &max_bpc))
+        return;
+
+      if (max_bpc >= range->min_value && max_bpc <= range->max_value)
+        {
+          meta_kms_update_set_max_bpc (kms_update, kms_connector, max_bpc);
+        }
+      else
+        {
+          g_warning ("Ignoring out of range value %u for max bpc (%u-%u)",
+                     max_bpc,
+                     (unsigned) range->min_value,
+                     (unsigned) range->max_value);
+        }
+    }
+}
+
 static MetaPrivacyScreenState
 meta_output_kms_get_privacy_screen_state (MetaOutput *output)
 {
@@ -362,6 +392,7 @@ meta_output_kms_new (MetaGpuKms        *gpu_kms,
   const MetaKmsConnectorState *connector_state;
   GArray *crtcs;
   GList *l;
+  const MetaKmsRange *max_bpc_range;
 
   gpu_id = meta_gpu_kms_get_id (gpu_kms);
   connector_id = meta_kms_connector_get_id (kms_connector);
@@ -409,6 +440,13 @@ meta_output_kms_new (MetaGpuKms        *gpu_kms,
   output_info->supports_underscanning =
     meta_kms_connector_is_underscanning_supported (kms_connector);
 
+  max_bpc_range = meta_kms_connector_get_max_bpc (kms_connector);
+  if (max_bpc_range)
+    {
+      output_info->max_bpc_min = max_bpc_range->min_value;
+      output_info->max_bpc_max = max_bpc_range->max_value;
+    }
+
   meta_output_info_parse_edid (output_info, connector_state->edid_data);
 
   drm_connector_type = meta_kms_connector_get_connector_type (kms_connector);
diff --git a/src/backends/native/meta-output-kms.h b/src/backends/native/meta-output-kms.h
index 52acc6032a..1e35dbb17d 100644
--- a/src/backends/native/meta-output-kms.h
+++ b/src/backends/native/meta-output-kms.h
@@ -40,6 +40,9 @@ void meta_output_kms_set_power_save_mode (MetaOutputKms *output_kms,
 void meta_output_kms_set_underscan (MetaOutputKms *output_kms,
                                     MetaKmsUpdate *kms_update);
 
+void meta_output_kms_set_max_bpc (MetaOutputKms *output_kms,
+                                  MetaKmsUpdate *kms_update);
+
 gboolean meta_output_kms_can_clone (MetaOutputKms *output_kms,
                                     MetaOutputKms *other_output_kms);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]