From: Suraj Kandpal <suraj.kandpal@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH v3 6/7] drm/i915/vdsc: Fill the intel_dsc_get_pps_config function
Date: Mon, 17 Jul 2023 15:39:30 +0530 [thread overview]
Message-ID: <20230717100931.2989980-7-suraj.kandpal@intel.com> (raw)
In-Reply-To: <20230717100931.2989980-1-suraj.kandpal@intel.com>
We have setup both the read and write functions so we can
move ahead and fill in all the readout state from PPS register
into the crtc_state so we can send it for comparision.
--v2
-Shorten comment to just PPSX rather than having the whole
"Readout PPSX register" [Jani]
-Remove pps_temp reinitialization as its being initialized in
the read function [Jani]
-Use REG_FIELD_GET to readout certain fields of dsc registers
[Jani]
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
drivers/gpu/drm/i915/display/intel_vdsc.c | 99 +++++++++++++++++--
.../gpu/drm/i915/display/intel_vdsc_regs.h | 3 +
2 files changed, 96 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c
index 2f0362241059..8c57a42bb8f7 100644
--- a/drivers/gpu/drm/i915/display/intel_vdsc.c
+++ b/drivers/gpu/drm/i915/display/intel_vdsc.c
@@ -828,18 +828,105 @@ static void intel_dsc_read_and_verify_pps_reg(struct intel_crtc_state *crtc_stat
static void intel_dsc_get_pps_config(struct intel_crtc_state *crtc_state)
{
struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config;
- u32 pps_temp1, pps_temp2;
+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+ struct drm_i915_private *i915 = to_i915(crtc->base.dev);
+ u32 pps_temp;
+
+ /* PPS_0 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 0, &pps_temp);
- /* Readout PPS_0 and PPS_1 registers */
- intel_dsc_read_and_verify_pps_reg(crtc_state, 0, &pps_temp1);
- intel_dsc_read_and_verify_pps_reg(crtc_state, 1, &pps_temp2);
+ vdsc_cfg->bits_per_component = (pps_temp & DSC_BPC_MASK) >> DSC_BPC_SHIFT;
+ vdsc_cfg->line_buf_depth =
+ (pps_temp & DSC_LINE_BUF_DEPTH_MASK) >> DSC_LINE_BUF_DEPTH_SHIFT;
+ vdsc_cfg->block_pred_enable = pps_temp & DSC_BLOCK_PREDICTION;
+ vdsc_cfg->convert_rgb = pps_temp & DSC_COLOR_SPACE_CONVERSION;
+ vdsc_cfg->simple_422 = pps_temp & DSC_422_ENABLE;
+ vdsc_cfg->native_422 = pps_temp & DSC_NATIVE_422_ENABLE;
+ vdsc_cfg->native_420 = pps_temp & DSC_NATIVE_420_ENABLE;
+ vdsc_cfg->vbr_enable = pps_temp & DSC_VBR_ENABLE;
- vdsc_cfg->bits_per_pixel = pps_temp2;
+ /* PPS_1 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 1, &pps_temp);
- if (pps_temp1 & DSC_NATIVE_420_ENABLE)
+ vdsc_cfg->bits_per_pixel = pps_temp;
+
+ if (vdsc_cfg->native_420)
vdsc_cfg->bits_per_pixel >>= 1;
crtc_state->dsc.compressed_bpp = vdsc_cfg->bits_per_pixel >> 4;
+
+ /* PPS_2 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 2, &pps_temp);
+
+ vdsc_cfg->pic_width = REG_FIELD_GET(DSC_PIC_WIDTH_MASK, pps_temp);
+ vdsc_cfg->pic_height = REG_FIELD_GET(DSC_PIC_HEIGHT_MASK, pps_temp);
+
+ /* PPS_3 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 3, &pps_temp);
+
+ vdsc_cfg->slice_width = REG_FIELD_GET(DSC_SLICE_WIDTH_MASK, pps_temp);
+ vdsc_cfg->slice_height = REG_FIELD_GET(DSC_SLICE_HEIGHT_MASK, pps_temp);
+
+ /* PPS_4 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 4, &pps_temp);
+
+ vdsc_cfg->initial_dec_delay = REG_FIELD_GET(DSC_INITIAL_DEC_DELAY_MASK, pps_temp);
+ vdsc_cfg->initial_xmit_delay = REG_FIELD_GET(DSC_INITIAL_XMIT_DELAY_MASK, pps_temp);
+
+ /* PPS_5 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 5, &pps_temp);
+
+ vdsc_cfg->scale_decrement_interval = REG_FIELD_GET(DSC_SCALE_DEC_INT_MASK, pps_temp);
+ vdsc_cfg->scale_increment_interval = REG_FIELD_GET(DSC_SCALE_INC_INT_MASK, pps_temp);
+
+ /* PPS_6 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 6, &pps_temp);
+
+ vdsc_cfg->initial_scale_value = REG_FIELD_GET(DSC_INITIAL_SCALE_VALUE_MASK, pps_temp);
+ vdsc_cfg->first_line_bpg_offset = REG_FIELD_GET(DSC_FIRST_LINE_BPG_OFFSET_MASK, pps_temp);
+ vdsc_cfg->flatness_min_qp = REG_FIELD_GET(DSC_FLATNESS_MIN_QP_MASK, pps_temp);
+ vdsc_cfg->flatness_max_qp = REG_FIELD_GET(DSC_FLATNESS_MAX_QP_MASK, pps_temp);
+
+ /* PPS_7 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 7, &pps_temp);
+
+ vdsc_cfg->nfl_bpg_offset = REG_FIELD_GET(DSC_NFL_BPG_OFFSET_MASK, pps_temp);
+ vdsc_cfg->slice_bpg_offset = REG_FIELD_GET(DSC_SLICE_BPG_OFFSET_MASK, pps_temp);
+
+ /* PPS_8 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 8, &pps_temp);
+
+ vdsc_cfg->initial_offset = REG_FIELD_GET(DSC_INITIAL_OFFSET_MASK, pps_temp);
+ vdsc_cfg->final_offset = REG_FIELD_GET(DSC_FINAL_OFFSET_MASK, pps_temp);
+
+ /* PPS_9 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 9, &pps_temp);
+
+ vdsc_cfg->rc_model_size = REG_FIELD_GET(DSC_RC_MODEL_SIZE_MASK, pps_temp);
+
+ /* PPS_10 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 10, &pps_temp);
+
+ vdsc_cfg->rc_quant_incr_limit0 = REG_FIELD_GET(DSC_RC_QUANT_INC_LIMIT0_MASK, pps_temp);
+ vdsc_cfg->rc_quant_incr_limit1 = REG_FIELD_GET(DSC_RC_QUANT_INC_LIMIT1_MASK, pps_temp);
+
+ /* PPS_16 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 16, &pps_temp);
+
+ vdsc_cfg->slice_chunk_size = REG_FIELD_GET(DSC_SLICE_CHUNK_SIZE_MASK, pps_temp);
+
+ if (DISPLAY_VER(i915) >= 14) {
+ /* PPS_17 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 17, &pps_temp);
+
+ vdsc_cfg->second_line_bpg_offset = REG_FIELD_GET(DSC_SL_BPG_OFFSET_MASK, pps_temp);
+
+ /* PPS_18 */
+ intel_dsc_read_and_verify_pps_reg(crtc_state, 18, &pps_temp);
+
+ vdsc_cfg->nsl_bpg_offset = REG_FIELD_GET(DSC_NSL_BPG_OFFSET_MASK, pps_temp);
+ vdsc_cfg->second_line_offset_adj = REG_FIELD_GET(DSC_SL_OFFSET_ADJ_MASK, pps_temp);
+ }
}
void intel_dsc_get_config(struct intel_crtc_state *crtc_state)
diff --git a/drivers/gpu/drm/i915/display/intel_vdsc_regs.h b/drivers/gpu/drm/i915/display/intel_vdsc_regs.h
index 785ede31116e..ebd1a59615f7 100644
--- a/drivers/gpu/drm/i915/display/intel_vdsc_regs.h
+++ b/drivers/gpu/drm/i915/display/intel_vdsc_regs.h
@@ -99,6 +99,9 @@
#define DSC_BPC_SHIFT 8
#define DSC_VER_MIN_SHIFT 4
#define DSC_VER_MAJ (0x1 << 0)
+#define DSC_LINE_BUF_DEPTH_MASK REG_GENMASK(15, 12)
+#define DSC_BPC_MASK REG_GENMASK(11, 8)
+
#define DSCA_PICTURE_PARAMETER_SET_1 _MMIO(0x6B204)
#define DSCC_PICTURE_PARAMETER_SET_1 _MMIO(0x6BA04)
--
2.25.1
next prev parent reply other threads:[~2023-07-17 10:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 10:09 [Intel-gfx] [PATCH v3 0/7] Add DSC PPS readout Suraj Kandpal
2023-07-17 10:09 ` [Intel-gfx] [PATCH v3 1/7] drm/i915/vdsc: Refactor dsc register field macro Suraj Kandpal
2023-07-17 10:09 ` [Intel-gfx] [PATCH v3 2/7] drm/i915/vdsc: Add a check for dsc split cases Suraj Kandpal
2023-07-17 10:09 ` [Intel-gfx] [PATCH v3 3/7] drm/i915/vdsc: Add function to read any PPS register Suraj Kandpal
2023-07-17 10:09 ` [Intel-gfx] [PATCH v3 4/7] drm/i915/vdsc: Use MACRO to cleanup intel_dsc_get_pps_reg Suraj Kandpal
2023-07-18 9:24 ` Nautiyal, Ankit K
2023-07-18 9:43 ` Nautiyal, Ankit K
2023-07-17 10:09 ` [Intel-gfx] [PATCH v3 5/7] drm/i915/vdsc: Add function to write in PPS register Suraj Kandpal
2023-07-17 10:09 ` Suraj Kandpal [this message]
2023-07-17 10:09 ` [Intel-gfx] [PATCH v3 7/7] drm/i915/display: Compare the readout dsc pps params Suraj Kandpal
2023-07-17 14:48 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Add DSC PPS readout (rev3) Patchwork
2023-07-17 14:48 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-07-17 15:07 ` [Intel-gfx] ✗ Fi.CI.BAT: 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=20230717100931.2989980-7-suraj.kandpal@intel.com \
--to=suraj.kandpal@intel.com \
--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