From: Jani Nikula <jani.nikula@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: Re: [PATCH v2 2/4] drm/edid: Add support for quirks visible to DRM core and drivers
Date: Wed, 04 Jun 2025 13:02:57 +0300 [thread overview]
Message-ID: <5e16fc31d59f2f284a0be57bf0e508c13ebb0a1a@intel.com> (raw)
In-Reply-To: <20250604091315.16703-1-imre.deak@intel.com>
On Wed, 04 Jun 2025, Imre Deak <imre.deak@intel.com> wrote:
> Add support for EDID based quirks which can be queried outside of the
> EDID parser iteself by DRM core and drivers. There are at least two such
> quirks applicable to all drivers: the DPCD register access probe quirk
> and the 128b/132b DPRX Lane Count Conversion quirk (see 3.5.2.16.3 in
> the v2.1a DP Standard). The latter quirk applies to panels with specific
> EDID panel names, accordingly add support for defining quirks based on
> the EDID panel name.
>
> v2: Reset global_quirks in drm_reset_display_info().
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> drivers/gpu/drm/drm_edid.c | 34 +++++++++++++++++++++++++++-------
> include/drm/drm_connector.h | 5 +++++
> include/drm/drm_edid.h | 5 +++++
> 3 files changed, 37 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 74e77742b2bd4..5d3a25cbc4d36 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -114,15 +114,21 @@ struct drm_edid_match_closure {
> #define LEVEL_GTF2 2
> #define LEVEL_CVT 3
>
> -#define EDID_QUIRK(vend_chr_0, vend_chr_1, vend_chr_2, product_id, _quirks) \
> +#define PANEL_NAME_ANY NULL
> +
> +#define DRM_EDID_QUIRK(_panel_id, _panel_name, _quirks) \
> { \
> .ident = { \
> - .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, \
> - vend_chr_2, product_id), \
> + .panel_id = _panel_id, \
> + .name = _panel_name, \
> }, \
> .quirks = _quirks \
> }
>
> +#define EDID_QUIRK(vend_chr_0, vend_chr_1, vend_chr_2, product_id, _quirks) \
> + DRM_EDID_QUIRK(drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, product_id), \
> + PANEL_NAME_ANY, _quirks)
> +
I'm not sure why this has to change. It's not explained in the commit
message.
> static const struct edid_quirk {
> const struct drm_edid_ident ident;
> u32 quirks;
> @@ -248,6 +254,9 @@ static const struct edid_quirk {
> EDID_QUIRK('A', 'U', 'O', 0x1111, EDID_QUIRK_NON_DESKTOP),
Don't we want the other quirk list also be this concise?
> };
>
> +static const struct edid_quirk global_edid_quirk_list[] = {
> +};
> +
> /*
> * Autogenerated from the DMT spec.
> * This table is copied from xfree86/modes/xf86EdidModes.c.
> @@ -2937,13 +2946,14 @@ EXPORT_SYMBOL(drm_edid_duplicate);
> *
> * Return: A u32 represents the quirks to apply.
> */
> -static u32 edid_get_quirks(const struct drm_edid *drm_edid)
> +static u32 edid_get_quirks(const struct drm_edid *drm_edid,
> + const struct edid_quirk *quirk_list, int quirk_list_size)
> {
> const struct edid_quirk *quirk;
> int i;
>
> - for (i = 0; i < ARRAY_SIZE(edid_quirk_list); i++) {
> - quirk = &edid_quirk_list[i];
> + for (i = 0; i < quirk_list_size; i++) {
> + quirk = &quirk_list[i];
> if (drm_edid_match(drm_edid, &quirk->ident))
> return quirk->quirks;
> }
> @@ -6614,6 +6624,7 @@ static void drm_reset_display_info(struct drm_connector *connector)
> info->vics_len = 0;
>
> info->quirks = 0;
> + info->global_quirks = 0;
So I am not sure if we really need or want two lists.
I think we could have
drm_edid.h:
enum drm_edid_quirk {
/* ... */
DRM_EDID_QUIRK_MAX,
};
drm_edid.c:
enum drm_edid_internal_quirk {
FOO_QUIRK = DRM_EDID_QUIRK_MAX,
/* etc ... */
};
And just make info->quirks big enough. I think it feels simpler overall.
>
> info->source_physical_address = CEC_PHYS_ADDR_INVALID;
> }
> @@ -6660,7 +6671,10 @@ static void update_display_info(struct drm_connector *connector,
>
> edid = drm_edid->edid;
>
> - info->quirks = edid_get_quirks(drm_edid);
> + info->quirks = edid_get_quirks(drm_edid, edid_quirk_list,
> + ARRAY_SIZE(edid_quirk_list));
> + info->global_quirks = edid_get_quirks(drm_edid, global_edid_quirk_list,
> + ARRAY_SIZE(global_edid_quirk_list));
>
> info->width_mm = edid->width_cm * 10;
> info->height_mm = edid->height_cm * 10;
> @@ -7566,3 +7580,9 @@ 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);
> +
> +bool drm_edid_has_quirk(struct drm_connector *connector, enum drm_edid_quirk quirk)
> +{
> + return connector->display_info.global_quirks & BIT(quirk);
> +}
> +EXPORT_SYMBOL(drm_edid_has_quirk);
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 73903c3c842f3..996ecf229f8c7 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -847,6 +847,11 @@ struct drm_display_info {
> */
> u32 quirks;
>
> + /**
> + * @global_quirks: EDID based quirks. Can be queried by DRM core and drivers.
Might mention that you should not access directly, but using
drm_edid_has_quirk().
> + */
> + u32 global_quirks;
> +
> /**
> * @source_physical_address: Source Physical Address from HDMI
> * Vendor-Specific Data Block, for CEC usage.
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index b38409670868d..3d8e168521c82 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -109,6 +109,10 @@ struct detailed_data_string {
> #define DRM_EDID_CVT_FLAGS_STANDARD_BLANKING (1 << 3)
> #define DRM_EDID_CVT_FLAGS_REDUCED_BLANKING (1 << 4)
>
> +enum drm_edid_quirk {
> + DRM_EDID_QUIRK_NONE,
> +};
> +
> struct detailed_data_monitor_range {
> u8 min_vfreq;
> u8 max_vfreq;
> @@ -476,5 +480,6 @@ void drm_edid_print_product_id(struct drm_printer *p,
> u32 drm_edid_get_panel_id(const struct drm_edid *drm_edid);
> bool drm_edid_match(const struct drm_edid *drm_edid,
> const struct drm_edid_ident *ident);
> +bool drm_edid_has_quirk(struct drm_connector *connector, enum drm_edid_quirk quirk);
>
> #endif /* __DRM_EDID_H__ */
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-06-04 10:03 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 12:15 [PATCH 0/4] drm/dp: Limit the DPCD probe quirk to the affected monitor Imre Deak
2025-06-03 12:15 ` [PATCH 1/4] drm/dp: Change AUX DPCD probe address from DPCD_REV to LANE0_1_STATUS Imre Deak
2025-06-04 9:53 ` Jani Nikula
2025-06-03 12:15 ` [PATCH 2/4] drm/edid: Add support for quirks visible to DRM core and drivers Imre Deak
2025-06-04 9:13 ` [PATCH v2 " Imre Deak
2025-06-04 10:02 ` Jani Nikula [this message]
2025-06-04 16:27 ` Imre Deak
2025-06-03 12:15 ` [PATCH 3/4] drm/dp: Add an EDID quirk for the DPCD register access probe Imre Deak
2025-06-03 15:36 ` [PATCH v2 " Imre Deak
2025-06-04 10:11 ` Jani Nikula
2025-06-04 16:34 ` Imre Deak
2025-06-03 12:15 ` [PATCH 4/4] drm/i915/dp: Disable the AUX DPCD probe quirk if it's not required Imre Deak
2025-06-04 10:13 ` Jani Nikula
2025-06-03 12:44 ` ✓ CI.Patch_applied: success for drm/dp: Limit the DPCD probe quirk to the affected monitor Patchwork
2025-06-03 12:44 ` ✗ CI.checkpatch: warning " Patchwork
2025-06-03 12:45 ` ✓ CI.KUnit: success " Patchwork
2025-06-03 12:56 ` ✓ CI.Build: " Patchwork
2025-06-03 12:58 ` ✓ CI.Hooks: " Patchwork
2025-06-03 13:00 ` ✗ CI.checksparse: warning " Patchwork
2025-06-03 13:48 ` ✓ Xe.CI.BAT: success " Patchwork
2025-06-03 15:42 ` ✓ CI.Patch_applied: success for drm/dp: Limit the DPCD probe quirk to the affected monitor (rev2) Patchwork
2025-06-03 15:42 ` ✗ CI.checkpatch: warning " Patchwork
2025-06-03 15:43 ` ✗ CI.KUnit: failure " Patchwork
2025-06-04 10:13 ` ✓ CI.Patch_applied: success for drm/dp: Limit the DPCD probe quirk to the affected monitor (rev3) Patchwork
2025-06-04 10:13 ` ✗ CI.checkpatch: warning " Patchwork
2025-06-04 10:14 ` ✓ CI.KUnit: success " Patchwork
2025-06-04 10:33 ` ✓ CI.Hooks: " Patchwork
2025-06-04 10:33 ` ✗ CI.checksparse: warning " Patchwork
2025-06-04 11:21 ` ✓ Xe.CI.BAT: success " Patchwork
2025-06-04 13:58 ` ✗ Xe.CI.Full: failure for drm/dp: Limit the DPCD probe quirk to the affected monitor Patchwork
2025-06-05 3:45 ` ✗ Xe.CI.Full: failure for drm/dp: Limit the DPCD probe quirk to the affected monitor (rev3) Patchwork
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=5e16fc31d59f2f284a0be57bf0e508c13ebb0a1a@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/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