aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_psr.c
diff options
context:
space:
mode:
authorDhinakaran Pandiyan <dhinakaran.pandiyan@gmail.com>2018-05-24 23:30:47 -0400
committerRodrigo Vivi <rodrigo.vivi@intel.com>2018-05-29 15:53:15 -0400
commita3db142829e68e2619207306a7b83e8ed47466a6 (patch)
treee91c223f83180eb1189385a36150e249bfab91fb /drivers/gpu/drm/i915/intel_psr.c
parent4ece66b149a38c7b52ead463fb608f2aad39c20e (diff)
drm/i915/psr: Set idle frame count based on sink synchronization latency
DPCD 2009h "Synchronization latency in sink" has bits that tell us the maximum number of frames sink can take to resynchronize to source timing when exiting PSR. More importantly, as per eDP 1.4b, this is the "Minimum number of frames following PSR exit that the Source device needs to wait for PSR entry." We currently use this value only to setup the number frames to wait before PSR2 selective update. But, based on the above description it makes more sense to use this to configure idle frames for both PSR1 and and PSR2. This will ensure we wait the required number of frames before activation whether it is PSR1 or PSR2. The minimum number of idle frames remains 6, while allowing sink synchronization latency and VBT to increase this value. This also solves the flip-flop between sink and source frames that I noticed on my Thinkpad X260 during PSR exit. This specific panel has a value of 8h, which according to the spec means the "Source device must wait for more than eight active frames after PSR exit before initiating PSR entry. (In this case, should be provided by the panel supplier.)" VBT however has a value of 0. Cc: Jani Nikula <jani.nikula@intel.com> Cc: Jose Roberto de Souza <jose.souza@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180525033047.7596-1-dhinakaran.pandiyan@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_psr.c')
-rw-r--r--drivers/gpu/drm/i915/intel_psr.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
index ebc483f06c6f..71dfe541740f 100644
--- a/drivers/gpu/drm/i915/intel_psr.c
+++ b/drivers/gpu/drm/i915/intel_psr.c
@@ -247,6 +247,8 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
247 return; 247 return;
248 } 248 }
249 dev_priv->psr.sink_support = true; 249 dev_priv->psr.sink_support = true;
250 dev_priv->psr.sink_sync_latency =
251 intel_dp_get_sink_sync_latency(intel_dp);
250 252
251 if (INTEL_GEN(dev_priv) >= 9 && 253 if (INTEL_GEN(dev_priv) >= 9 &&
252 (intel_dp->psr_dpcd[0] == DP_PSR2_WITH_Y_COORD_IS_SUPPORTED)) { 254 (intel_dp->psr_dpcd[0] == DP_PSR2_WITH_Y_COORD_IS_SUPPORTED)) {
@@ -272,8 +274,6 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
272 if (dev_priv->psr.sink_psr2_support) { 274 if (dev_priv->psr.sink_psr2_support) {
273 dev_priv->psr.colorimetry_support = 275 dev_priv->psr.colorimetry_support =
274 intel_dp_get_colorimetry_status(intel_dp); 276 intel_dp_get_colorimetry_status(intel_dp);
275 dev_priv->psr.sink_sync_latency =
276 intel_dp_get_sink_sync_latency(intel_dp);
277 } 277 }
278 } 278 }
279} 279}
@@ -370,21 +370,21 @@ static void hsw_activate_psr1(struct intel_dp *intel_dp)
370 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); 370 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
371 struct drm_device *dev = dig_port->base.base.dev; 371 struct drm_device *dev = dig_port->base.base.dev;
372 struct drm_i915_private *dev_priv = to_i915(dev); 372 struct drm_i915_private *dev_priv = to_i915(dev);
373 u32 max_sleep_time = 0x1f;
374 u32 val = EDP_PSR_ENABLE;
373 375
374 uint32_t max_sleep_time = 0x1f; 376 /* Let's use 6 as the minimum to cover all known cases including the
375 /* 377 * off-by-one issue that HW has in some cases.
376 * Let's respect VBT in case VBT asks a higher idle_frame value.
377 * Let's use 6 as the minimum to cover all known cases including
378 * the off-by-one issue that HW has in some cases. Also there are
379 * cases where sink should be able to train
380 * with the 5 or 6 idle patterns.
381 */ 378 */
382 uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames); 379 int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
383 uint32_t val = EDP_PSR_ENABLE;
384 380
385 val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT; 381 /* sink_sync_latency of 8 means source has to wait for more than 8
382 * frames, we'll go with 9 frames for now
383 */
384 idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
386 val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT; 385 val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;
387 386
387 val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
388 if (IS_HASWELL(dev_priv)) 388 if (IS_HASWELL(dev_priv))
389 val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES; 389 val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
390 390
@@ -424,15 +424,15 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
424 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); 424 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
425 struct drm_device *dev = dig_port->base.base.dev; 425 struct drm_device *dev = dig_port->base.base.dev;
426 struct drm_i915_private *dev_priv = to_i915(dev); 426 struct drm_i915_private *dev_priv = to_i915(dev);
427 /* 427 u32 val;
428 * Let's respect VBT in case VBT asks a higher idle_frame value. 428
429 * Let's use 6 as the minimum to cover all known cases including 429 /* Let's use 6 as the minimum to cover all known cases including the
430 * the off-by-one issue that HW has in some cases. Also there are 430 * off-by-one issue that HW has in some cases.
431 * cases where sink should be able to train
432 * with the 5 or 6 idle patterns.
433 */ 431 */
434 uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames); 432 int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
435 u32 val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT; 433
434 idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
435 val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;
436 436
437 /* FIXME: selective update is probably totally broken because it doesn't 437 /* FIXME: selective update is probably totally broken because it doesn't
438 * mesh at all with our frontbuffer tracking. And the hw alone isn't 438 * mesh at all with our frontbuffer tracking. And the hw alone isn't