Skip to contentSkip to conversation

drm/i915: HSW/BDW PSR Set idle_frames = VBT + 1

PATCH In review Rodrigo Vivi 3 participants 8 messages Nov 7, 2014 – Nov 12, 2014

Subsystems (2)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

PATCH 1/4 drm/i915: HSW/BDW PSR Set idle_frames = VBT + 1

Let's use VBT + 1 now we parse it.

v2: fix subject and consider that idle_frame = 2 is another fix.

---
 drivers/gpu/drm/i915/intel_dp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +6 -1
index 20beb59..41df221 100644
@@ -2174,7 +2174,12 @@ static void intel_edp_psr_enable_source(struct intel_dp *intel_dp)
 	struct drm_device *dev = dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t max_sleep_time = 0x1f;
-	uint32_t idle_frames = 2; /* 2 is the minimum allowed */
+	/* Lately it was identified that depending on panel idle frame count
+	 * calculated at HW can be off by 1. So let's use what came
+	 * from VBT + 1 and at minimum 2 to stay on the safest side.
+	 */
+	uint32_t idle_frames = dev_priv->vbt.psr.idle_frames ?
+			       dev_priv->vbt.psr.idle_frames + 1 : 2;
 	uint32_t val = 0x0;
 	const uint32_t link_entry_time = EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
 	bool only_standby = false;
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#1 lore raw

PATCH 2/4 drm/i915: Make dp aux pack/unpack public outside intel_dp.c

No functional change. Just making it public for use outside intel_dp.c Allowing split psr functions.

---
 drivers/gpu/drm/i915/intel_dp.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +7 -8
index 41df221..cab57e2 100644
@@ -227,8 +227,7 @@ intel_dp_mode_valid(struct drm_connector *connector,
 	return MODE_OK;
 }
 
-static uint32_t
-pack_aux(const uint8_t *src, int src_bytes)
+uint32_t intel_dp_pack_aux(const uint8_t *src, int src_bytes)
 {
 	int	i;
 	uint32_t v = 0;
@@ -240,8 +239,7 @@ pack_aux(const uint8_t *src, int src_bytes)
 	return v;
 }
 
-static void
-unpack_aux(uint32_t src, uint8_t *dst, int dst_bytes)
+void intel_dp_unpack_aux(uint32_t src, uint8_t *dst, int dst_bytes)
 {
 	int i;
 	if (dst_bytes > 4)
@@ -863,7 +861,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 			/* Load the send data into the aux channel data registers */
 			for (i = 0; i < send_bytes; i += 4)
 				I915_WRITE(ch_data + i,
-					   pack_aux(send + i, send_bytes - i));
+					   intel_dp_pack_aux(send + i,
+							     send_bytes - i));
 
 			/* Send the command and wait for it to complete */
 			I915_WRITE(ch_ctl, send_ctl);
@@ -917,8 +916,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 		recv_bytes = recv_size;
 
 	for (i = 0; i < recv_bytes; i += 4)
-		unpack_aux(I915_READ(ch_data + i),
-			   recv + i, recv_bytes - i);
+		intel_dp_unpack_aux(I915_READ(ch_data + i),
+				    recv + i, recv_bytes - i);
 
 	ret = recv_bytes;
 out:
@@ -2159,7 +2158,7 @@ static void intel_edp_psr_enable_sink(struct intel_dp *intel_dp)
 	/* Setup AUX registers */
 	for (i = 0; i < sizeof(aux_msg); i += 4)
 		I915_WRITE(EDP_PSR_AUX_DATA1(dev) + i,
-			   pack_aux(&aux_msg[i], sizeof(aux_msg) - i));
+			   intel_dp_pack_aux(&aux_msg[i], sizeof(aux_msg) - i));
 
 	I915_WRITE(EDP_PSR_AUX_CTL(dev),
 		   DP_AUX_CH_CTL_TIME_OUT_400us |
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#2 lore raw

PATCH 3/4 drm/i915: Introduce intel_psr.c

In reply to Rodrigo Vivi

No functional changes. Just cleaning and reorganizing it.

---
 drivers/gpu/drm/i915/Makefile            |   1 +
 drivers/gpu/drm/i915/intel_ddi.c         |   4 +-
 drivers/gpu/drm/i915/intel_display.c     |   2 +-
 drivers/gpu/drm/i915/intel_dp.c          | 386 +----------------------------
 drivers/gpu/drm/i915/intel_drv.h         |  21 +-
 drivers/gpu/drm/i915/intel_frontbuffer.c |   4 +-
 drivers/gpu/drm/i915/intel_psr.c         | 413 +++++++++++++++++++++++++++++++
 7 files changed, 433 insertions(+), 398 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_psr.c
drivers/gpu/drm/i915/Makefile +1 -0
index 891e584..e4083e4 100644
@@ -51,6 +51,7 @@ i915-y += intel_audio.o \
 	  intel_frontbuffer.o \
 	  intel_modes.o \
 	  intel_overlay.o \
+	  intel_psr.o \
 	  intel_sideband.o \
 	  intel_sprite.o
 i915-$(CONFIG_ACPI)		+= intel_acpi.o intel_opregion.o
drivers/gpu/drm/i915/intel_ddi.c +2 -2
index 68703ce..a5a8acd 100644
@@ -1228,7 +1228,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
 			intel_dp_stop_link_train(intel_dp);
 
 		intel_edp_backlight_on(intel_dp);
-		intel_edp_psr_enable(intel_dp);
+		intel_psr_enable(intel_dp);
 	}
 
 	if (intel_crtc->config.has_audio) {
@@ -1254,7 +1254,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 	if (type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
-		intel_edp_psr_disable(intel_dp);
+		intel_psr_disable(intel_dp);
 		intel_edp_backlight_off(intel_dp);
 	}
 }
drivers/gpu/drm/i915/intel_display.c +1 -1
index ff071a7..3bcdf87 100644
@@ -12231,7 +12231,7 @@ static void intel_setup_outputs(struct drm_device *dev)
 	if (SUPPORTS_TV(dev))
 		intel_tv_init(dev);
 
-	intel_edp_psr_init(dev);
+	intel_psr_init(dev);
 
 	for_each_intel_encoder(dev, encoder) {
 		encoder->base.possible_crtcs = encoder->crtc_mask;
drivers/gpu/drm/i915/intel_dp.c +1 -385

398 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +13 -8
index 5c622ad..df25a09 100644
@@ -992,21 +992,16 @@ void intel_edp_backlight_off(struct intel_dp *intel_dp);
 void intel_edp_panel_vdd_on(struct intel_dp *intel_dp);
 void intel_edp_panel_on(struct intel_dp *intel_dp);
 void intel_edp_panel_off(struct intel_dp *intel_dp);
-void intel_edp_psr_enable(struct intel_dp *intel_dp);
-void intel_edp_psr_disable(struct intel_dp *intel_dp);
 void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate);
-void intel_edp_psr_invalidate(struct drm_device *dev,
-			      unsigned frontbuffer_bits);
-void intel_edp_psr_flush(struct drm_device *dev,
-			 unsigned frontbuffer_bits);
-void intel_edp_psr_init(struct drm_device *dev);
-
 void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector);
 void intel_dp_mst_suspend(struct drm_device *dev);
 void intel_dp_mst_resume(struct drm_device *dev);
 int intel_dp_max_link_bw(struct intel_dp *intel_dp);
 void intel_dp_hot_plug(struct intel_encoder *intel_encoder);
 void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv);
+uint32_t intel_dp_pack_aux(const uint8_t *src, int src_bytes);
+void intel_dp_unpack_aux(uint32_t src, uint8_t *dst, int dst_bytes);
+
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
 void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port);
@@ -1107,6 +1102,16 @@ extern struct drm_display_mode *intel_find_panel_downclock(
 				struct drm_display_mode *fixed_mode,
 				struct drm_connector *connector);
 
+/* intel_psr.c */
+bool intel_psr_is_enabled(struct drm_device *dev);
+void intel_psr_enable(struct intel_dp *intel_dp);
+void intel_psr_disable(struct intel_dp *intel_dp);
+void intel_psr_invalidate(struct drm_device *dev,
+			      unsigned frontbuffer_bits);
+void intel_psr_flush(struct drm_device *dev,
+			 unsigned frontbuffer_bits);
+void intel_psr_init(struct drm_device *dev);
+
 /* intel_runtime_pm.c */
 int intel_power_domains_init(struct drm_i915_private *);
 void intel_power_domains_fini(struct drm_i915_private *);
drivers/gpu/drm/i915/intel_frontbuffer.c +2 -2
index 58cf2e6..79f6d72 100644
@@ -156,7 +156,7 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
 
 	intel_mark_fb_busy(dev, obj->frontbuffer_bits, ring);
 
-	intel_edp_psr_invalidate(dev, obj->frontbuffer_bits);
+	intel_psr_invalidate(dev, obj->frontbuffer_bits);
 }
 
 /**
@@ -182,7 +182,7 @@ void intel_frontbuffer_flush(struct drm_device *dev,
 
 	intel_mark_fb_busy(dev, frontbuffer_bits, NULL);
 
-	intel_edp_psr_flush(dev, frontbuffer_bits);
+	intel_psr_flush(dev, frontbuffer_bits);
 
 	/*
 	 * FIXME: Unconditional fbc flushing here is a rather gross hack and
drivers/gpu/drm/i915/intel_psr.c new file +413 -0

413 lines not on this page · raw message

Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#3 lore raw

PATCH 4/4 drm/i915: Add PSR docbook

In reply to Rodrigo Vivi

Let's document PSR a bit. No functional changes.

---
 drivers/gpu/drm/i915/intel_psr.c | 58 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
drivers/gpu/drm/i915/intel_psr.c +58 -0
index 793f491..5f350f0 100644
@@ -21,6 +21,26 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+/**
+ * DOC: Panel Self Refresh (PSR/SRD)
+ *
+ * Since 4th Generation Intel® Core™ processors with Intel® HD Graphics
+ * (Haswell) Display controller supports Panel Self-Refresh on display panels
+ * witch have a remote frame buffer (RFB) implemented according to PSR spec in
+ * eDP1.3. PSR feature allows the display to go to lower standby states when
+ * system is idle but display is on as it eliminates diplay refresh request
+ * to DDR memory completely as long as the frame buffer for that display is
+ * unchanged.
+ *
+ * Panel Self Refresh must be supported by both Hardware (source) and
+ * Panel (sink).
+ *
+ * The PSR feature enables system-level power savings when the displayed image
+ * remains static for multiple display frames. The Sink device stores a static
+ * image locally in the RFB within the Sink device, and displays this image
+ * from the RFB, while the eDP Main-Link can be turned OFF.
+ */
+
 #include <drm/drmP.h>
 
 #include "intel_drv.h"
@@ -222,6 +242,13 @@ static void intel_psr_do_enable(struct intel_dp *intel_dp)
 	dev_priv->psr.active = true;
 }
 
+/**
+ * intel_psr_enable - Enable PSR
+ * @intel_dp: Intel DP
+ *
+ * This function gets called every time eDP panel is turned on. Right after
+ * turning backlight on.
+ */
 void intel_psr_enable(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
@@ -263,6 +290,13 @@ unlock:
 	mutex_unlock(&dev_priv->psr.lock);
 }
 
+/**
+ * intel_psr_disable - Disable PSR
+ * @intel_dp: Intel DP
+ *
+ * This function gets called every time eDP panel is turned off. Right before
+ * turning backlight off.
+ */
 void intel_psr_disable(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
@@ -347,6 +381,16 @@ static void intel_psr_exit(struct drm_device *dev)
 
 }
 
+/**
+ * intel_psr_invalidate - Invalidade PSR
+ * @dev: DRM device
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * Hardware (source) is usually the responsible for identifying when the screen
+ * changed and Remote Frame Buffer must be updated. However this HW tracking
+ * doesn't cover all cases. So we can take advantage of frontbuffer tracking
+ * to force a psr_exit when driver knows RFB must be updated.
+ */
 void intel_psr_invalidate(struct drm_device *dev,
 			      unsigned frontbuffer_bits)
 {
@@ -371,6 +415,14 @@ void intel_psr_invalidate(struct drm_device *dev,
 	mutex_unlock(&dev_priv->psr.lock);
 }
 
+/**
+ * intel_psr_flush - Flush PSR
+ * @dev: DRM device
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * After PSR got invalidated forcing PSR exit and RFB update driver must also
+ * take care to flush it allowing PSR to come back to regular work.
+ */
 void intel_psr_flush(struct drm_device *dev,
 			 unsigned frontbuffer_bits)
 {
@@ -404,6 +456,12 @@ void intel_psr_flush(struct drm_device *dev,
 	mutex_unlock(&dev_priv->psr.lock);
 }
 
+/**
+ * intel_psr_init - Init basic PSR work and mutex.
+ * @dev: DRM device
+ *
+ * This function is to be called only once to initialize basic PSR stuff.
+ */
 void intel_psr_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
Signature · 6 lines
1.9.3

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

Re: [PATCH 4/4] drm/i915: Add PSR docbook

Quoted 3 lines · Rodrigo Vivi

Let's document PSR a bit. No functional changes.

I've tried to merge the preceeding patches to avoid rebase pain, but there's conflicts. I think it'd be best if we get those patches into shape first. A few comments below to clarify the kerneldoc.

Thanks for doing this, docs are always highly appreciated! -Daniel

Quoted 20 lines
---
 drivers/gpu/drm/i915/intel_psr.c | 58 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
drivers/gpu/drm/i915/intel_psr.c +8 -0
index 793f491..5f350f0 100644
@@ -21,6 +21,26 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+/**
+ * DOC: Panel Self Refresh (PSR/SRD)
+ *
+ * Since 4th Generation Intel® Core™ processors with Intel® HD Graphics
+ * (Haswell) Display controller supports Panel Self-Refresh on display panels
+ * witch have a remote frame buffer (RFB) implemented according to PSR spec in
+ * eDP1.3. PSR feature allows the display to go to lower standby states when
+ * system is idle but display is on as it eliminates diplay refresh request

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

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +10 -0
+ * to DDR memory completely as long as the frame buffer for that display is
+ * unchanged.
+ *
+ * Panel Self Refresh must be supported by both Hardware (source) and
+ * Panel (sink).
+ *
+ * The PSR feature enables system-level power savings when the displayed image
+ * remains static for multiple display frames. The Sink device stores a static
+ * image locally in the RFB within the Sink device, and displays this image
+ * from the RFB, while the eDP Main-Link can be turned OFF.

This smells a lot like a marketing copy. Generally in code we don't use marketing names but e.g. hsw.

Also it misses to explain the tricky implementation details, which is what's actually important for the implementation. That psr has nice power saving benefits is important, but I wouldn't put more than a sentence into that, e.g.

"PSR saves power by caching the framebuffer in the panel, which allows us to power down the link and memory controller. For DSI panels the same idea is called "manual mode".

"The implementation uses the hardware-based PSR support which automatically enters/exits self-refresh mode. The hardware takes care of sending the required DP aux message and could even retrain the link (that part isn't enabled yet though). The hardware also keeps track of any frontbuffer changes to know when to exit self-refresh mode again. Unfortunately that part doesn't work too well, hence why the i915 PSR support uses the software frontbuffer tracking to make sure it doesn't miss a screen update. For this integration intel_psr_invalidate() and intel_psr_flush() get called by the frontbuffer tracking code. Note that because of locking issues the self-refresh re-enable code is done from a work queue, which must be correctly synchronized/cancelled when shutting down the pipe."

This way docs raise the tricky parts of the implementation and how/where this integrates with the driver.

Quoted 6 lines
drivers/gpu/drm/i915/intel_psr.c +2 -0
+ */
+
 #include <drm/drmP.h>
 
 #include "intel_drv.h"

drivers/gpu/drm/i915/intel_psr.c static void intel_psr_do_enable(struct intel_dp *intel_dp) · line 250

Quoted 9 lines
drivers/gpu/drm/i915/intel_psr.c +6 -0
@@ -222,6 +242,13 @@ static void intel_psr_do_enable(struct intel_dp *intel_dp)
 	dev_priv->psr.active = true;
 }
 
+/**
+ * intel_psr_enable - Enable PSR
+ * @intel_dp: Intel DP
+ *
+ * This function gets called every time eDP panel is turned on. Right after
+ * turning backlight on.

Does the backlight really matter? Should this be: "This can only be called after the pipe is fully trained and enabled."?

Quoted 5 lines
drivers/gpu/drm/i915/intel_psr.c +1 -0
+ */
 void intel_psr_enable(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);

drivers/gpu/drm/i915/intel_psr.c unlock: · line 298

Quoted 9 lines
drivers/gpu/drm/i915/intel_psr.c +6 -0
@@ -263,6 +290,13 @@ unlock:
 	mutex_unlock(&dev_priv->psr.lock);
 }
 
+/**
+ * intel_psr_disable - Disable PSR
+ * @intel_dp: Intel DP
+ *
+ * This function gets called every time eDP panel is turned off. Right before
+ * turning backlight off.

Same here.

Quoted 7 lines
drivers/gpu/drm/i915/intel_psr.c +1 -0
+ */
 void intel_psr_disable(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
@@ -347,6 +381,16 @@ static void intel_psr_exit(struct drm_device *dev)
 
 }

drivers/gpu/drm/i915/intel_psr.c static void intel_psr_exit(struct drm_device *dev) · line 392

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +9 -0
 
+/**
+ * intel_psr_invalidate - Invalidade PSR
+ * @dev: DRM device
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * Hardware (source) is usually the responsible for identifying when the screen
+ * changed and Remote Frame Buffer must be updated. However this HW tracking
+ * doesn't cover all cases. So we can take advantage of frontbuffer tracking
+ * to force a psr_exit when driver knows RFB must be updated.

Source hardware isn't responsible for tracking, this is just how it's implemented on intel hw. You can do psr in software. What about:

"Since the hardware frontbuffer tracking has gaps we need to integrate with the software frontbuffer tracking. This function gets called every time frontbuffer rendering has completed and flushed out to memory. PSR can be enabled again if no other frontbuffer relevant to PSR is dirty.

Dirty frontbuffers relevant to PSR are tracked in busy_frontbuffer_bits."

Quoted 5 lines
drivers/gpu/drm/i915/intel_psr.c +1 -0
+ */
 void intel_psr_invalidate(struct drm_device *dev,
 			      unsigned frontbuffer_bits)
 {

drivers/gpu/drm/i915/intel_psr.c void intel_psr_invalidate(struct drm_device *dev, · line 424

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +7 -0
@@ -371,6 +415,14 @@ void intel_psr_invalidate(struct drm_device *dev,
 	mutex_unlock(&dev_priv->psr.lock);
 }
 
+/**
+ * intel_psr_flush - Flush PSR
+ * @dev: DRM device
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * After PSR got invalidated forcing PSR exit and RFB update driver must also
+ * take care to flush it allowing PSR to come back to regular work.

"Since the hardware frontbuffer tracking has gaps we need to integrate with the software frontbuffer tracking. This function gets called every time frontbuffer rendering starts and a buffer gets dirtied. PSR must be disabled if the frontbuffer mask contains a buffer relevant to PSR.

Dirty frontbuffers relevant to PSR are tracked in busy_frontbuffer_bits."

drivers/gpu/drm/i915/intel_psr.c void intel_psr_flush(struct drm_device *dev, · line 463

Quoted 13 lines
drivers/gpu/drm/i915/intel_psr.c +6 -0
+ */
 void intel_psr_flush(struct drm_device *dev,
 			 unsigned frontbuffer_bits)
 {
@@ -404,6 +456,12 @@ void intel_psr_flush(struct drm_device *dev,
 	mutex_unlock(&dev_priv->psr.lock);
 }
 
+/**
+ * intel_psr_init - Init basic PSR work and mutex.
+ * @dev: DRM device
+ *
+ * This function is to be called only once to initialize basic PSR stuff.

s/to be// and maybe s/once/once at driver load/

Quoted 11 lines
drivers/gpu/drm/i915/intel_psr.c +1 -0
+ */
 void intel_psr_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [PATCH 4/4] drm/i915: Add PSR docbook

Quoted 8 lines · Daniel Vetter
Quoted 3 lines · Rodrigo Vivi

Let's document PSR a bit. No functional changes.

I've tried to merge the preceeding patches to avoid rebase pain, but there's conflicts. I think it'd be best if we get those patches into shape first. A few comments below to clarify the kerneldoc.

Thanks. I started the rebase yesterday putting it on begin of the series than vbt work and at least 1 or 2 more coming. Also I'll send along with vlv/chv rebased... Putting everything organized together.

Quoted 29 lines

Thanks for doing this, docs are always highly appreciated! -Daniel

Quoted 25 lines
---
 drivers/gpu/drm/i915/intel_psr.c | 58 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
drivers/gpu/drm/i915/intel_psr.c +13 -0
index 793f491..5f350f0 100644
@@ -21,6 +21,26 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+/**
+ * DOC: Panel Self Refresh (PSR/SRD)
+ *
+ * Since 4th Generation Intel® Core™ processors with Intel® HD Graphics
+ * (Haswell) Display controller supports Panel Self-Refresh on display panels
+ * witch have a remote frame buffer (RFB) implemented according to PSR spec in
+ * eDP1.3. PSR feature allows the display to go to lower standby states when
+ * system is idle but display is on as it eliminates diplay refresh request
+ * to DDR memory completely as long as the frame buffer for that display is
+ * unchanged.
+ *
+ * Panel Self Refresh must be supported by both Hardware (source) and
+ * Panel (sink).
Quoted 8 lines

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

Quoted 5 lines
drivers/gpu/drm/i915/intel_psr.c +5 -0
+ *
+ * The PSR feature enables system-level power savings when the displayed image
+ * remains static for multiple display frames. The Sink device stores a static
+ * image locally in the RFB within the Sink device, and displays this image
+ * from the RFB, while the eDP Main-Link can be turned OFF.

This smells a lot like a marketing copy. Generally in code we don't use marketing names but e.g. hsw.

I got vesa spec + our pm enabling guide and put the market names by myself. Used to use market names on stack releases.

I believe that on docs that is visible to end users we could use more market names besides the codenames.

Quoted 22 lines

Also it misses to explain the tricky implementation details, which is what's actually important for the implementation. That psr has nice power saving benefits is important, but I wouldn't put more than a sentence into that, e.g.

"PSR saves power by caching the framebuffer in the panel, which allows us to power down the link and memory controller. For DSI panels the same idea is called "manual mode".

"The implementation uses the hardware-based PSR support which automatically enters/exits self-refresh mode. The hardware takes care of sending the required DP aux message and could even retrain the link (that part isn't enabled yet though). The hardware also keeps track of any frontbuffer changes to know when to exit self-refresh mode again. Unfortunately that part doesn't work too well, hence why the i915 PSR support uses the software frontbuffer tracking to make sure it doesn't miss a screen update. For this integration intel_psr_invalidate() and intel_psr_flush() get called by the frontbuffer tracking code. Note that because of locking issues the self-refresh re-enable code is done from a work queue, which must be correctly synchronized/cancelled when shutting down the pipe."

Quoted 3 lines

This way docs raise the tricky parts of the implementation and how/where this integrates with the driver.

Quoted 1 line
drivers/gpu/drm/i915/intel_psr.c +1 -0
+ */

Good. Thanks!

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_psr.c +1 -0
+
 #include <drm/drmP.h>
 
 #include "intel_drv.h"
@@ -222,6 +242,13 @@ static void intel_psr_do_enable(struct intel_dp *intel_dp)
      dev_priv->psr.active = true;
 }
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_psr.c static void intel_psr_do_enable(struct intel_dp *intel_dp) · line 250

Quoted 6 lines
drivers/gpu/drm/i915/intel_psr.c +6 -0
+/**
+ * intel_psr_enable - Enable PSR
+ * @intel_dp: Intel DP
+ *
+ * This function gets called every time eDP panel is turned on. Right after
+ * turning backlight on.

Does the backlight really matter? Should this be: "This can only be called after the pipe is fully trained and enabled."?

definitely better. Thanks.

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_psr.c +1 -0
+ */
 void intel_psr_enable(struct intel_dp *intel_dp)
 {
      struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
@@ -263,6 +290,13 @@ unlock:
      mutex_unlock(&dev_priv->psr.lock);
 }
 
Quoted 8 lines

drivers/gpu/drm/i915/intel_psr.c unlock: · line 298

Quoted 6 lines
drivers/gpu/drm/i915/intel_psr.c +6 -0
+/**
+ * intel_psr_disable - Disable PSR
+ * @intel_dp: Intel DP
+ *
+ * This function gets called every time eDP panel is turned off. Right before
+ * turning backlight off.

Same here.

noted.

Quoted 22 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_psr.c +1 -0
+ */
 void intel_psr_disable(struct intel_dp *intel_dp)
 {
      struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
@@ -347,6 +381,16 @@ static void intel_psr_exit(struct drm_device *dev)
 
 }

drivers/gpu/drm/i915/intel_psr.c static void intel_psr_exit(struct drm_device *dev) · line 392

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +9 -0
 
+/**
+ * intel_psr_invalidate - Invalidade PSR
+ * @dev: DRM device
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * Hardware (source) is usually the responsible for identifying when the screen
+ * changed and Remote Frame Buffer must be updated. However this HW tracking
+ * doesn't cover all cases. So we can take advantage of frontbuffer tracking
+ * to force a psr_exit when driver knows RFB must be updated.

Source hardware isn't responsible for tracking, this is just how it's implemented on intel hw. You can do psr in software. What about:

Quoted 6 lines

"Since the hardware frontbuffer tracking has gaps we need to integrate with the software frontbuffer tracking. This function gets called every time frontbuffer rendering has completed and flushed out to memory. PSR can be enabled again if no other frontbuffer relevant to PSR is dirty.

Dirty frontbuffers relevant to PSR are tracked in busy_frontbuffer_bits."

yeah. I'd have to change that for vlv/chv anyway where hw can never track. thanks.

Quoted 22 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_psr.c +1 -0
+ */
 void intel_psr_invalidate(struct drm_device *dev,
                            unsigned frontbuffer_bits)
 {

drivers/gpu/drm/i915/intel_psr.c void intel_psr_invalidate(struct drm_device *dev, · line 424

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +7 -0
@@ -371,6 +415,14 @@ void intel_psr_invalidate(struct drm_device *dev,
      mutex_unlock(&dev_priv->psr.lock);
 }
 
+/**
+ * intel_psr_flush - Flush PSR
+ * @dev: DRM device
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * After PSR got invalidated forcing PSR exit and RFB update driver must also
+ * take care to flush it allowing PSR to come back to regular work.

"Since the hardware frontbuffer tracking has gaps we need to integrate with the software frontbuffer tracking. This function gets called every time frontbuffer rendering starts and a buffer gets dirtied. PSR must be disabled if the frontbuffer mask contains a buffer relevant to PSR.

Quoted 1 line

Dirty frontbuffers relevant to PSR are tracked in busy_frontbuffer_bits."

noted

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_psr.c +1 -0
+ */
 void intel_psr_flush(struct drm_device *dev,
                       unsigned frontbuffer_bits)
 {
@@ -404,6 +456,12 @@ void intel_psr_flush(struct drm_device *dev,
      mutex_unlock(&dev_priv->psr.lock);
 }
 
Quoted 7 lines

drivers/gpu/drm/i915/intel_psr.c void intel_psr_flush(struct drm_device *dev, · line 463

Quoted 5 lines
drivers/gpu/drm/i915/intel_psr.c +5 -0
+/**
+ * intel_psr_init - Init basic PSR work and mutex.
+ * @dev: DRM device
+ *
+ * This function is to be called only once to initialize basic PSR stuff.

s/to be// and maybe s/once/once at driver load/

noted

thank you very much for all suggestions.

Quoted 21 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_psr.c +1 -1
+ */
 void intel_psr_init(struct drm_device *dev)
 {
      struct drm_i915_private *dev_priv = dev->dev_private;
--

1.9.3

Quoted 4 lines

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

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 4/4] drm/i915: Add PSR docbook

Quoted 2 lines · Rodrigo Vivi

I believe that on docs that is visible to end users we could use more market names besides the codenames.

This isn't documentation for end users but developers working on i915. So aligning with the codenames used in the driver is more important imo than aligning with marketing. We could do an overview section in the docs to match up marketing names with codenames in the driver (or explain stuff like what IS_VALLEYVIEW means ...). Or just do a link to wikipedia, since that page is usually really accurate ;-)

But imo that should be pulled together into a separate section. -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
In reply to Rodrigo Vivi
Quoted 1 line · Rodrigo Vivi

Let's use VBT + 1 now we parse it.

This patch completely lacks the justification for why we need this. Please add a short summary of our previous discussion with Art.

Quoted 14 lines

v2: fix subject and consider that idle_frame = 2 is another fix.

---
 drivers/gpu/drm/i915/intel_dp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 20beb59..41df221 100644

drivers/gpu/drm/i915/intel_dp.c static void intel_edp_psr_enable_source(struct intel_dp *intel_dp) · line 2177

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +0 -1
@@ -2174,7 +2174,12 @@ static void intel_edp_psr_enable_source(struct intel_dp *intel_dp)
 	struct drm_device *dev = dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t max_sleep_time = 0x1f;
-	uint32_t idle_frames = 2; /* 2 is the minimum allowed */

Doesn't apply because the v1 series seems to be missing. I tried to fix that but then it wouldn't compile because I'm missing the vbt patch.

Please always send the full patch series or mention unmerged depencies in the cover letter.
-Daniel

Quoted 16 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
+	/* Lately it was identified that depending on panel idle frame count
+	 * calculated at HW can be off by 1. So let's use what came
+	 * from VBT + 1 and at minimum 2 to stay on the safest side.
+	 */
+	uint32_t idle_frames = dev_priv->vbt.psr.idle_frames ?
+			       dev_priv->vbt.psr.idle_frames + 1 : 2;
 	uint32_t val = 0x0;
 	const uint32_t link_entry_time = EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
 	bool only_standby = false;
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx