dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add DRM property for panel type
@ 2026-01-06 17:00 Mario Limonciello (AMD)
  2026-01-06 17:00 ` [PATCH 1/2] drm/connector: Add a new 'panel_type' property Mario Limonciello (AMD)
  2026-01-06 17:00 ` [PATCH 2/2] drm/amd/display: Attach OLED property to eDP panels Mario Limonciello (AMD)
  0 siblings, 2 replies; 6+ messages in thread
From: Mario Limonciello (AMD) @ 2026-01-06 17:00 UTC (permalink / raw)
  To: dri-devel; +Cc: amd-gfx, harry.wentland, Xaver Hugl, Mario Limonciello (AMD)

OLED panels consume a lot less power with darker content.  However
userspace doesn't currently know what kind of panel technology is
used to decide what kind of image to show.

This series introduces a DRM property for the panel type.  Initially
the values are "Unknown" and "OLED" leaving room for expansion later
for other display technologies like MiniLED or LCD if they are sensible
to detect and advertise as well.

A userspace implementation utilizing the new property to decide the
theme of GNOME is available here:

Link: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4029

Mario Limonciello (AMD) (2):
  drm/connector: Add a new 'panel_type' property
  drm/amd/display: Attach OLED property to eDP panels

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  7 ++++
 drivers/gpu/drm/drm_connector.c               | 33 +++++++++++++++++++
 include/drm/drm_connector.h                   |  1 +
 include/drm/drm_mode_config.h                 |  4 +++
 include/uapi/drm/drm_mode.h                   |  4 +++
 5 files changed, 49 insertions(+)

-- 
2.43.0


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

* [PATCH 1/2] drm/connector: Add a new 'panel_type' property
  2026-01-06 17:00 [PATCH 0/2] Add DRM property for panel type Mario Limonciello (AMD)
@ 2026-01-06 17:00 ` Mario Limonciello (AMD)
  2026-01-06 17:00 ` [PATCH 2/2] drm/amd/display: Attach OLED property to eDP panels Mario Limonciello (AMD)
  1 sibling, 0 replies; 6+ messages in thread
From: Mario Limonciello (AMD) @ 2026-01-06 17:00 UTC (permalink / raw)
  To: dri-devel; +Cc: amd-gfx, harry.wentland, Xaver Hugl, Mario Limonciello (AMD)

If the driver can make an assertion whether a connected panel is an OLED
panel or not then it can attach a property to the connector that userspace
can use as a hint for color schemes.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
 drivers/gpu/drm/drm_connector.c | 33 +++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h     |  1 +
 include/drm/drm_mode_config.h   |  4 ++++
 include/uapi/drm/drm_mode.h     |  4 ++++
 4 files changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 4d6dc9ebfdb5b..7d5279c366583 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1167,6 +1167,11 @@ static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
 	{ DRM_MODE_LINK_STATUS_BAD, "Bad" },
 };
 
+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_display_info_set_bus_formats - set the supported bus formats
  * @info: display info to store bus formats in
@@ -1495,6 +1500,9 @@ EXPORT_SYMBOL(drm_hdmi_connector_get_output_format_name);
  * 	Summarizing: Only set "DPMS" when the connector is known to be enabled,
  * 	assume that a successful SETCONFIG call also sets "DPMS" to on, and
  * 	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".
  * PATH:
  * 	Connector path property to identify how this sink is physically
  * 	connected. Used by DP MST. This should be set by calling
@@ -1845,6 +1853,13 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.link_status_property = prop;
 
+	prop = drm_property_create_enum(dev, DRM_MODE_PROP_IMMUTABLE, "panel_type",
+					drm_panel_type_enum_list,
+					ARRAY_SIZE(drm_panel_type_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.panel_type_property = prop;
+
 	prop = drm_property_create_bool(dev, DRM_MODE_PROP_IMMUTABLE, "non-desktop");
 	if (!prop)
 		return -ENOMEM;
@@ -3620,3 +3635,21 @@ struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
 	return tg;
 }
 EXPORT_SYMBOL(drm_mode_create_tile_group);
+
+/**
+ * drm_connector_attach_panel_type_property - attaches panel type property
+ * @connector: connector to attach the property on.
+ *
+ * This is used to add support for panel type detection.
+ */
+void drm_connector_attach_panel_type_property(struct drm_connector *connector)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_property *prop = dev->mode_config.panel_type_property;
+
+	if (!prop)
+		return;
+
+	drm_object_attach_property(&connector->base, prop, DRM_MODE_PANEL_TYPE_UNKNOWN);
+}
+EXPORT_SYMBOL(drm_connector_attach_panel_type_property);
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 8f34f4b8183d8..bd460a6d0d052 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -2448,6 +2448,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
 					       u32 scaling_mode_mask);
 int drm_connector_attach_vrr_capable_property(
 		struct drm_connector *connector);
+void drm_connector_attach_panel_type_property(struct drm_connector *connector);
 int drm_connector_attach_broadcast_rgb_property(struct drm_connector *connector);
 int drm_connector_attach_colorspace_property(struct drm_connector *connector);
 int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 895fb820dba07..5e1dd0cfccde2 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -600,6 +600,10 @@ struct drm_mode_config {
 	 * multiple CRTCs.
 	 */
 	struct drm_property *tile_property;
+	/**
+	 * @panel_type_property: Default connector property for panel type
+	 */
+	struct drm_property *panel_type_property;
 	/**
 	 * @link_status_property: Default connector property for link status
 	 * of a connector
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index cbbbfc1dfe2b8..3693d82b5279f 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -166,6 +166,10 @@ extern "C" {
 #define DRM_MODE_LINK_STATUS_GOOD	0
 #define DRM_MODE_LINK_STATUS_BAD	1
 
+/* Panel type property */
+#define DRM_MODE_PANEL_TYPE_UNKNOWN	0
+#define DRM_MODE_PANEL_TYPE_OLED	1
+
 /*
  * DRM_MODE_ROTATE_<degrees>
  *
-- 
2.43.0


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

* [PATCH 2/2] drm/amd/display: Attach OLED property to eDP panels
  2026-01-06 17:00 [PATCH 0/2] Add DRM property for panel type Mario Limonciello (AMD)
  2026-01-06 17:00 ` [PATCH 1/2] drm/connector: Add a new 'panel_type' property Mario Limonciello (AMD)
@ 2026-01-06 17:00 ` Mario Limonciello (AMD)
  2026-01-08 18:46   ` Leo Li
  1 sibling, 1 reply; 6+ messages in thread
From: Mario Limonciello (AMD) @ 2026-01-06 17:00 UTC (permalink / raw)
  To: dri-devel; +Cc: amd-gfx, harry.wentland, Xaver Hugl, Mario Limonciello (AMD)

amdgpu verifies that a given panel is an OLED panel from extended caps
and can provide accurate information to userspace.  Attach a property
to the DRM connector.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++++
 1 file changed, 7 insertions(+)

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 35dbc6aba4dfc..1cac5ebf50a9d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -91,6 +91,7 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_eld.h>
+#include <drm/drm_mode.h>
 #include <drm/drm_utils.h>
 #include <drm/drm_vblank.h>
 #include <drm/drm_audio_component.h>
@@ -3739,6 +3740,10 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
 	caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps;
 	caps->aux_support = false;
 
+	drm_object_property_set_value(&conn_base->base,
+				      adev_to_drm(adev)->mode_config.panel_type_property,
+				      caps->ext_caps->bits.oled ? DRM_MODE_PANEL_TYPE_OLED : DRM_MODE_PANEL_TYPE_UNKNOWN);
+
 	if (caps->ext_caps->bits.oled == 1
 	    /*
 	     * ||
@@ -9020,6 +9025,8 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
 	if (connector_type == DRM_MODE_CONNECTOR_eDP) {
 		struct drm_privacy_screen *privacy_screen;
 
+		drm_connector_attach_panel_type_property(&aconnector->base);
+
 		privacy_screen = drm_privacy_screen_get(adev_to_drm(adev)->dev, NULL);
 		if (!IS_ERR(privacy_screen)) {
 			drm_connector_attach_privacy_screen_provider(&aconnector->base,
-- 
2.43.0


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

* Re: [PATCH 2/2] drm/amd/display: Attach OLED property to eDP panels
  2026-01-06 17:00 ` [PATCH 2/2] drm/amd/display: Attach OLED property to eDP panels Mario Limonciello (AMD)
@ 2026-01-08 18:46   ` Leo Li
  2026-01-09  8:16     ` Jani Nikula
  0 siblings, 1 reply; 6+ messages in thread
From: Leo Li @ 2026-01-08 18:46 UTC (permalink / raw)
  To: Mario Limonciello (AMD), dri-devel; +Cc: amd-gfx, harry.wentland, Xaver Hugl



On 2026-01-06 12:00, Mario Limonciello (AMD) wrote:
> amdgpu verifies that a given panel is an OLED panel from extended caps
> and can provide accurate information to userspace.  Attach a property
> to the DRM connector.
> 
> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> 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 35dbc6aba4dfc..1cac5ebf50a9d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -91,6 +91,7 @@
>  #include <drm/drm_fourcc.h>
>  #include <drm/drm_edid.h>
>  #include <drm/drm_eld.h>
> +#include <drm/drm_mode.h>
>  #include <drm/drm_utils.h>
>  #include <drm/drm_vblank.h>
>  #include <drm/drm_audio_component.h>
> @@ -3739,6 +3740,10 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
>  	caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps;
>  	caps->aux_support = false;
>  
> +	drm_object_property_set_value(&conn_base->base,
> +				      adev_to_drm(adev)->mode_config.panel_type_property,
> +				      caps->ext_caps->bits.oled ? DRM_MODE_PANEL_TYPE_OLED : DRM_MODE_PANEL_TYPE_UNKNOWN);
> +

I think we'll want to pull this out into something like `dm_set_panel_type()`, called after `update_connector_ext_caps()` and any additional bits of edid parsing needed to make panel_type detection more robust. I suppose that can be a future task.

Series is
Reviewed-by: Leo Li <sunpeng.li@amd.com>

Thanks,
Leo

>  	if (caps->ext_caps->bits.oled == 1
>  	    /*
>  	     * ||
> @@ -9020,6 +9025,8 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
>  	if (connector_type == DRM_MODE_CONNECTOR_eDP) {
>  		struct drm_privacy_screen *privacy_screen;
>  
> +		drm_connector_attach_panel_type_property(&aconnector->base);
> +
>  		privacy_screen = drm_privacy_screen_get(adev_to_drm(adev)->dev, NULL);
>  		if (!IS_ERR(privacy_screen)) {
>  			drm_connector_attach_privacy_screen_provider(&aconnector->base,


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

* Re: [PATCH 2/2] drm/amd/display: Attach OLED property to eDP panels
  2026-01-08 18:46   ` Leo Li
@ 2026-01-09  8:16     ` Jani Nikula
  2026-01-09 19:17       ` Leo Li
  0 siblings, 1 reply; 6+ messages in thread
From: Jani Nikula @ 2026-01-09  8:16 UTC (permalink / raw)
  To: Leo Li, Mario Limonciello (AMD), dri-devel
  Cc: amd-gfx, harry.wentland, Xaver Hugl

On Thu, 08 Jan 2026, Leo Li <sunpeng.li@amd.com> wrote:
> On 2026-01-06 12:00, Mario Limonciello (AMD) wrote:
>> amdgpu verifies that a given panel is an OLED panel from extended caps
>> and can provide accurate information to userspace.  Attach a property
>> to the DRM connector.
>> 
>> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
>> ---
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>> 
>> 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 35dbc6aba4dfc..1cac5ebf50a9d 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -91,6 +91,7 @@
>>  #include <drm/drm_fourcc.h>
>>  #include <drm/drm_edid.h>
>>  #include <drm/drm_eld.h>
>> +#include <drm/drm_mode.h>
>>  #include <drm/drm_utils.h>
>>  #include <drm/drm_vblank.h>
>>  #include <drm/drm_audio_component.h>
>> @@ -3739,6 +3740,10 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
>>  	caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps;
>>  	caps->aux_support = false;
>>  
>> +	drm_object_property_set_value(&conn_base->base,
>> +				      adev_to_drm(adev)->mode_config.panel_type_property,
>> +				      caps->ext_caps->bits.oled ? DRM_MODE_PANEL_TYPE_OLED : DRM_MODE_PANEL_TYPE_UNKNOWN);
>> +
>
> I think we'll want to pull this out into something like
> `dm_set_panel_type()`, called after `update_connector_ext_caps()` and
> any additional bits of edid parsing needed to make panel_type
> detection more robust. I suppose that can be a future task.

I really wish you moved *all* EDID parsing to drm_edid.c instead of
having your own.

BR,
Jani.

>
> Series is
> Reviewed-by: Leo Li <sunpeng.li@amd.com>
>
> Thanks,
> Leo
>
>>  	if (caps->ext_caps->bits.oled == 1
>>  	    /*
>>  	     * ||
>> @@ -9020,6 +9025,8 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
>>  	if (connector_type == DRM_MODE_CONNECTOR_eDP) {
>>  		struct drm_privacy_screen *privacy_screen;
>>  
>> +		drm_connector_attach_panel_type_property(&aconnector->base);
>> +
>>  		privacy_screen = drm_privacy_screen_get(adev_to_drm(adev)->dev, NULL);
>>  		if (!IS_ERR(privacy_screen)) {
>>  			drm_connector_attach_privacy_screen_provider(&aconnector->base,
>

-- 
Jani Nikula, Intel

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

* Re: [PATCH 2/2] drm/amd/display: Attach OLED property to eDP panels
  2026-01-09  8:16     ` Jani Nikula
@ 2026-01-09 19:17       ` Leo Li
  0 siblings, 0 replies; 6+ messages in thread
From: Leo Li @ 2026-01-09 19:17 UTC (permalink / raw)
  To: Jani Nikula, Mario Limonciello (AMD), dri-devel
  Cc: amd-gfx, harry.wentland, Xaver Hugl



On 2026-01-09 03:16, Jani Nikula wrote:
> On Thu, 08 Jan 2026, Leo Li <sunpeng.li@amd.com> wrote:
>> On 2026-01-06 12:00, Mario Limonciello (AMD) wrote:
>>> amdgpu verifies that a given panel is an OLED panel from extended caps
>>> and can provide accurate information to userspace.  Attach a property
>>> to the DRM connector.
>>>
>>> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
>>> ---
>>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++++
>>>  1 file changed, 7 insertions(+)
>>>
>>> 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 35dbc6aba4dfc..1cac5ebf50a9d 100644
>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>> @@ -91,6 +91,7 @@
>>>  #include <drm/drm_fourcc.h>
>>>  #include <drm/drm_edid.h>
>>>  #include <drm/drm_eld.h>
>>> +#include <drm/drm_mode.h>
>>>  #include <drm/drm_utils.h>
>>>  #include <drm/drm_vblank.h>
>>>  #include <drm/drm_audio_component.h>
>>> @@ -3739,6 +3740,10 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
>>>  	caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps;
>>>  	caps->aux_support = false;
>>>  
>>> +	drm_object_property_set_value(&conn_base->base,
>>> +				      adev_to_drm(adev)->mode_config.panel_type_property,
>>> +				      caps->ext_caps->bits.oled ? DRM_MODE_PANEL_TYPE_OLED : DRM_MODE_PANEL_TYPE_UNKNOWN);
>>> +
>>
>> I think we'll want to pull this out into something like
>> `dm_set_panel_type()`, called after `update_connector_ext_caps()` and
>> any additional bits of edid parsing needed to make panel_type
>> detection more robust. I suppose that can be a future task.
> 
> I really wish you moved *all* EDID parsing to drm_edid.c instead of
> having your own.

That can definitely be considered :) Maybe not everything all at once, but any new bits for sure.
- Leo

> 
> BR,
> Jani.
> 
>>
>> Series is
>> Reviewed-by: Leo Li <sunpeng.li@amd.com>
>>
>> Thanks,
>> Leo
>>
>>>  	if (caps->ext_caps->bits.oled == 1
>>>  	    /*
>>>  	     * ||
>>> @@ -9020,6 +9025,8 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
>>>  	if (connector_type == DRM_MODE_CONNECTOR_eDP) {
>>>  		struct drm_privacy_screen *privacy_screen;
>>>  
>>> +		drm_connector_attach_panel_type_property(&aconnector->base);
>>> +
>>>  		privacy_screen = drm_privacy_screen_get(adev_to_drm(adev)->dev, NULL);
>>>  		if (!IS_ERR(privacy_screen)) {
>>>  			drm_connector_attach_privacy_screen_provider(&aconnector->base,
>>
> 


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

end of thread, other threads:[~2026-01-09 19:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-06 17:00 [PATCH 0/2] Add DRM property for panel type Mario Limonciello (AMD)
2026-01-06 17:00 ` [PATCH 1/2] drm/connector: Add a new 'panel_type' property Mario Limonciello (AMD)
2026-01-06 17:00 ` [PATCH 2/2] drm/amd/display: Attach OLED property to eDP panels Mario Limonciello (AMD)
2026-01-08 18:46   ` Leo Li
2026-01-09  8:16     ` Jani Nikula
2026-01-09 19:17       ` Leo Li

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