From: Javier Martinez Canillas <javierm@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
ardb@kernel.org, ilias.apalodimas@linaro.org,
jani.nikula@linux.intel.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, simona@ffwll.ch, airlied@gmail.com
Cc: dri-devel@lists.freedesktop.org, linux-efi@vger.kernel.org,
sashiko-reviews@lists.linux.dev,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: Re: [PATCH v4 2/3] drm/edid: Add drm_edid_detect_panel_size()
Date: Thu, 10 Sep 2026 10:10:03 +0200 [thread overview]
Message-ID: <87y0d9cysk.fsf@ocarina.mail-host-address-is-not-set> (raw)
In-Reply-To: <20260904090850.43060-3-tzimmermann@suse.de>
Thomas Zimmermann <tzimmermann@suse.de> writes:
> Add drm_edid_detect_panel_size() to extract the panel's preferred
> display resolution from a given EDID. Required for setting up DRM's
> panel orientation quirks in sysfb drivers.
>
> v4:
> - fix test for EDID PTD (Jani)
> v3:
> - mention use case in documentation (Jani)
> - use is_detailed_timing_descriptor() (Jani)
> - rename helper to drm_edid_detect_panel_size()
> v2:
> - handle EDID without pixel timing descriptor (Sashiko)
> - fix checks for width and height pointers
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> drivers/gpu/drm/drm_edid.c | 47 ++++++++++++++++++++++++++++++++++++++
> include/drm/drm_edid.h | 2 ++
> 2 files changed, 49 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 9990a836d0b6..1331efb4876c 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -7852,3 +7852,50 @@ bool drm_edid_is_digital(const struct drm_edid *drm_edid)
> drm_edid->edid->input & DRM_EDID_INPUT_DIGITAL;
> }
> EXPORT_SYMBOL(drm_edid_is_digital);
> +
> +/**
> + * drm_edid_detect_panel_size - Get a panel's size from EDID
> + * @drm_edid: EDID of the panel.
> + * @width: Returns the panel's width in pixels per scanline, if given
> + * @height: Returns the panel's height in scanlines, if given
> + *
> + * This function detects the preferred size of a panel from the given
> + * EDID. There is no such information stored in the EDID block directly,
> + * but the preferred mode often corresponds to the panel's native geometry.
> + *
> + * This helper should only be used during initialization before the
> + * connector is available. For regular use, retrieve the available display
> + * modes with the connector functions.
> + *
> + * Return: Zero on success, or a negative errno code otherwise.
> + */
> +int drm_edid_detect_panel_size(const struct drm_edid *drm_edid,
> + unsigned int *width, unsigned int *height)
> +{
> + const struct edid *edid = drm_edid->edid;
> + const struct detailed_timing *dt;
> + const struct detailed_pixel_timing *pt;
> +
> + /*
> + * Use display mode from the Preferred Timing Descriptor. For old
> + * and obscure displays, we might need better heuristics.
> + */
> +
> + if (edid->revision < 4 || !(edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING))
> + return -EINVAL; /* no Preferred Timing Descriptor */
> +
I saw that Jani and you discussed this logic in v3. I originally thought that
your v3 was correct and this one was wrong, but I noticed now that this flag
changed its semantic between 1.3 and 1.4.
So I think that this latest version is correct indeed, 1.3 didn't include the
native pixel format and 1.4 does not either if DRM_EDID_FEATURE_PREFERRED_TIMING
flag is not set.
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
next prev parent reply other threads:[~2026-09-10 8:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 9:06 [PATCH v4 0/3] sysfb: Fix display output on Lenovo D330 (and others) Thomas Zimmermann
2026-09-04 9:07 ` [PATCH v4 1/3] firmware/sysfb: Remove rotation quirk for Lenovo D330 Thomas Zimmermann
2026-09-10 7:23 ` Javier Martinez Canillas
2026-09-10 7:46 ` Thomas Zimmermann
2026-09-04 9:07 ` [PATCH v4 2/3] drm/edid: Add drm_edid_detect_panel_size() Thomas Zimmermann
2026-09-04 9:28 ` Jani Nikula
2026-09-10 8:10 ` Javier Martinez Canillas [this message]
2026-09-11 7:35 ` Jani Nikula
2026-09-04 9:07 ` [PATCH v4 3/3] drm/sysfb: Use preferred panel size for panel orientation quirks Thomas Zimmermann
2026-09-04 9:41 ` Jani Nikula
2026-09-10 8:11 ` Javier Martinez Canillas
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=87y0d9cysk.fsf@ocarina.mail-host-address-is-not-set \
--to=javierm@redhat.com \
--cc=airlied@gmail.com \
--cc=ardb@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ilias.apalodimas@linaro.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-efi@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
--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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox