Skip to contentSkip to conversation

drm/i915: Attach a PSR property on eDP

PATCH In review Rodrigo Vivi 2 participants 6 messages Mar 25, 2015 – Mar 26, 2015

Subsystems (3)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

PATCH 1/1 drm/i915: Attach a PSR property on eDP

From: Chris Wilson <[email protected]>

Let userspace know the status of Panel Self-Refresh by virtue of a property on the appropriate connector.

v2: Only attach the property if the driver is capable of PSR.
v3: Add docbook courtesy of Damien.
v4: Mark the initial value as 'unsupported' - it will be determined
correctly when we later read the DCPD from the panel.
v5: Done by Rodrigo:
- Add disabled state to match all cases
- Attach it anyway to eDP since it is started as unsupported
- Change prop name to PSR
- Add enum to make states more clear
- Rebased on intel_psr.c changing func name and fixing states

---
 Documentation/DocBook/drm.tmpl   | 10 +++++++-
 drivers/gpu/drm/i915/i915_drv.h  |  1 +
 drivers/gpu/drm/i915/intel_dp.c  |  1 +
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 drivers/gpu/drm/i915/intel_psr.c | 53 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 65 insertions(+), 1 deletion(-)
Documentation/DocBook/drm.tmpl +9 -1
index f4976cd..bda3948 100644
@@ -2834,7 +2834,7 @@ void intel_crt_init(struct drm_device *dev)
 	<td valign="top" >TBD</td>
 	</tr>
 	<tr>
-	<td rowspan="21" valign="top" >i915</td>
+	<td rowspan="22" valign="top" >i915</td>
 	<td rowspan="2" valign="top" >Generic</td>
 	<td valign="top" >"Broadcast RGB"</td>
 	<td valign="top" >ENUM</td>
@@ -2986,6 +2986,14 @@ void intel_crt_init(struct drm_device *dev)
 	<td valign="top" >TBD</td>
 	</tr>
 	<tr>
+	<td valign="top" >eDP</td>
+	<td valign="top" >“Panel Self-Refresh”</td>
+	<td valign="top" >ENUM | IMMUTABLE</td>
+	<td valign="top" >{ "Unsupported", "Idle", "Active" }</td>
+	<td valign="top" >Connector</td>
+	<td valign="top" >Whether the eDP panel supports using self-refresh, which is a power saving mode for static displays as the panel is able to read from its own buffer rather than require the host to send the same frame on every vertical refresh, and whether it is idle or active</td>
+	</tr>
+	<tr>
 	<td rowspan="2" valign="top" >CDV gma-500</td>
 	<td rowspan="2" valign="top" >Generic</td>
 	<td valign="top" >"Broadcast RGB"</td>
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 92a9e85..afb9741 100644
@@ -878,6 +878,7 @@ struct i915_psr {
 	bool active;
 	struct delayed_work work;
 	unsigned busy_frontbuffer_bits;
+	struct drm_property *property;
 };
 
 enum intel_pch {
drivers/gpu/drm/i915/intel_dp.c +1 -0
index af28833..2aa9a8b 100644
@@ -4774,6 +4774,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 	intel_dp->color_range_auto = true;
 
 	if (is_edp(intel_dp)) {
+		intel_attach_psr_property(connector);
 		drm_mode_create_scaling_mode_property(connector->dev);
 		drm_object_attach_property(
 			&connector->base,
drivers/gpu/drm/i915/intel_drv.h +1 -0
index d79852f..0910782 100644
@@ -1207,6 +1207,7 @@ void intel_backlight_unregister(struct drm_device *dev);
 
 
 /* intel_psr.c */
+void intel_attach_psr_property(struct drm_connector *connector);
 bool intel_psr_match_conditions(struct intel_digital_port *dig_port);
 void intel_psr_enable(struct intel_dp *intel_dp);
 void intel_psr_disable(struct intel_dp *intel_dp);
drivers/gpu/drm/i915/intel_psr.c +53 -0

89 lines not on this page · raw message

Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 20 lines · Rodrigo Vivi

From: Chris Wilson <[email protected]>

Let userspace know the status of Panel Self-Refresh by virtue of a property on the appropriate connector.

v2: Only attach the property if the driver is capable of PSR.
v3: Add docbook courtesy of Damien.
v4: Mark the initial value as 'unsupported' - it will be determined
correctly when we later read the DCPD from the panel.
v5: Done by Rodrigo:
- Add disabled state to match all cases
- Attach it anyway to eDP since it is started as unsupported
- Change prop name to PSR
- Add enum to make states more clear
- Rebased on intel_psr.c changing func name and fixing states

drivers/gpu/drm/i915/intel_psr.c +4 -0
+void intel_attach_psr_property(struct drm_connector *connector)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;

drivers/gpu/drm/i915/intel_psr.c line 86

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +10 -0
+	struct drm_property *prop;
+
+	prop = dev_priv->psr.property;
+	if (prop == NULL) {
+		prop = drm_property_create_enum(dev,
+						DRM_MODE_PROP_ENUM |
+						DRM_MODE_PROP_IMMUTABLE,
+						"PSR",
+						psr_names,
+						ARRAY_SIZE(psr_names));

Are you sure you want the user visible string to be "PSR"? Googling prefers "Panel Self-Refresh".
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#2 lore raw
Quoted 26 lines · Chris Wilson
Quoted 25 lines · Rodrigo Vivi

From: Chris Wilson <[email protected]>

Let userspace know the status of Panel Self-Refresh by virtue of a property on the appropriate connector.

v2: Only attach the property if the driver is capable of PSR.
v3: Add docbook courtesy of Damien.
v4: Mark the initial value as 'unsupported' - it will be determined
correctly when we later read the DCPD from the panel.
v5: Done by Rodrigo:
- Add disabled state to match all cases
- Attach it anyway to eDP since it is started as unsupported
- Change prop name to PSR
- Add enum to make states more clear
- Rebased on intel_psr.c changing func name and fixing states

drivers/gpu/drm/i915/intel_psr.c +9 -0
+void intel_attach_psr_property(struct drm_connector *connector)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_property *prop;
+
+	prop = dev_priv->psr.property;
+	if (prop == NULL) {
+		prop = drm_property_create_enum(dev,
Quoted 8 lines

drivers/gpu/drm/i915/intel_psr.c line 86

Quoted 5 lines
drivers/gpu/drm/i915/intel_psr.c +5 -0
+						DRM_MODE_PROP_ENUM |
+						DRM_MODE_PROP_IMMUTABLE,
+						"PSR",
+						psr_names,
+						ARRAY_SIZE(psr_names));

Are you sure you want the user visible string to be "PSR"? Googling prefers "Panel Self-Refresh".

To be honest, no I'm not sure... something I regretted already... Sorry!

Also talking about visible names I'm not sure about "Idle" as well... Every time I read it get confused... I believe it is because PSR active needs Idle usage...

What do you think about changing to Idle to Enable-Exit and Active to Enable-Active?

Quoted 2 lines

-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 6 lines · Rodrigo

Also talking about visible names I'm not sure about "Idle" as well... Every time I read it get confused... I believe it is because PSR active needs Idle usage...

What do you think about changing to Idle to Enable-Exit and Active to Enable-Active?

If we switch states rapidly, we don't want to change the output property (as it will trigger uevents, or at least it should).

So just "Enabled" ?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#4 lore raw

PATCH 1/1 drm/i915: Attach a PSR property on eDP

Let userspace know the status of Panel Self-Refresh by virtue of a property on the appropriate connector.

v2: Only attach the property if the driver is capable of PSR.
v3: Add docbook courtesy of Damien.
v4: Mark the initial value as 'unsupported' - it will be determined
correctly when we later read the DCPD from the panel.
v5: Done by Rodrigo:
- Add disabled state to match all cases
- Attach it anyway to eDP since it is started as unsupported
- Change prop name to PSR
- Add enum to make states more clear
- Rebased on intel_psr.c changing func name and fixing states
v6: Done by Rodrigo:
- Revert name to Panel Self-Refresh
- Only report Enable/Disable since Active/Exit change so rapidily triggering many uevents as Chris pointed out.

---
 Documentation/DocBook/drm.tmpl   | 10 ++++++++-
 drivers/gpu/drm/i915/i915_drv.h  |  1 +
 drivers/gpu/drm/i915/intel_dp.c  |  1 +
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 drivers/gpu/drm/i915/intel_psr.c | 47 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 59 insertions(+), 1 deletion(-)
Documentation/DocBook/drm.tmpl +9 -1
index f4976cd..bda3948 100644
@@ -2834,7 +2834,7 @@ void intel_crt_init(struct drm_device *dev)
 	<td valign="top" >TBD</td>
 	</tr>
 	<tr>
-	<td rowspan="21" valign="top" >i915</td>
+	<td rowspan="22" valign="top" >i915</td>
 	<td rowspan="2" valign="top" >Generic</td>
 	<td valign="top" >"Broadcast RGB"</td>
 	<td valign="top" >ENUM</td>
@@ -2986,6 +2986,14 @@ void intel_crt_init(struct drm_device *dev)
 	<td valign="top" >TBD</td>
 	</tr>
 	<tr>
+	<td valign="top" >eDP</td>
+	<td valign="top" >“Panel Self-Refresh”</td>
+	<td valign="top" >ENUM | IMMUTABLE</td>
+	<td valign="top" >{ "Unsupported", "Idle", "Active" }</td>
+	<td valign="top" >Connector</td>
+	<td valign="top" >Whether the eDP panel supports using self-refresh, which is a power saving mode for static displays as the panel is able to read from its own buffer rather than require the host to send the same frame on every vertical refresh, and whether it is idle or active</td>
+	</tr>
+	<tr>
 	<td rowspan="2" valign="top" >CDV gma-500</td>
 	<td rowspan="2" valign="top" >Generic</td>
 	<td valign="top" >"Broadcast RGB"</td>
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 92a9e85..afb9741 100644
@@ -878,6 +878,7 @@ struct i915_psr {
 	bool active;
 	struct delayed_work work;
 	unsigned busy_frontbuffer_bits;
+	struct drm_property *property;
 };
 
 enum intel_pch {
drivers/gpu/drm/i915/intel_dp.c +1 -0
index 5551b3c..cfd64bd 100644
@@ -4776,6 +4776,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 	intel_dp->color_range_auto = true;
 
 	if (is_edp(intel_dp)) {
+		intel_attach_psr_property(connector);
 		drm_mode_create_scaling_mode_property(connector->dev);
 		drm_object_attach_property(
 			&connector->base,
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 250d70c..d286ba3 100644
@@ -1207,6 +1207,7 @@ void intel_backlight_unregister(struct drm_device *dev);
 
 
 /* intel_psr.c */
+void intel_attach_psr_property(struct drm_connector *connector);
 bool intel_psr_ready(struct intel_dp *intel_dp);
 void intel_psr_enable(struct intel_dp *intel_dp);
 void intel_psr_disable(struct intel_dp *intel_dp);
drivers/gpu/drm/i915/intel_psr.c +47 -0

65 lines not on this page · raw message

Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#5 lore raw
Quoted 18 lines · Rodrigo Vivi

Let userspace know the status of Panel Self-Refresh by virtue of a property on the appropriate connector.

v2: Only attach the property if the driver is capable of PSR.
v3: Add docbook courtesy of Damien.
v4: Mark the initial value as 'unsupported' - it will be determined
correctly when we later read the DCPD from the panel.
v5: Done by Rodrigo:
- Add disabled state to match all cases
- Attach it anyway to eDP since it is started as unsupported
- Change prop name to PSR
- Add enum to make states more clear
- Rebased on intel_psr.c changing func name and fixing states
v6: Done by Rodrigo:
- Revert name to Panel Self-Refresh
- Only report Enable/Disable since Active/Exit change so rapidily triggering many uevents as Chris pointed out.

Quoted 3 lines

Looks good to me,

We probably want to teach

drm_object_set_value() { if (property == NULL) return -EINVAL; }

but it is safe enough to call with a NULL property, that guard would just short-circuit the search for an impossible property. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx