From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: [Intel-gfx] [RFC 11/13] drm/i915: Read DSC capabilities of the HDMI2.1 PCON encoder
Date: Thu, 15 Oct 2020 16:22:57 +0530 [thread overview]
Message-ID: <20201015105259.27934-12-ankit.k.nautiyal@intel.com> (raw)
In-Reply-To: <20201015105259.27934-1-ankit.k.nautiyal@intel.com>
This patch adds a helper function to read the DSC capabilities of the
HDMI2.1 PCon encoder. It also adds a new structure to store these caps,
which can then be used to get the PPS parameters for PCON-HDMI2.1 sink
pair. Which inturn will be used to take a call to override the existing
PPS-metadata, by either writing the entire new PPS metadata, or by
writing only the PPS override parameters.
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
.../drm/i915/display/intel_display_types.h | 16 ++
drivers/gpu/drm/i915/display/intel_dp.c | 178 ++++++++++++++++++
2 files changed, 194 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 6c69922313d6..23282695a47f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1292,6 +1292,21 @@ struct intel_dp_pcon_frl {
int trained_rate_gbps;
};
+struct intel_dp_pcon_dsc {
+ bool enc_support;
+ bool pps_override_support;
+ bool blk_prediction_support;
+ u8 version_major;
+ u8 version_minor;
+ u8 color_fmt_mask;
+ u8 color_depth_mask;
+ u8 max_slices;;
+ u8 max_slice_width;
+ u8 line_buf_bit_depth;
+ u8 bpp_precision_incr;
+ int rc_buf_size;
+};
+
struct intel_dp {
i915_reg_t output_reg;
u32 DP;
@@ -1415,6 +1430,7 @@ struct intel_dp {
bool hobl_active;
struct intel_dp_pcon_frl frl;
+ struct intel_dp_pcon_dsc pcon_dsc;
};
enum lspcon_vendor {
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index e6c4cb844e37..b4f8abaea607 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -3882,6 +3882,182 @@ cpt_set_link_train(struct intel_dp *intel_dp,
intel_de_posting_read(dev_priv, intel_dp->output_reg);
}
+void intel_dp_get_pcon_dsc_cap(struct intel_dp *intel_dp)
+{
+ u8 buf;
+ u8 rc_buf_blk_size;
+ u8 max_slices = 0;
+
+ struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+ struct intel_dp_pcon_dsc *pcon_dsc = &intel_dp->pcon_dsc;
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_ENCODER, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_ENCODER\n");
+ return;
+ }
+ pcon_dsc->enc_support = buf & DP_PCON_DSC_ENCODER_SUPPORTED;
+ pcon_dsc->pps_override_support = buf & DP_PCON_DSC_PPS_ENC_OVERRIDE;
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_VERSION, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_VERSION\n");
+ return;
+ }
+ pcon_dsc->version_major = (buf & DP_PCON_DSC_MAJOR_MASK) >>
+ DP_PCON_DSC_MAJOR_SHIFT;
+ pcon_dsc->version_minor = (buf & DP_PCON_DSC_MINOR_MASK) >>
+ DP_PCON_DSC_MINOR_SHIFT;
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_RC_BUF_BLK_INFO, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_RC_BUF_BLK_INFO\n");
+ return;
+ }
+
+ switch (buf & DP_PCON_DSC_RC_BUF_BLK_SIZE) {
+ case DP_PCON_DSC_RC_BUF_BLK_1KB :
+ rc_buf_blk_size = 1;
+ break;
+ case DP_PCON_DSC_RC_BUF_BLK_4KB :
+ rc_buf_blk_size = 4;
+ break;
+ case DP_PCON_DSC_RC_BUF_BLK_16KB :
+ rc_buf_blk_size = 16;
+ break;
+ case DP_PCON_DSC_RC_BUF_BLK_64KB :
+ rc_buf_blk_size = 64;
+ break;
+ default :
+ rc_buf_blk_size = 0;
+ }
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_RC_BUF_SIZE, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_RC_BUF_SIZE\n");
+ return;
+ }
+ /* storing rc_buf_size in bytes */
+ pcon_dsc->rc_buf_size = (buf + 1) * rc_buf_blk_size * 1024;
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_SLICE_CAP_2, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_SLICE_CAP_2\n");
+ return;
+ }
+ if (buf & DP_PCON_DSC_24_PER_DSC_ENC)
+ max_slices = 24;
+ else if (buf & DP_PCON_DSC_20_PER_DSC_ENC)
+ max_slices = 20;
+ else if (buf & DP_PCON_DSC_16_PER_DSC_ENC)
+ max_slices = 16;
+
+ if (max_slices == 0) {
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_SLICE_CAP_1,
+ &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_SLICE_CAP_2\n");
+ return;
+ }
+
+ if (buf & DP_PCON_DSC_12_PER_DSC_ENC)
+ max_slices = 12;
+ else if (buf & DP_PCON_DSC_10_PER_DSC_ENC)
+ max_slices = 10;
+ else if (buf & DP_PCON_DSC_8_PER_DSC_ENC)
+ max_slices = 8;
+ else if (buf & DP_PCON_DSC_6_PER_DSC_ENC)
+ max_slices = 6;
+ else if (buf & DP_PCON_DSC_4_PER_DSC_ENC)
+ max_slices = 4;
+ else if (buf & DP_PCON_DSC_2_PER_DSC_ENC)
+ max_slices = 2;
+ else if (buf & DP_PCON_DSC_1_PER_DSC_ENC)
+ max_slices = 1;
+ }
+
+ pcon_dsc->max_slices = max_slices;
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_BUF_BIT_DEPTH, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_BUF_BIT_DEPTH\n");
+ return;
+ }
+ switch (buf & DP_PCON_DSC_BIT_DEPTH_MASK) {
+ case DP_PCON_DSC_DEPTH_8_BITS :
+ pcon_dsc->line_buf_bit_depth = 8;
+ break;
+ case DP_PCON_DSC_DEPTH_9_BITS :
+ pcon_dsc->line_buf_bit_depth = 9;
+ break;
+ case DP_PCON_DSC_DEPTH_10_BITS :
+ pcon_dsc->line_buf_bit_depth = 10;
+ break;
+ case DP_PCON_DSC_DEPTH_11_BITS :
+ pcon_dsc->line_buf_bit_depth = 11;
+ break;
+ case DP_PCON_DSC_DEPTH_12_BITS :
+ pcon_dsc->line_buf_bit_depth = 12;
+ break;
+ case DP_PCON_DSC_DEPTH_13_BITS :
+ pcon_dsc->line_buf_bit_depth = 13;
+ break;
+ case DP_PCON_DSC_DEPTH_14_BITS :
+ pcon_dsc->line_buf_bit_depth = 14;
+ break;
+ case DP_PCON_DSC_DEPTH_15_BITS :
+ pcon_dsc->line_buf_bit_depth = 15;
+ break;
+ case DP_PCON_DSC_DEPTH_16_BITS :
+ pcon_dsc->line_buf_bit_depth = 16;
+ break;
+ default :
+ pcon_dsc->line_buf_bit_depth = 0;
+ }
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_BLOCK_PREDICTION, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_BLOCK_PREDICTION\n");
+ return;
+ }
+ if (buf && DP_PCON_DSC_BLOCK_PRED_SUPPORT)
+ pcon_dsc->blk_prediction_support = true;
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_ENC_COLOR_FMT_CAP, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_ENC_COLOR_FMT_CAP\n");
+ return;
+ }
+ pcon_dsc->color_fmt_mask = buf;
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_ENC_COLOR_DEPTH_CAP, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_ENC_COLOR_DEPTH_CAP\n");
+ return;
+ }
+ pcon_dsc->color_depth_mask = buf;
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_MAX_SLICE_WIDTH, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_MAX_SLICE_WIDTH\n");
+ return;
+ }
+ pcon_dsc->max_slice_width = buf;;
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_DSC_BPP_INCR, &buf) < 0) {
+ drm_err(&i915->drm, "Failed to read DP_PCON_DSC_BPP_INCR\n");
+ return;
+ }
+ switch(buf & DP_PCON_DSC_BPP_INCR_MASK) {
+ case DP_PCON_DSC_ONE_16TH_BPP:
+ pcon_dsc->bpp_precision_incr = 16;
+ break;
+ case DP_PCON_DSC_ONE_8TH_BPP:
+ pcon_dsc->bpp_precision_incr = 8;
+ break;
+ case DP_PCON_DSC_ONE_4TH_BPP:
+ pcon_dsc->bpp_precision_incr = 4;
+ break;
+ case DP_PCON_DSC_ONE_HALF_BPP:
+ pcon_dsc->bpp_precision_incr = 2;
+ break;
+ case DP_PCON_DSC_ONE_BPP:
+ pcon_dsc->bpp_precision_incr = 1;
+ break;
+ default :
+ pcon_dsc->bpp_precision_incr = 0;
+ }
+}
+
static int intel_dp_get_max_rate_gbps(struct intel_dp *intel_dp)
{
int max_link_clock, max_lanes, max_rate_khz, max_rate_gbps;
@@ -6659,6 +6835,8 @@ intel_dp_update_dfp(struct intel_dp *intel_dp,
intel_dp->dfp.max_tmds_clock,
intel_dp->dfp.pcon_max_frl,
intel_dp->dfp.sink_max_frl);
+
+ intel_dp_get_pcon_dsc_cap(intel_dp);
}
static void
--
2.17.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-10-15 11:00 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-15 10:52 [Intel-gfx] [RFC 00/13] Add support for DP-HDMI2.1 PCON Ankit Nautiyal
2020-10-15 10:52 ` [Intel-gfx] [RFC 01/13] drm/edid: Add additional HFVSDB fields for HDMI2.1 Ankit Nautiyal
2020-10-18 20:47 ` Shankar, Uma
2020-11-01 5:31 ` Nautiyal, Ankit K
2020-10-15 10:52 ` [Intel-gfx] [RFC 02/13] drm/edid: Parse MAX_FRL field from HFVSDB block Ankit Nautiyal
2020-10-18 20:47 ` Shankar, Uma
2020-11-01 5:41 ` Nautiyal, Ankit K
2020-10-15 10:52 ` [Intel-gfx] [RFC 03/13] drm/dp_helper: Add FRL training support for a DP-HDMI2.1 PCON Ankit Nautiyal
2020-10-18 21:33 ` Shankar, Uma
2020-11-01 5:53 ` Nautiyal, Ankit K
2020-10-15 10:52 ` [Intel-gfx] [RFC 04/13] drm/i915: Capture max frl rate for PCON in dfp cap structure Ankit Nautiyal
2020-10-18 21:41 ` Shankar, Uma
2020-11-01 5:56 ` Nautiyal, Ankit K
2020-10-15 10:52 ` [Intel-gfx] [RFC 05/13] drm/i915: Add support for starting FRL training for HDMI2.1 via PCON Ankit Nautiyal
2020-10-18 22:14 ` Shankar, Uma
2020-11-01 6:01 ` Nautiyal, Ankit K
2020-10-15 10:52 ` [Intel-gfx] [RFC 06/13] drm/i915: Check for FRL training before DP Link training Ankit Nautiyal
2020-10-18 22:21 ` Shankar, Uma
2020-11-01 6:06 ` Nautiyal, Ankit K
2020-10-15 10:52 ` [Intel-gfx] [RFC 07/13] drm/dp_helper: Add support for link status and link recovery Ankit Nautiyal
2020-10-18 22:37 ` Shankar, Uma
2020-11-01 6:18 ` Nautiyal, Ankit K
2020-10-15 10:52 ` [Intel-gfx] [RFC 08/13] drm/i915: Add support for enabling link status and recovery Ankit Nautiyal
2020-10-18 22:49 ` Shankar, Uma
2020-11-01 6:26 ` Nautiyal, Ankit K
2020-10-15 10:52 ` [Intel-gfx] [RFC 09/13] drm/edid: Parse DSC1.2 cap fields from HFVSDB block Ankit Nautiyal
2020-10-18 23:01 ` Shankar, Uma
2020-11-01 6:52 ` Nautiyal, Ankit K
2020-10-15 10:52 ` [Intel-gfx] [RFC 10/13] drm/dp_helper: Add support for Configuring DSC for HDMI2.1 Pcon Ankit Nautiyal
2020-10-18 23:19 ` Shankar, Uma
2020-11-01 7:00 ` Nautiyal, Ankit K
2020-10-15 10:52 ` Ankit Nautiyal [this message]
2020-10-18 23:32 ` [Intel-gfx] [RFC 11/13] drm/i915: Read DSC capabilities of the HDMI2.1 PCON encoder Shankar, Uma
2020-10-18 23:34 ` Shankar, Uma
2020-11-01 7:14 ` Nautiyal, Ankit K
2020-11-01 7:13 ` Nautiyal, Ankit K
2020-10-15 10:52 ` [Intel-gfx] [RFC 12/13] drm/i915: Add helper functions for calculating DSC parameters for HDMI2.1 Ankit Nautiyal
2020-10-15 10:52 ` [Intel-gfx] [RFC 13/13] drm/i915: Configure PCON for DSC1.1 to DSC1.2 encoding Ankit Nautiyal
2020-10-15 11:37 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Add support for DP-HDMI2.1 PCON (rev3) Patchwork
2020-10-15 11:39 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-10-15 12:02 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-10-15 13:41 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201015105259.27934-12-ankit.k.nautiyal@intel.com \
--to=ankit.k.nautiyal@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox