Skip to contentSkip to conversation

drm/i915/dp: Check if the sink crc we read is 6 bytes.

PATCH In review Dhinakaran Pandiyan 6 participants 19 messages Apr 24, 2018 – Apr 26, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/i915/dp: Check if the sink crc we read is 6 bytes.

We attempt to read 6 bytes, make sure we have.

---
 drivers/gpu/drm/i915/intel_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 62f82c4298ac..7dcc874b7d8f 100644
@@ -3989,7 +3989,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, struct intel_crtc_state *crtc_s
 		goto stop;
 	}
 
-	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) < 0) {
+	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
 		ret = -EIO;
 		goto stop;
 	}
Signature · 6 lines
2.14.1

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

PATCH 2/3 drm/i915/dp: Fix sink-crc reads.

Sink crc is calculated by the sink for static frames irrespective of what the driver sets in TEST_SINK_START dpcd. Since PSR is the only use case for sink crc, we don't really need the sink_crc_{start, stop} code.

The second problem with the current implementation is vblank waits. Enabling vblank interrupts triggers PSR exit, which means we aren't really reading the correct CRC values for PSR tests. vblank waits are replaced by delays.

With the changes made in this patch, sink CRC is available only for static frames. I have tested this on a SKL laptop with PSR panel.

---
 drivers/gpu/drm/i915/i915_debugfs.c |   2 +-
 drivers/gpu/drm/i915/intel_dp.c     | 114 ++++--------------------------------
 drivers/gpu/drm/i915/intel_drv.h    |   3 +-
 3 files changed, 15 insertions(+), 104 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 2f05f5262bba..35fa1418cc07 100644
@@ -2784,7 +2784,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 
 		intel_dp = enc_to_intel_dp(state->best_encoder);
 
-		ret = intel_dp_sink_crc(intel_dp, crtc_state, crc);
+		ret = intel_dp_sink_crc(intel_dp, crc);
 		if (ret)
 			goto err;
 
drivers/gpu/drm/i915/intel_dp.c +13 -101

138 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +1 -2
index 44ed248f1fe9..cacee94749e2 100644
@@ -1644,8 +1644,7 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
-int intel_dp_sink_crc(struct intel_dp *intel_dp,
-		      struct intel_crtc_state *crtc_state, u8 *crc);
+int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state);
Signature · 6 lines
2.14.1

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

Re: [PATCH 2/3] drm/i915/dp: Fix sink-crc reads.

Quoted 68 lines · Dhinakaran Pandiyan

Sink crc is calculated by the sink for static frames irrespective of what the driver sets in TEST_SINK_START dpcd. Since PSR is the only use
case for sink crc, we don't really need the sink_crc_{start, stop} code.

The second problem with the current implementation is vblank waits. Enabling vblank interrupts triggers PSR exit, which means we aren't really reading the correct CRC values for PSR tests. vblank waits are replaced by delays.

With the changes made in this patch, sink CRC is available only for static frames. I have tested this on a SKL laptop with PSR panel.

---
 drivers/gpu/drm/i915/i915_debugfs.c |   2 +- drivers/gpu/drm/i915/intel_dp.c     | 114 ++++--------------------
------------
 drivers/gpu/drm/i915/intel_drv.h    |   3 +-

 3 files changed, 15 insertions(+), 104 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index 2f05f5262bba..35fa1418cc07 100644
@@ -2784,7 +2784,7 @@ static int i915_sink_crc(struct seq_file *m,
 void *data)


  intel_dp = enc_to_intel_dp(state->best_encoder);

drivers/gpu/drm/i915/i915_debugfs.c +1 -1
-		ret = intel_dp_sink_crc(intel_dp, crtc_state, crc);
+		ret = intel_dp_sink_crc(intel_dp, crc);

  if (ret)
  goto err;

drivers/gpu/drm/i915/intel_dp.c +0 -0
index 7dcc874b7d8f..7352ab631ea8 100644
@@ -3876,32 +3876,18 @@ intel_dp_configure_mst(struct intel_dp
 *intel_dp)
  					intel_dp->is_mst);
  }

drivers/gpu/drm/i915/intel_dp.c +0 -2
-static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp,
-				  struct intel_crtc_state

*crtc_state, bool disable_wa)
+int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) {

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	struct intel_digital_port *dig_port =

dp_to_dig_port(intel_dp);

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	struct drm_i915_private *dev_priv = to_i915(dig_port-
Quoted 1 line

base.base.dev);

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state-
Quoted 1 line

base.crtc);

drivers/gpu/drm/i915/intel_dp.c +1 -4
-	u8 buf;
-	int ret = 0;
-	int count = 0;
-	int attempts = 10;
+	int count = 0, ret = 0, attempts;

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) <

0) {

drivers/gpu/drm/i915/intel_dp.c +0 -1
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped

properly\n");

drivers/gpu/drm/i915/intel_dp.c intel_dp_configure_mst(struct intel_dp *intel_dp) · line 3883

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +1 -3
-		ret = -EIO;
-		goto out;
-	}
+	for (attempts = 0; attempts < 3 && count == 0; attempts++) {

A question. How did you end up with three attempts or one and a half frames? We used to try 6 times or 6 vblanks until we gave up trying. Well, I don't really know the history why we have ended up with 6 attempts in the first place.

Quoted 153 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
+		u8 buf;

drivers/gpu/drm/i915/intel_dp.c +0 -3
-	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
-			       buf & ~DP_TEST_SINK_START) < 0) {
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped

properly\n");

drivers/gpu/drm/i915/intel_dp.c +1 -6
-		ret = -EIO;
-		goto out;
-	}
-
-	do {
-		intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
+		/* Wait for approximately half a frame, we cannot

wait for a

drivers/gpu/drm/i915/intel_dp.c +4 -0
+		 * vblank interrupt as it triggers PSR exit.
+		 */
+		if (attempts)
+			usleep_range(8000, 8500);


  if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf) < 0) {

drivers/gpu/drm/i915/intel_dp.c +0 -5
@@ -3909,93 +3895,19 @@ static int intel_dp_sink_crc_stop(struct
 intel_dp *intel_dp,
  			goto out;
  		}
  		count = buf & DP_TEST_COUNT_MASK;
-	} while (--attempts && count);
-
-	if (attempts == 0) {
-		DRM_DEBUG_KMS("TIMEOUT: Sink CRC counter is not
 zeroed after calculation is stopped\n");
-		ret = -ETIMEDOUT;
  	}


- out:

drivers/gpu/drm/i915/intel_dp.c +0 -7
-	if (disable_wa)
-		hsw_enable_ips(crtc_state);
-	return ret;
-}
-
-static int intel_dp_sink_crc_start(struct intel_dp *intel_dp,
-				   struct intel_crtc_state

*crtc_state)

drivers/gpu/drm/i915/intel_dp.c +0 -2
-{
-	struct intel_digital_port *dig_port =

dp_to_dig_port(intel_dp);

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	struct drm_i915_private *dev_priv = to_i915(dig_port-
Quoted 1 line

base.base.dev);

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state-
Quoted 1 line

base.crtc);

drivers/gpu/drm/i915/intel_dp.c +0 -4
-	u8 buf;
-	int ret;
-
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC,

&buf) < 0)

drivers/gpu/drm/i915/intel_dp.c +0 -6
-		return -EIO;
-
-	if (!(buf & DP_TEST_CRC_SUPPORTED))
-		return -ENOTTY;
-
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) <

0)

drivers/gpu/drm/i915/intel_dp.c +0 -4
-		return -EIO;
-
-	if (buf & DP_TEST_SINK_START) {
-		ret = intel_dp_sink_crc_stop(intel_dp, crtc_state,

false);

drivers/gpu/drm/i915/intel_dp.c +0 -17
-		if (ret)
-			return ret;
-	}
-
-	hsw_disable_ips(crtc_state);
-
-	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
-			       buf | DP_TEST_SINK_START) < 0) {
-		hsw_enable_ips(crtc_state);
-		return -EIO;
-	}
-
-	intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
-	return 0;
-}
-
-int intel_dp_sink_crc(struct intel_dp *intel_dp, struct

intel_crtc_state *crtc_state, u8 *crc)

drivers/gpu/drm/i915/intel_dp.c +0 -2
-{
-	struct intel_digital_port *dig_port =

dp_to_dig_port(intel_dp);

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	struct drm_i915_private *dev_priv = to_i915(dig_port-
Quoted 1 line

base.base.dev);

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state-
Quoted 1 line

base.crtc);

drivers/gpu/drm/i915/intel_dp.c +0 -13
-	u8 buf;
-	int count, ret;
-	int attempts = 6;
-
-	ret = intel_dp_sink_crc_start(intel_dp, crtc_state);
-	if (ret)
-		return ret;
-
-	do {
-		intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
-
-		if (drm_dp_dpcd_readb(&intel_dp->aux,
-				      DP_TEST_SINK_MISC, &buf) < 0)

{

drivers/gpu/drm/i915/intel_dp.c +0 -9
-			ret = -EIO;
-			goto stop;
-		}
-		count = buf & DP_TEST_COUNT_MASK;
-
-	} while (--attempts && count == 0);
-
-	if (attempts == 0) {
-		DRM_ERROR("Panel is unable to calculate any CRC

after 6 vblanks\n");

drivers/gpu/drm/i915/intel_dp.c +1 -0
+	if (attempts == 3) {

  ret = -ETIMEDOUT;

drivers/gpu/drm/i915/intel_dp.c +1 -1
-		goto stop;
+		goto out;

  }

  if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc,
6) != 6) {
  ret = -EIO;

drivers/gpu/drm/i915/intel_dp.c +1 -1
-		goto stop;
+		goto out;

  }

drivers/gpu/drm/i915/intel_dp.c +1 -2
-stop:
-	intel_dp_sink_crc_stop(intel_dp, crtc_state, true);
+out:

  return ret;
 }

drivers/gpu/drm/i915/intel_drv.h +1 -2
index 44ed248f1fe9..cacee94749e2 100644
@@ -1644,8 +1644,7 @@ void intel_dp_sink_dpms(struct intel_dp
 *intel_dp, int mode);
  void intel_dp_encoder_reset(struct drm_encoder *encoder);
  void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
  void intel_dp_encoder_destroy(struct drm_encoder *encoder);
-int intel_dp_sink_crc(struct intel_dp *intel_dp,
-		      struct intel_crtc_state *crtc_state, u8 *crc);
+int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
  bool intel_dp_compute_config(struct intel_encoder *encoder,
  			     struct intel_crtc_state *pipe_config,

       struct drm_connector_state *conn_state);

Signature · 6 lines
Mika Kahola - Intel OTC

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

Re: [PATCH 2/3] drm/i915/dp: Fix sink-crc reads.

Quoted 65 lines · Mika Kahola
Quoted 64 lines · Dhinakaran Pandiyan

Sink crc is calculated by the sink for static frames irrespective of what the driver sets in TEST_SINK_START dpcd. Since PSR is the only use
case for sink crc, we don't really need the sink_crc_{start, stop} code.

The second problem with the current implementation is vblank waits. Enabling vblank interrupts triggers PSR exit, which means we aren't really reading the correct CRC values for PSR tests. vblank waits are replaced by delays.

With the changes made in this patch, sink CRC is available only for static frames. I have tested this on a SKL laptop with PSR panel.

---
 drivers/gpu/drm/i915/i915_debugfs.c |   2 +-
 drivers/gpu/drm/i915/intel_dp.c     | 114 ++++--------------------
------------
 drivers/gpu/drm/i915/intel_drv.h    |   3 +-
 3 files changed, 15 insertions(+), 104 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 2f05f5262bba..35fa1418cc07 100644
@@ -2784,7 +2784,7 @@ static int i915_sink_crc(struct seq_file *m,
 void *data)
 
 		intel_dp = enc_to_intel_dp(state->best_encoder);
 
-		ret = intel_dp_sink_crc(intel_dp, crtc_state, crc);
+		ret = intel_dp_sink_crc(intel_dp, crc);
 		if (ret)
 			goto err;
drivers/gpu/drm/i915/intel_dp.c +2 -9
index 7dcc874b7d8f..7352ab631ea8 100644
@@ -3876,32 +3876,18 @@ intel_dp_configure_mst(struct intel_dp
 *intel_dp)
 					intel_dp->is_mst);
 }
 
-static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp,
-				  struct intel_crtc_state
 *crtc_state, bool disable_wa)
+int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)
 {
-	struct intel_digital_port *dig_port =
 dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dig_port-
 >base.base.dev);
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state-
 >base.crtc);
-	u8 buf;
-	int ret = 0;
-	int count = 0;
-	int attempts = 10;
+	int count = 0, ret = 0, attempts;
 
Quoted 12 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_configure_mst(struct intel_dp *intel_dp) · line 3883

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1 -5
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) <
 0) {
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped
 properly\n");
-		ret = -EIO;
-		goto out;
-	}
+	for (attempts = 0; attempts < 3 && count == 0; attempts++) {

A question. How did you end up with three attempts or one and a half frames? We used to try 6 times or 6 vblanks until we gave up trying. Well, I don't really know the history why we have ended up with 6 attempts in the first place.

CRC should be available within the next static frame. So the idea for a tests is to do, for example, a page flip and immediately attempt to read the CRC. Since we cannot exactly synchronize the flip getting committed, debugfs read and CRC generation, all that the kernel can do correctly is check if the CRC is available within a frame and read it.

I think the reason for trying 6 times was to somehow get a non-zero CRC. But that means tests end up reading CRC of a different frame.

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

maintainer
#4 lore raw

Re: [PATCH 2/3] drm/i915/dp: Fix sink-crc reads.

In reply to Dhinakaran Pandiyan
Quoted 61 lines · Dhinakaran Pandiyan

Sink crc is calculated by the sink for static frames irrespective of what the driver sets in TEST_SINK_START dpcd. Since PSR is the only use case for sink crc, we don't really need the sink_crc_{start, stop} code.

The second problem with the current implementation is vblank waits. Enabling vblank interrupts triggers PSR exit, which means we aren't really reading the correct CRC values for PSR tests. vblank waits are replaced by delays.

With the changes made in this patch, sink CRC is available only for static frames. I have tested this on a SKL laptop with PSR panel.

---
 drivers/gpu/drm/i915/i915_debugfs.c |   2 +-
 drivers/gpu/drm/i915/intel_dp.c     | 114 ++++--------------------------------
 drivers/gpu/drm/i915/intel_drv.h    |   3 +-
 3 files changed, 15 insertions(+), 104 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 2f05f5262bba..35fa1418cc07 100644
@@ -2784,7 +2784,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 
 		intel_dp = enc_to_intel_dp(state->best_encoder);
 
-		ret = intel_dp_sink_crc(intel_dp, crtc_state, crc);
+		ret = intel_dp_sink_crc(intel_dp, crc);
 		if (ret)
 			goto err;
 
drivers/gpu/drm/i915/intel_dp.c +4 -14
index 7dcc874b7d8f..7352ab631ea8 100644
@@ -3876,32 +3876,18 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
 					intel_dp->is_mst);
 }
 
-static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp,
-				  struct intel_crtc_state *crtc_state, bool disable_wa)
+int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)
 {
-	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
-	u8 buf;
-	int ret = 0;
-	int count = 0;
-	int attempts = 10;
+	int count = 0, ret = 0, attempts;
 
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0) {
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
-		ret = -EIO;
-		goto out;
-	}
+	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
+		u8 buf;
 

drivers/gpu/drm/i915/intel_dp.c intel_dp_configure_mst(struct intel_dp *intel_dp) · line 3886

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +1 -9
-	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
-			       buf & ~DP_TEST_SINK_START) < 0) {
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
-		ret = -EIO;
-		goto out;
-	}
-
-	do {
-		intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
+		/* Wait for approximately half a frame, we cannot wait for a

that should be dependend on the mode timings right?!
I mean, I'm not against some random value that matches most used cases, but I believe the statement should be different.

Quoted 122 lines
drivers/gpu/drm/i915/intel_dp.c +8 -78
+		 * vblank interrupt as it triggers PSR exit.
+		 */
+		if (attempts)
+			usleep_range(8000, 8500);
 
 		if (drm_dp_dpcd_readb(&intel_dp->aux,
 				      DP_TEST_SINK_MISC, &buf) < 0) {
@@ -3909,93 +3895,19 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp,
 			goto out;
 		}
 		count = buf & DP_TEST_COUNT_MASK;
-	} while (--attempts && count);
-
-	if (attempts == 0) {
-		DRM_DEBUG_KMS("TIMEOUT: Sink CRC counter is not zeroed after calculation is stopped\n");
-		ret = -ETIMEDOUT;
 	}
 
- out:
-	if (disable_wa)
-		hsw_enable_ips(crtc_state);
-	return ret;
-}
-
-static int intel_dp_sink_crc_start(struct intel_dp *intel_dp,
-				   struct intel_crtc_state *crtc_state)
-{
-	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
-	u8 buf;
-	int ret;
-
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf) < 0)
-		return -EIO;
-
-	if (!(buf & DP_TEST_CRC_SUPPORTED))
-		return -ENOTTY;
-
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0)
-		return -EIO;
-
-	if (buf & DP_TEST_SINK_START) {
-		ret = intel_dp_sink_crc_stop(intel_dp, crtc_state, false);
-		if (ret)
-			return ret;
-	}
-
-	hsw_disable_ips(crtc_state);
-
-	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
-			       buf | DP_TEST_SINK_START) < 0) {
-		hsw_enable_ips(crtc_state);
-		return -EIO;
-	}
-
-	intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
-	return 0;
-}
-
-int intel_dp_sink_crc(struct intel_dp *intel_dp, struct intel_crtc_state *crtc_state, u8 *crc)
-{
-	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
-	u8 buf;
-	int count, ret;
-	int attempts = 6;
-
-	ret = intel_dp_sink_crc_start(intel_dp, crtc_state);
-	if (ret)
-		return ret;
-
-	do {
-		intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
-
-		if (drm_dp_dpcd_readb(&intel_dp->aux,
-				      DP_TEST_SINK_MISC, &buf) < 0) {
-			ret = -EIO;
-			goto stop;
-		}
-		count = buf & DP_TEST_COUNT_MASK;
-
-	} while (--attempts && count == 0);
-
-	if (attempts == 0) {
-		DRM_ERROR("Panel is unable to calculate any CRC after 6 vblanks\n");
+	if (attempts == 3) {
 		ret = -ETIMEDOUT;
-		goto stop;
+		goto out;
 	}
 
 	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
 		ret = -EIO;
-		goto stop;
+		goto out;
 	}
 
-stop:
-	intel_dp_sink_crc_stop(intel_dp, crtc_state, true);
+out:
 	return ret;
 }
 
drivers/gpu/drm/i915/intel_drv.h +1 -2
index 44ed248f1fe9..cacee94749e2 100644
@@ -1644,8 +1644,7 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
-int intel_dp_sink_crc(struct intel_dp *intel_dp,
-		      struct intel_crtc_state *crtc_state, u8 *crc);
+int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state);
Signature · 1 line
2.14.1

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

#5 lore raw

Re: [PATCH 2/3] drm/i915/dp: Fix sink-crc reads.

Quoted 62 lines · Rodrigo Vivi
Quoted 61 lines · Dhinakaran Pandiyan

Sink crc is calculated by the sink for static frames irrespective of what the driver sets in TEST_SINK_START dpcd. Since PSR is the only use case for sink crc, we don't really need the sink_crc_{start, stop} code.

The second problem with the current implementation is vblank waits. Enabling vblank interrupts triggers PSR exit, which means we aren't really reading the correct CRC values for PSR tests. vblank waits are replaced by delays.

With the changes made in this patch, sink CRC is available only for static frames. I have tested this on a SKL laptop with PSR panel.

---
 drivers/gpu/drm/i915/i915_debugfs.c |   2 +-
 drivers/gpu/drm/i915/intel_dp.c     | 114 ++++--------------------------------
 drivers/gpu/drm/i915/intel_drv.h    |   3 +-
 3 files changed, 15 insertions(+), 104 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 2f05f5262bba..35fa1418cc07 100644
@@ -2784,7 +2784,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 
 		intel_dp = enc_to_intel_dp(state->best_encoder);
 
-		ret = intel_dp_sink_crc(intel_dp, crtc_state, crc);
+		ret = intel_dp_sink_crc(intel_dp, crc);
 		if (ret)
 			goto err;
 
drivers/gpu/drm/i915/intel_dp.c +4 -14
index 7dcc874b7d8f..7352ab631ea8 100644
@@ -3876,32 +3876,18 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
 					intel_dp->is_mst);
 }
 
-static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp,
-				  struct intel_crtc_state *crtc_state, bool disable_wa)
+int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)
 {
-	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
-	u8 buf;
-	int ret = 0;
-	int count = 0;
-	int attempts = 10;
+	int count = 0, ret = 0, attempts;
 
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0) {
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
-		ret = -EIO;
-		goto out;
-	}
+	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
+		u8 buf;
 
Quoted 15 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_configure_mst(struct intel_dp *intel_dp) · line 3886

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +1 -9
-	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
-			       buf & ~DP_TEST_SINK_START) < 0) {
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
-		ret = -EIO;
-		goto out;
-	}
-
-	do {
-		intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
+		/* Wait for approximately half a frame, we cannot wait for a

that should be dependend on the mode timings right?!
I mean, I'm not against some random value that matches most used cases, but I believe the statement should be different.

I'll modify the comment, thanks!

Is there an existing function that provides this number in milliseconds?

Quoted 114 lines
Quoted 114 lines
drivers/gpu/drm/i915/intel_dp.c +8 -78
+		 * vblank interrupt as it triggers PSR exit.
+		 */
+		if (attempts)
+			usleep_range(8000, 8500);
 
 		if (drm_dp_dpcd_readb(&intel_dp->aux,
 				      DP_TEST_SINK_MISC, &buf) < 0) {
@@ -3909,93 +3895,19 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp,
 			goto out;
 		}
 		count = buf & DP_TEST_COUNT_MASK;
-	} while (--attempts && count);
-
-	if (attempts == 0) {
-		DRM_DEBUG_KMS("TIMEOUT: Sink CRC counter is not zeroed after calculation is stopped\n");
-		ret = -ETIMEDOUT;
 	}
 
- out:
-	if (disable_wa)
-		hsw_enable_ips(crtc_state);
-	return ret;
-}
-
-static int intel_dp_sink_crc_start(struct intel_dp *intel_dp,
-				   struct intel_crtc_state *crtc_state)
-{
-	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
-	u8 buf;
-	int ret;
-
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf) < 0)
-		return -EIO;
-
-	if (!(buf & DP_TEST_CRC_SUPPORTED))
-		return -ENOTTY;
-
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0)
-		return -EIO;
-
-	if (buf & DP_TEST_SINK_START) {
-		ret = intel_dp_sink_crc_stop(intel_dp, crtc_state, false);
-		if (ret)
-			return ret;
-	}
-
-	hsw_disable_ips(crtc_state);
-
-	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
-			       buf | DP_TEST_SINK_START) < 0) {
-		hsw_enable_ips(crtc_state);
-		return -EIO;
-	}
-
-	intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
-	return 0;
-}
-
-int intel_dp_sink_crc(struct intel_dp *intel_dp, struct intel_crtc_state *crtc_state, u8 *crc)
-{
-	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
-	u8 buf;
-	int count, ret;
-	int attempts = 6;
-
-	ret = intel_dp_sink_crc_start(intel_dp, crtc_state);
-	if (ret)
-		return ret;
-
-	do {
-		intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
-
-		if (drm_dp_dpcd_readb(&intel_dp->aux,
-				      DP_TEST_SINK_MISC, &buf) < 0) {
-			ret = -EIO;
-			goto stop;
-		}
-		count = buf & DP_TEST_COUNT_MASK;
-
-	} while (--attempts && count == 0);
-
-	if (attempts == 0) {
-		DRM_ERROR("Panel is unable to calculate any CRC after 6 vblanks\n");
+	if (attempts == 3) {
 		ret = -ETIMEDOUT;
-		goto stop;
+		goto out;
 	}
 
 	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
 		ret = -EIO;
-		goto stop;
+		goto out;
 	}
 
-stop:
-	intel_dp_sink_crc_stop(intel_dp, crtc_state, true);
+out:
 	return ret;
 }
 
drivers/gpu/drm/i915/intel_drv.h +0 -1
index 44ed248f1fe9..cacee94749e2 100644
@@ -1644,8 +1644,7 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
-int intel_dp_sink_crc(struct intel_dp *intel_dp,
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +1 -1
-		      struct intel_crtc_state *crtc_state, u8 *crc);
+int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state);
Signature · 1 line
2.14.1

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

#6 lore raw

PATCH v2 2/3 drm/i915/dp: Fix sink-crc reads.

In reply to Dhinakaran Pandiyan

Sink crc is calculated by the sink for static frames irrespective of what the driver sets in TEST_SINK_START dpcd. Since PSR is the only use case for sink crc, we don't really need the sink_crc_{start, stop} code.

The second problem with the current implementation is vblank waits. Enabling vblank interrupts triggers PSR exit, which means we aren't really reading the correct CRC values for PSR tests. vblank waits are replaced by delays.

With the changes made in this patch, sink CRC is available only for static frames. I have tested this on a SKL laptop with PSR panel.

v2: Use refresh rate to calculate frame time.

---
 drivers/gpu/drm/i915/i915_debugfs.c |   4 +-
 drivers/gpu/drm/i915/intel_dp.c     | 115 +++++-------------------------------
 drivers/gpu/drm/i915/intel_drv.h    |   3 +-
 3 files changed, 18 insertions(+), 104 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +3 -1
index 2f05f5262bba..e4ba6527c16e 100644
@@ -2749,6 +2749,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 		struct drm_crtc *crtc;
 		struct drm_connector_state *state;
 		struct intel_crtc_state *crtc_state;
+		int vrefresh;
 
 		if (connector->base.connector_type != DRM_MODE_CONNECTOR_eDP)
 			continue;
@@ -2783,8 +2784,9 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 		}
 
 		intel_dp = enc_to_intel_dp(state->best_encoder);
+		vrefresh = crtc_state->base.adjusted_mode.vrefresh;
 
-		ret = intel_dp_sink_crc(intel_dp, crtc_state, crc);
+		ret = intel_dp_sink_crc(intel_dp, vrefresh, crc);
 		if (ret)
 			goto err;
 
drivers/gpu/drm/i915/intel_dp.c +14 -101

139 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +1 -2
index 44ed248f1fe9..48073be8a023 100644
@@ -1644,8 +1644,7 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
-int intel_dp_sink_crc(struct intel_dp *intel_dp,
-		      struct intel_crtc_state *crtc_state, u8 *crc);
+int intel_dp_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state);
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v2 2/3
#7 lore raw

Re: [PATCH v2 2/3] drm/i915/dp: Fix sink-crc reads.

Quoted 9 lines · Dhinakaran Pandiyan

Sink crc is calculated by the sink for static frames irrespective of what the driver sets in TEST_SINK_START dpcd. Since PSR is the only use case for sink crc, we don't really need the sink_crc_{start, stop} code.

The second problem with the current implementation is vblank waits. Enabling vblank interrupts triggers PSR exit, which means we aren't really reading the correct CRC values for PSR tests. vblank waits are replaced by delays.

Quoted 4 lines

With the changes made in this patch, sink CRC is available only for static frames. I have tested this on a SKL laptop with PSR panel.

v2: Use refresh rate to calculate frame time.

Cool! :)

Quoted 2 lines
Quoted 191 lines
---
 drivers/gpu/drm/i915/i915_debugfs.c |   4 +-
 drivers/gpu/drm/i915/intel_dp.c     | 115 +++++-------------------------------
 drivers/gpu/drm/i915/intel_drv.h    |   3 +-
 3 files changed, 18 insertions(+), 104 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +3 -1
index 2f05f5262bba..e4ba6527c16e 100644
@@ -2749,6 +2749,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 		struct drm_crtc *crtc;
 		struct drm_connector_state *state;
 		struct intel_crtc_state *crtc_state;
+		int vrefresh;
 
 		if (connector->base.connector_type != DRM_MODE_CONNECTOR_eDP)
 			continue;
@@ -2783,8 +2784,9 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 		}
 
 		intel_dp = enc_to_intel_dp(state->best_encoder);
+		vrefresh = crtc_state->base.adjusted_mode.vrefresh;
 
-		ret = intel_dp_sink_crc(intel_dp, crtc_state, crc);
+		ret = intel_dp_sink_crc(intel_dp, vrefresh, crc);
 		if (ret)
 			goto err;
 
drivers/gpu/drm/i915/intel_dp.c +14 -101
index 7dcc874b7d8f..3ab3f82e33f6 100644
@@ -3876,32 +3876,19 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
 					intel_dp->is_mst);
 }
 
-static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp,
-				  struct intel_crtc_state *crtc_state, bool disable_wa)
+int intel_dp_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc)
 {
-	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
-	u8 buf;
-	int ret = 0;
-	int count = 0;
-	int attempts = 10;
+	int count = 0, ret = 0, attempts;
+	int half_frame_us = DIV_ROUND_UP(1000000/2, vrefresh);
 
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0) {
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
-		ret = -EIO;
-		goto out;
-	}
+	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
+		u8 buf;
 
-	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
-			       buf & ~DP_TEST_SINK_START) < 0) {
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
-		ret = -EIO;
-		goto out;
-	}
-
-	do {
-		intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
+		/* Wait for approximately half a frame, we cannot wait for a
+		 * vblank interrupt as it triggers PSR exit.
+		 */
+		if (attempts)
+			usleep_range(half_frame_us, half_frame_us + 100);
 
 		if (drm_dp_dpcd_readb(&intel_dp->aux,
 				      DP_TEST_SINK_MISC, &buf) < 0) {
@@ -3909,93 +3896,19 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp,
 			goto out;
 		}
 		count = buf & DP_TEST_COUNT_MASK;
-	} while (--attempts && count);
-
-	if (attempts == 0) {
-		DRM_DEBUG_KMS("TIMEOUT: Sink CRC counter is not zeroed after calculation is stopped\n");
-		ret = -ETIMEDOUT;
 	}
 
- out:
-	if (disable_wa)
-		hsw_enable_ips(crtc_state);
-	return ret;
-}
-
-static int intel_dp_sink_crc_start(struct intel_dp *intel_dp,
-				   struct intel_crtc_state *crtc_state)
-{
-	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
-	u8 buf;
-	int ret;
-
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf) < 0)
-		return -EIO;
-
-	if (!(buf & DP_TEST_CRC_SUPPORTED))
-		return -ENOTTY;
-
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0)
-		return -EIO;
-
-	if (buf & DP_TEST_SINK_START) {
-		ret = intel_dp_sink_crc_stop(intel_dp, crtc_state, false);
-		if (ret)
-			return ret;
-	}
-
-	hsw_disable_ips(crtc_state);
-
-	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
-			       buf | DP_TEST_SINK_START) < 0) {
-		hsw_enable_ips(crtc_state);
-		return -EIO;
-	}
-
-	intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
-	return 0;
-}
-
-int intel_dp_sink_crc(struct intel_dp *intel_dp, struct intel_crtc_state *crtc_state, u8 *crc)
-{
-	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
-	u8 buf;
-	int count, ret;
-	int attempts = 6;
-
-	ret = intel_dp_sink_crc_start(intel_dp, crtc_state);
-	if (ret)
-		return ret;
-
-	do {
-		intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
-
-		if (drm_dp_dpcd_readb(&intel_dp->aux,
-				      DP_TEST_SINK_MISC, &buf) < 0) {
-			ret = -EIO;
-			goto stop;
-		}
-		count = buf & DP_TEST_COUNT_MASK;
-
-	} while (--attempts && count == 0);
-
-	if (attempts == 0) {
-		DRM_ERROR("Panel is unable to calculate any CRC after 6 vblanks\n");
+	if (attempts == 3) {
 		ret = -ETIMEDOUT;
-		goto stop;
+		goto out;
 	}
 
 	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
 		ret = -EIO;
-		goto stop;
+		goto out;
 	}
 
-stop:
-	intel_dp_sink_crc_stop(intel_dp, crtc_state, true);
+out:
 	return ret;
 }
 
drivers/gpu/drm/i915/intel_drv.h +1 -2
index 44ed248f1fe9..48073be8a023 100644
@@ -1644,8 +1644,7 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
-int intel_dp_sink_crc(struct intel_dp *intel_dp,
-		      struct intel_crtc_state *crtc_state, u8 *crc);
+int intel_dp_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state);
Signature · 1 line
2.14.1

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

#8 lore raw

Re: [PATCH v2 2/3] drm/i915/dp: Fix sink-crc reads.

In reply to Dhinakaran Pandiyan
Quoted 34 lines · Dhinakaran Pandiyan

Sink crc is calculated by the sink for static frames irrespective of what the driver sets in TEST_SINK_START dpcd. Since PSR is the only use case for sink crc, we don't really need the sink_crc_{start, stop} code.

The second problem with the current implementation is vblank waits. Enabling vblank interrupts triggers PSR exit, which means we aren't really reading the correct CRC values for PSR tests. vblank waits are replaced by delays.

With the changes made in this patch, sink CRC is available only for static frames. I have tested this on a SKL laptop with PSR panel.

v2: Use refresh rate to calculate frame time.

---
 drivers/gpu/drm/i915/i915_debugfs.c |   4 +-
 drivers/gpu/drm/i915/intel_dp.c     | 115 +++++-------------------------------
 drivers/gpu/drm/i915/intel_drv.h    |   3 +-
 3 files changed, 18 insertions(+), 104 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index 2f05f5262bba..e4ba6527c16e 100644
@@ -2749,6 +2749,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 		struct drm_crtc *crtc;
 		struct drm_connector_state *state;
 		struct intel_crtc_state *crtc_state;
+		int vrefresh;
 
 		if (connector->base.connector_type != DRM_MODE_CONNECTOR_eDP)
 			continue;

drivers/gpu/drm/i915/i915_debugfs.c static int i915_sink_crc(struct seq_file *m, void *data) · line 2787

Quoted 4 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
@@ -2783,8 +2784,9 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 		}
 
 		intel_dp = enc_to_intel_dp(state->best_encoder);
+		vrefresh = crtc_state->base.adjusted_mode.vrefresh;

Hmm. Is vrefresh always populated correctly for us?

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 3/3 drm/i915/psr: Move sink-crc to intel_psr.c

In reply to Dhinakaran Pandiyan

With sink-crc now being relevant only for PSR static frames, move the code to intel_psr.c and rename the function.

---
 drivers/gpu/drm/i915/i915_debugfs.c |  4 ++--
 drivers/gpu/drm/i915/intel_dp.c     | 35 -----------------------------------
 drivers/gpu/drm/i915/intel_drv.h    |  2 +-
 drivers/gpu/drm/i915/intel_psr.c    | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 38 insertions(+), 38 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -2
index 35fa1418cc07..9913258e20ed 100644
@@ -2784,7 +2784,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 
 		intel_dp = enc_to_intel_dp(state->best_encoder);
 
-		ret = intel_dp_sink_crc(intel_dp, crc);
+		ret = intel_psr_sink_crc(intel_dp, crc);
 		if (ret)
 			goto err;
 
@@ -4854,7 +4854,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_ppgtt_info", i915_ppgtt_info, 0},
 	{"i915_llc", i915_llc, 0},
 	{"i915_edp_psr_status", i915_edp_psr_status, 0},
-	{"i915_sink_crc_eDP1", i915_sink_crc, 0},
+	{"i915_edp_psr_sink_crc", i915_sink_crc, 0},
 	{"i915_energy_uJ", i915_energy_uJ, 0},
 	{"i915_runtime_pm_status", i915_runtime_pm_status, 0},
 	{"i915_power_domain_info", i915_power_domain_info, 0},
drivers/gpu/drm/i915/intel_dp.c +0 -35
index 7352ab631ea8..ff7522d3632e 100644
@@ -3876,41 +3876,6 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
 					intel_dp->is_mst);
 }
 
-int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)
-{
-	int count = 0, ret = 0, attempts;
-
-	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
-		u8 buf;
-
-		/* Wait for approximately half a frame, we cannot wait for a
-		 * vblank interrupt as it triggers PSR exit.
-		 */
-		if (attempts)
-			usleep_range(8000, 8500);
-
-		if (drm_dp_dpcd_readb(&intel_dp->aux,
-				      DP_TEST_SINK_MISC, &buf) < 0) {
-			ret = -EIO;
-			goto out;
-		}
-		count = buf & DP_TEST_COUNT_MASK;
-	}
-
-	if (attempts == 3) {
-		ret = -ETIMEDOUT;
-		goto out;
-	}
-
-	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
-		ret = -EIO;
-		goto out;
-	}
-
-out:
-	return ret;
-}
-
 static bool
 intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
 {
drivers/gpu/drm/i915/intel_drv.h +1 -1
index cacee94749e2..0da7be3349cc 100644
@@ -1644,7 +1644,6 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
-int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state);
@@ -1900,6 +1899,7 @@ void intel_psr_compute_config(struct intel_dp *intel_dp,
 			      struct intel_crtc_state *crtc_state);
 void intel_psr_irq_control(struct drm_i915_private *dev_priv, bool debug);
 void intel_psr_irq_handler(struct drm_i915_private *dev_priv, u32 psr_iir);
+int intel_psr_sink_crc(struct intel_dp *intel_dp, u8 *crc);
 
 /* intel_runtime_pm.c */
 int intel_power_domains_init(struct drm_i915_private *);
drivers/gpu/drm/i915/intel_psr.c +35 -0
index 0d548292dd09..4ebd05b6e86d 100644
@@ -197,6 +197,41 @@ static u8 intel_dp_get_sink_sync_latency(struct intel_dp *intel_dp)
 	return val;
 }
 
+int intel_psr_sink_crc(struct intel_dp *intel_dp, u8 *crc)
+{
+	int count = 0, ret = 0, attempts;
+
+	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
+		u8 buf;
+
+		/* Wait for approximately half a frame, we cannot wait for a
+		 * vblank interrupt as it triggers PSR exit.
+		 */
+		if (attempts)
+			usleep_range(8000, 8500);
+
+		if (drm_dp_dpcd_readb(&intel_dp->aux,
+				      DP_TEST_SINK_MISC, &buf) < 0) {
+			ret = -EIO;
+			goto out;
+		}
+		count = buf & DP_TEST_COUNT_MASK;
+	}
+
+	if (attempts == 3) {
+		ret = -ETIMEDOUT;
+		goto out;
+	}
+
+	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
+		ret = -EIO;
+		goto out;
+	}
+
+out:
+	return ret;
+}
+
 void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 {
 	struct drm_i915_private *dev_priv =
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Acked-by on v1 3/3
#10 lore raw

Re: [PATCH 3/3] drm/i915/psr: Move sink-crc to intel_psr.c

Quoted 4 lines · Dhinakaran Pandiyan

With sink-crc now being relevant only for PSR static frames, move the code to intel_psr.c and rename the function.

Quoted 144 lines
---
 drivers/gpu/drm/i915/i915_debugfs.c |  4 ++--
 drivers/gpu/drm/i915/intel_dp.c     | 35 -----------------------------------
 drivers/gpu/drm/i915/intel_drv.h    |  2 +-
 drivers/gpu/drm/i915/intel_psr.c    | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 38 insertions(+), 38 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -2
index 35fa1418cc07..9913258e20ed 100644
@@ -2784,7 +2784,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 
 		intel_dp = enc_to_intel_dp(state->best_encoder);
 
-		ret = intel_dp_sink_crc(intel_dp, crc);
+		ret = intel_psr_sink_crc(intel_dp, crc);
 		if (ret)
 			goto err;
 
@@ -4854,7 +4854,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_ppgtt_info", i915_ppgtt_info, 0},
 	{"i915_llc", i915_llc, 0},
 	{"i915_edp_psr_status", i915_edp_psr_status, 0},
-	{"i915_sink_crc_eDP1", i915_sink_crc, 0},
+	{"i915_edp_psr_sink_crc", i915_sink_crc, 0},
 	{"i915_energy_uJ", i915_energy_uJ, 0},
 	{"i915_runtime_pm_status", i915_runtime_pm_status, 0},
 	{"i915_power_domain_info", i915_power_domain_info, 0},
drivers/gpu/drm/i915/intel_dp.c +0 -35
index 7352ab631ea8..ff7522d3632e 100644
@@ -3876,41 +3876,6 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
 					intel_dp->is_mst);
 }
 
-int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)
-{
-	int count = 0, ret = 0, attempts;
-
-	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
-		u8 buf;
-
-		/* Wait for approximately half a frame, we cannot wait for a
-		 * vblank interrupt as it triggers PSR exit.
-		 */
-		if (attempts)
-			usleep_range(8000, 8500);
-
-		if (drm_dp_dpcd_readb(&intel_dp->aux,
-				      DP_TEST_SINK_MISC, &buf) < 0) {
-			ret = -EIO;
-			goto out;
-		}
-		count = buf & DP_TEST_COUNT_MASK;
-	}
-
-	if (attempts == 3) {
-		ret = -ETIMEDOUT;
-		goto out;
-	}
-
-	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
-		ret = -EIO;
-		goto out;
-	}
-
-out:
-	return ret;
-}
-
 static bool
 intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
 {
drivers/gpu/drm/i915/intel_drv.h +1 -1
index cacee94749e2..0da7be3349cc 100644
@@ -1644,7 +1644,6 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
-int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state);
@@ -1900,6 +1899,7 @@ void intel_psr_compute_config(struct intel_dp *intel_dp,
 			      struct intel_crtc_state *crtc_state);
 void intel_psr_irq_control(struct drm_i915_private *dev_priv, bool debug);
 void intel_psr_irq_handler(struct drm_i915_private *dev_priv, u32 psr_iir);
+int intel_psr_sink_crc(struct intel_dp *intel_dp, u8 *crc);
 
 /* intel_runtime_pm.c */
 int intel_power_domains_init(struct drm_i915_private *);
drivers/gpu/drm/i915/intel_psr.c +35 -0
index 0d548292dd09..4ebd05b6e86d 100644
@@ -197,6 +197,41 @@ static u8 intel_dp_get_sink_sync_latency(struct intel_dp *intel_dp)
 	return val;
 }
 
+int intel_psr_sink_crc(struct intel_dp *intel_dp, u8 *crc)
+{
+	int count = 0, ret = 0, attempts;
+
+	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
+		u8 buf;
+
+		/* Wait for approximately half a frame, we cannot wait for a
+		 * vblank interrupt as it triggers PSR exit.
+		 */
+		if (attempts)
+			usleep_range(8000, 8500);
+
+		if (drm_dp_dpcd_readb(&intel_dp->aux,
+				      DP_TEST_SINK_MISC, &buf) < 0) {
+			ret = -EIO;
+			goto out;
+		}
+		count = buf & DP_TEST_COUNT_MASK;
+	}
+
+	if (attempts == 3) {
+		ret = -ETIMEDOUT;
+		goto out;
+	}
+
+	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
+		ret = -EIO;
+		goto out;
+	}
+
+out:
+	return ret;
+}
+
 void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 {
 	struct drm_i915_private *dev_priv =
Signature · 1 line
2.14.1

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

#11 lore raw

PATCH v2 3/3 drm/i915/psr: Move sink-crc to intel_psr.c

In reply to Dhinakaran Pandiyan

With sink-crc now being relevant only for PSR static frames, move the code to intel_psr.c and rename the function.

v2: Rebased.

---
 drivers/gpu/drm/i915/i915_debugfs.c |  4 ++--
 drivers/gpu/drm/i915/intel_dp.c     | 36 ------------------------------------
 drivers/gpu/drm/i915/intel_drv.h    |  2 +-
 drivers/gpu/drm/i915/intel_psr.c    | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 39 insertions(+), 39 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -2
index e4ba6527c16e..a84f410ad722 100644
@@ -2786,7 +2786,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 		intel_dp = enc_to_intel_dp(state->best_encoder);
 		vrefresh = crtc_state->base.adjusted_mode.vrefresh;
 
-		ret = intel_dp_sink_crc(intel_dp, vrefresh, crc);
+		ret = intel_psr_sink_crc(intel_dp, vrefresh, crc);
 		if (ret)
 			goto err;
 
@@ -4856,7 +4856,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_ppgtt_info", i915_ppgtt_info, 0},
 	{"i915_llc", i915_llc, 0},
 	{"i915_edp_psr_status", i915_edp_psr_status, 0},
-	{"i915_sink_crc_eDP1", i915_sink_crc, 0},
+	{"i915_edp_psr_sink_crc", i915_sink_crc, 0},
 	{"i915_energy_uJ", i915_energy_uJ, 0},
 	{"i915_runtime_pm_status", i915_runtime_pm_status, 0},
 	{"i915_power_domain_info", i915_power_domain_info, 0},
drivers/gpu/drm/i915/intel_dp.c +0 -36
index 3ab3f82e33f6..ff7522d3632e 100644
@@ -3876,42 +3876,6 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
 					intel_dp->is_mst);
 }
 
-int intel_dp_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc)
-{
-	int count = 0, ret = 0, attempts;
-	int half_frame_us = DIV_ROUND_UP(1000000/2, vrefresh);
-
-	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
-		u8 buf;
-
-		/* Wait for approximately half a frame, we cannot wait for a
-		 * vblank interrupt as it triggers PSR exit.
-		 */
-		if (attempts)
-			usleep_range(half_frame_us, half_frame_us + 100);
-
-		if (drm_dp_dpcd_readb(&intel_dp->aux,
-				      DP_TEST_SINK_MISC, &buf) < 0) {
-			ret = -EIO;
-			goto out;
-		}
-		count = buf & DP_TEST_COUNT_MASK;
-	}
-
-	if (attempts == 3) {
-		ret = -ETIMEDOUT;
-		goto out;
-	}
-
-	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
-		ret = -EIO;
-		goto out;
-	}
-
-out:
-	return ret;
-}
-
 static bool
 intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
 {
drivers/gpu/drm/i915/intel_drv.h +1 -1
index 48073be8a023..d4e5a407777f 100644
@@ -1644,7 +1644,6 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
-int intel_dp_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state);
@@ -1900,6 +1899,7 @@ void intel_psr_compute_config(struct intel_dp *intel_dp,
 			      struct intel_crtc_state *crtc_state);
 void intel_psr_irq_control(struct drm_i915_private *dev_priv, bool debug);
 void intel_psr_irq_handler(struct drm_i915_private *dev_priv, u32 psr_iir);
+int intel_psr_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc);
 
 /* intel_runtime_pm.c */
 int intel_power_domains_init(struct drm_i915_private *);
drivers/gpu/drm/i915/intel_psr.c +36 -0
index 0d548292dd09..8b3a3459eae5 100644
@@ -197,6 +197,42 @@ static u8 intel_dp_get_sink_sync_latency(struct intel_dp *intel_dp)
 	return val;
 }
 
+int intel_psr_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc)
+{
+	int count = 0, ret = 0, attempts;
+	int half_frame_us = DIV_ROUND_UP(1000000/2, vrefresh);
+
+	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
+		u8 buf;
+
+		/* Wait for approximately half a frame, we cannot wait for a
+		 * vblank interrupt as it triggers PSR exit.
+		 */
+		if (attempts)
+			usleep_range(half_frame_us, half_frame_us + 100);
+
+		if (drm_dp_dpcd_readb(&intel_dp->aux,
+				      DP_TEST_SINK_MISC, &buf) < 0) {
+			ret = -EIO;
+			goto out;
+		}
+		count = buf & DP_TEST_COUNT_MASK;
+	}
+
+	if (attempts == 3) {
+		ret = -ETIMEDOUT;
+		goto out;
+	}
+
+	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
+		ret = -EIO;
+		goto out;
+	}
+
+out:
+	return ret;
+}
+
 void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 {
 	struct drm_i915_private *dev_priv =
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v2 3/3
#12 lore raw

Re: [PATCH v2 3/3] drm/i915/psr: Move sink-crc to intel_psr.c

Quoted 5 lines · Dhinakaran Pandiyan

With sink-crc now being relevant only for PSR static frames, move the code to intel_psr.c and rename the function.

v2: Rebased.

Quoted 146 lines
---
 drivers/gpu/drm/i915/i915_debugfs.c |  4 ++--
 drivers/gpu/drm/i915/intel_dp.c     | 36 ------------------------------------
 drivers/gpu/drm/i915/intel_drv.h    |  2 +-
 drivers/gpu/drm/i915/intel_psr.c    | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 39 insertions(+), 39 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -2
index e4ba6527c16e..a84f410ad722 100644
@@ -2786,7 +2786,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
 		intel_dp = enc_to_intel_dp(state->best_encoder);
 		vrefresh = crtc_state->base.adjusted_mode.vrefresh;
 
-		ret = intel_dp_sink_crc(intel_dp, vrefresh, crc);
+		ret = intel_psr_sink_crc(intel_dp, vrefresh, crc);
 		if (ret)
 			goto err;
 
@@ -4856,7 +4856,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_ppgtt_info", i915_ppgtt_info, 0},
 	{"i915_llc", i915_llc, 0},
 	{"i915_edp_psr_status", i915_edp_psr_status, 0},
-	{"i915_sink_crc_eDP1", i915_sink_crc, 0},
+	{"i915_edp_psr_sink_crc", i915_sink_crc, 0},
 	{"i915_energy_uJ", i915_energy_uJ, 0},
 	{"i915_runtime_pm_status", i915_runtime_pm_status, 0},
 	{"i915_power_domain_info", i915_power_domain_info, 0},
drivers/gpu/drm/i915/intel_dp.c +0 -36
index 3ab3f82e33f6..ff7522d3632e 100644
@@ -3876,42 +3876,6 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
 					intel_dp->is_mst);
 }
 
-int intel_dp_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc)
-{
-	int count = 0, ret = 0, attempts;
-	int half_frame_us = DIV_ROUND_UP(1000000/2, vrefresh);
-
-	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
-		u8 buf;
-
-		/* Wait for approximately half a frame, we cannot wait for a
-		 * vblank interrupt as it triggers PSR exit.
-		 */
-		if (attempts)
-			usleep_range(half_frame_us, half_frame_us + 100);
-
-		if (drm_dp_dpcd_readb(&intel_dp->aux,
-				      DP_TEST_SINK_MISC, &buf) < 0) {
-			ret = -EIO;
-			goto out;
-		}
-		count = buf & DP_TEST_COUNT_MASK;
-	}
-
-	if (attempts == 3) {
-		ret = -ETIMEDOUT;
-		goto out;
-	}
-
-	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
-		ret = -EIO;
-		goto out;
-	}
-
-out:
-	return ret;
-}
-
 static bool
 intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
 {
drivers/gpu/drm/i915/intel_drv.h +1 -1
index 48073be8a023..d4e5a407777f 100644
@@ -1644,7 +1644,6 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
-int intel_dp_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state);
@@ -1900,6 +1899,7 @@ void intel_psr_compute_config(struct intel_dp *intel_dp,
 			      struct intel_crtc_state *crtc_state);
 void intel_psr_irq_control(struct drm_i915_private *dev_priv, bool debug);
 void intel_psr_irq_handler(struct drm_i915_private *dev_priv, u32 psr_iir);
+int intel_psr_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc);
 
 /* intel_runtime_pm.c */
 int intel_power_domains_init(struct drm_i915_private *);
drivers/gpu/drm/i915/intel_psr.c +36 -0
index 0d548292dd09..8b3a3459eae5 100644
@@ -197,6 +197,42 @@ static u8 intel_dp_get_sink_sync_latency(struct intel_dp *intel_dp)
 	return val;
 }
 
+int intel_psr_sink_crc(struct intel_dp *intel_dp, int vrefresh, u8 *crc)
+{
+	int count = 0, ret = 0, attempts;
+	int half_frame_us = DIV_ROUND_UP(1000000/2, vrefresh);
+
+	for (attempts = 0; attempts < 3 && count == 0; attempts++) {
+		u8 buf;
+
+		/* Wait for approximately half a frame, we cannot wait for a
+		 * vblank interrupt as it triggers PSR exit.
+		 */
+		if (attempts)
+			usleep_range(half_frame_us, half_frame_us + 100);
+
+		if (drm_dp_dpcd_readb(&intel_dp->aux,
+				      DP_TEST_SINK_MISC, &buf) < 0) {
+			ret = -EIO;
+			goto out;
+		}
+		count = buf & DP_TEST_COUNT_MASK;
+	}
+
+	if (attempts == 3) {
+		ret = -ETIMEDOUT;
+		goto out;
+	}
+
+	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
+		ret = -EIO;
+		goto out;
+	}
+
+out:
+	return ret;
+}
+
 void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 {
 	struct drm_i915_private *dev_priv =
Signature · 1 line
2.14.1

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

#13 lore raw

✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915/dp: Check if the sink crc we read is 6 bytes.

In reply to Dhinakaran Pandiyan
== Series Details ==

== Series Details ==

Series: series starting with [1/3] drm/i915/dp: Check if the sink crc we read is 6 bytes.
URL : https://patchwork.freedesktop.org/series/42154/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4082 -> Patchwork_8783 =

== Summary - FAILURE ==

Serious unknown changes coming with Patchwork_8783 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8783, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/42154/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_8783:

=== IGT changes ===

    ==== Possible regressions ====

    igt@kms_frontbuffer_tracking@basic:
      fi-cnl-y3:          PASS -> FAIL
      fi-cnl-psr:         PASS -> FAIL
      fi-cfl-s3:          PASS -> FAIL
      {fi-kbl-7560u}:     PASS -> FAIL
      fi-skl-6600u:       PASS -> FAIL
      fi-kbl-r:           PASS -> FAIL
      fi-cfl-u:           PASS -> FAIL

    
    ==== Warnings ====

    igt@kms_force_connector_basic@force-load-detect:
      fi-ivb-3520m:       PASS -> SKIP +3

    igt@kms_sink_crc_basic:
      fi-cfl-u:           PASS -> SKIP
      fi-cnl-psr:         PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_8783 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_mmap_gtt@basic-small-bo-tiledx:
      fi-gdg-551:         PASS -> FAIL (fdo#102575)

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b-frame-sequence:
      fi-skl-guc:         PASS -> FAIL (fdo#103191)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s4-devices:
      fi-ilk-650:         DMESG-WARN -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         FAIL (fdo#104008) -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008

== Participating hosts (36 -> 33) ==

Missing (3): fi-ctg-p8600 fi-ilk-m540 fi-skl-6700hq

== Build changes ==

* Linux: CI_DRM_4082 -> Patchwork_8783

CI_DRM_4082: 0600266ef9b8407e0dc281acb6b754eba8178c91 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4444: dcc44347494231feabc588c2a76998cbc9afdf8c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8783: c0e07f8b9d9412e9d41da72654ec408658913b94 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4444: a2f486679f467cd6e82578384f56d4aabaa8cf2e @ git://anongit.freedesktop.org/piglit

== Linux commits ==

c0e07f8b9d94 drm/i915/psr: Move sink-crc to intel_psr.c 676d279f8a86 drm/i915/dp: Fix sink-crc reads. 7fc2b33053e5 drm/i915/dp: Check if the sink crc we read is 6 bytes.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8783/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

Re: ✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915/dp: Check if the sink crc we read is 6 bytes.

Quoted 30 lines · PDT Patchwork

== Series Details ==

Series: series starting with [1/3] drm/i915/dp: Check if the sink crc we
read is 6 bytes. URL : https://patchwork.freedesktop.org/series/42154/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4082 -> Patchwork_8783 =

== Summary - FAILURE ==

Serious unknown changes coming with Patchwork_8783 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8783, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in
CI.

External URL:
https://patchwork.freedesktop.org/api/1.0/series/42154/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in
Patchwork_8783:

=== IGT changes ===

Quoted 11 lines
    ==== Possible regressions ====

    igt@kms_frontbuffer_tracking@basic:
      fi-cnl-y3:          PASS -> FAIL
      fi-cnl-psr:         PASS -> FAIL
      fi-cfl-s3:          PASS -> FAIL
      {fi-kbl-7560u}:     PASS -> FAIL
      fi-skl-6600u:       PASS -> FAIL
      fi-kbl-r:           PASS -> FAIL
      fi-cfl-u:           PASS -> FAIL

These failures are expected, tests need to modified if this series is accepted.

Quoted 10 lines
    ==== Warnings ====

    igt@kms_force_connector_basic@force-load-detect:
      fi-ivb-3520m:       PASS -> SKIP +3

    igt@kms_sink_crc_basic:
      fi-cfl-u:           PASS -> SKIP
      fi-cnl-psr:         PASS -> SKIP

So are these.

Quoted 62 lines

== Known issues ==

Here are the changes found in Patchwork_8783 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_mmap_gtt@basic-small-bo-tiledx:
      fi-gdg-551:         PASS -> FAIL (fdo#102575)

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b-frame-sequence:
      fi-skl-guc:         PASS -> FAIL (fdo#103191)


    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s4-devices:
      fi-ilk-650:         DMESG-WARN -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         FAIL (fdo#104008) -> PASS

{name}: This element is suppressed. This means it is ignored when
computing the status of the difference (SUCCESS, WARNING, or FAILURE).

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008

== Participating hosts (36 -> 33) ==

Missing (3): fi-ctg-p8600 fi-ilk-m540 fi-skl-6700hq

== Build changes ==

* Linux: CI_DRM_4082 -> Patchwork_8783

CI_DRM_4082: 0600266ef9b8407e0dc281acb6b754eba8178c91 @
git://anongit.freedesktop.org/gfx-ci/linux IGT_4444:
dcc44347494231feabc588c2a76998cbc9afdf8c @
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools Patchwork_8783:
c0e07f8b9d9412e9d41da72654ec408658913b94 @
git://anongit.freedesktop.org/gfx-ci/linux piglit_4444:
a2f486679f467cd6e82578384f56d4aabaa8cf2e @
git://anongit.freedesktop.org/piglit

== Linux commits ==

c0e07f8b9d94 drm/i915/psr: Move sink-crc to intel_psr.c 676d279f8a86 drm/i915/dp: Fix sink-crc reads. 7fc2b33053e5 drm/i915/dp: Check if the sink crc we read is 6 bytes.

Quoted 8 lines

== Logs ==

For more details see:
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8783/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

maintainer Reviewed-by on v1 1/3
#15 lore raw
In reply to Dhinakaran Pandiyan
Quoted 3 lines · Dhinakaran Pandiyan

We attempt to read 6 bytes, make sure we have.

Quoted 20 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 62f82c4298ac..7dcc874b7d8f 100644
@@ -3989,7 +3989,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, struct intel_crtc_state *crtc_s
 		goto stop;
 	}
 
-	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) < 0) {
+	if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) != 6) {
 		ret = -EIO;
 		goto stop;
 	}
Signature · 1 line
2.14.1

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

#16 lore raw

✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915/dp: Check if the sink crc we read is 6 bytes. (rev3)

In reply to Dhinakaran Pandiyan
== Series Details ==

== Series Details ==

Series: series starting with [1/3] drm/i915/dp: Check if the sink crc we read is 6 bytes. (rev3)
URL : https://patchwork.freedesktop.org/series/42154/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
89124b64449f drm/i915/dp: Check if the sink crc we read is 6 bytes.
d8db909cc13f drm/i915/dp: Fix sink-crc reads.
-:65: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV)
#65: FILE: drivers/gpu/drm/i915/intel_dp.c:3882:
+	int half_frame_us = DIV_ROUND_UP(1000000/2, vrefresh);
 	                                        ^

total: 0 errors, 0 warnings, 1 checks, 165 lines checked 3288f3762198 drm/i915/psr: Move sink-crc to intel_psr.c -:112: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #112: FILE: drivers/gpu/drm/i915/intel_psr.c:203:
+ int half_frame_us = DIV_ROUND_UP(1000000/2, vrefresh);
^

total: 0 errors, 0 warnings, 1 checks, 114 lines checked

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

#17 lore raw

✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915/dp: Check if the sink crc we read is 6 bytes. (rev3)

In reply to Dhinakaran Pandiyan
== Series Details ==

== Series Details ==

Series: series starting with [1/3] drm/i915/dp: Check if the sink crc we read is 6 bytes. (rev3)
URL : https://patchwork.freedesktop.org/series/42154/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4099 -> Patchwork_8804 =

== Summary - FAILURE ==

Serious unknown changes coming with Patchwork_8804 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8804, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/42154/revisions/3/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_8804:

=== IGT changes ===

    ==== Possible regressions ====

    igt@kms_frontbuffer_tracking@basic:
      fi-cnl-y3:          PASS -> FAIL
      fi-cnl-psr:         PASS -> FAIL
      fi-cfl-s3:          PASS -> FAIL
      fi-kbl-7560u:       PASS -> FAIL
      fi-skl-6600u:       PASS -> FAIL
      {fi-hsw-4200u}:     PASS -> FAIL
      fi-kbl-r:           PASS -> FAIL
      fi-cfl-u:           PASS -> FAIL

    
    ==== Warnings ====

    igt@kms_sink_crc_basic:
      fi-cfl-u:           PASS -> SKIP
      {fi-hsw-4200u}:     PASS -> SKIP
      fi-cnl-psr:         PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_8804 that come from known issues:

=== IGT changes ===

    ==== Possible fixes ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

== Participating hosts (38 -> 35) ==

Missing (3): fi-ilk-m540 fi-skl-6700hq fi-pnv-d510

== Build changes ==

* Linux: CI_DRM_4099 -> Patchwork_8804

CI_DRM_4099: 92a39635c2eca4dfe1c8c1673e0c606a720746e5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4449: 0350f0e7f6a0e07281445fc3082aa70419f4aac7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8804: 3288f3762198964ac51b630273a5b3cbbee2db4d @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4449: ad8992d3fb27fd604b9ab15e7963c42421ced85c @ git://anongit.freedesktop.org/piglit

== Linux commits ==

3288f3762198 drm/i915/psr: Move sink-crc to intel_psr.c d8db909cc13f drm/i915/dp: Fix sink-crc reads. 89124b64449f drm/i915/dp: Check if the sink crc we read is 6 bytes.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8804/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#18 lore raw

Re: ✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915/dp: Check if the sink crc we read is 6 bytes. (rev3)

Quoted 27 lines · Patchwork

== Series Details ==

Series: series starting with [1/3] drm/i915/dp: Check if the sink crc we read is 6 bytes. (rev3)
URL : https://patchwork.freedesktop.org/series/42154/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4099 -> Patchwork_8804 =

== Summary - FAILURE ==

Serious unknown changes coming with Patchwork_8804 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8804, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/42154/revisions/3/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_8804:

=== IGT changes ===

Quoted 11 lines
    ==== Possible regressions ====

    igt@kms_frontbuffer_tracking@basic:
      fi-cnl-y3:          PASS -> FAIL
      fi-cnl-psr:         PASS -> FAIL
      fi-cfl-s3:          PASS -> FAIL
      fi-kbl-7560u:       PASS -> FAIL
      fi-skl-6600u:       PASS -> FAIL
      {fi-hsw-4200u}:     PASS -> FAIL
      fi-kbl-r:           PASS -> FAIL
      fi-cfl-u:           PASS -> FAIL

it seems that we need to kill sink_crc test case first...

Quoted 49 lines
    
    ==== Warnings ====

    igt@kms_sink_crc_basic:
      fi-cfl-u:           PASS -> SKIP
      {fi-hsw-4200u}:     PASS -> SKIP
      fi-cnl-psr:         PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_8804 that come from known issues:

=== IGT changes ===

    ==== Possible fixes ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

== Participating hosts (38 -> 35) ==

Missing (3): fi-ilk-m540 fi-skl-6700hq fi-pnv-d510

== Build changes ==

* Linux: CI_DRM_4099 -> Patchwork_8804

CI_DRM_4099: 92a39635c2eca4dfe1c8c1673e0c606a720746e5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4449: 0350f0e7f6a0e07281445fc3082aa70419f4aac7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8804: 3288f3762198964ac51b630273a5b3cbbee2db4d @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4449: ad8992d3fb27fd604b9ab15e7963c42421ced85c @ git://anongit.freedesktop.org/piglit

== Linux commits ==

3288f3762198 drm/i915/psr: Move sink-crc to intel_psr.c d8db909cc13f drm/i915/dp: Fix sink-crc reads. 89124b64449f drm/i915/dp: Check if the sink crc we read is 6 bytes.

Quoted 7 lines

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8804/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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