public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] drm: detect panel type from DisplayID 2.x
@ 2026-05-26  2:59 Chenyu Chen
  2026-05-26  2:59 ` [PATCH v3 1/3] drm/edid: extract base section header processing into helper Chenyu Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Chenyu Chen @ 2026-05-26  2:59 UTC (permalink / raw)
  To: amd-gfx, dri-devel
  Cc: Harry Wentland, Leo Li, Ray Wu, Limonciello Mario, Jani Nikula,
	Chenyu Chen

This series adds parsing of the Display Device Technology field from
the DisplayID v2.x Display Parameters Data Block (tag 0x21), enabling
panel type detection (LCD/OLED) through a standards-based source.

Previously, amdgpu_dm determined panel type only from AMD VSDB, DPCD
sink extended caps, and a Samsung luminance heuristic. A TODO comment
in dm_set_panel_type() acknowledged the need to also use DisplayID as
a source. This series resolves that by parsing the Display Parameters
block in DRM core and wiring it into amdgpu_dm's detection priority
chain as: VSDB > DPCD > DisplayID > Samsung heuristic.

Patch 1 extracts the base section header processing into a helper and
removes the break so the iterator can walk through all data blocks.
The helper is invoked only once via a base_section_header_processed
flag because displayid_version() and displayid_primary_use() always
return values captured from the base section — they are fixed
regardless of which extension section the iterator is currently in,
so processing the header more than once would be redundant.

Changes in v3:
- Renamed helper to drm_displayid_process_base_section_header() to
  reflect it handles the base section (Jani)
- Fixed argument alignment to match opening parenthesis (Jani)
- Renamed header_processed to base_section_header_processed (Jani)
- Fully expanded displayid_display_params_block struct with all named
  fields per spec Table 4-7, replacing u8 payload[27] (Jani)
- Added DISPLAYID_DEVICE_TECH_{UNSPECIFIED,LCD,OLED} named defines (Jani)
- Removed DISPLAYID_DISPLAY_PARAMS_MIN_LEN macro, use inline sizeof (Jani)
- Removed superfluous blank line and useless inline comments (Jani)
- Debug print now shows "LCD"/"OLED" string instead of number (Jani)
- Renamed did_panel_type to panel_type (Jani)
- Added LCD to drm_panel_type_enum_list[] and property documentation (Jani)
- Added PANEL_TYPE_LCD branch in dm_set_panel_type() property setting

Chenyu Chen (3):
  drm/edid: extract base section header processing into helper
  drm/edid: parse panel type from DisplayID 2.x Display Parameters
  drm/amd/display: use DisplayID panel type in dm_set_panel_type

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 16 ++--
 drivers/gpu/drm/drm_connector.c               |  3 +-
 drivers/gpu/drm/drm_displayid_internal.h      | 24 ++++++
 drivers/gpu/drm/drm_edid.c                    | 80 +++++++++++++++----
 include/drm/drm_connector.h                   |  6 ++
 include/uapi/drm/drm_mode.h                   |  1 +
 6 files changed, 109 insertions(+), 21 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3 1/3] drm/edid: extract base section header processing into helper
  2026-05-26  2:59 [PATCH v3 0/3] drm: detect panel type from DisplayID 2.x Chenyu Chen
@ 2026-05-26  2:59 ` Chenyu Chen
  2026-05-26  3:09   ` Chen, Chen-Yu
  2026-05-27  5:16   ` Claude review: " Claude Code Review Bot
  2026-05-26  2:59 ` [PATCH v3 2/3] drm/edid: parse panel type from DisplayID 2.x Display Parameters Chenyu Chen
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 11+ messages in thread
From: Chenyu Chen @ 2026-05-26  2:59 UTC (permalink / raw)
  To: amd-gfx, dri-devel
  Cc: Harry Wentland, Leo Li, Ray Wu, Limonciello Mario, Jani Nikula,
	Chenyu Chen

Extract the DisplayID base section header logging and non_desktop
detection from update_displayid_info() into a dedicated helper,
drm_displayid_process_base_section_header(). Remove the break so the
iterator walks through all data blocks, preparing for future patches
that will parse additional block types within the loop.

The helper is called only once for the base section via a
base_section_header_processed flag. Since version and primary_use are
only captured from the base section, and extension sections carry a
primary use of zero per spec, the non_desktop logic is unaffected.

No functional change.

Assisted-by: Copilot:Claude-Opus-4.6
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
---
 drivers/gpu/drm/drm_edid.c | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 8031f021d4d0..7ad3f939dbe6 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -6715,30 +6715,35 @@ static void drm_reset_display_info(struct drm_connector *connector)
 	memset(&info->amd_vsdb, 0, sizeof(info->amd_vsdb));
 }
 
+static void drm_displayid_process_base_section_header(struct drm_connector *connector,
+						      const struct displayid_iter *iter)
+{
+	struct drm_display_info *info = &connector->display_info;
+
+	drm_dbg_kms(connector->dev,
+		    "[CONNECTOR:%d:%s] DisplayID extension version 0x%02x, primary use 0x%02x\n",
+		    connector->base.id, connector->name,
+		    displayid_version(iter),
+		    displayid_primary_use(iter));
+	if (displayid_version(iter) == DISPLAY_ID_STRUCTURE_VER_20 &&
+	    (displayid_primary_use(iter) == PRIMARY_USE_HEAD_MOUNTED_VR ||
+	     displayid_primary_use(iter) == PRIMARY_USE_HEAD_MOUNTED_AR))
+		info->non_desktop = true;
+}
+
 static void update_displayid_info(struct drm_connector *connector,
 				  const struct drm_edid *drm_edid)
 {
-	struct drm_display_info *info = &connector->display_info;
 	const struct displayid_block *block;
 	struct displayid_iter iter;
+	bool base_section_header_processed = false;
 
 	displayid_iter_edid_begin(drm_edid, &iter);
 	displayid_iter_for_each(block, &iter) {
-		drm_dbg_kms(connector->dev,
-			    "[CONNECTOR:%d:%s] DisplayID extension version 0x%02x, primary use 0x%02x\n",
-			    connector->base.id, connector->name,
-			    displayid_version(&iter),
-			    displayid_primary_use(&iter));
-		if (displayid_version(&iter) == DISPLAY_ID_STRUCTURE_VER_20 &&
-		    (displayid_primary_use(&iter) == PRIMARY_USE_HEAD_MOUNTED_VR ||
-		     displayid_primary_use(&iter) == PRIMARY_USE_HEAD_MOUNTED_AR))
-			info->non_desktop = true;
-
-		/*
-		 * We're only interested in the base section here, no need to
-		 * iterate further.
-		 */
-		break;
+		if (!base_section_header_processed) {
+			drm_displayid_process_base_section_header(connector, &iter);
+			base_section_header_processed = true;
+		}
 	}
 	displayid_iter_end(&iter);
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 2/3] drm/edid: parse panel type from DisplayID 2.x Display Parameters
  2026-05-26  2:59 [PATCH v3 0/3] drm: detect panel type from DisplayID 2.x Chenyu Chen
  2026-05-26  2:59 ` [PATCH v3 1/3] drm/edid: extract base section header processing into helper Chenyu Chen
@ 2026-05-26  2:59 ` Chenyu Chen
  2026-05-26  3:09   ` Chen, Chen-Yu
  2026-05-27  5:16   ` Claude review: " Claude Code Review Bot
  2026-05-26  2:59 ` [PATCH v3 3/3] drm/amd/display: use DisplayID panel type in dm_set_panel_type Chenyu Chen
  2026-05-27  5:16 ` Claude review: drm: detect panel type from DisplayID 2.x Claude Code Review Bot
  3 siblings, 2 replies; 11+ messages in thread
From: Chenyu Chen @ 2026-05-26  2:59 UTC (permalink / raw)
  To: amd-gfx, dri-devel
  Cc: Harry Wentland, Leo Li, Ray Wu, Limonciello Mario, Jani Nikula,
	Chenyu Chen

Parse the Display Parameters Data Block (tag 0x21) defined in
DisplayID v2.1a Section 4.2.6. Extract the Display Device Technology
field from the color depth and device technology byte, which indicates
whether the panel uses LCD or OLED technology.

Add a panel_type field to struct drm_display_info and populate it
during DisplayID iteration so downstream drivers can use it for
panel-type-dependent behavior. Add DRM_MODE_PANEL_TYPE_LCD to the UAPI
panel type property alongside the existing OLED value.

Assisted-by: Copilot:Claude-Opus-4.6
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
---
 drivers/gpu/drm/drm_connector.c          |  3 +-
 drivers/gpu/drm/drm_displayid_internal.h | 24 +++++++++++++
 drivers/gpu/drm/drm_edid.c               | 45 ++++++++++++++++++++++++
 include/drm/drm_connector.h              |  6 ++++
 include/uapi/drm/drm_mode.h              |  1 +
 5 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index aec05adbc889..f2ac4542a7d3 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1176,6 +1176,7 @@ static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
 static const struct drm_prop_enum_list drm_panel_type_enum_list[] = {
 	{ DRM_MODE_PANEL_TYPE_UNKNOWN, "unknown" },
 	{ DRM_MODE_PANEL_TYPE_OLED, "OLED" },
+	{ DRM_MODE_PANEL_TYPE_LCD, "LCD" },
 };
 
 /**
@@ -1508,7 +1509,7 @@ EXPORT_SYMBOL(drm_hdmi_connector_get_output_format_name);
  * 	never read back the value of "DPMS" because it can be incorrect.
  * panel_type:
  * 	Immutable enum property to indicate the type of connected panel.
- * 	Possible values are "unknown" (default) and "OLED".
+ * 	Possible values are "unknown" (default), "OLED", and "LCD".
  * PATH:
  * 	Connector path property to identify how this sink is physically
  * 	connected. Used by DP MST. This should be set by calling
diff --git a/drivers/gpu/drm/drm_displayid_internal.h b/drivers/gpu/drm/drm_displayid_internal.h
index 5b1b32f73516..6f431aafafcf 100644
--- a/drivers/gpu/drm/drm_displayid_internal.h
+++ b/drivers/gpu/drm/drm_displayid_internal.h
@@ -142,6 +142,30 @@ struct displayid_formula_timing_block {
 	struct displayid_formula_timings_9 timings[];
 } __packed;
 
+#define DISPLAYID_DEVICE_TECH_UNSPECIFIED	0
+#define DISPLAYID_DEVICE_TECH_LCD		1
+#define DISPLAYID_DEVICE_TECH_OLED		2
+
+#define DISPLAYID_DISPLAY_PARAMS_DEVICE_TECH	GENMASK(6, 4)
+
+struct displayid_display_params_block {
+	struct displayid_block base;
+	__le16 horiz_image_size;
+	__le16 vert_image_size;
+	__le16 horiz_pixel_count;
+	__le16 vert_pixel_count;
+	u8 features;
+	u8 primary_color1[3];
+	u8 primary_color2[3];
+	u8 primary_color3[3];
+	u8 white_point[3];
+	__le16 max_luminance_full;
+	__le16 max_luminance_10;
+	__le16 min_luminance;
+	u8 color_depth_and_tech;	/* [2:0] depth, [6:4] device tech, [7] theme */
+	u8 gamma_eotf;
+} __packed;
+
 #define DISPLAYID_VESA_MSO_OVERLAP	GENMASK(3, 0)
 #define DISPLAYID_VESA_MSO_MODE		GENMASK(6, 5)
 
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 7ad3f939dbe6..a9d480981c8f 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -6713,6 +6713,8 @@ static void drm_reset_display_info(struct drm_connector *connector)
 
 	info->source_physical_address = CEC_PHYS_ADDR_INVALID;
 	memset(&info->amd_vsdb, 0, sizeof(info->amd_vsdb));
+
+	info->panel_type = DRM_MODE_PANEL_TYPE_UNKNOWN;
 }
 
 static void drm_displayid_process_base_section_header(struct drm_connector *connector,
@@ -6731,6 +6733,45 @@ static void drm_displayid_process_base_section_header(struct drm_connector *conn
 		info->non_desktop = true;
 }
 
+static void
+drm_displayid_parse_display_params(struct drm_connector *connector,
+				   const struct displayid_block *block)
+{
+	struct drm_display_info *info = &connector->display_info;
+	const struct displayid_display_params_block *params =
+		(const struct displayid_display_params_block *)block;
+	u8 tech;
+
+	if (block->num_bytes < sizeof(*params) - sizeof(params->base)) {
+		drm_dbg_kms(connector->dev,
+			    "[CONNECTOR:%d:%s] DisplayID Display Parameters block too short (%u < %zu)\n",
+			    connector->base.id, connector->name,
+			    block->num_bytes,
+			    sizeof(*params) - sizeof(params->base));
+		return;
+	}
+
+	tech = FIELD_GET(DISPLAYID_DISPLAY_PARAMS_DEVICE_TECH,
+			 params->color_depth_and_tech);
+
+	drm_dbg_kms(connector->dev,
+		    "[CONNECTOR:%d:%s] DisplayID Display Parameters: device technology %s\n",
+		    connector->base.id, connector->name,
+		    tech == DISPLAYID_DEVICE_TECH_LCD ? "LCD" :
+		    tech == DISPLAYID_DEVICE_TECH_OLED ? "OLED" : "unspecified");
+
+	switch (tech) {
+	case DISPLAYID_DEVICE_TECH_LCD:
+		info->panel_type = DRM_MODE_PANEL_TYPE_LCD;
+		break;
+	case DISPLAYID_DEVICE_TECH_OLED:
+		info->panel_type = DRM_MODE_PANEL_TYPE_OLED;
+		break;
+	default:
+		break;
+	}
+}
+
 static void update_displayid_info(struct drm_connector *connector,
 				  const struct drm_edid *drm_edid)
 {
@@ -6744,6 +6785,10 @@ static void update_displayid_info(struct drm_connector *connector,
 			drm_displayid_process_base_section_header(connector, &iter);
 			base_section_header_processed = true;
 		}
+
+		if (displayid_version(&iter) == DISPLAY_ID_STRUCTURE_VER_20 &&
+		    block->tag == DATA_BLOCK_2_DISPLAY_PARAMETERS)
+			drm_displayid_parse_display_params(connector, block);
 	}
 	displayid_iter_end(&iter);
 }
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index c398dbc68bbc..745cd917fe40 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -899,6 +899,12 @@ struct drm_display_info {
 	 * @amd_vsdb: AMD-specific VSDB information.
 	 */
 	struct drm_amd_vsdb_info amd_vsdb;
+
+	/**
+	 * @panel_type: Panel type from DisplayID Display Parameters
+	 * Data Block (tag 0x21). Uses DRM_MODE_PANEL_TYPE_* constants.
+	 */
+	u8 panel_type;
 };
 
 int drm_display_info_set_bus_formats(struct drm_display_info *info,
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 3693d82b5279..d7ca1040b92e 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -169,6 +169,7 @@ extern "C" {
 /* Panel type property */
 #define DRM_MODE_PANEL_TYPE_UNKNOWN	0
 #define DRM_MODE_PANEL_TYPE_OLED	1
+#define DRM_MODE_PANEL_TYPE_LCD		2
 
 /*
  * DRM_MODE_ROTATE_<degrees>
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 3/3] drm/amd/display: use DisplayID panel type in dm_set_panel_type
  2026-05-26  2:59 [PATCH v3 0/3] drm: detect panel type from DisplayID 2.x Chenyu Chen
  2026-05-26  2:59 ` [PATCH v3 1/3] drm/edid: extract base section header processing into helper Chenyu Chen
  2026-05-26  2:59 ` [PATCH v3 2/3] drm/edid: parse panel type from DisplayID 2.x Display Parameters Chenyu Chen
@ 2026-05-26  2:59 ` Chenyu Chen
  2026-05-26  3:09   ` Chen, Chen-Yu
  2026-05-27  5:16   ` Claude review: " Claude Code Review Bot
  2026-05-27  5:16 ` Claude review: drm: detect panel type from DisplayID 2.x Claude Code Review Bot
  3 siblings, 2 replies; 11+ messages in thread
From: Chenyu Chen @ 2026-05-26  2:59 UTC (permalink / raw)
  To: amd-gfx, dri-devel
  Cc: Harry Wentland, Leo Li, Ray Wu, Limonciello Mario, Jani Nikula,
	Chenyu Chen

Wire up the newly parsed panel_type from drm_display_info into
amdgpu_dm's panel type detection path. When neither the AMD VSDB
nor DPCD determines the panel type, fall back to the DisplayID
Display Device Technology field to set PANEL_TYPE_LCD or
PANEL_TYPE_OLED accordingly. Also expose LCD to userspace via
the panel_type connector property.

Assisted-by: Copilot:Claude-Opus-4.6
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c    | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e42a5eecdf46..ccf933ed63de 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3944,11 +3944,13 @@ static void dm_set_panel_type(struct amdgpu_dm_connector *aconnector)
 			link->panel_type = PANEL_TYPE_OLED;
 	}
 
-	/*
-	 * TODO: get panel type from DID2 that has device technology field
-	 * to specify if it's OLED or not. But we need to wait for DID2
-	 * support in DC and EDID parser to be able to use it here.
-	 */
+	/* If VSDB and DPCD didn't determine panel type, check DID */
+	if (link->panel_type == PANEL_TYPE_NONE) {
+		if (display_info->panel_type == DRM_MODE_PANEL_TYPE_LCD)
+			link->panel_type = PANEL_TYPE_LCD;
+		else if (display_info->panel_type == DRM_MODE_PANEL_TYPE_OLED)
+			link->panel_type = PANEL_TYPE_OLED;
+	}
 
 	if (link->panel_type == PANEL_TYPE_NONE) {
 		struct drm_amd_vsdb_info *vsdb = &display_info->amd_vsdb;
@@ -3966,6 +3968,10 @@ static void dm_set_panel_type(struct amdgpu_dm_connector *aconnector)
 		drm_object_property_set_value(&connector->base,
 		    adev_to_drm(adev)->mode_config.panel_type_property,
 		    DRM_MODE_PANEL_TYPE_OLED);
+	else if (link->panel_type == PANEL_TYPE_LCD)
+		drm_object_property_set_value(&connector->base,
+		    adev_to_drm(adev)->mode_config.panel_type_property,
+		    DRM_MODE_PANEL_TYPE_LCD);
 	else
 		drm_object_property_set_value(&connector->base,
 		    adev_to_drm(adev)->mode_config.panel_type_property,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 1/3] drm/edid: extract base section header processing into helper
  2026-05-26  2:59 ` [PATCH v3 1/3] drm/edid: extract base section header processing into helper Chenyu Chen
@ 2026-05-26  3:09   ` Chen, Chen-Yu
  2026-05-27  5:16   ` Claude review: " Claude Code Review Bot
  1 sibling, 0 replies; 11+ messages in thread
From: Chen, Chen-Yu @ 2026-05-26  3:09 UTC (permalink / raw)
  To: amd-gfx, dri-devel
  Cc: Harry Wentland, Leo Li, Ray Wu, Limonciello Mario, Jani Nikula

I forgot to include Mario's Reviewed-by in the commit message:

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>

On 5/26/2026 10:59 AM, Chenyu Chen wrote:
> Extract the DisplayID base section header logging and non_desktop
> detection from update_displayid_info() into a dedicated helper,
> drm_displayid_process_base_section_header(). Remove the break so the
> iterator walks through all data blocks, preparing for future patches
> that will parse additional block types within the loop.
> 
> The helper is called only once for the base section via a
> base_section_header_processed flag. Since version and primary_use are
> only captured from the base section, and extension sections carry a
> primary use of zero per spec, the non_desktop logic is unaffected.
> 
> No functional change.
> 
> Assisted-by: Copilot:Claude-Opus-4.6
> Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 37 +++++++++++++++++++++----------------
>  1 file changed, 21 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 8031f021d4d0..7ad3f939dbe6 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -6715,30 +6715,35 @@ static void drm_reset_display_info(struct drm_connector *connector)
>  	memset(&info->amd_vsdb, 0, sizeof(info->amd_vsdb));
>  }
>  
> +static void drm_displayid_process_base_section_header(struct drm_connector *connector,
> +						      const struct displayid_iter *iter)
> +{
> +	struct drm_display_info *info = &connector->display_info;
> +
> +	drm_dbg_kms(connector->dev,
> +		    "[CONNECTOR:%d:%s] DisplayID extension version 0x%02x, primary use 0x%02x\n",
> +		    connector->base.id, connector->name,
> +		    displayid_version(iter),
> +		    displayid_primary_use(iter));
> +	if (displayid_version(iter) == DISPLAY_ID_STRUCTURE_VER_20 &&
> +	    (displayid_primary_use(iter) == PRIMARY_USE_HEAD_MOUNTED_VR ||
> +	     displayid_primary_use(iter) == PRIMARY_USE_HEAD_MOUNTED_AR))
> +		info->non_desktop = true;
> +}
> +
>  static void update_displayid_info(struct drm_connector *connector,
>  				  const struct drm_edid *drm_edid)
>  {
> -	struct drm_display_info *info = &connector->display_info;
>  	const struct displayid_block *block;
>  	struct displayid_iter iter;
> +	bool base_section_header_processed = false;
>  
>  	displayid_iter_edid_begin(drm_edid, &iter);
>  	displayid_iter_for_each(block, &iter) {
> -		drm_dbg_kms(connector->dev,
> -			    "[CONNECTOR:%d:%s] DisplayID extension version 0x%02x, primary use 0x%02x\n",
> -			    connector->base.id, connector->name,
> -			    displayid_version(&iter),
> -			    displayid_primary_use(&iter));
> -		if (displayid_version(&iter) == DISPLAY_ID_STRUCTURE_VER_20 &&
> -		    (displayid_primary_use(&iter) == PRIMARY_USE_HEAD_MOUNTED_VR ||
> -		     displayid_primary_use(&iter) == PRIMARY_USE_HEAD_MOUNTED_AR))
> -			info->non_desktop = true;
> -
> -		/*
> -		 * We're only interested in the base section here, no need to
> -		 * iterate further.
> -		 */
> -		break;
> +		if (!base_section_header_processed) {
> +			drm_displayid_process_base_section_header(connector, &iter);
> +			base_section_header_processed = true;
> +		}
>  	}
>  	displayid_iter_end(&iter);
>  }

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 2/3] drm/edid: parse panel type from DisplayID 2.x Display Parameters
  2026-05-26  2:59 ` [PATCH v3 2/3] drm/edid: parse panel type from DisplayID 2.x Display Parameters Chenyu Chen
@ 2026-05-26  3:09   ` Chen, Chen-Yu
  2026-05-27  5:16   ` Claude review: " Claude Code Review Bot
  1 sibling, 0 replies; 11+ messages in thread
From: Chen, Chen-Yu @ 2026-05-26  3:09 UTC (permalink / raw)
  To: amd-gfx, dri-devel
  Cc: Harry Wentland, Leo Li, Ray Wu, Limonciello Mario, Jani Nikula

I forgot to include Mario's Reviewed-by in the commit message:

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>

On 5/26/2026 10:59 AM, Chenyu Chen wrote:
> Parse the Display Parameters Data Block (tag 0x21) defined in
> DisplayID v2.1a Section 4.2.6. Extract the Display Device Technology
> field from the color depth and device technology byte, which indicates
> whether the panel uses LCD or OLED technology.
> 
> Add a panel_type field to struct drm_display_info and populate it
> during DisplayID iteration so downstream drivers can use it for
> panel-type-dependent behavior. Add DRM_MODE_PANEL_TYPE_LCD to the UAPI
> panel type property alongside the existing OLED value.
> 
> Assisted-by: Copilot:Claude-Opus-4.6
> Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
> ---
>  drivers/gpu/drm/drm_connector.c          |  3 +-
>  drivers/gpu/drm/drm_displayid_internal.h | 24 +++++++++++++
>  drivers/gpu/drm/drm_edid.c               | 45 ++++++++++++++++++++++++
>  include/drm/drm_connector.h              |  6 ++++
>  include/uapi/drm/drm_mode.h              |  1 +
>  5 files changed, 78 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index aec05adbc889..f2ac4542a7d3 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -1176,6 +1176,7 @@ static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
>  static const struct drm_prop_enum_list drm_panel_type_enum_list[] = {
>  	{ DRM_MODE_PANEL_TYPE_UNKNOWN, "unknown" },
>  	{ DRM_MODE_PANEL_TYPE_OLED, "OLED" },
> +	{ DRM_MODE_PANEL_TYPE_LCD, "LCD" },
>  };
>  
>  /**
> @@ -1508,7 +1509,7 @@ EXPORT_SYMBOL(drm_hdmi_connector_get_output_format_name);
>   * 	never read back the value of "DPMS" because it can be incorrect.
>   * panel_type:
>   * 	Immutable enum property to indicate the type of connected panel.
> - * 	Possible values are "unknown" (default) and "OLED".
> + * 	Possible values are "unknown" (default), "OLED", and "LCD".
>   * PATH:
>   * 	Connector path property to identify how this sink is physically
>   * 	connected. Used by DP MST. This should be set by calling
> diff --git a/drivers/gpu/drm/drm_displayid_internal.h b/drivers/gpu/drm/drm_displayid_internal.h
> index 5b1b32f73516..6f431aafafcf 100644
> --- a/drivers/gpu/drm/drm_displayid_internal.h
> +++ b/drivers/gpu/drm/drm_displayid_internal.h
> @@ -142,6 +142,30 @@ struct displayid_formula_timing_block {
>  	struct displayid_formula_timings_9 timings[];
>  } __packed;
>  
> +#define DISPLAYID_DEVICE_TECH_UNSPECIFIED	0
> +#define DISPLAYID_DEVICE_TECH_LCD		1
> +#define DISPLAYID_DEVICE_TECH_OLED		2
> +
> +#define DISPLAYID_DISPLAY_PARAMS_DEVICE_TECH	GENMASK(6, 4)
> +
> +struct displayid_display_params_block {
> +	struct displayid_block base;
> +	__le16 horiz_image_size;
> +	__le16 vert_image_size;
> +	__le16 horiz_pixel_count;
> +	__le16 vert_pixel_count;
> +	u8 features;
> +	u8 primary_color1[3];
> +	u8 primary_color2[3];
> +	u8 primary_color3[3];
> +	u8 white_point[3];
> +	__le16 max_luminance_full;
> +	__le16 max_luminance_10;
> +	__le16 min_luminance;
> +	u8 color_depth_and_tech;	/* [2:0] depth, [6:4] device tech, [7] theme */
> +	u8 gamma_eotf;
> +} __packed;
> +
>  #define DISPLAYID_VESA_MSO_OVERLAP	GENMASK(3, 0)
>  #define DISPLAYID_VESA_MSO_MODE		GENMASK(6, 5)
>  
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 7ad3f939dbe6..a9d480981c8f 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -6713,6 +6713,8 @@ static void drm_reset_display_info(struct drm_connector *connector)
>  
>  	info->source_physical_address = CEC_PHYS_ADDR_INVALID;
>  	memset(&info->amd_vsdb, 0, sizeof(info->amd_vsdb));
> +
> +	info->panel_type = DRM_MODE_PANEL_TYPE_UNKNOWN;
>  }
>  
>  static void drm_displayid_process_base_section_header(struct drm_connector *connector,
> @@ -6731,6 +6733,45 @@ static void drm_displayid_process_base_section_header(struct drm_connector *conn
>  		info->non_desktop = true;
>  }
>  
> +static void
> +drm_displayid_parse_display_params(struct drm_connector *connector,
> +				   const struct displayid_block *block)
> +{
> +	struct drm_display_info *info = &connector->display_info;
> +	const struct displayid_display_params_block *params =
> +		(const struct displayid_display_params_block *)block;
> +	u8 tech;
> +
> +	if (block->num_bytes < sizeof(*params) - sizeof(params->base)) {
> +		drm_dbg_kms(connector->dev,
> +			    "[CONNECTOR:%d:%s] DisplayID Display Parameters block too short (%u < %zu)\n",
> +			    connector->base.id, connector->name,
> +			    block->num_bytes,
> +			    sizeof(*params) - sizeof(params->base));
> +		return;
> +	}
> +
> +	tech = FIELD_GET(DISPLAYID_DISPLAY_PARAMS_DEVICE_TECH,
> +			 params->color_depth_and_tech);
> +
> +	drm_dbg_kms(connector->dev,
> +		    "[CONNECTOR:%d:%s] DisplayID Display Parameters: device technology %s\n",
> +		    connector->base.id, connector->name,
> +		    tech == DISPLAYID_DEVICE_TECH_LCD ? "LCD" :
> +		    tech == DISPLAYID_DEVICE_TECH_OLED ? "OLED" : "unspecified");
> +
> +	switch (tech) {
> +	case DISPLAYID_DEVICE_TECH_LCD:
> +		info->panel_type = DRM_MODE_PANEL_TYPE_LCD;
> +		break;
> +	case DISPLAYID_DEVICE_TECH_OLED:
> +		info->panel_type = DRM_MODE_PANEL_TYPE_OLED;
> +		break;
> +	default:
> +		break;
> +	}
> +}
> +
>  static void update_displayid_info(struct drm_connector *connector,
>  				  const struct drm_edid *drm_edid)
>  {
> @@ -6744,6 +6785,10 @@ static void update_displayid_info(struct drm_connector *connector,
>  			drm_displayid_process_base_section_header(connector, &iter);
>  			base_section_header_processed = true;
>  		}
> +
> +		if (displayid_version(&iter) == DISPLAY_ID_STRUCTURE_VER_20 &&
> +		    block->tag == DATA_BLOCK_2_DISPLAY_PARAMETERS)
> +			drm_displayid_parse_display_params(connector, block);
>  	}
>  	displayid_iter_end(&iter);
>  }
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index c398dbc68bbc..745cd917fe40 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -899,6 +899,12 @@ struct drm_display_info {
>  	 * @amd_vsdb: AMD-specific VSDB information.
>  	 */
>  	struct drm_amd_vsdb_info amd_vsdb;
> +
> +	/**
> +	 * @panel_type: Panel type from DisplayID Display Parameters
> +	 * Data Block (tag 0x21). Uses DRM_MODE_PANEL_TYPE_* constants.
> +	 */
> +	u8 panel_type;
>  };
>  
>  int drm_display_info_set_bus_formats(struct drm_display_info *info,
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 3693d82b5279..d7ca1040b92e 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -169,6 +169,7 @@ extern "C" {
>  /* Panel type property */
>  #define DRM_MODE_PANEL_TYPE_UNKNOWN	0
>  #define DRM_MODE_PANEL_TYPE_OLED	1
> +#define DRM_MODE_PANEL_TYPE_LCD		2
>  
>  /*
>   * DRM_MODE_ROTATE_<degrees>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 3/3] drm/amd/display: use DisplayID panel type in dm_set_panel_type
  2026-05-26  2:59 ` [PATCH v3 3/3] drm/amd/display: use DisplayID panel type in dm_set_panel_type Chenyu Chen
@ 2026-05-26  3:09   ` Chen, Chen-Yu
  2026-05-27  5:16   ` Claude review: " Claude Code Review Bot
  1 sibling, 0 replies; 11+ messages in thread
From: Chen, Chen-Yu @ 2026-05-26  3:09 UTC (permalink / raw)
  To: amd-gfx, dri-devel
  Cc: Harry Wentland, Leo Li, Ray Wu, Limonciello Mario, Jani Nikula

I forgot to include Mario's Reviewed-by in the commit message:

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>

On 5/26/2026 10:59 AM, Chenyu Chen wrote:
> Wire up the newly parsed panel_type from drm_display_info into
> amdgpu_dm's panel type detection path. When neither the AMD VSDB
> nor DPCD determines the panel type, fall back to the DisplayID
> Display Device Technology field to set PANEL_TYPE_LCD or
> PANEL_TYPE_OLED accordingly. Also expose LCD to userspace via
> the panel_type connector property.
> 
> Assisted-by: Copilot:Claude-Opus-4.6
> Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c    | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index e42a5eecdf46..ccf933ed63de 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3944,11 +3944,13 @@ static void dm_set_panel_type(struct amdgpu_dm_connector *aconnector)
>  			link->panel_type = PANEL_TYPE_OLED;
>  	}
>  
> -	/*
> -	 * TODO: get panel type from DID2 that has device technology field
> -	 * to specify if it's OLED or not. But we need to wait for DID2
> -	 * support in DC and EDID parser to be able to use it here.
> -	 */
> +	/* If VSDB and DPCD didn't determine panel type, check DID */
> +	if (link->panel_type == PANEL_TYPE_NONE) {
> +		if (display_info->panel_type == DRM_MODE_PANEL_TYPE_LCD)
> +			link->panel_type = PANEL_TYPE_LCD;
> +		else if (display_info->panel_type == DRM_MODE_PANEL_TYPE_OLED)
> +			link->panel_type = PANEL_TYPE_OLED;
> +	}
>  
>  	if (link->panel_type == PANEL_TYPE_NONE) {
>  		struct drm_amd_vsdb_info *vsdb = &display_info->amd_vsdb;
> @@ -3966,6 +3968,10 @@ static void dm_set_panel_type(struct amdgpu_dm_connector *aconnector)
>  		drm_object_property_set_value(&connector->base,
>  		    adev_to_drm(adev)->mode_config.panel_type_property,
>  		    DRM_MODE_PANEL_TYPE_OLED);
> +	else if (link->panel_type == PANEL_TYPE_LCD)
> +		drm_object_property_set_value(&connector->base,
> +		    adev_to_drm(adev)->mode_config.panel_type_property,
> +		    DRM_MODE_PANEL_TYPE_LCD);
>  	else
>  		drm_object_property_set_value(&connector->base,
>  		    adev_to_drm(adev)->mode_config.panel_type_property,

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Claude review: drm: detect panel type from DisplayID 2.x
  2026-05-26  2:59 [PATCH v3 0/3] drm: detect panel type from DisplayID 2.x Chenyu Chen
                   ` (2 preceding siblings ...)
  2026-05-26  2:59 ` [PATCH v3 3/3] drm/amd/display: use DisplayID panel type in dm_set_panel_type Chenyu Chen
@ 2026-05-27  5:16 ` Claude Code Review Bot
  3 siblings, 0 replies; 11+ messages in thread
From: Claude Code Review Bot @ 2026-05-27  5:16 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm: detect panel type from DisplayID 2.x
Author: Chenyu Chen <chen-yu.chen@amd.com>
Patches: 7
Reviewed: 2026-05-27T15:16:42.537253

---

This is a well-structured 3-patch series that adds DisplayID 2.x Display Parameters Data Block parsing to detect LCD/OLED panel types, addressing a longstanding TODO in `dm_set_panel_type()`. The v3 iteration cleanly addresses Jani Nikula's prior review feedback (named struct fields, named defines, helper naming, debug strings).

The series is logically decomposed: (1) refactor to allow iterating all DisplayID blocks, (2) add DRM-core parsing and UAPI, (3) wire into amdgpu_dm. The priority chain (VSDB > DPCD > DisplayID > Samsung heuristic) is correct, and the UAPI addition is backwards-compatible.

No correctness bugs found. A few minor observations below.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Claude review: drm/edid: extract base section header processing into helper
  2026-05-26  2:59 ` [PATCH v3 1/3] drm/edid: extract base section header processing into helper Chenyu Chen
  2026-05-26  3:09   ` Chen, Chen-Yu
@ 2026-05-27  5:16   ` Claude Code Review Bot
  1 sibling, 0 replies; 11+ messages in thread
From: Claude Code Review Bot @ 2026-05-27  5:16 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Status: Looks good.**

The refactoring is clean. Extracting the version/primary_use logging and non_desktop check into `drm_displayid_process_base_section_header()` and removing the `break` statement is the right preparation for iterating over additional block types in patch 2.

The `base_section_header_processed` flag correctly ensures the base section header is only processed once even as the iterator walks through all blocks (including extension sections). The cover letter correctly notes that `displayid_version()` and `displayid_primary_use()` return values from the base section regardless of which extension section the iterator is in, so processing once is sufficient.

One minor style observation: the old code had a `struct drm_display_info *info` local variable in `update_displayid_info()` that is now removed since `info` is accessed inside the helper. This is fine since the variable was only used in the removed code.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Claude review: drm/edid: parse panel type from DisplayID 2.x Display Parameters
  2026-05-26  2:59 ` [PATCH v3 2/3] drm/edid: parse panel type from DisplayID 2.x Display Parameters Chenyu Chen
  2026-05-26  3:09   ` Chen, Chen-Yu
@ 2026-05-27  5:16   ` Claude Code Review Bot
  1 sibling, 0 replies; 11+ messages in thread
From: Claude Code Review Bot @ 2026-05-27  5:16 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Status: Looks good with minor notes.**

The struct definition for `displayid_display_params_block` properly lays out all fields per DisplayID 2.1a spec Table 4-7. The payload size calculates correctly:

```
sizeof(displayid_display_params_block) - sizeof(displayid_block) =
(3 + 2+2+2+2+1+9+3+2+2+2+1+1) - 3 = 29 bytes
```

This matches the expected payload for the Display Parameters block.

The length validation is correct:
```c
if (block->num_bytes < sizeof(*params) - sizeof(params->base))
```

The field extraction `FIELD_GET(DISPLAYID_DISPLAY_PARAMS_DEVICE_TECH, params->color_depth_and_tech)` with `GENMASK(6, 4)` correctly extracts bits [6:4] for the device technology field.

The version guard in `update_displayid_info()`:
```c
if (displayid_version(&iter) == DISPLAY_ID_STRUCTURE_VER_20 &&
    block->tag == DATA_BLOCK_2_DISPLAY_PARAMETERS)
```
correctly restricts parsing to DisplayID 2.x only, since the tag value 0x21 has different semantics in DisplayID 1.x.

**Minor notes:**
- The `panel_type` field added to `drm_display_info` stores `DRM_MODE_PANEL_TYPE_*` UAPI values directly. This is consistent with how other UAPI-facing properties are handled in this struct, but it creates a coupling worth noting — if the UAPI enum ever changes numbering, this field must be updated too. In practice this won't happen since UAPI is stable.

- If a DisplayID contains multiple Display Parameters Data Blocks (theoretically possible per spec, though unusual), the last one wins. This seems acceptable.

- The UAPI addition of `DRM_MODE_PANEL_TYPE_LCD = 2` is backwards-compatible. Existing userspace seeing an unknown enum value would already need to handle it gracefully, and the immutable property documentation is updated accordingly.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Claude review: drm/amd/display: use DisplayID panel type in dm_set_panel_type
  2026-05-26  2:59 ` [PATCH v3 3/3] drm/amd/display: use DisplayID panel type in dm_set_panel_type Chenyu Chen
  2026-05-26  3:09   ` Chen, Chen-Yu
@ 2026-05-27  5:16   ` Claude Code Review Bot
  1 sibling, 0 replies; 11+ messages in thread
From: Claude Code Review Bot @ 2026-05-27  5:16 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Status: Looks good.**

The patch correctly replaces the TODO comment with working code. The insertion point after DPCD and before the Samsung luminance heuristic gives the right priority: VSDB > DPCD > DisplayID > Samsung heuristic.

The mapping between the two enum spaces is correct:
- `DRM_MODE_PANEL_TYPE_LCD (2)` → `PANEL_TYPE_LCD (1)` from `dc_types.h`
- `DRM_MODE_PANEL_TYPE_OLED (1)` → `PANEL_TYPE_OLED (2)` from `dc_types.h`

These are different numbering spaces, and the explicit if/else-if mapping handles the translation correctly without assuming the values match.

The LCD property exposure at the end of the function:
```c
else if (link->panel_type == PANEL_TYPE_LCD)
    drm_object_property_set_value(&connector->base,
        adev_to_drm(adev)->mode_config.panel_type_property,
        DRM_MODE_PANEL_TYPE_LCD);
```
is correctly placed between the OLED and UNKNOWN branches.

**Note:** `PANEL_TYPE_MINILED` still falls through to `DRM_MODE_PANEL_TYPE_UNKNOWN` in the property setting. This is pre-existing behavior, not introduced by this patch, but it means mini-LED panels detected via VSDB/DPCD won't be exposed as a distinct type to userspace. This could be a follow-up enhancement.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-05-27  5:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26  2:59 [PATCH v3 0/3] drm: detect panel type from DisplayID 2.x Chenyu Chen
2026-05-26  2:59 ` [PATCH v3 1/3] drm/edid: extract base section header processing into helper Chenyu Chen
2026-05-26  3:09   ` Chen, Chen-Yu
2026-05-27  5:16   ` Claude review: " Claude Code Review Bot
2026-05-26  2:59 ` [PATCH v3 2/3] drm/edid: parse panel type from DisplayID 2.x Display Parameters Chenyu Chen
2026-05-26  3:09   ` Chen, Chen-Yu
2026-05-27  5:16   ` Claude review: " Claude Code Review Bot
2026-05-26  2:59 ` [PATCH v3 3/3] drm/amd/display: use DisplayID panel type in dm_set_panel_type Chenyu Chen
2026-05-26  3:09   ` Chen, Chen-Yu
2026-05-27  5:16   ` Claude review: " Claude Code Review Bot
2026-05-27  5:16 ` Claude review: drm: detect panel type from DisplayID 2.x Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox