Skip to content

Commit c4932d7

Browse files
committed
drm/i915/psr: Don't avoid PSR when PSR2 conditions are not met.
We can still use PSR1 when PSR2 conditions are not met. So, let's split the check in a way that we make sure has_psr gets set independently of PSR2 criteria. v2: Duh! Handle proper return to avoid breaking PSR2. v3: (DK): - better name for psr2 conditions check function - Don't remove FIXME block and psr2.support check. - Add a debug message to show us what PSR or PSR2 is getting enabled now we have ways to enabled PSR on PSR2 panels. - s/PSR2 disabled/PSR2 not enabled Cc: Dhinakaran Pandiyan <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]> Reviewed-by: Dhinakaran Pandiyan <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 8cef3e5 commit c4932d7

File tree

1 file changed

+37
-27
lines changed

1 file changed

+37
-27
lines changed

drivers/gpu/drm/i915/intel_psr.c

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,41 @@ static void hsw_psr_activate(struct intel_dp *intel_dp)
446446
hsw_activate_psr1(intel_dp);
447447
}
448448

449+
static bool intel_psr2_config_valid(struct intel_dp *intel_dp,
450+
struct intel_crtc_state *crtc_state)
451+
{
452+
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
453+
struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
454+
const struct drm_display_mode *adjusted_mode =
455+
&crtc_state->base.adjusted_mode;
456+
457+
/*
458+
* FIXME psr2_support is messed up. It's both computed
459+
* dynamically during PSR enable, and extracted from sink
460+
* caps during eDP detection.
461+
*/
462+
if (!dev_priv->psr.psr2_support)
463+
return false;
464+
465+
/* PSR2 is restricted to work with panel resolutions up to 3640x2304 */
466+
if (adjusted_mode->crtc_hdisplay > 3640 ||
467+
adjusted_mode->crtc_vdisplay > 2304) {
468+
DRM_DEBUG_KMS("PSR2 not enabled, panel resolution too big\n");
469+
return false;
470+
}
471+
472+
/*
473+
* FIXME:enable psr2 only for y-cordinate psr2 panels
474+
* After gtc implementation , remove this restriction.
475+
*/
476+
if (!dev_priv->psr.y_cord_support) {
477+
DRM_DEBUG_KMS("PSR2 not enabled, panel does not support Y coordinate\n");
478+
return false;
479+
}
480+
481+
return true;
482+
}
483+
449484
void intel_psr_compute_config(struct intel_dp *intel_dp,
450485
struct intel_crtc_state *crtc_state)
451486
{
@@ -513,34 +548,9 @@ void intel_psr_compute_config(struct intel_dp *intel_dp,
513548
return;
514549
}
515550

516-
/*
517-
* FIXME psr2_support is messed up. It's both computed
518-
* dynamically during PSR enable, and extracted from sink
519-
* caps during eDP detection.
520-
*/
521-
if (!dev_priv->psr.psr2_support) {
522-
crtc_state->has_psr = true;
523-
return;
524-
}
525-
526-
/* PSR2 is restricted to work with panel resolutions up to 3640x2304 */
527-
if (adjusted_mode->crtc_hdisplay > 3640 ||
528-
adjusted_mode->crtc_vdisplay > 2304) {
529-
DRM_DEBUG_KMS("PSR2 disabled, panel resolution too big\n");
530-
return;
531-
}
532-
533-
/*
534-
* FIXME:enable psr2 only for y-cordinate psr2 panels
535-
* After gtc implementation , remove this restriction.
536-
*/
537-
if (!dev_priv->psr.y_cord_support) {
538-
DRM_DEBUG_KMS("PSR2 disabled, panel does not support Y coordinate\n");
539-
return;
540-
}
541-
542551
crtc_state->has_psr = true;
543-
crtc_state->has_psr2 = true;
552+
crtc_state->has_psr2 = intel_psr2_config_valid(intel_dp, crtc_state);
553+
DRM_DEBUG_KMS("Enabling PSR%s\n", crtc_state->has_psr2 ? "2" : "");
544554
}
545555

546556
static void intel_psr_activate(struct intel_dp *intel_dp)

0 commit comments

Comments
 (0)