[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220426132121.RFC.1.I31ec454f8d4ffce51a7708a8092f8a6f9c929092@changeid>
Date: Tue, 26 Apr 2022 13:21:26 -0700
From: Douglas Anderson <dianders@...omium.org>
To: dri-devel@...ts.freedesktop.org
Cc: robdclark@...il.com, linux-arm-msm@...r.kernel.org,
quic_abhinavk@...cinc.com, quic_khsieh@...cinc.com,
quic_aravindh@...cinc.com, swboyd@...omium.org,
dmitry.baryshkov@...aro.org, quic_sbillaka@...cinc.com,
Douglas Anderson <dianders@...omium.org>,
Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...ux.ie>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH] drm/edid: drm_add_modes_noedid() should set lowest resolution as preferred
If we're unable to read the EDID for a display because it's corrupt /
bogus / invalid then we'll add a set of standard modes for the
display. When userspace looks at these modes it doesn't really have a
good concept for which mode to pick and it'll likely pick the highest
resolution one by default. That's probably not ideal because the modes
were purely guesses on the part of the Linux kernel.
Let's instead set 640x480 as the "preferred" mode when we have no EDID.
Signed-off-by: Douglas Anderson <dianders@...omium.org>
---
drivers/gpu/drm/drm_edid.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 7a8482b75071..64ccfff4167e 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -5839,6 +5839,15 @@ int drm_add_modes_noedid(struct drm_connector *connector,
continue;
mode = drm_mode_duplicate(dev, ptr);
if (mode) {
+ /*
+ * The drm_dmt_modes array is sorted so that lower
+ * resolutions come first. We'll set the lowest
+ * resolution mode as preferred. We have no EDID so
+ * we should prefer the lowest resolution mode as
+ * the safest one.
+ */
+ if (num_modes == 0)
+ mode->type |= DRM_MODE_TYPE_PREFERRED;
drm_mode_probed_add(connector, mode);
num_modes++;
}
--
2.36.0.rc2.479.g8af0fa9b8e-goog
Powered by blists - more mailing lists