Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915/bios: Attempt to match the VBT PnP ID against DisplayID first
Date: Fri, 27 Nov 2026 20:08:55 +0200	[thread overview]
Message-ID: <32ff6cca90355d34d5cfb59b6dd22a07cd456c29@intel.com> (raw)
In-Reply-To: <awm2FlsQeZpjZNBU@intel.com>

On Fri, 27 Nov 2026, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Fri, Nov 27, 2026 at 06:29:00PM +0200, Jani Nikula wrote:
>> On Wed, 25 Nov 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
>> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> >
>> > The Windows driver policy appears to be now to first match the
>> > VBT PnP ID against the DisplayID product ID block, and only if
>> > there is no match (not even a partial one) then attempt to
>> > match the against the EDID base block vendor/product ID.
>> > Implement the same policy.
>> >
>> > We also need to implement the same weird scheme of just smashing
>> > the first two bytes of the DisplayID three byte OUI into the
>> > old EISA/PNPID field of the EDID defined structure. That is
>> > then matched against the similar old EDID style structures in
>> > the VBT.
>> >
>> > Smoke tested with a firmware override of EDID and VBT:
>> >  [drm:get_panel_type [xe]] Panel type (VBT): 255
>> >  [drm:pnpid_get_panel_type [xe]] DisplayID manufacturer name: NRA, product code: 16826, serial number: 0, year of manufacture: 2014
>> >  [drm:pnpid_get_panel_type [xe]] DisplayID raw product id: ba 41 ba 41 00 00 00 00 00 18
>> >  [drm:get_panel_type [xe]] Panel type (PNPID DisplayID): 3
>> >  [drm:pnpid_get_panel_type [xe]] EDID manufacturer name: SDC, product code: 16826, serial number: 65441, year of manufacture: 2024
>> >  [drm:pnpid_get_panel_type [xe]] EDID raw product id: 4c 83 ba 41 a1 ff 00 00 00 22
>> >  [drm:get_panel_type [xe]] Panel type (fallback): 0
>> >  [drm:get_panel_type [xe]] Selected panel type (PNPID DisplayID): 3
>> >
>> > Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/8969
>> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> > ---
>> >  drivers/gpu/drm/i915/display/intel_bios.c | 81 ++++++++++++++++++-----
>> >  1 file changed, 63 insertions(+), 18 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
>> > index b77d1599482a..5b0fc87e7673 100644
>> > --- a/drivers/gpu/drm/i915/display/intel_bios.c
>> > +++ b/drivers/gpu/drm/i915/display/intel_bios.c
>> > @@ -684,27 +684,22 @@ static int vbt_get_panel_type(struct intel_display *display,
>> >  }
>> >  
>> >  static int pnpid_get_panel_type(struct intel_display *display,
>> > -				const struct intel_bios_encoder_data *devdata,
>> > -				const struct drm_edid *drm_edid, bool use_fallback)
>> > +				const struct drm_edid_product_id *product_id,
>> > +				const char *source)
>> >  {
>> >  	const struct bdb_lfp_data *data;
>> >  	const struct bdb_lfp_data_ptrs *ptrs;
>> > -	struct drm_edid_product_id product_id, product_id_nodate;
>> > +	struct drm_edid_product_id product_id_nodate;
>> >  	struct drm_printer p;
>> >  	int i, best = -1;
>> >  
>> > -	if (!drm_edid)
>> > -		return -1;
>> > +	p = drm_dbg_printer(display->drm, DRM_UT_KMS, source);
>> > +	drm_edid_print_product_id(&p, product_id, true);
>> 
>> This will now print the wrong year for DisplayID, off by 10 years.
>
> I think in this case we actually want to print the bogus year
> as is because that's also what's in the VBT. All we care about
> is whether this matches something in the VBT, not whether it's
> in any way correct data otherwise. The mangled OUI is also
> complete nonsense outside of the VBT context.

Fair enough. Maybe copy-paste that into the commit message? Or add a
note about it in a comment before someone goes and changes the printing.

BR,
Jani.

>
>> 
>> [Unprintable words about not learning anything from Y2K.]
>> 
>> I'm beginning to think we should have a separate struct that's not
>> __packed or serialized, which can be initialized from either EDID or
>> DisplayID. And have drm_edid_print_product_id() operate on that. But
>> maybe it's a bit too much for this now.
>> 
>> The EDID spec says the year is mandatory. The DisplayID spec says 0x00
>> is a reserved value, but also contradicts itself by saying, "If the Year
>> of Manufacture/Model Year field is not used, the byte would be cleared
>> to all 0s."
>> 
>> One approach is to make drm_edid_print_product_id() treat zero week and
>> year as "not specified", basically incorrectly reporting displays
>> manufactured in the year 1990. And then printing product_id_nodate
>> here. Possibly an acceptable compromise?
>> 
>> I don't know. It's a mess.
>> 
>> >  
>> > -	drm_edid_get_product_id(drm_edid, &product_id);
>> > -
>> > -	product_id_nodate = product_id;
>> > +	product_id_nodate = *product_id;
>> >  	product_id_nodate.week_of_manufacture = 0;
>> >  	product_id_nodate.year_of_manufacture = 0;
>> >  
>> > -	p = drm_dbg_printer(display->drm, DRM_UT_KMS, "EDID");
>> > -	drm_edid_print_product_id(&p, &product_id, true);
>> > -
>> >  	ptrs = bdb_find_section(display, BDB_LFP_DATA_PTRS);
>> >  	if (!ptrs)
>> >  		return -1;
>> > @@ -718,7 +713,7 @@ static int pnpid_get_panel_type(struct intel_display *display,
>> >  			get_lfp_pnp_id(data, ptrs, i);
>> >  
>> >  		/* full match? */
>> > -		if (!memcmp(vbt_id, &product_id, sizeof(*vbt_id)))
>> > +		if (!memcmp(vbt_id, product_id, sizeof(*vbt_id)))
>> >  			return i;
>> >  
>> >  		/*
>> > @@ -733,6 +728,48 @@ static int pnpid_get_panel_type(struct intel_display *display,
>> >  	return best;
>> >  }
>> >  
>> > +static int pnpid_edid_get_panel_type(struct intel_display *display,
>> > +				     const struct intel_bios_encoder_data *devdata,
>> > +				     const struct drm_edid *drm_edid, bool use_fallback)
>> > +{
>> > +	struct drm_edid_product_id product_id;
>> > +
>> > +	if (!drm_edid)
>> > +		return -1;
>> > +
>> > +	drm_edid_get_product_id(drm_edid, &product_id);
>> > +
>> > +	return pnpid_get_panel_type(display, &product_id, "EDID");
>> > +}
>> > +
>> > +static int pnpid_displayid_get_panel_type(struct intel_display *display,
>> > +					  const struct intel_bios_encoder_data *devdata,
>> > +					  const struct drm_edid *drm_edid, bool use_fallback)
>> > +{
>> > +	struct drm_displayid_product_id displayid_id;
>> > +	struct drm_edid_product_id product_id;
>> > +
>> > +	if (!drm_edid)
>> > +		return -1;
>> > +
>> > +	drm_displayid_get_product_id(drm_edid, &displayid_id);
>> 
>> Having this return a value based on whether the product id was found or
>> not would indeed be useful.
>> 
>> > +
>> > +	/*
>> > +	 * Only the first two bytes of the OUI get
>> > +	 * smashed into the old EISA/PNPID field, and
>> > +	 * that gets matched against what's in the VBT.
>> > +	 */
>> > +	product_id.manufacturer_name =
>> > +		cpu_to_be16((displayid_id.vendor_id[0] << 8) |
>> > +			    displayid_id.vendor_id[1]);
>> 
>> I'll take your word for this.
>> 
>> Apart from the comments, everything else looks good,
>> 
>> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>> 
>> > +	product_id.product_code = displayid_id.product_code;
>> > +	product_id.serial_number = displayid_id.serial_number;
>> > +	product_id.week_of_manufacture = displayid_id.week_of_manufacture;
>> > +	product_id.year_of_manufacture = displayid_id.year_of_manufacture;
>> > +
>> > +	return pnpid_get_panel_type(display, &product_id, "DisplayID");
>> > +}
>> > +
>> >  static int fallback_get_panel_type(struct intel_display *display,
>> >  				   const struct intel_bios_encoder_data *devdata,
>> >  				   const struct drm_edid *drm_edid, bool use_fallback)
>> > @@ -743,7 +780,8 @@ static int fallback_get_panel_type(struct intel_display *display,
>> >  enum panel_type {
>> >  	PANEL_TYPE_OPREGION,
>> >  	PANEL_TYPE_VBT,
>> > -	PANEL_TYPE_PNPID,
>> > +	PANEL_TYPE_PNPID_DISPLAYID,
>> > +	PANEL_TYPE_PNPID_EDID,
>> >  	PANEL_TYPE_FALLBACK,
>> >  };
>> >  
>> > @@ -766,9 +804,13 @@ static int get_panel_type(struct intel_display *display,
>> >  			.name = "VBT",
>> >  			.get_panel_type = vbt_get_panel_type,
>> >  		},
>> > -		[PANEL_TYPE_PNPID] = {
>> > -			.name = "PNPID",
>> > -			.get_panel_type = pnpid_get_panel_type,
>> > +		[PANEL_TYPE_PNPID_DISPLAYID] = {
>> > +			.name = "PNPID DisplayID",
>> > +			.get_panel_type = pnpid_displayid_get_panel_type,
>> > +		},
>> > +		[PANEL_TYPE_PNPID_EDID] = {
>> > +			.name = "PNPID EDID",
>> > +			.get_panel_type = pnpid_edid_get_panel_type,
>> >  		},
>> >  		[PANEL_TYPE_FALLBACK] = {
>> >  			.name = "fallback",
>> > @@ -792,8 +834,11 @@ static int get_panel_type(struct intel_display *display,
>> >  	if (is_panel_type_valid(panel_types[PANEL_TYPE_OPREGION].panel_type))
>> >  		i = PANEL_TYPE_OPREGION;
>> >  	else if (is_panel_type_pnp(panel_types[PANEL_TYPE_VBT].panel_type) &&
>> > -		 is_panel_type_valid(panel_types[PANEL_TYPE_PNPID].panel_type))
>> > -		i = PANEL_TYPE_PNPID;
>> > +		 is_panel_type_valid(panel_types[PANEL_TYPE_PNPID_DISPLAYID].panel_type))
>> > +		i = PANEL_TYPE_PNPID_DISPLAYID;
>> > +	else if (is_panel_type_pnp(panel_types[PANEL_TYPE_VBT].panel_type) &&
>> > +		 is_panel_type_valid(panel_types[PANEL_TYPE_PNPID_EDID].panel_type))
>> > +		i = PANEL_TYPE_PNPID_EDID;
>> >  	else if (is_panel_type_valid(panel_types[PANEL_TYPE_VBT].panel_type))
>> >  		i = PANEL_TYPE_VBT;
>> >  	else
>> 
>> -- 
>> Jani Nikula, Intel

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-11-27 18:09 UTC|newest]

Thread overview: 17+ 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
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 [this message]
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

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=32ff6cca90355d34d5cfb59b6dd22a07cd456c29@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox