From: Douglas Anderson <dianders@chromium.org> To: dri-devel@lists.freedesktop.org Cc: robdclark@gmail.com, linux-arm-msm@vger.kernel.org, quic_abhinavk@quicinc.com, quic_khsieh@quicinc.com, quic_aravindh@quicinc.com, swboyd@chromium.org, dmitry.baryshkov@linaro.org, quic_sbillaka@quicinc.com, Douglas Anderson <dianders@chromium.org>, Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, linux-kernel@vger.kernel.org Subject: [RFC PATCH] drm/edid: drm_add_modes_noedid() should set lowest resolution as preferred Date: Tue, 26 Apr 2022 13:21:26 -0700 [thread overview] Message-ID: <20220426132121.RFC.1.I31ec454f8d4ffce51a7708a8092f8a6f9c929092@changeid> (raw) 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@chromium.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
WARNING: multiple messages have this Message-ID (diff)
From: Douglas Anderson <dianders@chromium.org> To: dri-devel@lists.freedesktop.org Cc: quic_sbillaka@quicinc.com, Douglas Anderson <dianders@chromium.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@linux.ie>, linux-arm-msm@vger.kernel.org, quic_abhinavk@quicinc.com, swboyd@chromium.org, dmitry.baryshkov@linaro.org, quic_aravindh@quicinc.com, quic_khsieh@quicinc.com, linux-kernel@vger.kernel.org Subject: [RFC PATCH] drm/edid: drm_add_modes_noedid() should set lowest resolution as preferred Date: Tue, 26 Apr 2022 13:21:26 -0700 [thread overview] Message-ID: <20220426132121.RFC.1.I31ec454f8d4ffce51a7708a8092f8a6f9c929092@changeid> (raw) 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@chromium.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
next reply other threads:[~2022-04-26 20:21 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-26 20:21 Douglas Anderson [this message] 2022-04-26 20:21 ` [RFC PATCH] drm/edid: drm_add_modes_noedid() should set lowest resolution as preferred Douglas Anderson 2022-04-26 20:45 ` Abhinav Kumar 2022-04-26 20:45 ` Abhinav Kumar 2022-04-26 20:52 ` Doug Anderson 2022-04-26 20:52 ` Doug Anderson 2022-04-26 21:21 ` Abhinav Kumar 2022-04-26 21:21 ` Abhinav Kumar 2022-04-27 21:20 ` Kuogee Hsieh 2022-04-27 21:20 ` Kuogee Hsieh 2022-05-05 15:44 ` Doug Anderson 2022-05-05 15:44 ` Doug Anderson 2022-05-06 11:16 ` Jani Nikula 2022-05-06 11:16 ` Jani Nikula 2022-05-06 16:33 ` Abhinav Kumar 2022-05-06 16:33 ` Abhinav Kumar 2022-05-10 20:53 ` Doug Anderson 2022-05-10 20:53 ` Doug Anderson 2022-05-10 21:33 ` Abhinav Kumar 2022-05-10 21:33 ` Abhinav Kumar 2022-05-10 21:41 ` Doug Anderson 2022-05-10 21:41 ` Doug Anderson 2022-05-11 0:03 ` Abhinav Kumar 2022-05-11 0:03 ` Abhinav Kumar
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220426132121.RFC.1.I31ec454f8d4ffce51a7708a8092f8a6f9c929092@changeid \ --to=dianders@chromium.org \ --cc=airlied@linux.ie \ --cc=daniel@ffwll.ch \ --cc=dmitry.baryshkov@linaro.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=maarten.lankhorst@linux.intel.com \ --cc=mripard@kernel.org \ --cc=quic_abhinavk@quicinc.com \ --cc=quic_aravindh@quicinc.com \ --cc=quic_khsieh@quicinc.com \ --cc=quic_sbillaka@quicinc.com \ --cc=robdclark@gmail.com \ --cc=swboyd@chromium.org \ --cc=tzimmermann@suse.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.