diff mbox series

[12/16] drm/i915/display: Account for pixel replication in pipe_src

Message ID 20241021123414.3993899-13-ankit.k.nautiyal@intel.com (mailing list archive)
State New, archived
Headers show
Series Add support for 3 VDSC engines 12 slices | expand

Commit Message

Nautiyal, Ankit K Oct. 21, 2024, 12:34 p.m. UTC
With DSC pixel replication, extra pixels are added in the last slice
of the last pipe. Due to this the total hactive gets increased by few
pixels. Adjust the computation for pipe source width to account for
pixel replication.

These extra pixels will be take care by the Splitter logic in
hardware.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 1b772f58998e..de682fec45cd 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -2514,6 +2514,22 @@  void intel_encoder_get_config(struct intel_encoder *encoder,
 	intel_crtc_readout_derived_state(crtc_state);
 }
 
+static int intel_splitter_adjust_pipe_width(int width, int replicated_pixels)
+{
+	/* Account for Pixel replication:
+	 * Pixel replication is required due to the rounding of slice_width (Hactive / slice_count).
+	 *
+	 * Splitter HW takes care of these by removing replicated pixels from the last pipe.
+	 */
+
+	if (!replicated_pixels)
+		return width;
+
+	width += replicated_pixels;
+
+	return width;
+}
+
 static void intel_joiner_compute_pipe_src(struct intel_crtc_state *crtc_state)
 {
 	int num_pipes = intel_crtc_num_joined_pipes(crtc_state);
@@ -2522,7 +2538,9 @@  static void intel_joiner_compute_pipe_src(struct intel_crtc_state *crtc_state)
 	if (num_pipes == 1)
 		return;
 
-	width = drm_rect_width(&crtc_state->pipe_src);
+	width = intel_splitter_adjust_pipe_width(drm_rect_width(&crtc_state->pipe_src),
+						 crtc_state->dsc.replicated_pixels);
+
 	height = drm_rect_height(&crtc_state->pipe_src);
 
 	drm_rect_init(&crtc_state->pipe_src, 0, 0,