All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/edid: Introduce drm_edid_get_displayid_product_id()
Date: Fri, 27 Nov 2026 17:59:26 +0200	[thread overview]
Message-ID: <cf7b8ed0a6d15037694a4fc12db237a3669a619c@intel.com> (raw)
In-Reply-To: <20261124224621.6506-2-ville.syrjala@linux.intel.com>

On Wed, 25 Nov 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Add drm_displayid_get_product_id() as the DisplayID based
> counterpart to the already existing EDID base block based
> drm_edid_get_product_id().
>
> In DisplayID the information is stored in the "Product ID"
> block (0x00 or 0x20). The layout is slightly different to the
> EDID one as the vendor ID is a three byte OUI isntead of
> the compressed ASCII EISA/PNPID of EDID. The "year of
> manufacture" is now relative to the year 2000, as opposed
> to 1990 for EDID.
>
> There is also a product ID string, but I decided to leave that
> out from the user visible struct because the variable length
> would just complicate things.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_displayid_internal.h | 11 ++++++
>  drivers/gpu/drm/drm_edid.c               | 49 ++++++++++++++++++++++++
>  include/drm/drm_edid.h                   | 10 +++++
>  3 files changed, 70 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_displayid_internal.h b/drivers/gpu/drm/drm_displayid_internal.h
> index ef7e6c9bd4db..2177c19cae4c 100644
> --- a/drivers/gpu/drm/drm_displayid_internal.h
> +++ b/drivers/gpu/drm/drm_displayid_internal.h
> @@ -103,6 +103,17 @@ struct displayid_block {
>  	u8 num_bytes;
>  } __packed;
>  
> +struct displayid_product_id_block {
> +	struct displayid_block base;
> +	u8 vendor_id[3];
> +	__le16 product_code;
> +	__le32 serial_number;
> +	u8 week_of_manufacture;
> +	u8 year_of_manufacture;
> +	u8 size_of_product_id_string;
> +	u8 product_id_string[];
> +} __packed;
> +
>  struct displayid_tiled_block {
>  	struct displayid_block base;
>  	u8 tile_cap;
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index b8f882a17c8f..8bde2a9cebb4 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2791,6 +2791,55 @@ void drm_edid_get_product_id(const struct drm_edid *drm_edid,
>  }
>  EXPORT_SYMBOL(drm_edid_get_product_id);
>  
> +static bool displayid_is_product_id_block(const struct displayid_iter *iter,
> +					  const struct displayid_block *block)
> +{
> +	return (displayid_version(iter) < DISPLAY_ID_STRUCTURE_VER_20 &&
> +		block->tag == DATA_BLOCK_PRODUCT_ID) ||
> +		(displayid_version(iter) == DISPLAY_ID_STRUCTURE_VER_20 &&
> +		 block->tag == DATA_BLOCK_2_PRODUCT_ID);
> +}
> +
> +/**
> + * drm_displayid_get_product_id - Get the vendor and product identification from DisplayID
> + * @drm_edid: EDID
> + * @id: Where to place the product id
> + */
> +void drm_displayid_get_product_id(const struct drm_edid *drm_edid,
> +				  struct drm_displayid_product_id *id)
> +{
> +	const struct displayid_block *block;
> +	struct displayid_iter iter;
> +
> +	memset(id, 0, sizeof(*id));
> +
> +	if (!drm_edid)
> +		return;
> +
> +	displayid_iter_edid_begin(drm_edid, &iter);
> +	displayid_iter_for_each(block, &iter) {
> +		const struct displayid_product_id_block *prod_id =
> +			(struct displayid_product_id_block *)block;
> +
> +		if (!displayid_is_product_id_block(&iter, block))
> +			continue;
> +
> +		if (block->num_bytes < sizeof(*prod_id) - sizeof(prod_id->base))
> +			continue;
> +
> +		id->vendor_id[0] = prod_id->vendor_id[0];
> +		id->vendor_id[1] = prod_id->vendor_id[1];
> +		id->vendor_id[2] = prod_id->vendor_id[2];
> +		id->product_code = prod_id->product_code;
> +		id->serial_number = prod_id->serial_number;
> +		id->week_of_manufacture = prod_id->week_of_manufacture;
> +		id->year_of_manufacture = prod_id->year_of_manufacture;
> +		break;
> +	}
> +	displayid_iter_end(&iter);
> +}
> +EXPORT_SYMBOL(drm_displayid_get_product_id);

Looking at patch 2, I think it does make sense to make this return
-EINVAL for !drm_edid, -ENOENT for no DisplayID/product id, and 0 for
found. Or something like that.

BR,
Jani.


> +
>  static void decode_date(struct seq_buf *s, const struct drm_edid_product_id *id)
>  {
>  	int week = id->week_of_manufacture;
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index a2617aa34edf..b44c26d42217 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -288,6 +288,14 @@ struct drm_edid_product_id {
>  	u8 year_of_manufacture;
>  } __packed;
>  
> +struct drm_displayid_product_id {
> +	u8 vendor_id[3];
> +	__le16 product_code;
> +	__le32 serial_number;
> +	u8 week_of_manufacture;
> +	u8 year_of_manufacture;
> +} __packed;
> +
>  struct edid {
>  	u8 header[8];
>  	/* Vendor & product info */
> @@ -484,6 +492,8 @@ int drm_edid_connector_add_modes(struct drm_connector *connector);
>  bool drm_edid_is_digital(const struct drm_edid *drm_edid);
>  void drm_edid_get_product_id(const struct drm_edid *drm_edid,
>  			     struct drm_edid_product_id *id);
> +void drm_displayid_get_product_id(const struct drm_edid *drm_edid,
> +				  struct drm_displayid_product_id *id);
>  void drm_edid_print_product_id(struct drm_printer *p,
>  			       const struct drm_edid_product_id *id, bool raw);
>  u32 drm_edid_get_panel_id(const struct drm_edid *drm_edid);

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2026-11-27 15:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 22:46 [PATCH 0/2] drm/i915: Implement DisplayID based VBT panel type detection Ville Syrjala
2026-11-24 22:46 ` [PATCH 1/2] drm/edid: Introduce drm_edid_get_displayid_product_id() Ville Syrjala
2026-11-24 22:51   ` sashiko-bot
2026-11-24 23:02     ` Ville Syrjälä
2026-11-27 15:55       ` Jani Nikula
2026-11-27 15:45   ` Jani Nikula
2026-11-27 15:59   ` Jani Nikula [this message]
2026-11-24 22:46 ` [PATCH 2/2] drm/i915/bios: Attempt to match the VBT PnP ID against DisplayID first Ville Syrjala
2026-11-24 22:56   ` sashiko-bot
2026-11-24 23:06     ` Ville Syrjälä
2026-11-27 16:29   ` Jani Nikula
2026-11-27 16:55     ` Ville Syrjälä
2026-11-27 18:08       ` Jani Nikula
2026-11-25  0:13 ` ✗ CI.checkpatch: warning for drm/i915: Implement DisplayID based VBT panel type detection Patchwork
2026-11-25  0:16 ` ✓ CI.KUnit: success " Patchwork
2026-11-25  0:55 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-11-25  4:05 ` ✗ Xe.CI.FULL: " Patchwork
2026-11-25  5:48 ` ✓ i915.CI.BAT: success " Patchwork
2026-11-26  2:23 ` ✓ i915.CI.Full: " 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=cf7b8ed0a6d15037694a4fc12db237a3669a619c@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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 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.