Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nemesa Garg <nemesa.garg@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: ville.syrjala@intel.com, uma.shankar@intel.com,
	Nemesa Garg <nemesa.garg@intel.com>
Subject: [PATCH 4/5] drm/i915/display: Add intel_casf_arm() to enable casf
Date: Tue,  9 Dec 2025 11:55:26 +0530	[thread overview]
Message-ID: <20251209062527.620382-5-nemesa.garg@intel.com> (raw)
In-Reply-To: <20251209062527.620382-1-nemesa.garg@intel.com>

Enable casf by writing the register SKL_PS_WIN_SZ as
it is an arming register. It has to be invoked from
both dsb and non-dsb path.

Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
---
 drivers/gpu/drm/i915/display/intel_casf.c    | 27 +++++++++++++++-----
 drivers/gpu/drm/i915/display/intel_casf.h    |  3 +++
 drivers/gpu/drm/i915/display/intel_display.c |  6 +++++
 3 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_casf.c b/drivers/gpu/drm/i915/display/intel_casf.c
index e9ffbd42a030..6b99eca6f031 100644
--- a/drivers/gpu/drm/i915/display/intel_casf.c
+++ b/drivers/gpu/drm/i915/display/intel_casf.c
@@ -81,14 +81,9 @@ void intel_casf_update_strength(struct intel_dsb *dsb,
 {
 	struct intel_display *display = to_intel_display(crtc_state);
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
-	int win_size;
 
 	intel_de_rmw(display, SHARPNESS_CTL(crtc->pipe), FILTER_STRENGTH_MASK,
 		     FILTER_STRENGTH(crtc_state->hw.casf_params.strength));
-
-	win_size = intel_de_read(display, SKL_PS_WIN_SZ(crtc->pipe, 1));
-
-	intel_de_write_fw(display, SKL_PS_WIN_SZ(crtc->pipe, 1), win_size);
 }
 
 static void intel_casf_compute_win_size(struct intel_crtc_state *crtc_state)
@@ -280,6 +275,27 @@ void intel_casf_enable(struct intel_dsb *dsb,
 	skl_scaler_setup_casf(crtc_state);
 }
 
+void intel_casf_arm(struct intel_dsb *dsb,
+		    const struct intel_crtc_state *crtc_state)
+{
+	struct intel_display *display = to_intel_display(crtc_state);
+	const struct drm_display_mode *adjusted_mode =
+		&crtc_state->hw.adjusted_mode;
+	const struct intel_crtc_scaler_state *scaler_state =
+		&crtc_state->scaler_state;
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+	enum pipe pipe = crtc->pipe;
+
+	int id, width, height;
+
+	width = adjusted_mode->crtc_hdisplay;
+	height = adjusted_mode->crtc_vdisplay;
+	id = scaler_state->scaler_id;
+
+	intel_de_write_fw(display, SKL_PS_WIN_SZ(pipe, id),
+			  PS_WIN_XSIZE(width) | PS_WIN_YSIZE(height));
+}
+
 void intel_casf_disable(struct intel_dsb *dsb,
 			const struct intel_crtc_state *crtc_state)
 {
@@ -289,7 +305,6 @@ void intel_casf_disable(struct intel_dsb *dsb,
 	intel_de_write_dsb(display, dsb, SKL_PS_CTRL(crtc->pipe, 1), 0);
 	intel_de_write_dsb(display, dsb, SKL_PS_WIN_POS(crtc->pipe, 1), 0);
 	intel_de_write_dsb(display, dsb, SHARPNESS_CTL(crtc->pipe), 0);
-	intel_de_write_dsb(display, dsb, SKL_PS_WIN_SZ(crtc->pipe, 1), 0);
 }
 
 void intel_casf_check(struct intel_atomic_state *state)
diff --git a/drivers/gpu/drm/i915/display/intel_casf.h b/drivers/gpu/drm/i915/display/intel_casf.h
index 16a938e19c71..816fc285a921 100644
--- a/drivers/gpu/drm/i915/display/intel_casf.h
+++ b/drivers/gpu/drm/i915/display/intel_casf.h
@@ -24,5 +24,8 @@ void intel_casf_disable(struct intel_dsb *dsb,
 void intel_casf_scaler_compute_config(struct intel_crtc_state *crtc_state);
 bool intel_casf_needs_scaler(const struct intel_crtc_state *crtc_state);
 void intel_casf_check(struct intel_atomic_state *state);
+void intel_casf_arm(struct intel_dsb *dsb,
+		    const struct intel_crtc_state *crtc_state);
+
 
 #endif /* __INTEL_CASF_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 7edfc8c2ae21..52d1eff4de2e 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -6722,6 +6722,9 @@ static void commit_pipe_post_planes(struct intel_atomic_state *state,
 
 	drm_WARN_ON(display->drm, new_crtc_state->use_dsb || new_crtc_state->use_flipq);
 
+	if (new_crtc_state->hw.casf_params.casf_enable)
+		intel_casf_arm(new_crtc_state->dsb_commit,
+			       new_crtc_state);
 	/*
 	 * Disable the scaler(s) after the plane(s) so that we don't
 	 * get a catastrophic underrun even if the two operations
@@ -7364,6 +7367,9 @@ static void intel_atomic_dsb_finish(struct intel_atomic_state *state,
 		if (intel_crtc_needs_color_update(new_crtc_state))
 			intel_color_commit_arm(new_crtc_state->dsb_commit,
 					       new_crtc_state);
+		if (new_crtc_state->hw.casf_params.casf_enable)
+			intel_casf_arm(new_crtc_state->dsb_commit,
+				       new_crtc_state);
 		bdw_set_pipe_misc(new_crtc_state->dsb_commit,
 				  new_crtc_state);
 		intel_psr2_program_trans_man_trk_ctl(new_crtc_state->dsb_commit,
-- 
2.25.1


  parent reply	other threads:[~2025-12-09  6:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09  6:25 [PATCH 0/5] Make casf updates atomic and dsb ready Nemesa Garg
2025-12-09  6:25 ` [PATCH 1/5] drm/i915/display: Move casf_compute_config Nemesa Garg
2025-12-12 15:51   ` Ville Syrjälä
2025-12-09  6:25 ` [PATCH 2/5] drm/i915/display: Add intel_dsb param to CASF helpers Nemesa Garg
2025-12-09  6:25 ` [PATCH 3/5] drm/i915/display: Pass dsb_commit " Nemesa Garg
2025-12-12 16:34   ` Ville Syrjälä
2025-12-16 14:59     ` Garg, Nemesa
2025-12-17  3:10       ` Garg, Nemesa
2025-12-09  6:25 ` Nemesa Garg [this message]
2025-12-09  6:25 ` [PATCH 5/5] drm/i915/display: Introduce skl_pipe_scaler_setup() Nemesa Garg
2025-12-09  6:36 ` ✓ CI.KUnit: success for Make casf updates atomic and dsb ready Patchwork
2025-12-09  7:10 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-09 13:31 ` ✗ Xe.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=20251209062527.620382-5-nemesa.garg@intel.com \
    --to=nemesa.garg@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=uma.shankar@intel.com \
    --cc=ville.syrjala@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