From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org, suraj.kandpal@intel.com
Subject: [PATCH 07/10] drm/i915/dp: Compute pixel replication count for DSC 12 slices case
Date: Thu, 17 Oct 2024 13:53:45 +0530 [thread overview]
Message-ID: <20241017082348.3413727-8-ankit.k.nautiyal@intel.com> (raw)
In-Reply-To: <20241017082348.3413727-1-ankit.k.nautiyal@intel.com>
Add check if pixel replication is required while computing slice count
and fill the pixel replication count in crtc_state.
For MST currently 12 slices case is skipped, as it needs the extra
pixels for bandwidth computation.
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
drivers/gpu/drm/i915/display/intel_dp.c | 61 ++++++++++++++++++++-
drivers/gpu/drm/i915/display/intel_dp.h | 1 +
drivers/gpu/drm/i915/display/intel_dp_mst.c | 20 +++++--
3 files changed, 77 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 6cfc7d1c96ea..ef96b9235636 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -981,13 +981,37 @@ u16 intel_dp_dsc_get_max_compressed_bpp(struct drm_i915_private *i915,
return bits_per_pixel;
}
+static
+bool can_use_pixel_replication(int mode_hdisplay, u8 slice_count,
+ enum intel_output_format output_format,
+ bool ultrajoiner)
+{
+ int slice_width;
+
+ if (!(mode_hdisplay % slice_count))
+ return false;
+
+ if (!ultrajoiner)
+ return false;
+
+ slice_width = DIV_ROUND_UP(mode_hdisplay, slice_count);
+
+ /* Odd slice width is not supported by YCbCr420/422 formats */
+ if (slice_width % 2 && output_format == INTEL_OUTPUT_FORMAT_YCBCR420)
+ return false;
+
+ return true;
+}
+
u8 intel_dp_dsc_get_slice_count(const struct intel_connector *connector,
int mode_clock, int mode_hdisplay,
+ enum intel_output_format output_format,
int num_joined_pipes)
{
struct drm_i915_private *i915 = to_i915(connector->base.dev);
u8 min_slice_count, i;
int max_slice_width;
+ bool ultrajoiner = num_joined_pipes == 4 ? true : false;
if (mode_clock <= DP_DSC_PEAK_PIXEL_RATE)
min_slice_count = DIV_ROUND_UP(mode_clock,
@@ -1031,7 +1055,10 @@ u8 intel_dp_dsc_get_slice_count(const struct intel_connector *connector,
if (num_joined_pipes > 1 && valid_dsc_slicecount[i] < 2)
continue;
- if (mode_hdisplay % test_slice_count)
+ if (mode_hdisplay % test_slice_count &&
+ !can_use_pixel_replication(mode_hdisplay,
+ test_slice_count,
+ output_format, ultrajoiner))
continue;
if (min_slice_count <= test_slice_count)
@@ -1458,6 +1485,7 @@ intel_dp_mode_valid(struct drm_connector *_connector,
intel_dp_dsc_get_slice_count(connector,
target_clock,
mode->hdisplay,
+ output_format,
num_joined_pipes);
}
@@ -2322,6 +2350,33 @@ static int intel_edp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
return 0;
}
+static
+int intel_dp_dsc_get_pixel_replication(struct intel_dp *intel_dp,
+ struct intel_crtc_state *pipe_config)
+{
+ int mode_hdisplay = pipe_config->hw.adjusted_mode.hdisplay;
+ int slice_count = pipe_config->dsc.slice_count;
+ int pixel_replication_count;
+ int slice_width;
+ bool ultrajoiner = false;
+
+ if (intel_crtc_num_joined_pipes(pipe_config) == 4)
+ ultrajoiner = true;
+
+ if (!can_use_pixel_replication(mode_hdisplay, slice_count,
+ pipe_config->output_format, ultrajoiner))
+ return 0;
+
+ slice_width = DIV_ROUND_UP(mode_hdisplay, slice_count);
+
+ pixel_replication_count = (slice_width * slice_count) - mode_hdisplay;
+
+ if (pixel_replication_count >= 0)
+ return pixel_replication_count;
+
+ return 0;
+}
+
int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
struct intel_crtc_state *pipe_config,
struct drm_connector_state *conn_state,
@@ -2391,6 +2446,7 @@ int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
intel_dp_dsc_get_slice_count(connector,
adjusted_mode->crtc_clock,
adjusted_mode->crtc_hdisplay,
+ pipe_config->output_format,
num_joined_pipes);
if (!dsc_dp_slice_count) {
drm_dbg_kms(&dev_priv->drm,
@@ -2400,6 +2456,9 @@ int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
pipe_config->dsc.slice_count = dsc_dp_slice_count;
}
+
+ pipe_config->dsc.pixel_replication_count =
+ intel_dp_dsc_get_pixel_replication(intel_dp, pipe_config);
/*
* VDSC engine operates at 1 Pixel per clock, so if peak pixel rate
* is greater than the maximum Cdclock and if slice count is even
diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h
index 60baf4072dc9..bd7a8232572b 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.h
+++ b/drivers/gpu/drm/i915/display/intel_dp.h
@@ -149,6 +149,7 @@ int intel_dp_dsc_sink_max_compressed_bpp(const struct intel_connector *connector
int bpc);
u8 intel_dp_dsc_get_slice_count(const struct intel_connector *connector,
int mode_clock, int mode_hdisplay,
+ enum intel_output_format output_format,
int num_joined_pipes);
int intel_dp_num_joined_pipes(struct intel_dp *intel_dp,
struct intel_connector *connector,
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 1a2ff3e1cb68..f1f19e1c4df8 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -154,11 +154,22 @@ static int intel_dp_mst_dsc_get_slice_count(const struct intel_connector *connec
const struct drm_display_mode *adjusted_mode =
&crtc_state->hw.adjusted_mode;
int num_joined_pipes = intel_crtc_num_joined_pipes(crtc_state);
+ int slice_count;
- return intel_dp_dsc_get_slice_count(connector,
- adjusted_mode->clock,
- adjusted_mode->hdisplay,
- num_joined_pipes);
+ slice_count = intel_dp_dsc_get_slice_count(connector,
+ adjusted_mode->clock,
+ adjusted_mode->hdisplay,
+ crtc_state->output_format,
+ num_joined_pipes);
+ /*
+ * FIXME: With 12 slice count, extra pixels are added.
+ * Take pixel replication into account for MST BW calculation?
+ * Avoid slice count of 12 for now.
+ */
+ if (slice_count == 12)
+ return 0;
+
+ return slice_count;
}
static int intel_dp_mst_find_vcpi_slots_for_bpp(struct intel_encoder *encoder,
@@ -1524,6 +1535,7 @@ intel_dp_mst_mode_valid_ctx(struct drm_connector *connector,
intel_dp_dsc_get_slice_count(intel_connector,
target_clock,
mode->hdisplay,
+ INTEL_OUTPUT_FORMAT_RGB,
num_joined_pipes);
}
--
2.45.2
next prev parent reply other threads:[~2024-10-17 8:21 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 8:23 [PATCH 00/10] Add support for 3 VDSC engines 12 slices Ankit Nautiyal
2024-10-17 8:23 ` [PATCH 01/10] drm/i915/display: Prepare for dsc 3 stream splitter Ankit Nautiyal
2024-10-17 8:58 ` Kandpal, Suraj
2024-10-17 8:23 ` [PATCH 02/10] drm/i915/vdsc: Use VDSC0/VDSC1 for LEFT/RIGHT VDSC engine Ankit Nautiyal
2024-10-17 9:04 ` Kandpal, Suraj
2024-10-17 8:23 ` [PATCH 03/10] drm/i915/vdsc: Add register bits for VDSC2 engine Ankit Nautiyal
2024-10-17 9:10 ` Kandpal, Suraj
2024-10-17 8:23 ` [PATCH 04/10] drm/i915/vdsc: Add support for read/write PPS for DSC3 Ankit Nautiyal
2024-10-18 2:17 ` Kandpal, Suraj
2024-10-21 12:14 ` Nautiyal, Ankit K
2024-10-17 8:23 ` [PATCH 05/10] drm/i915/dp: Add check for hdisplay divisible by slice count Ankit Nautiyal
2024-10-17 9:45 ` Kandpal, Suraj
2024-10-17 8:23 ` [PATCH 06/10] drm/i915/display: Add DSC pixel replication Ankit Nautiyal
2024-10-17 9:33 ` Kandpal, Suraj
2024-10-24 22:18 ` kernel test robot
2024-10-17 8:23 ` Ankit Nautiyal [this message]
2024-10-17 9:44 ` [PATCH 07/10] drm/i915/dp: Compute pixel replication count for DSC 12 slices case Kandpal, Suraj
2024-10-17 8:23 ` [PATCH 08/10] drm/i915/display: Account for pixel replication in pipe_src Ankit Nautiyal
2024-10-17 8:23 ` [PATCH 09/10] drm/i915/dsc: Account for Odd pixel removal Ankit Nautiyal
2024-10-17 8:23 ` [PATCH 10/10] drm/i915/dp: Add support for 3 vdsc engines and 12 slices Ankit Nautiyal
2024-10-17 8:42 ` ✓ CI.Patch_applied: success for Add support for 3 VDSC engines 12 slices (rev3) Patchwork
2024-10-17 8:42 ` ✓ CI.checkpatch: " Patchwork
2024-10-17 8:43 ` ✓ CI.KUnit: " Patchwork
2024-10-17 8:55 ` ✓ CI.Build: " Patchwork
2024-10-17 8:57 ` ✓ CI.Hooks: " Patchwork
2024-10-17 8:59 ` ✗ CI.checksparse: warning " Patchwork
2024-10-17 9:24 ` ✓ CI.BAT: success " Patchwork
2024-10-17 18:15 ` ✗ CI.FULL: 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=20241017082348.3413727-8-ankit.k.nautiyal@intel.com \
--to=ankit.k.nautiyal@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=suraj.kandpal@intel.com \
/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