Skip to content

Commit 7a00e68

Browse files
elongbugjnikula
authored andcommitted
drm/i915/psr: Use new DP VSC SDP compute routine on PSR
In order to use a common VSC SDP Colorimetry calculating code on PSR, it uses a new psr vsc sdp compute routine. Because PSR routine has its own scenario and timings of writing a VSC SDP, the current PSR routine needs to have its own drm_dp_vsc_sdp structure member variable on struct i915_psr. In order to calculate colorimetry information, intel_psr_update() function and intel_psr_enable() function extend a drm_connector_state argument. There are no changes to PSR mechanism. v3: Replace a structure name to drm_dp_vsc_sdp from intel_dp_vsc_sdp v4: Rebased v8: Rebased v10: When a PSR is enabled, it needs to add DP_SDP_VSC to infoframes.enable. It is needed for comparing between HW and pipe_state of VSC_SDP. v11: If PSR is disabled by flag, it don't enable psr on pipe compute. v12: Fix an inconsistent indenting Signed-off-by: Gwan-gyeong Mun <[email protected]> Reviewed-by: Uma Shankar <[email protected]> Reported-by: kbuild test robot <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent cafac5a commit 7a00e68

File tree

4 files changed

+26
-43
lines changed

4 files changed

+26
-43
lines changed

drivers/gpu/drm/i915/display/intel_ddi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3682,7 +3682,7 @@ static void intel_enable_ddi_dp(struct intel_atomic_state *state,
36823682
intel_dp_stop_link_train(intel_dp);
36833683

36843684
intel_edp_backlight_on(crtc_state, conn_state);
3685-
intel_psr_enable(intel_dp, crtc_state);
3685+
intel_psr_enable(intel_dp, crtc_state, conn_state);
36863686
intel_dp_set_infoframes(encoder, true, crtc_state, conn_state);
36873687
intel_edp_drrs_enable(intel_dp, crtc_state);
36883688

@@ -3865,7 +3865,7 @@ static void intel_ddi_update_pipe_dp(struct intel_atomic_state *state,
38653865

38663866
intel_ddi_set_dp_msa(crtc_state, conn_state);
38673867

3868-
intel_psr_update(intel_dp, crtc_state);
3868+
intel_psr_update(intel_dp, crtc_state, conn_state);
38693869
intel_dp_set_infoframes(encoder, true, crtc_state, conn_state);
38703870
intel_edp_drrs_enable(intel_dp, crtc_state);
38713871

drivers/gpu/drm/i915/display/intel_psr.c

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "intel_display_types.h"
3131
#include "intel_psr.h"
3232
#include "intel_sprite.h"
33+
#include "intel_hdmi.h"
3334

3435
/**
3536
* DOC: Panel Self Refresh (PSR/SRD)
@@ -357,39 +358,6 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
357358
}
358359
}
359360

360-
static void intel_psr_setup_vsc(struct intel_dp *intel_dp,
361-
const struct intel_crtc_state *crtc_state)
362-
{
363-
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
364-
struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
365-
struct dp_sdp psr_vsc;
366-
367-
if (dev_priv->psr.psr2_enabled) {
368-
/* Prepare VSC Header for SU as per EDP 1.4 spec, Table 6.11 */
369-
memset(&psr_vsc, 0, sizeof(psr_vsc));
370-
psr_vsc.sdp_header.HB0 = 0;
371-
psr_vsc.sdp_header.HB1 = 0x7;
372-
if (dev_priv->psr.colorimetry_support) {
373-
psr_vsc.sdp_header.HB2 = 0x5;
374-
psr_vsc.sdp_header.HB3 = 0x13;
375-
} else {
376-
psr_vsc.sdp_header.HB2 = 0x4;
377-
psr_vsc.sdp_header.HB3 = 0xe;
378-
}
379-
} else {
380-
/* Prepare VSC packet as per EDP 1.3 spec, Table 3.10 */
381-
memset(&psr_vsc, 0, sizeof(psr_vsc));
382-
psr_vsc.sdp_header.HB0 = 0;
383-
psr_vsc.sdp_header.HB1 = 0x7;
384-
psr_vsc.sdp_header.HB2 = 0x2;
385-
psr_vsc.sdp_header.HB3 = 0x8;
386-
}
387-
388-
intel_dig_port->write_infoframe(&intel_dig_port->base,
389-
crtc_state,
390-
DP_SDP_VSC, &psr_vsc, sizeof(psr_vsc));
391-
}
392-
393361
static void hsw_psr_setup_aux(struct intel_dp *intel_dp)
394362
{
395363
struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
@@ -756,6 +724,8 @@ void intel_psr_compute_config(struct intel_dp *intel_dp,
756724
if (intel_dp != dev_priv->psr.dp)
757725
return;
758726

727+
if (!psr_global_enabled(dev_priv))
728+
return;
759729
/*
760730
* HSW spec explicitly says PSR is tied to port A.
761731
* BDW+ platforms have a instance of PSR registers per transcoder but
@@ -798,6 +768,7 @@ void intel_psr_compute_config(struct intel_dp *intel_dp,
798768

799769
crtc_state->has_psr = true;
800770
crtc_state->has_psr2 = intel_psr2_config_valid(intel_dp, crtc_state);
771+
crtc_state->infoframes.enable |= intel_hdmi_infoframe_enable(DP_SDP_VSC);
801772
}
802773

803774
static void intel_psr_activate(struct intel_dp *intel_dp)
@@ -880,9 +851,12 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,
880851
}
881852

882853
static void intel_psr_enable_locked(struct drm_i915_private *dev_priv,
883-
const struct intel_crtc_state *crtc_state)
854+
const struct intel_crtc_state *crtc_state,
855+
const struct drm_connector_state *conn_state)
884856
{
885857
struct intel_dp *intel_dp = dev_priv->psr.dp;
858+
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
859+
struct intel_encoder *encoder = &intel_dig_port->base;
886860
u32 val;
887861

888862
drm_WARN_ON(&dev_priv->drm, dev_priv->psr.enabled);
@@ -921,7 +895,9 @@ static void intel_psr_enable_locked(struct drm_i915_private *dev_priv,
921895

922896
drm_dbg_kms(&dev_priv->drm, "Enabling PSR%s\n",
923897
dev_priv->psr.psr2_enabled ? "2" : "1");
924-
intel_psr_setup_vsc(intel_dp, crtc_state);
898+
intel_dp_compute_psr_vsc_sdp(intel_dp, crtc_state, conn_state,
899+
&dev_priv->psr.vsc);
900+
intel_write_dp_vsc_sdp(encoder, crtc_state, &dev_priv->psr.vsc);
925901
intel_psr_enable_sink(intel_dp);
926902
intel_psr_enable_source(intel_dp, crtc_state);
927903
dev_priv->psr.enabled = true;
@@ -933,11 +909,13 @@ static void intel_psr_enable_locked(struct drm_i915_private *dev_priv,
933909
* intel_psr_enable - Enable PSR
934910
* @intel_dp: Intel DP
935911
* @crtc_state: new CRTC state
912+
* @conn_state: new CONNECTOR state
936913
*
937914
* This function can only be called after the pipe is fully trained and enabled.
938915
*/
939916
void intel_psr_enable(struct intel_dp *intel_dp,
940-
const struct intel_crtc_state *crtc_state)
917+
const struct intel_crtc_state *crtc_state,
918+
const struct drm_connector_state *conn_state)
941919
{
942920
struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
943921

@@ -958,7 +936,7 @@ void intel_psr_enable(struct intel_dp *intel_dp,
958936
goto unlock;
959937
}
960938

961-
intel_psr_enable_locked(dev_priv, crtc_state);
939+
intel_psr_enable_locked(dev_priv, crtc_state, conn_state);
962940

963941
unlock:
964942
mutex_unlock(&dev_priv->psr.lock);
@@ -1091,13 +1069,15 @@ static void psr_force_hw_tracking_exit(struct drm_i915_private *dev_priv)
10911069
* intel_psr_update - Update PSR state
10921070
* @intel_dp: Intel DP
10931071
* @crtc_state: new CRTC state
1072+
* @conn_state: new CONNECTOR state
10941073
*
10951074
* This functions will update PSR states, disabling, enabling or switching PSR
10961075
* version when executing fastsets. For full modeset, intel_psr_disable() and
10971076
* intel_psr_enable() should be called instead.
10981077
*/
10991078
void intel_psr_update(struct intel_dp *intel_dp,
1100-
const struct intel_crtc_state *crtc_state)
1079+
const struct intel_crtc_state *crtc_state,
1080+
const struct drm_connector_state *conn_state)
11011081
{
11021082
struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
11031083
struct i915_psr *psr = &dev_priv->psr;
@@ -1134,7 +1114,7 @@ void intel_psr_update(struct intel_dp *intel_dp,
11341114
intel_psr_disable_locked(intel_dp);
11351115

11361116
if (enable)
1137-
intel_psr_enable_locked(dev_priv, crtc_state);
1117+
intel_psr_enable_locked(dev_priv, crtc_state, conn_state);
11381118

11391119
unlock:
11401120
mutex_unlock(&dev_priv->psr.lock);

drivers/gpu/drm/i915/display/intel_psr.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ struct intel_dp;
1717
#define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
1818
void intel_psr_init_dpcd(struct intel_dp *intel_dp);
1919
void intel_psr_enable(struct intel_dp *intel_dp,
20-
const struct intel_crtc_state *crtc_state);
20+
const struct intel_crtc_state *crtc_state,
21+
const struct drm_connector_state *conn_state);
2122
void intel_psr_disable(struct intel_dp *intel_dp,
2223
const struct intel_crtc_state *old_crtc_state);
2324
void intel_psr_update(struct intel_dp *intel_dp,
24-
const struct intel_crtc_state *crtc_state);
25+
const struct intel_crtc_state *crtc_state,
26+
const struct drm_connector_state *conn_state);
2527
int intel_psr_debug_set(struct drm_i915_private *dev_priv, u64 value);
2628
void intel_psr_invalidate(struct drm_i915_private *dev_priv,
2729
unsigned frontbuffer_bits,

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ struct i915_psr {
512512
u32 dc3co_exit_delay;
513513
struct delayed_work dc3co_work;
514514
bool force_mode_changed;
515+
struct drm_dp_vsc_sdp vsc;
515516
};
516517

517518
#define QUIRK_LVDS_SSC_DISABLE (1<<1)

0 commit comments

Comments
 (0)