A DP->HDMI 2.1 PCON handles DSC in one of three ways:
 - it decodes the stream,
 - passes it through to the HDMI sink, or
 - decodes it and encodes it again, if it has a DSC encoder.

Add the state to hold that decision, along with the PCON DSC encoder
PPS override parameters, so that they can be computed during
compute_config and only programmed at enable time.

The pass-through is not handled yet, so for now the state is none, decode,
or decode and re-encode.

The state is not read out since it does not map to any register, and
reading back the DPCD is unreliable. Reset it for every link
configuration attempt and print it in the crtc state dump.

Signed-off-by: Ankit Nautiyal <[email protected]>
---
 .../drm/i915/display/intel_crtc_state_dump.c  | 15 +++++++++++
 .../drm/i915/display/intel_display_types.h    | 27 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_dp.c       |  1 +
 3 files changed, 43 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c 
b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
index 57e64dda79c1..4e9ff59a8d5c 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
@@ -73,6 +73,12 @@ static const char * const output_type_str[] = {
 
 #undef OUTPUT_TYPE
 
+static const char * const pcon_dsc_op_str[] = {
+       [INTEL_PCON_NO_DSC] = "none",
+       [INTEL_PCON_DSC_DECODE] = "decode",
+       [INTEL_PCON_DSC_DECODE_ENCODE] = "decode+encode",
+};
+
 static void snprintf_output_types(char *buf, size_t len,
                                  unsigned int output_types)
 {
@@ -243,6 +249,15 @@ void intel_crtc_state_dump(const struct intel_crtc_state 
*pipe_config,
                           str_enabled_disabled(pipe_config->fec_enable),
                           str_enabled_disabled(pipe_config->enhanced_framing));
 
+               drm_printf(&p, "pcon: dsc op %s\n",
+                          pcon_dsc_op_str[pipe_config->pcon_config.dsc_op]);
+               if (pipe_config->pcon_config.dsc_op == 
INTEL_PCON_DSC_DECODE_ENCODE)
+                       drm_printf(&p,
+                                  "pcon dsc encoder: slice height: %u, slice 
width: %u, bpp_x16: %u\n",
+                                  
pipe_config->pcon_config.dsc_enc.slice_height,
+                                  pipe_config->pcon_config.dsc_enc.slice_width,
+                                  pipe_config->pcon_config.dsc_enc.bpp_x16);
+
                drm_printf(&p, "sdp split: %s\n",
                           str_enabled_disabled(pipe_config->sdp_split_enable));
 
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index 514ca067e139..0103ac569727 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -968,6 +968,23 @@ enum intel_output_format {
        INTEL_OUTPUT_FORMAT_YCBCR444,
 };
 
+enum intel_pcon_dsc_op {
+       /* The PCON does not take part in DSC, also used when there is no HDMI 
2.1 PCON */
+       INTEL_PCON_NO_DSC,
+       /* PCON decodes the DSC stream from the DP link, HDMI link is 
uncompressed */
+       INTEL_PCON_DSC_DECODE,
+       /* PCON decodes the DP stream and encodes DSC 1.2 for the HDMI sink */
+       INTEL_PCON_DSC_DECODE_ENCODE,
+};
+
+/* PCON DSC encoder PPS override parameters */
+struct intel_pcon_dsc_enc_config {
+       u16 slice_height;
+       u16 slice_width;
+       /* Compressed Bpp in U6.4 format */
+       u16 bpp_x16;
+};
+
 /* Used by dp and fdi links */
 struct intel_link_m_n {
        u32 tu;
@@ -1370,6 +1387,16 @@ struct intel_crtc_state {
                struct drm_dsc_config config;
        } dsc;
 
+       /*
+        * Configuration of a DP->HDMI PCON. Only used for state computation,
+        * not read out from the HW.
+        */
+       struct {
+               enum intel_pcon_dsc_op dsc_op;
+               /* Only valid for INTEL_PCON_DSC_DECODE_ENCODE */
+               struct intel_pcon_dsc_enc_config dsc_enc;
+       } pcon_config;
+
        /* DP tunnel used for BW allocation. */
        struct drm_dp_tunnel_ref dp_tunnel_ref;
 
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index c0cf0938a7b6..2d5f7754eda0 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2514,6 +2514,7 @@ void intel_dp_dsc_reset_config(struct intel_crtc_state 
*crtc_state)
 
        memset(&crtc_state->dsc.slice_config, 0, 
sizeof(crtc_state->dsc.slice_config));
        memset(&crtc_state->dsc.config, 0, sizeof(crtc_state->dsc.config));
+       memset(&crtc_state->pcon_config, 0, sizeof(crtc_state->pcon_config));
 }
 
 int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
-- 
2.50.1

Reply via email to