|
|
88a40e |
From cf16c0d16b42215f35dcede6163235ad5ec1734b Mon Sep 17 00:00:00 2001
|
|
|
88a40e |
From: Mario Limonciello <mario.limonciello@amd.com>
|
|
|
88a40e |
Date: Thu, 18 Aug 2022 13:36:20 -0500
|
|
|
88a40e |
Subject: [PATCH] output/kms: Add more heuristics to decide when to offer
|
|
|
88a40e |
fallback modes
|
|
|
88a40e |
|
|
|
88a40e |
If the panel is connected via eDP and supports more than one mode
|
|
|
88a40e |
at different resolutions don't try to add more.
|
|
|
88a40e |
|
|
|
88a40e |
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2586>
|
|
|
88a40e |
(cherry picked from commit 96aa0fb8536eca579ceb1b17d83e19cf9e3e9e81)
|
|
|
88a40e |
---
|
|
|
88a40e |
src/backends/native/meta-output-kms.c | 45 ++++++++++++++++++++++-----
|
|
|
88a40e |
1 file changed, 38 insertions(+), 7 deletions(-)
|
|
|
88a40e |
|
|
|
88a40e |
diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c
|
|
|
88a40e |
index f3cc543c4d..44c25c5648 100644
|
|
|
88a40e |
--- a/src/backends/native/meta-output-kms.c
|
|
|
88a40e |
+++ b/src/backends/native/meta-output-kms.c
|
|
|
88a40e |
@@ -505,6 +505,43 @@ compare_modes (const void *one,
|
|
|
88a40e |
return g_strcmp0 (b->name, a->name);
|
|
|
88a40e |
}
|
|
|
88a40e |
|
|
|
88a40e |
+static gboolean
|
|
|
88a40e |
+are_all_modes_equally_sized (MetaOutput *output)
|
|
|
88a40e |
+{
|
|
|
88a40e |
+ MetaCrtcMode *base = output->modes[0];
|
|
|
88a40e |
+ int i;
|
|
|
88a40e |
+
|
|
|
88a40e |
+ for (i = 1; i < output->n_modes; i++)
|
|
|
88a40e |
+ {
|
|
|
88a40e |
+ MetaCrtcMode *crtc_mode = output->modes[i];
|
|
|
88a40e |
+
|
|
|
88a40e |
+ if (base->width != crtc_mode->width ||
|
|
|
88a40e |
+ base->height != crtc_mode->height)
|
|
|
88a40e |
+ return FALSE;
|
|
|
88a40e |
+ }
|
|
|
88a40e |
+
|
|
|
88a40e |
+ return TRUE;
|
|
|
88a40e |
+}
|
|
|
88a40e |
+
|
|
|
88a40e |
+static void
|
|
|
88a40e |
+maybe_add_fallback_modes (MetaOutput *output,
|
|
|
88a40e |
+ MetaGpuKms *gpu_kms)
|
|
|
88a40e |
+{
|
|
|
88a40e |
+ MetaOutputKms *output_kms = output->driver_private;
|
|
|
88a40e |
+
|
|
|
88a40e |
+ if (!output_kms->has_scaling)
|
|
|
88a40e |
+ return;
|
|
|
88a40e |
+
|
|
|
88a40e |
+ if (output->n_modes == 0)
|
|
|
88a40e |
+ return;
|
|
|
88a40e |
+
|
|
|
88a40e |
+ if (output_kms->connector->connector_type == DRM_MODE_CONNECTOR_eDP &&
|
|
|
88a40e |
+ !are_all_modes_equally_sized (output))
|
|
|
88a40e |
+ return;
|
|
|
88a40e |
+
|
|
|
88a40e |
+ add_common_modes (output, gpu_kms);
|
|
|
88a40e |
+}
|
|
|
88a40e |
+
|
|
|
88a40e |
static gboolean
|
|
|
88a40e |
init_output_modes (MetaOutput *output,
|
|
|
88a40e |
MetaGpuKms *gpu_kms,
|
|
|
88a40e |
@@ -528,13 +565,7 @@ init_output_modes (MetaOutput *output,
|
|
|
88a40e |
output->preferred_mode = output->modes[i];
|
|
|
88a40e |
}
|
|
|
88a40e |
|
|
|
88a40e |
- /* FIXME: MSC feature bit? */
|
|
|
88a40e |
- /* Presume that if the output supports scaling, then we have
|
|
|
88a40e |
- * a panel fitter capable of adjusting any mode to suit.
|
|
|
88a40e |
- */
|
|
|
88a40e |
- if (output_kms->has_scaling)
|
|
|
88a40e |
- add_common_modes (output, gpu_kms);
|
|
|
88a40e |
-
|
|
|
88a40e |
+ maybe_add_fallback_modes (output, gpu_kms);
|
|
|
88a40e |
if (!output->modes)
|
|
|
88a40e |
{
|
|
|
88a40e |
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
|
88a40e |
--
|
|
|
88a40e |
2.37.1
|
|
|
88a40e |
|