drm/i915: Try to stop sink crc calculation on error.
Subsystems (2)
Rodrigo Vivi
maintainerPATCH 2/7 drm/i915: Try to stop sink crc calculation on error.
Right now if we face any kind of error sink crc calculation stays enabled.
So, let's give a shot and try to stop it anyway if it got enabled.
--- drivers/gpu/drm/i915/intel_dp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +5 -4
@@ -3994,7 +3994,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; - goto out; + goto stop; } test_crc_count = buf &DP_TEST_COUNT_MASK ;
@@ -4003,7 +4003,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; - goto out; + goto stop; }intel_wait_for_vblank (dev, intel_crtc->pipe); }while (--attempts && (buf &DP_TEST_COUNT_MASK ) == test_crc_count);
@@ -4011,14 +4011,15 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)if (attempts ==0 ) {DRM_DEBUG_KMS ("Panel is unable to calculate CRC after 6 vblanks\n" ); ret = -ETIMEDOUT ; - goto out; + goto stop; }if (drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_CRC_R_CR , crc,6 ) <0 ) { ret = -EIO ; - goto out; + goto stop; } +stop:if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { ret = -EIO ; goto out;
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 3/7 drm/i915: Don't return error on sink crc stop.
If we got to the point where we are trying to stop sink CRC the main output of this function was already gotten properly, so don't return the error and let userspace use the crc data.
Let's replace the errnos returns with some log messages.
--- drivers/gpu/drm/i915/intel_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -2
@@ -4021,12 +4021,12 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) stop:if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); goto out; }if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , buf & ~DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); goto out; } out:
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/7] drm/i915: Don't return error on sink crc stop.
Quoted 5 lines · Rodrigo Vivi
If we got to the point where we are trying to stop sink CRC the main output of this function was already gotten properly, so don't return the error and let userspace use the crc data.
Let's replace the errnos returns with some log messages.
So, up to this commit, there's no way to know that an error has ocurred and the next CRC calculation can go wrong.
I know that in a follow up patch this is fixed by trying to stop the calculation at the beginning too, but just pointing out that this one specifically has this problem.
Not sure if this is a problem though, since the patches are submitted together. If not, then
Quoted 31 lines
Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-2@@ -4021,12 +4021,12 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) stop:if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); goto out; }if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , buf & ~DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); goto out; } out:Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Rafael
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/7] drm/i915: Don't return error on sink crc stop.
Quoted 5 lines · Rafael Antognolli
Quoted 4 lines · Rodrigo Vivi
If we got to the point where we are trying to stop sink CRC the main output of this function was already gotten properly, so don't return the error and let userspace use the crc data.
Quoted 9 lines
Quoted 1 line
Let's replace the errnos returns with some log messages.
So, up to this commit, there's no way to know that an error has ocurred and the next CRC calculation can go wrong.
I know that in a follow up patch this is fixed by trying to stop the calculation at the beginning too, but just pointing out that this one specifically has this problem.
Actually it isn't a problem if crc calculation continue enabled. Mainly with the mask s/0x7/0xf fix.
But it is good to disable and force counter reset anyway. (the following patch you mentioned)
This patch here is just to highlight that errors during read has more priority than errors on stopping crc.
Another way would be to create a stop_ret and
if (!ret and stop_ret)
ret = stop_ret;
But I decided this cleaned version would be better.
Quoted 6 lines
Not sure if this is a problem though, since the patches are submitted together. If not, then
Reviewed-by Rafael Antognolli <[email protected]>
Thanks!
Quoted 36 lines
Review
Quoted 8 lines
Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_dp.cdrivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp,
Quoted 4 lines
index 70a4a37..44f8a32 100644
drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -4021,12 +4021,12 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp,u8 *crc)
Quoted 17 lines
drivers/gpu/drm/i915/intel_dp.c +2
-3stop:if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); goto out; }if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , buf & ~DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); goto out; } out: --2.1.0
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines
--
Rafael
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 4/7 drm/i915: Split sink_crc function in start, stop and read.
In reply to Rodrigo ViviNo functional change. Just a preparation patch to make clear what operation we are performing.
--- drivers/gpu/drm/i915/intel_dp.c | 89 +++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 39 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +50 -39
@@ -3958,40 +3958,64 @@ intel_dp_probe_mst(struct intel_dp *intel_dp)return intel_dp->is_mst; } -int intel_dp_sink_crc (struct intel_dp *intel_dp,u8 *crc) +static void intel_dp_sink_crc_stop (struct intel_dp *intel_dp) { -struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = intel_dig_port->base.base.dev; -struct intel_crtc *intel_crtc = -to_intel_crtc (intel_dig_port->base.base.crtc); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; -int test_crc_count; -int attempts =6 ; -int ret =0 ; - -hsw_disable_ips (intel_crtc); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { - ret = -EIO ; - goto out; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); +return ; } -if (!(buf &DP_TEST_CRC_SUPPORTED )) { - ret = -ENOTTY ; - goto out; - } +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" ); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; - goto out; - } +hsw_enable_ips (intel_crtc); +} + +static int intel_dp_sink_crc_start (struct intel_dp *intel_dp) +{ +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; + +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 ; + +hsw_disable_ips (intel_crtc);if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , - buf |DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; - goto out; + buf |DP_TEST_SINK_START ) <0 ) { +hsw_enable_ips (intel_crtc); +return -EIO ; } +return 0 ; +} + +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_device *dev = dig_port->base.base.dev; +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; +int test_crc_count; +int attempts =6 ; +int ret; + + ret =intel_dp_sink_crc_start (intel_dp); +if (ret) +return ret; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; goto stop;
@@ -4014,23 +4038,10 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) 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 ) <0 ) ret = -EIO ; - goto stop; - } - stop: -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { -DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); - goto out; - } -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" ); - goto out; - } -out: -hsw_enable_ips (intel_crtc); +intel_dp_sink_crc_stop (intel_dp);return ret; }
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/7] drm/i915: Split sink_crc function in start, stop and read.
Quoted 4 lines · Rodrigo Vivi
No functional change. Just a preparation patch to make clear what operation we are performing.
Signed-off-by Rodrigo Vivi <[email protected]>
Good. The place where you call hsw_disable_ips() changes, but as you explained earlier, this is required.
Quoted 130 lines
--- drivers/gpu/drm/i915/intel_dp.c | 89 +++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 39 deletions(-)drivers/gpu/drm/i915/intel_dp.c +50
-39@@ -3958,40 +3958,64 @@ intel_dp_probe_mst(struct intel_dp *intel_dp)return intel_dp->is_mst; } -int intel_dp_sink_crc (struct intel_dp *intel_dp,u8 *crc) +static void intel_dp_sink_crc_stop (struct intel_dp *intel_dp) { -struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = intel_dig_port->base.base.dev; -struct intel_crtc *intel_crtc = -to_intel_crtc (intel_dig_port->base.base.crtc); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; -int test_crc_count; -int attempts =6 ; -int ret =0 ; - -hsw_disable_ips (intel_crtc); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { - ret = -EIO ; - goto out; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); +return ; } -if (!(buf &DP_TEST_CRC_SUPPORTED )) { - ret = -ENOTTY ; - goto out; - } +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" ); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; - goto out; - } +hsw_enable_ips (intel_crtc); +} + +static int intel_dp_sink_crc_start (struct intel_dp *intel_dp) +{ +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; + +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 ; + +hsw_disable_ips (intel_crtc);if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , - buf |DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; - goto out; + buf |DP_TEST_SINK_START ) <0 ) { +hsw_enable_ips (intel_crtc); +return -EIO ; } +return 0 ; +} + +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_device *dev = dig_port->base.base.dev; +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; +int test_crc_count; +int attempts =6 ; +int ret; + + ret =intel_dp_sink_crc_start (intel_dp); +if (ret) +return ret; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; goto stop;@@ -4014,23 +4038,10 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) 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 ) <0 ) ret = -EIO ; - goto stop; - } - stop: -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { -DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); - goto out; - } -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" ); - goto out; - } -out: -hsw_enable_ips (intel_crtc); +intel_dp_sink_crc_stop (intel_dp);return ret; }Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/7] drm/i915: Split sink_crc function in start, stop and read.
Quoted 8 lines · Rafael Antognolli
Quoted 4 lines · Rodrigo Vivi
No functional change. Just a preparation patch to make clear what operation we are performing.
Signed-off-by Rodrigo Vivi <[email protected]>Good. The place where you call
hsw_disable_ips()changes, but as you explained earlier, this is required.
That explanation should be in the commit message. Merged the two earlier patches in the series meanwhile.
-Daniel
Quoted 137 lines
Reviewed-by Rafael Antognolli <[email protected]>Quoted 130 lines
--- drivers/gpu/drm/i915/intel_dp.c | 89 +++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 39 deletions(-)drivers/gpu/drm/i915/intel_dp.c +50
-39@@ -3958,40 +3958,64 @@ intel_dp_probe_mst(struct intel_dp *intel_dp)return intel_dp->is_mst; } -int intel_dp_sink_crc (struct intel_dp *intel_dp,u8 *crc) +static void intel_dp_sink_crc_stop (struct intel_dp *intel_dp) { -struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = intel_dig_port->base.base.dev; -struct intel_crtc *intel_crtc = -to_intel_crtc (intel_dig_port->base.base.crtc); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; -int test_crc_count; -int attempts =6 ; -int ret =0 ; - -hsw_disable_ips (intel_crtc); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { - ret = -EIO ; - goto out; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); +return ; } -if (!(buf &DP_TEST_CRC_SUPPORTED )) { - ret = -ENOTTY ; - goto out; - } +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" ); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; - goto out; - } +hsw_enable_ips (intel_crtc); +} + +static int intel_dp_sink_crc_start (struct intel_dp *intel_dp) +{ +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; + +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 ; + +hsw_disable_ips (intel_crtc);if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , - buf |DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; - goto out; + buf |DP_TEST_SINK_START ) <0 ) { +hsw_enable_ips (intel_crtc); +return -EIO ; } +return 0 ; +} + +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_device *dev = dig_port->base.base.dev; +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; +int test_crc_count; +int attempts =6 ; +int ret; + + ret =intel_dp_sink_crc_start (intel_dp); +if (ret) +return ret; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; goto stop;@@ -4014,23 +4038,10 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) 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 ) <0 ) ret = -EIO ; - goto stop; - } - stop: -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { -DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); - goto out; - } -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" ); - goto out; - } -out: -hsw_enable_ips (intel_crtc); +intel_dp_sink_crc_stop (intel_dp);return ret; }Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 1/1 drm/i915: Split sink_crc function in start, stop and read.
This is just a preparation patch to make clear what operation we are performing. There is no functional change on the sink crc logic.
hsw_disable_ips has been moved a bit further in the start function to avoid disabling ips when sink crc is not going to be started. and to avoid goto on this function.
v2: explain why hsw_disable_ips() call place has changed.
--- drivers/gpu/drm/i915/intel_dp.c | 89 +++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 39 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +50 -39
@@ -3958,40 +3958,64 @@ intel_dp_probe_mst(struct intel_dp *intel_dp)return intel_dp->is_mst; } -int intel_dp_sink_crc (struct intel_dp *intel_dp,u8 *crc) +static void intel_dp_sink_crc_stop (struct intel_dp *intel_dp) { -struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = intel_dig_port->base.base.dev; -struct intel_crtc *intel_crtc = -to_intel_crtc (intel_dig_port->base.base.crtc); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; -int test_crc_count; -int attempts =6 ; -int ret =0 ; - -hsw_disable_ips (intel_crtc); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { - ret = -EIO ; - goto out; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); +return ; } -if (!(buf &DP_TEST_CRC_SUPPORTED )) { - ret = -ENOTTY ; - goto out; - } +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" ); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; - goto out; - } +hsw_enable_ips (intel_crtc); +} + +static int intel_dp_sink_crc_start (struct intel_dp *intel_dp) +{ +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; + +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 ; + +hsw_disable_ips (intel_crtc);if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , - buf |DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; - goto out; + buf |DP_TEST_SINK_START ) <0 ) { +hsw_enable_ips (intel_crtc); +return -EIO ; } +return 0 ; +} + +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_device *dev = dig_port->base.base.dev; +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; +int test_crc_count; +int attempts =6 ; +int ret; + + ret =intel_dp_sink_crc_start (intel_dp); +if (ret) +return ret; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; goto stop;
@@ -4014,23 +4038,10 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) 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 ) <0 ) ret = -EIO ; - goto stop; - } - stop: -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { -DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); - goto out; - } -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" ); - goto out; - } -out: -hsw_enable_ips (intel_crtc); +intel_dp_sink_crc_stop (intel_dp);return ret; }
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Split sink_crc function in start, stop and read.
Quoted 8 lines · Rodrigo Vivi
This is just a preparation patch to make clear what operation we are performing. There is no functional change on the sink crc logic.
hsw_disable_ipshas been moved a bit further in the start function to avoid disabling ips when sink crc is not going to be started. and to avoid goto on this function.
Quoted 5 lines
v2: explain why
hsw_disable_ips()call place has changed.Cc Daniel Vetter <[email protected]>Reviewed-by Rafael Antognolli <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>
Thanks for the updated commit message. Queued for -next, thanks for the patch.
-Daniel
Quoted 126 lines
--- drivers/gpu/drm/i915/intel_dp.c | 89 +++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 39 deletions(-)drivers/gpu/drm/i915/intel_dp.c +50
-39@@ -3958,40 +3958,64 @@ intel_dp_probe_mst(struct intel_dp *intel_dp)return intel_dp->is_mst; } -int intel_dp_sink_crc (struct intel_dp *intel_dp,u8 *crc) +static void intel_dp_sink_crc_stop (struct intel_dp *intel_dp) { -struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = intel_dig_port->base.base.dev; -struct intel_crtc *intel_crtc = -to_intel_crtc (intel_dig_port->base.base.crtc); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; -int test_crc_count; -int attempts =6 ; -int ret =0 ; - -hsw_disable_ips (intel_crtc); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { - ret = -EIO ; - goto out; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); +return ; } -if (!(buf &DP_TEST_CRC_SUPPORTED )) { - ret = -ENOTTY ; - goto out; - } +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" ); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; - goto out; - } +hsw_enable_ips (intel_crtc); +} + +static int intel_dp_sink_crc_start (struct intel_dp *intel_dp) +{ +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; + +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 ; + +hsw_disable_ips (intel_crtc);if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , - buf |DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; - goto out; + buf |DP_TEST_SINK_START ) <0 ) { +hsw_enable_ips (intel_crtc); +return -EIO ; } +return 0 ; +} + +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_device *dev = dig_port->base.base.dev; +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; +int test_crc_count; +int attempts =6 ; +int ret; + + ret =intel_dp_sink_crc_start (intel_dp); +if (ret) +return ret; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; goto stop;@@ -4014,23 +4038,10 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) 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 ) <0 ) ret = -EIO ; - goto stop; - } - stop: -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { -DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); - goto out; - } -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" ); - goto out; - } -out: -hsw_enable_ips (intel_crtc); +intel_dp_sink_crc_stop (intel_dp);return ret; }Signature · 1 line
2.1.0
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Vivi, Rodrigo
maintainerRe: [PATCH] drm/i915: Split sink_crc function in start, stop and read.
Quoted 9 lines · Daniel Vetter
Quoted 8 lines · Rodrigo Vivi
This is just a preparation patch to make clear what operation we are performing. There is no functional change on the sink crc logic.
hsw_disable_ipshas been moved a bit further in the start function to avoid disabling ips when sink crc is not going to be started. and to avoid goto on this function.
Quoted 8 lines
Quoted 5 lines
v2: explain why
hsw_disable_ips()call place has changed.Cc Daniel Vetter <[email protected]>Reviewed-by Rafael Antognolli <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Thanks for the updated commit message. Queued for -next, thanks for the patch.
Thanks!
Do you intend to merge the other 3 remaining patches? Or am I missing something there?
Thanks,
Rodrigo.
Quoted 124 lines
-Daniel
Quoted 123 lines
--- drivers/gpu/drm/i915/intel_dp.c | 89 +++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 39 deletions(-)drivers/gpu/drm/i915/intel_dp.c +50
-39@@ -3958,40 +3958,64 @@ intel_dp_probe_mst(struct intel_dp *intel_dp)return intel_dp->is_mst; } -int intel_dp_sink_crc (struct intel_dp *intel_dp,u8 *crc) +static void intel_dp_sink_crc_stop (struct intel_dp *intel_dp) { -struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = intel_dig_port->base.base.dev; -struct intel_crtc *intel_crtc = -to_intel_crtc (intel_dig_port->base.base.crtc); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; -int test_crc_count; -int attempts =6 ; -int ret =0 ; - -hsw_disable_ips (intel_crtc); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { - ret = -EIO ; - goto out; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); +return ; } -if (!(buf &DP_TEST_CRC_SUPPORTED )) { - ret = -ENOTTY ; - goto out; - } +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" ); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; - goto out; - } +hsw_enable_ips (intel_crtc); +} + +static int intel_dp_sink_crc_start (struct intel_dp *intel_dp) +{ +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; + +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 ; + +hsw_disable_ips (intel_crtc);if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , - buf |DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; - goto out; + buf |DP_TEST_SINK_START ) <0 ) { +hsw_enable_ips (intel_crtc); +return -EIO ; } +return 0 ; +} + +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_device *dev = dig_port->base.base.dev; +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; +int test_crc_count; +int attempts =6 ; +int ret; + + ret =intel_dp_sink_crc_start (intel_dp); +if (ret) +return ret; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; goto stop;@@ -4014,23 +4038,10 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) 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 ) <0 ) ret = -EIO ; - goto stop; - } - stop: -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { -DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); - goto out; - } -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" ); - goto out; - } -out: -hsw_enable_ips (intel_crtc); +intel_dp_sink_crc_stop (intel_dp);return ret; }
Quoted 4 lines
Quoted 3 lines
Signature · 1 line
2.1.0
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Split sink_crc function in start, stop and read.
Quoted 16 lines · Rodrigo
Quoted 15 lines · Daniel Vetter
Quoted 13 lines · Rodrigo Vivi
This is just a preparation patch to make clear what operation we are performing. There is no functional change on the sink crc logic.
hsw_disable_ipshas been moved a bit further in the start function to avoid disabling ips when sink crc is not going to be started. and to avoid goto on this function.v2: explain why
hsw_disable_ips()call place has changed.Cc Daniel Vetter <[email protected]>Reviewed-by Rafael Antognolli <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>
Quoted 7 lines
Quoted 2 lines
Thanks for the updated commit message. Queued for -next, thanks for the patch.
Thanks!
Do you intend to merge the other 3 remaining patches? Or am I missing something there?
Nah just oversight, merged 3 more patches. Do I have them all now? -Daniel
Quoted 133 lines
Thanks,
Rodrigo.Quoted 128 lines
-Daniel
Quoted 126 lines
--- drivers/gpu/drm/i915/intel_dp.c | 89 +++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 39 deletions(-)drivers/gpu/drm/i915/intel_dp.c +50
-39@@ -3958,40 +3958,64 @@ intel_dp_probe_mst(struct intel_dp *intel_dp)return intel_dp->is_mst; } -int intel_dp_sink_crc (struct intel_dp *intel_dp,u8 *crc) +static void intel_dp_sink_crc_stop (struct intel_dp *intel_dp) { -struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = intel_dig_port->base.base.dev; -struct intel_crtc *intel_crtc = -to_intel_crtc (intel_dig_port->base.base.crtc); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; -int test_crc_count; -int attempts =6 ; -int ret =0 ; - -hsw_disable_ips (intel_crtc); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { - ret = -EIO ; - goto out; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); +return ; } -if (!(buf &DP_TEST_CRC_SUPPORTED )) { - ret = -ENOTTY ; - goto out; - } +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" ); -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; - goto out; - } +hsw_enable_ips (intel_crtc); +} + +static int intel_dp_sink_crc_start (struct intel_dp *intel_dp) +{ +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; + +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 ; + +hsw_disable_ips (intel_crtc);if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , - buf |DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; - goto out; + buf |DP_TEST_SINK_START ) <0 ) { +hsw_enable_ips (intel_crtc); +return -EIO ; } +return 0 ; +} + +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_device *dev = dig_port->base.base.dev; +struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc); +u8 buf; +int test_crc_count; +int attempts =6 ; +int ret; + + ret =intel_dp_sink_crc_start (intel_dp); +if (ret) +return ret; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; goto stop;@@ -4014,23 +4038,10 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) 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 ) <0 ) ret = -EIO ; - goto stop; - } - stop: -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { -DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); - goto out; - } -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" ); - goto out; - } -out: -hsw_enable_ips (intel_crtc); +intel_dp_sink_crc_stop (intel_dp);return ret; }Signature · 1 line
2.1.0
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Split sink_crc function in start, stop and read.
Quoted 20 lines · Daniel Vetter
Quoted 19 lines · Rodrigo
Quoted 17 lines · Daniel Vetter
Quoted 8 lines · Rodrigo Vivi
This is just a preparation patch to make clear what operation we are performing. There is no functional change on the sink crc logic.
hsw_disable_ipshas been moved a bit further in the start function to avoid disabling ips when sink crc is not going to be started. and to avoid goto on this function.Quoted 5 lines
v2: explain why
hsw_disable_ips()call place has changed.Cc Daniel Vetter <[email protected]>Reviewed-by Rafael Antognolli <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Thanks for the updated commit message. Queued for -next, thanks for the patch.
Quoted 7 lines
Quoted 4 lines
Thanks!
Do you intend to merge the other 3 remaining patches? Or am I missing something there?
Nah just oversight, merged 3 more patches. Do I have them all now?
yes, thanks!
Quoted 146 lines
-Daniel
Quoted 7 lines
Thanks,
Rodrigo.Quoted 3 lines
-Daniel
Quoted 2 lines
--- drivers/gpu/drm/i915/intel_dp.c | 89+++++++++++++++++++++++------------------
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
1 file changed, 50 insertions(+), 39 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_dp.cQuoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_probe_mst(struct intel_dp *intel_dp) · line 3963
Quoted 11 lines
index 44f8a32..10cbc98 100644
drivers/gpu/drm/i915/intel_dp.c +1
-2@@ -3958,40 +3958,64 @@ intel_dp_probe_mst(struct intel_dp *intel_dp)return intel_dp->is_mst; } -int intel_dp_sink_crc (struct intel_dp *intel_dp,u8 *crc) +static void intel_dp_sink_crc_stop (struct intel_dp *intel_dp) { - struct intel_digital_port *intel_dig_port =
dp_to_dig_port(intel_dp);Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_probe_mst(struct intel_dp *intel_dp)
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2
-3-struct drm_device *dev = intel_dig_port->base.base.dev; -struct intel_crtc *intel_crtc = -to_intel_crtc (intel_dig_port->base.base.crtc); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); + struct intel_crtc *intel_crtc =
to_intel_crtc(dig_port->base.base.crtc);Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_probe_mst(struct intel_dp *intel_dp)
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +0
-6u8 buf; -int test_crc_count; -int attempts =6 ; -int ret =0 ; - -hsw_disable_ips (intel_crtc); - if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf) <0) {
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i915/intel_dp.c +6
-6- ret = -EIO ; - goto out; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { +DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); +return ; } -if (!(buf &DP_TEST_CRC_SUPPORTED )) { - ret = -ENOTTY ; - goto out; - } +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" );Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_probe_mst(struct intel_dp *intel_dp)
Quoted 11 lines
drivers/gpu/drm/i915/intel_dp.c +7
-4-if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { - ret = -EIO ; - goto out; - } +hsw_enable_ips (intel_crtc); +} + +static int intel_dp_sink_crc_start (struct intel_dp *intel_dp) +{ +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); + struct intel_crtc *intel_crtc =
to_intel_crtc(dig_port->base.base.crtc);Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
drivers/gpu/drm/i915/intel_dp.c +15
-3+u8 buf; + +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 ; + +hsw_disable_ips (intel_crtc);if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , - buf |DP_TEST_SINK_START ) <0 ) { - ret = -EIO ; - goto out; + buf |DP_TEST_SINK_START ) <0 ) { +hsw_enable_ips (intel_crtc); +return -EIO ; }Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_probe_mst(struct intel_dp *intel_dp)
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +8
-0+return 0 ; +} + +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_device *dev = dig_port->base.base.dev; + struct intel_crtc *intel_crtc =
to_intel_crtc(dig_port->base.base.crtc);Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_probe_mst(struct intel_dp *intel_dp)
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +9
-0+u8 buf; +int test_crc_count; +int attempts =6 ; +int ret; + + ret =intel_dp_sink_crc_start (intel_dp); +if (ret) +return ret; + if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf) <0) {
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0ret = -EIO ; goto stop;@@ -4014,23 +4038,10 @@ int intel_dp_sink_crc(struct intel_dp
*intel_dp, u8 *crc)Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +0
-1goto stop; } - if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) <0) {
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/i915/intel_dp.c +2
-14+if (drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_CRC_R_CR , crc,6 ) <0 ) ret = -EIO ; - goto stop; - } - stop: -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { -DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); - goto out; - } -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" ); - goto out; - } -out: -hsw_enable_ips (intel_crtc); +intel_dp_sink_crc_stop (intel_dp);return ret; }Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
--
2.1.0
Quoted 9 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 5/7 drm/i915: Force sink crc stop before start.
In reply to Rodrigo ViviBy Vesa DP spec, test counter at DP_TEST_SINK_MISC just reset to 0 when unsetting DP_TEST_SINK_START, so let's force this stop here.
But let's minimize the aux transactions and just do it when we know it hasn't been properly stoped.
--- drivers/gpu/drm/i915/intel_dp.c | 22 +++++++++++++++++++--- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 20 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +19 -3
@@ -3958,22 +3958,30 @@ intel_dp_probe_mst(struct intel_dp *intel_dp)return intel_dp->is_mst; } -static void intel_dp_sink_crc_stop (struct intel_dp *intel_dp) +static int intel_dp_sink_crc_stop (struct intel_dp *intel_dp) {struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp);struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; +int ret =0 ;if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) {DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); -return ; + ret = -EIO ; + goto out; }if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , - buf & ~DP_TEST_SINK_START ) <0 ) + buf & ~DP_TEST_SINK_START ) <0 ) {DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); + ret = -EIO ; + goto out; + } + intel_dp->sink_crc_started = false; + out:hsw_enable_ips (intel_crtc); +return ret; }static int intel_dp_sink_crc_start (struct intel_dp *intel_dp)
@@ -3981,6 +3989,13 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp);struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; +int ret; + +if (intel_dp->sink_crc_started) { + ret =intel_dp_sink_crc_stop (intel_dp); +if (ret) +return ret; + }if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 )return -EIO ;
@@ -3999,6 +4014,7 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)return -EIO ; } + intel_dp->sink_crc_started = true;return 0 ; }
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -714,6 +714,7 @@ struct intel_dp {/* sink rates as reported by DP_SUPPORTED_LINK_RATES */ uint8_t num_sink_rates;int sink_rates[DP_MAX_SUPPORTED_RATES ]; +bool sink_crc_started;struct drm_dp_aux aux;uint8_t train_set[4 ];int panel_power_up_delay;
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/7] drm/i915: Force sink crc stop before start.
Quoted 7 lines · Rodrigo Vivi
By Vesa DP spec, test counter at
DP_TEST_SINK_MISCjust reset to 0 when unsettingDP_TEST_SINK_START, so let's force this stop here.But let's minimize the aux transactions and just do it when we know it hasn't been properly stoped.
Signed-off-by Rodrigo Vivi <[email protected]>
Quoted 84 lines
--- drivers/gpu/drm/i915/intel_dp.c | 22 +++++++++++++++++++--- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 20 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_dp.c +19
-3@@ -3958,22 +3958,30 @@ intel_dp_probe_mst(struct intel_dp *intel_dp)return intel_dp->is_mst; } -static void intel_dp_sink_crc_stop (struct intel_dp *intel_dp) +static int intel_dp_sink_crc_stop (struct intel_dp *intel_dp) {struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp);struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; +int ret =0 ;if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) {DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); -return ; + ret = -EIO ; + goto out; }if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_TEST_SINK , - buf & ~DP_TEST_SINK_START ) <0 ) + buf & ~DP_TEST_SINK_START ) <0 ) {DRM_DEBUG_KMS ("Sink CRC couldn't be stopped properly\n" ); + ret = -EIO ; + goto out; + } + intel_dp->sink_crc_started = false; + out:hsw_enable_ips (intel_crtc); +return ret; }static int intel_dp_sink_crc_start (struct intel_dp *intel_dp)@@ -3981,6 +3989,13 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp);struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; +int ret; + +if (intel_dp->sink_crc_started) { + ret =intel_dp_sink_crc_stop (intel_dp); +if (ret) +return ret; + }if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 )return -EIO ;@@ -3999,6 +4014,7 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)return -EIO ; } + intel_dp->sink_crc_started = true;return 0 ; }drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -714,6 +714,7 @@ struct intel_dp {/* sink rates as reported by DP_SUPPORTED_LINK_RATES */ uint8_t num_sink_rates;int sink_rates[DP_MAX_SUPPORTED_RATES ]; +bool sink_crc_started;struct drm_dp_aux aux;uint8_t train_set[4 ];int panel_power_up_delay;Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 6/7 drm/i915: Save latest known sink CRC to compensate delayed counter reset.
In reply to Rodrigo ViviBy Vesa DP 1.2 Spec TEST_CRC_COUNT should be "reset to 0 when TEST_SINK bit 0 = 0."
However for some strange reason when PSR is enabled in certain platforms this is not true. At least not immediatelly.
So we face cases like this:
first get_sink_crc operation:
count: 0, crc: 000000000000 count: 1, crc: c101c101c101
returned expected crc: c101c101c101
secont get_sink_crc operation:
count: 1, crc: c101c101c101 count: 0, crc: 000000000000 count: 1, crc: 0000c1010000
should return expected crc: 0000c1010000
But also the reset to 0 should be faster resulting into:
get_sink_crc operation:
count: 1, crc: c101c101c101 count: 1, crc: 0000c1010000
should return expected crc: 0000c1010000
So in order to know that the second one is valid one
we need to compare the pair (count, crc) with latest (count, crc).
If the pair changed you have your valid CRC.
--- drivers/gpu/drm/i915/intel_dp.c | 42 +++++++++++++++++++++++++--------------- drivers/gpu/drm/i915/intel_drv.h | 8 +++++++- 2 files changed, 33 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +26 -16
@@ -3978,7 +3978,7 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp) goto out; } - intel_dp->sink_crc_started = false; + intel_dp->sink_crc.started = false; out:hsw_enable_ips (intel_crtc);return ret;
@@ -3991,7 +3991,7 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)u8 buf;int ret; -if (intel_dp->sink_crc_started) { +if (intel_dp->sink_crc.started) { ret =intel_dp_sink_crc_stop (intel_dp);if (ret)return ret;
@@ -4003,6 +4003,8 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)if (!(buf &DP_TEST_CRC_SUPPORTED ))return -ENOTTY ; + intel_dp->sink_crc.last_count = buf &DP_TEST_COUNT_MASK ; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 )return -EIO ;
@@ -4014,7 +4016,7 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)return -EIO ; } - intel_dp->sink_crc_started = true; + intel_dp->sink_crc.started = true;return 0 ; }
@@ -4024,29 +4026,39 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)struct drm_device *dev = dig_port->base.base.dev;struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; -int test_crc_count; +int count, ret;int attempts =6 ; -int ret; ret =intel_dp_sink_crc_start (intel_dp);if (ret)return ret; -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { - ret = -EIO ; - goto stop; - } - - test_crc_count = buf &DP_TEST_COUNT_MASK ; -do { +intel_wait_for_vblank (dev, intel_crtc->pipe); +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; goto stop; } -intel_wait_for_vblank (dev, intel_crtc->pipe); - }while (--attempts && (buf &DP_TEST_COUNT_MASK ) == test_crc_count); + count = buf &DP_TEST_COUNT_MASK ; +/* +* Count might be reset during the loop. In this case +* last known count needs to be reset as well. +*/ +if (count ==0 ) + intel_dp->sink_crc.last_count =0 ; + +if (drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_CRC_R_CR , crc,6 ) <0 ) { + ret = -EIO ; + goto stop; + } + }while (--attempts && (count ==0 || (count == intel_dp->sink_crc.last_count && + !memcmp (intel_dp->sink_crc.last_crc, crc, +6 *sizeof (u8))))); + + intel_dp->sink_crc.last_count = buf &DP_TEST_COUNT_MASK ; +memcpy (intel_dp->sink_crc.last_crc, crc,6 *sizeof (u8));if (attempts ==0 ) {DRM_DEBUG_KMS ("Panel is unable to calculate CRC after 6 vblanks\n" );
@@ -4054,8 +4066,6 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) goto stop; } -if (drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_CRC_R_CR , crc,6 ) <0 ) - ret = -EIO ; stop:intel_dp_sink_crc_stop (intel_dp);return ret;
drivers/gpu/drm/i915/intel_drv.h +7 -1
@@ -697,6 +697,12 @@ enum link_m_n_set {M2_N2 }; +struct sink_crc { +bool started; +u8 last_crc[6 ]; +int last_count; +}; +struct intel_dp {uint32_t output_reg;uint32_t aux_ch_ctl_reg;
@@ -714,7 +720,7 @@ struct intel_dp {/* sink rates as reported by DP_SUPPORTED_LINK_RATES */ uint8_t num_sink_rates;int sink_rates[DP_MAX_SUPPORTED_RATES ]; -bool sink_crc_started; +struct sink_crc sink_crc;struct drm_dp_aux aux;uint8_t train_set[4 ];int panel_power_up_delay;
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 6/7] drm/i915: Save latest known sink CRC to compensate delayed counter reset.
Quoted 24 lines · Rodrigo Vivi
By Vesa DP 1.2 Spec
TEST_CRC_COUNTshould be "reset to 0 whenTEST_SINKbit 0 = 0."However for some strange reason when PSR is enabled in certain platforms this is not true. At least not immediatelly.
So we face cases like this:
first
get_sink_crcoperation:count: 0, crc: 000000000000 count: 1, crc: c101c101c101returned expected crc:
c101c101c101secont
get_sink_crcoperation:count: 1, crc: c101c101c101 count: 0, crc: 000000000000 count: 1, crc: 0000c1010000should return expected crc:
0000c1010000But also the reset to 0 should be faster resulting into:
get_sink_crcoperation:count: 1, crc: c101c101c101 count: 1, crc: 0000c1010000
Quoted 8 lines
should return expected crc:
0000c1010000So in order to know that the second one is valid one
we need to compare the pair (count, crc) with latest (count, crc).If the pair changed you have your valid CRC.
Signed-off-by Rodrigo Vivi <[email protected]>
We discussed this before, unfortunately I don't see any other way to do this, since there is no way to know that the crc count really restarted, became 0 and then 1 again. So I think this workaround is needed.
Quoted 138 lines
--- drivers/gpu/drm/i915/intel_dp.c | 42 +++++++++++++++++++++++++--------------- drivers/gpu/drm/i915/intel_drv.h | 8 +++++++- 2 files changed, 33 insertions(+), 17 deletions(-)drivers/gpu/drm/i915/intel_dp.c +26
-16@@ -3978,7 +3978,7 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp) goto out; } - intel_dp->sink_crc_started = false; + intel_dp->sink_crc.started = false; out:hsw_enable_ips (intel_crtc);return ret;@@ -3991,7 +3991,7 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)u8 buf;int ret; -if (intel_dp->sink_crc_started) { +if (intel_dp->sink_crc.started) { ret =intel_dp_sink_crc_stop (intel_dp);if (ret)return ret;@@ -4003,6 +4003,8 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)if (!(buf &DP_TEST_CRC_SUPPORTED ))return -ENOTTY ; + intel_dp->sink_crc.last_count = buf &DP_TEST_COUNT_MASK ; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 )return -EIO ;@@ -4014,7 +4016,7 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)return -EIO ; } - intel_dp->sink_crc_started = true; + intel_dp->sink_crc.started = true;return 0 ; }@@ -4024,29 +4026,39 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)struct drm_device *dev = dig_port->base.base.dev;struct intel_crtc *intel_crtc =to_intel_crtc (dig_port->base.base.crtc);u8 buf; -int test_crc_count; +int count, ret;int attempts =6 ; -int ret; ret =intel_dp_sink_crc_start (intel_dp);if (ret)return ret; -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { - ret = -EIO ; - goto stop; - } - - test_crc_count = buf &DP_TEST_COUNT_MASK ; -do { +intel_wait_for_vblank (dev, intel_crtc->pipe); +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; goto stop; } -intel_wait_for_vblank (dev, intel_crtc->pipe); - }while (--attempts && (buf &DP_TEST_COUNT_MASK ) == test_crc_count); + count = buf &DP_TEST_COUNT_MASK ; +/* +* Count might be reset during the loop. In this case +* last known count needs to be reset as well. +*/ +if (count ==0 ) + intel_dp->sink_crc.last_count =0 ; + +if (drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_CRC_R_CR , crc,6 ) <0 ) { + ret = -EIO ; + goto stop; + } + }while (--attempts && (count ==0 || (count == intel_dp->sink_crc.last_count && + !memcmp (intel_dp->sink_crc.last_crc, crc, +6 *sizeof (u8))))); + + intel_dp->sink_crc.last_count = buf &DP_TEST_COUNT_MASK ; +memcpy (intel_dp->sink_crc.last_crc, crc,6 *sizeof (u8));if (attempts ==0 ) {DRM_DEBUG_KMS ("Panel is unable to calculate CRC after 6 vblanks\n" );@@ -4054,8 +4066,6 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) goto stop; } -if (drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_CRC_R_CR , crc,6 ) <0 ) - ret = -EIO ; stop:intel_dp_sink_crc_stop (intel_dp);return ret;drivers/gpu/drm/i915/intel_drv.h +7
-1@@ -697,6 +697,12 @@ enum link_m_n_set {M2_N2 }; +struct sink_crc { +bool started; +u8 last_crc[6 ]; +int last_count; +}; +struct intel_dp {uint32_t output_reg;uint32_t aux_ch_ctl_reg;@@ -714,7 +720,7 @@ struct intel_dp {/* sink rates as reported by DP_SUPPORTED_LINK_RATES */ uint8_t num_sink_rates;int sink_rates[DP_MAX_SUPPORTED_RATES ]; -bool sink_crc_started; +struct sink_crc sink_crc;struct drm_dp_aux aux;uint8_t train_set[4 ];int panel_power_up_delay;Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 7/7 drm/i915: Dont -ETIMEDOUT on identical new and previous (count, crc).
In reply to Rodrigo ViviBy Vesa DP 1.2 spec TEST_CRC_COUNT is a "4 bit wrap counter which increments each time the TEST_CRC_x_x are updated."
However if we are trying to verify the screen hasn't changed we get same (count, crc) pair twice. Without this patch we would return -ETIMEOUT in this case.
So, if in 6 vblanks the pair (count, crc) hasn't changed we return it anyway instead of returning error and let test case decide if it was right or not.
--- drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +15 -6
@@ -4028,6 +4028,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)u8 buf;int count, ret;int attempts =6 ; +bool old_equal_new; ret =intel_dp_sink_crc_start (intel_dp);if (ret)
@@ -4042,6 +4043,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) goto stop; } count = buf &DP_TEST_COUNT_MASK ; +/* * Count might be reset during the loop. In this case * last known count needs to be reset as well.
@@ -4053,17 +4055,24 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) ret = -EIO ; goto stop; } - }while (--attempts && (count ==0 || (count == intel_dp->sink_crc.last_count && - !memcmp (intel_dp->sink_crc.last_crc, crc, -6 *sizeof (u8))))); + + old_equal_new = (count == intel_dp->sink_crc.last_count && + !memcmp (intel_dp->sink_crc.last_crc, crc, +6 *sizeof (u8))); + + }while (--attempts && (count ==0 || old_equal_new)); intel_dp->sink_crc.last_count = buf &DP_TEST_COUNT_MASK ;memcpy (intel_dp->sink_crc.last_crc, crc,6 *sizeof (u8));if (attempts ==0 ) { -DRM_DEBUG_KMS ("Panel is unable to calculate CRC after 6 vblanks\n" ); - ret = -ETIMEDOUT ; - goto stop; +if (old_equal_new) { +DRM_DEBUG_KMS ("Unreliable Sink CRC counter: Current returned CRC is identical to the previous one\n" ); + }else { +DRM_ERROR ("Panel is unable to calculate any CRC after 6 vblanks\n" ); + ret = -ETIMEDOUT ; + goto stop; + } } stop:
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 7/7] drm/i915: Dont -ETIMEDOUT on identical new and previous (count, crc).
Quoted 7 lines · Rodrigo Vivi
By Vesa DP 1.2 spec
TEST_CRC_COUNTis a "4 bit wrap counter which increments each time theTEST_CRC_x_xare updated."However if we are trying to verify the screen hasn't changed we get same (count, crc) pair twice. Without this patch we would return
-ETIMEOUTin this case.
Quoted 5 lines
So, if in 6 vblanks the pair (count, crc) hasn't changed we return it anyway instead of returning error and let test case decide if it was right or not.
Signed-off-by Rodrigo Vivi <[email protected]>
Looks good.
Quoted 37 lines
--- drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dp.c +8
-3@@ -4028,6 +4028,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)u8 buf;int count, ret;int attempts =6 ; +bool old_equal_new; ret =intel_dp_sink_crc_start (intel_dp);if (ret)@@ -4042,6 +4043,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) goto stop; } count = buf &DP_TEST_COUNT_MASK ; +/* * Count might be reset during the loop. In this case * last known count needs to be reset as well. @@ -4053,17 +4055,24 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) ret = -EIO ; goto stop; } - }while (--attempts && (count ==0 || (count == intel_dp->sink_crc.last_count && - !memcmp (intel_dp->sink_crc.last_crc, crc, -6 *sizeof (u8))))); + + old_equal_new = (count == intel_dp->sink_crc.last_count && + !memcmp (intel_dp->sink_crc.last_crc, crc, +6 *sizeof (u8))); + + }while (--attempts && (count ==0 || old_equal_new));
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 4070
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +2
-3intel_dp->sink_crc.last_count = buf &DP_TEST_COUNT_MASK ;memcpy (intel_dp->sink_crc.last_crc, crc,6 *sizeof (u8));if (attempts ==0 ) { -DRM_DEBUG_KMS ("Panel is unable to calculate CRC after 6 vblanks\n" ); - ret = -ETIMEDOUT ; - goto stop; +if (old_equal_new) { +DRM_DEBUG_KMS ("Unreliable Sink CRC counter: Current returned CRC is identical to the previous one\n" );
Isn't this line a little too long?
Quoted 15 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+ }else { +DRM_ERROR ("Panel is unable to calculate any CRC after 6 vblanks\n" ); + ret = -ETIMEDOUT ; + goto stop; + } } stop:Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Vivi, Rodrigo
maintainerRe: [PATCH 7/7] drm/i915: Dont -ETIMEDOUT on identical new and previous (count, crc).
Quoted 57 lines · Rafael Antognolli
Quoted 7 lines · Rodrigo Vivi
By Vesa DP 1.2 spec
TEST_CRC_COUNTis a "4 bit wrap counter which increments each time theTEST_CRC_x_xare updated."However if we are trying to verify the screen hasn't changed we get same (count, crc) pair twice. Without this patch we would return
-ETIMEOUTin this case.Quoted 5 lines
So, if in 6 vblanks the pair (count, crc) hasn't changed we return it anyway instead of returning error and let test case decide if it was right or not.
Signed-off-by Rodrigo Vivi <[email protected]>Looks good.
Quoted 41 lines
--- drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dp.c +8
-3@@ -4028,6 +4028,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)u8 buf;int count, ret;int attempts =6 ; +bool old_equal_new; ret =intel_dp_sink_crc_start (intel_dp);if (ret)@@ -4042,6 +4043,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) goto stop; } count = buf &DP_TEST_COUNT_MASK ; +/* * Count might be reset during the loop. In this case * last known count needs to be reset as well. @@ -4053,17 +4055,24 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) ret = -EIO ; goto stop; } - }while (--attempts && (count ==0 || (count == intel_dp->sink_crc.last_count && - !memcmp (intel_dp->sink_crc.last_crc, crc, -6 *sizeof (u8))))); + + old_equal_new = (count == intel_dp->sink_crc.last_count && + !memcmp (intel_dp->sink_crc.last_crc, crc, +6 *sizeof (u8))); + + }while (--attempts && (count ==0 || old_equal_new)); intel_dp->sink_crc.last_count = buf &DP_TEST_COUNT_MASK ;memcpy (intel_dp->sink_crc.last_crc, crc,6 *sizeof (u8));
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 4070
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +2
-3if (attempts ==0 ) { -DRM_DEBUG_KMS ("Panel is unable to calculate CRC after 6 vblanks\n" ); - ret = -ETIMEDOUT ; - goto stop; +if (old_equal_new) { +DRM_DEBUG_KMS ("Unreliable Sink CRC counter: Current returned CRC is identical to the previous one\n" );Isn't this line a little too long?
I agree, but I had no idea how to make it shorter. I believe this long debug message is the only case where we can go over 80 characters in i915. but if it isn't true and/or have a suggestion how to make it shorter please let me know that I can change.
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+ }else { +DRM_ERROR ("Panel is unable to calculate any CRC after 6 vblanks\n" ); + ret = -ETIMEDOUT ; + goto stop; + } }
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0stop:Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 7/7] drm/i915: Dont -ETIMEDOUT on identical new and previous (count, crc).
Quoted 67 lines · Rodrigo
Quoted 57 lines · Rafael Antognolli
Quoted 7 lines · Rodrigo Vivi
By Vesa DP 1.2 spec
TEST_CRC_COUNTis a "4 bit wrap counter which increments each time theTEST_CRC_x_xare updated."However if we are trying to verify the screen hasn't changed we get same (count, crc) pair twice. Without this patch we would return
-ETIMEOUTin this case.Quoted 5 lines
So, if in 6 vblanks the pair (count, crc) hasn't changed we return it anyway instead of returning error and let test case decide if it was right or not.
Signed-off-by Rodrigo Vivi <[email protected]>Looks good.
Quoted 41 lines
--- drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dp.c +8
-3@@ -4028,6 +4028,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)u8 buf;int count, ret;int attempts =6 ; +bool old_equal_new; ret =intel_dp_sink_crc_start (intel_dp);if (ret)@@ -4042,6 +4043,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) goto stop; } count = buf &DP_TEST_COUNT_MASK ; +/* * Count might be reset during the loop. In this case * last known count needs to be reset as well. @@ -4053,17 +4055,24 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) ret = -EIO ; goto stop; } - }while (--attempts && (count ==0 || (count == intel_dp->sink_crc.last_count && - !memcmp (intel_dp->sink_crc.last_crc, crc, -6 *sizeof (u8))))); + + old_equal_new = (count == intel_dp->sink_crc.last_count && + !memcmp (intel_dp->sink_crc.last_crc, crc, +6 *sizeof (u8))); + + }while (--attempts && (count ==0 || old_equal_new)); intel_dp->sink_crc.last_count = buf &DP_TEST_COUNT_MASK ;memcpy (intel_dp->sink_crc.last_crc, crc,6 *sizeof (u8));Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 4070
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +2
-3if (attempts ==0 ) { -DRM_DEBUG_KMS ("Panel is unable to calculate CRC after 6 vblanks\n" ); - ret = -ETIMEDOUT ; - goto stop; +if (old_equal_new) { +DRM_DEBUG_KMS ("Unreliable Sink CRC counter: Current returned CRC is identical to the previous one\n" );Isn't this line a little too long?
Quoted 4 lines
I agree, but I had no idea how to make it shorter. I believe this long debug message is the only case where we can go over 80 characters in i915. but if it isn't true and/or have a suggestion how to make it shorter please let me know that I can change.
dmesg output is explicitly an exception since breaking lines makes it much harder to grep for a line you spot in dmesg. Ofc 500 lines would be a bit too much, we're breaking those. But this one here is totally fine.
Remember, checkpatch is just suggestions mostly, not law. -Daniel
Quoted 22 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+ }else { +DRM_ERROR ("Panel is unable to calculate any CRC after 6 vblanks\n" ); + ret = -ETIMEDOUT ; + goto stop; + } }Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0stop:Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rafael Antognolli
Reviewed-byRe: [PATCH 7/7] drm/i915: Dont -ETIMEDOUT on identical new and previous (count, crc).
Quoted 68 lines · Daniel Vetter
Quoted 67 lines · Rodrigo
Quoted 65 lines · Rafael Antognolli
Quoted 7 lines · Rodrigo Vivi
By Vesa DP 1.2 spec
TEST_CRC_COUNTis a "4 bit wrap counter which increments each time theTEST_CRC_x_xare updated."However if we are trying to verify the screen hasn't changed we get same (count, crc) pair twice. Without this patch we would return
-ETIMEOUTin this case.Quoted 5 lines
So, if in 6 vblanks the pair (count, crc) hasn't changed we return it anyway instead of returning error and let test case decide if it was right or not.
Signed-off-by Rodrigo Vivi <[email protected]>Looks good.
Quoted 37 lines
--- drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dp.c +8
-3@@ -4028,6 +4028,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)u8 buf;int count, ret;int attempts =6 ; +bool old_equal_new; ret =intel_dp_sink_crc_start (intel_dp);if (ret)@@ -4042,6 +4043,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) goto stop; } count = buf &DP_TEST_COUNT_MASK ; +/* * Count might be reset during the loop. In this case * last known count needs to be reset as well. @@ -4053,17 +4055,24 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) ret = -EIO ; goto stop; } - }while (--attempts && (count ==0 || (count == intel_dp->sink_crc.last_count && - !memcmp (intel_dp->sink_crc.last_crc, crc, -6 *sizeof (u8))))); + + old_equal_new = (count == intel_dp->sink_crc.last_count && + !memcmp (intel_dp->sink_crc.last_crc, crc, +6 *sizeof (u8))); + + }while (--attempts && (count ==0 || old_equal_new));drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 4070
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +2
-3intel_dp->sink_crc.last_count = buf &DP_TEST_COUNT_MASK ;memcpy (intel_dp->sink_crc.last_crc, crc,6 *sizeof (u8));if (attempts ==0 ) { -DRM_DEBUG_KMS ("Panel is unable to calculate CRC after 6 vblanks\n" ); - ret = -ETIMEDOUT ; - goto stop; +if (old_equal_new) { +DRM_DEBUG_KMS ("Unreliable Sink CRC counter: Current returned CRC is identical to the previous one\n" );Isn't this line a little too long?
Quoted 8 lines
Quoted 4 lines
I agree, but I had no idea how to make it shorter. I believe this long debug message is the only case where we can go over 80 characters in i915. but if it isn't true and/or have a suggestion how to make it shorter please let me know that I can change.
dmesg output is explicitly an exception since breaking lines makes it much harder to grep for a line you spot in dmesg. Ofc 500 lines would be a bit too much, we're breaking those. But this one here is totally fine.
Nice, I never thought about being able to grep, but makes total sense.
Quoted 1 line
Remember, checkpatch is just suggestions mostly, not law.
I wasn't aware of it, but good to know that it exists. I'll check it out.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+ }else { +DRM_ERROR ("Panel is unable to calculate any CRC after 6 vblanks\n" ); + ret = -ETIMEDOUT ; + goto stop; + } } stop:Signature · 1 line
2.1.0
Quoted 14 lines
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 40 lines · Rodrigo Vivi
Right now if we face any kind of error sink crc calculation stays enabled.
So, let's give a shot and try to stop it anyway if it got enabled.
Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_dp.c +3
-3@@ -3994,7 +3994,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; - goto out; + goto stop; } test_crc_count = buf &DP_TEST_COUNT_MASK ;@@ -4003,7 +4003,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK_MISC , &buf) <0 ) { ret = -EIO ; - goto out; + goto stop; }intel_wait_for_vblank (dev, intel_crtc->pipe); }while (--attempts && (buf &DP_TEST_COUNT_MASK ) == test_crc_count);@@ -4011,14 +4011,15 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)if (attempts ==0 ) {DRM_DEBUG_KMS ("Panel is unable to calculate CRC after 6 vblanks\n" ); ret = -ETIMEDOUT ; - goto out; + goto stop; }
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 4025
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +2
-1if (drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_CRC_R_CR , crc,6 ) <0 ) { ret = -EIO ; - goto out; + goto stop; } +stop:if (drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_SINK , &buf) <0 ) { ret = -EIO ; goto out;
Nice cleanup on exit.
--
Rafael
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx