|
|
1679d1 |
From 86000c32d64cea7be2e6ed911cb9ea5df1306c0e Mon Sep 17 00:00:00 2001
|
|
|
1679d1 |
From: Mario Limonciello <mario.limonciello@amd.com>
|
|
|
1679d1 |
Date: Thu, 18 Aug 2022 13:36:20 -0500
|
|
|
1679d1 |
Subject: [PATCH 1/2] output/kms: Add more heuristics to decide when to offer
|
|
|
1679d1 |
fallback modes
|
|
|
1679d1 |
|
|
|
1679d1 |
If the panel is connected via eDP and supports more than one mode
|
|
|
1679d1 |
at different resolutions don't try to add more.
|
|
|
1679d1 |
|
|
|
1679d1 |
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2586>
|
|
|
1679d1 |
(cherry picked from commit 96aa0fb8536eca579ceb1b17d83e19cf9e3e9e81)
|
|
|
1679d1 |
(cherry picked from commit 877cc3eb7d44e2886395151f763ec09bea350444)
|
|
|
1679d1 |
---
|
|
|
1679d1 |
src/backends/native/meta-output-kms.c | 56 +++++++++++++++++++++------
|
|
|
1679d1 |
1 file changed, 44 insertions(+), 12 deletions(-)
|
|
|
1679d1 |
|
|
|
1679d1 |
diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c
|
|
|
1679d1 |
index f35cdf04e1..9adc20bfd9 100644
|
|
|
1679d1 |
--- a/src/backends/native/meta-output-kms.c
|
|
|
1679d1 |
+++ b/src/backends/native/meta-output-kms.c
|
|
|
1679d1 |
@@ -224,6 +224,45 @@ compare_modes (const void *one,
|
|
|
1679d1 |
meta_crtc_mode_get_name (crtc_mode_two));
|
|
|
1679d1 |
}
|
|
|
1679d1 |
|
|
|
1679d1 |
+static gboolean
|
|
|
1679d1 |
+are_all_modes_equally_sized (MetaOutputInfo *output_info)
|
|
|
1679d1 |
+{
|
|
|
1679d1 |
+ const MetaCrtcModeInfo *base =
|
|
|
1679d1 |
+ meta_crtc_mode_get_info (output_info->modes[0]);
|
|
|
1679d1 |
+ int i;
|
|
|
1679d1 |
+
|
|
|
1679d1 |
+ for (i = 1; i < output_info->n_modes; i++)
|
|
|
1679d1 |
+ {
|
|
|
1679d1 |
+ const MetaCrtcModeInfo *mode_info =
|
|
|
1679d1 |
+ meta_crtc_mode_get_info (output_info->modes[i]);
|
|
|
1679d1 |
+
|
|
|
1679d1 |
+ if (base->width != mode_info->width ||
|
|
|
1679d1 |
+ base->height != mode_info->height)
|
|
|
1679d1 |
+ return FALSE;
|
|
|
1679d1 |
+ }
|
|
|
1679d1 |
+
|
|
|
1679d1 |
+ return TRUE;
|
|
|
1679d1 |
+}
|
|
|
1679d1 |
+
|
|
|
1679d1 |
+static void
|
|
|
1679d1 |
+maybe_add_fallback_modes (const MetaKmsConnectorState *connector_state,
|
|
|
1679d1 |
+ MetaOutputInfo *output_info,
|
|
|
1679d1 |
+ MetaGpuKms *gpu_kms,
|
|
|
1679d1 |
+ MetaKmsConnector *kms_connector)
|
|
|
1679d1 |
+{
|
|
|
1679d1 |
+ if (!connector_state->has_scaling)
|
|
|
1679d1 |
+ return;
|
|
|
1679d1 |
+
|
|
|
1679d1 |
+ if (output_info->connector_type == DRM_MODE_CONNECTOR_eDP &&
|
|
|
1679d1 |
+ !are_all_modes_equally_sized (output_info))
|
|
|
1679d1 |
+ return;
|
|
|
1679d1 |
+
|
|
|
1679d1 |
+ meta_topic (META_DEBUG_KMS, "Adding common modes to connector %u on %s",
|
|
|
1679d1 |
+ meta_kms_connector_get_id (kms_connector),
|
|
|
1679d1 |
+ meta_gpu_kms_get_file_path (gpu_kms));
|
|
|
1679d1 |
+ add_common_modes (output_info, gpu_kms);
|
|
|
1679d1 |
+}
|
|
|
1679d1 |
+
|
|
|
1679d1 |
static gboolean
|
|
|
1679d1 |
init_output_modes (MetaOutputInfo *output_info,
|
|
|
1679d1 |
MetaGpuKms *gpu_kms,
|
|
|
1679d1 |
@@ -252,14 +291,7 @@ init_output_modes (MetaOutputInfo *output_info,
|
|
|
1679d1 |
output_info->preferred_mode = output_info->modes[i];
|
|
|
1679d1 |
}
|
|
|
1679d1 |
|
|
|
1679d1 |
- if (connector_state->has_scaling)
|
|
|
1679d1 |
- {
|
|
|
1679d1 |
- meta_topic (META_DEBUG_KMS, "Adding common modes to connector %u on %s",
|
|
|
1679d1 |
- meta_kms_connector_get_id (kms_connector),
|
|
|
1679d1 |
- meta_gpu_kms_get_file_path (gpu_kms));
|
|
|
1679d1 |
- add_common_modes (output_info, gpu_kms);
|
|
|
1679d1 |
- }
|
|
|
1679d1 |
-
|
|
|
1679d1 |
+ maybe_add_fallback_modes (connector_state, output_info, gpu_kms, kms_connector);
|
|
|
1679d1 |
if (!output_info->modes)
|
|
|
1679d1 |
{
|
|
|
1679d1 |
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
|
1679d1 |
@@ -322,6 +354,10 @@ meta_output_kms_new (MetaGpuKms *gpu_kms,
|
|
|
1679d1 |
output_info->height_mm = connector_state->height_mm;
|
|
|
1679d1 |
}
|
|
|
1679d1 |
|
|
|
1679d1 |
+ drm_connector_type = meta_kms_connector_get_connector_type (kms_connector);
|
|
|
1679d1 |
+ output_info->connector_type =
|
|
|
1679d1 |
+ meta_kms_connector_type_from_drm (drm_connector_type);
|
|
|
1679d1 |
+
|
|
|
1679d1 |
if (!init_output_modes (output_info, gpu_kms, kms_connector, error))
|
|
|
1679d1 |
return NULL;
|
|
|
1679d1 |
|
|
|
1679d1 |
@@ -349,10 +385,6 @@ meta_output_kms_new (MetaGpuKms *gpu_kms,
|
|
|
1679d1 |
|
|
|
1679d1 |
meta_output_info_parse_edid (output_info, connector_state->edid_data);
|
|
|
1679d1 |
|
|
|
1679d1 |
- drm_connector_type = meta_kms_connector_get_connector_type (kms_connector);
|
|
|
1679d1 |
- output_info->connector_type =
|
|
|
1679d1 |
- meta_kms_connector_type_from_drm (drm_connector_type);
|
|
|
1679d1 |
-
|
|
|
1679d1 |
output_info->tile_info = connector_state->tile_info;
|
|
|
1679d1 |
|
|
|
1679d1 |
output = g_object_new (META_TYPE_OUTPUT_KMS,
|
|
|
1679d1 |
--
|
|
|
1679d1 |
2.37.1
|
|
|
1679d1 |
|