Skip to content

Commit cafac5a

Browse files
elongbugjnikula
authored andcommitted
drm/i915/dp: Add compute routine for DP PSR VSC SDP
In order to use a common VSC SDP Colorimetry calculating code on PSR, it adds a compute routine for PSR VSC SDP. As PSR routine can not use infoframes.vsc of crtc state, it also adds new writing of DP SDPs (Secondary Data Packet) for PSR. PSR routine has its own scenario and timings of writing a VSC SDP. v3: Replace a structure name to drm_dp_vsc_sdp from intel_dp_vsc_sdp v4: Use struct drm_device logging macros v10: 1) Fix packing of VSC SDP where Pixel Encoding/Colorimetry Format is not supported. 2) Change a checking of PSR state. Signed-off-by: Gwan-gyeong Mun <[email protected]> Reviewed-by: Uma Shankar <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent fa37a21 commit cafac5a

File tree

2 files changed

+72
-2
lines changed

2 files changed

+72
-2
lines changed

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

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,8 +2487,8 @@ static void intel_dp_compute_vsc_sdp(struct intel_dp *intel_dp,
24872487
{
24882488
struct drm_dp_vsc_sdp *vsc = &crtc_state->infoframes.vsc;
24892489

2490-
/* When PSR is enabled, VSC SDP is handled by PSR routine */
2491-
if (intel_psr_enabled(intel_dp))
2490+
/* When a crtc state has PSR, VSC SDP will be handled by PSR routine */
2491+
if (crtc_state->has_psr)
24922492
return;
24932493

24942494
if (!intel_dp_needs_vsc_sdp(crtc_state, conn_state))
@@ -2500,6 +2500,42 @@ static void intel_dp_compute_vsc_sdp(struct intel_dp *intel_dp,
25002500
&crtc_state->infoframes.vsc);
25012501
}
25022502

2503+
void intel_dp_compute_psr_vsc_sdp(struct intel_dp *intel_dp,
2504+
const struct intel_crtc_state *crtc_state,
2505+
const struct drm_connector_state *conn_state,
2506+
struct drm_dp_vsc_sdp *vsc)
2507+
{
2508+
struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
2509+
2510+
vsc->sdp_type = DP_SDP_VSC;
2511+
2512+
if (dev_priv->psr.psr2_enabled) {
2513+
if (dev_priv->psr.colorimetry_support &&
2514+
intel_dp_needs_vsc_sdp(crtc_state, conn_state)) {
2515+
/* [PSR2, +Colorimetry] */
2516+
intel_dp_compute_vsc_colorimetry(crtc_state, conn_state,
2517+
vsc);
2518+
} else {
2519+
/*
2520+
* [PSR2, -Colorimetry]
2521+
* Prepare VSC Header for SU as per eDP 1.4 spec, Table 6-11
2522+
* 3D stereo + PSR/PSR2 + Y-coordinate.
2523+
*/
2524+
vsc->revision = 0x4;
2525+
vsc->length = 0xe;
2526+
}
2527+
} else {
2528+
/*
2529+
* [PSR1]
2530+
* Prepare VSC Header for SU as per DP 1.4 spec, Table 2-118
2531+
* VSC SDP supporting 3D stereo + PSR (applies to eDP v1.3 or
2532+
* higher).
2533+
*/
2534+
vsc->revision = 0x2;
2535+
vsc->length = 0x8;
2536+
}
2537+
}
2538+
25032539
static void
25042540
intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,
25052541
struct intel_crtc_state *crtc_state,
@@ -4791,6 +4827,13 @@ static ssize_t intel_dp_vsc_sdp_pack(const struct drm_dp_vsc_sdp *vsc,
47914827
sdp->sdp_header.HB2 = vsc->revision; /* Revision Number */
47924828
sdp->sdp_header.HB3 = vsc->length; /* Number of Valid Data Bytes */
47934829

4830+
/*
4831+
* Only revision 0x5 supports Pixel Encoding/Colorimetry Format as
4832+
* per DP 1.4a spec.
4833+
*/
4834+
if (vsc->revision != 0x5)
4835+
goto out;
4836+
47944837
/* VSC SDP Payload for DB16 through DB18 */
47954838
/* Pixel Encoding and Colorimetry Formats */
47964839
sdp->db[16] = (vsc->pixelformat & 0xf) << 4; /* DB16[7:4] */
@@ -4823,6 +4866,7 @@ static ssize_t intel_dp_vsc_sdp_pack(const struct drm_dp_vsc_sdp *vsc,
48234866
/* Content Type */
48244867
sdp->db[18] = vsc->content_type & 0x7;
48254868

4869+
out:
48264870
return length;
48274871
}
48284872

@@ -4935,6 +4979,24 @@ static void intel_write_dp_sdp(struct intel_encoder *encoder,
49354979
intel_dig_port->write_infoframe(encoder, crtc_state, type, &sdp, len);
49364980
}
49374981

4982+
void intel_write_dp_vsc_sdp(struct intel_encoder *encoder,
4983+
const struct intel_crtc_state *crtc_state,
4984+
struct drm_dp_vsc_sdp *vsc)
4985+
{
4986+
struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
4987+
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
4988+
struct dp_sdp sdp = {};
4989+
ssize_t len;
4990+
4991+
len = intel_dp_vsc_sdp_pack(vsc, &sdp, sizeof(sdp));
4992+
4993+
if (drm_WARN_ON(&dev_priv->drm, len < 0))
4994+
return;
4995+
4996+
intel_dig_port->write_infoframe(encoder, crtc_state, DP_SDP_VSC,
4997+
&sdp, len);
4998+
}
4999+
49385000
void intel_dp_set_infoframes(struct intel_encoder *encoder,
49395001
bool enable,
49405002
const struct intel_crtc_state *crtc_state,

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct drm_connector_state;
1616
struct drm_encoder;
1717
struct drm_i915_private;
1818
struct drm_modeset_acquire_ctx;
19+
struct drm_dp_vsc_sdp;
1920
struct intel_connector;
2021
struct intel_crtc_state;
2122
struct intel_digital_port;
@@ -108,6 +109,13 @@ int intel_dp_link_required(int pixel_clock, int bpp);
108109
int intel_dp_max_data_rate(int max_link_clock, int max_lanes);
109110
bool intel_dp_needs_vsc_sdp(const struct intel_crtc_state *crtc_state,
110111
const struct drm_connector_state *conn_state);
112+
void intel_dp_compute_psr_vsc_sdp(struct intel_dp *intel_dp,
113+
const struct intel_crtc_state *crtc_state,
114+
const struct drm_connector_state *conn_state,
115+
struct drm_dp_vsc_sdp *vsc);
116+
void intel_write_dp_vsc_sdp(struct intel_encoder *encoder,
117+
const struct intel_crtc_state *crtc_state,
118+
struct drm_dp_vsc_sdp *vsc);
111119
void intel_dp_set_infoframes(struct intel_encoder *encoder, bool enable,
112120
const struct intel_crtc_state *crtc_state,
113121
const struct drm_connector_state *conn_state);

0 commit comments

Comments
 (0)