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,
	dri-devel@lists.freedesktop.org
Cc: Nemesa Garg <nemesa.garg@intel.com>
Subject: [PATCH 08/10] drm/i915/display: Call the compute function
Date: Tue,  4 Mar 2025 15:58:55 +0530	[thread overview]
Message-ID: <20250304102857.326544-9-nemesa.garg@intel.com> (raw)
In-Reply-To: <20250304102857.326544-1-nemesa.garg@intel.com>

Once the casf_compute config is called then the
strength and win_size bit of sharpness ctl register
will be set. Read back the bits in get_config.

Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
---
 drivers/gpu/drm/i915/display/intel_casf.c    | 11 +++++++
 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/skl_scaler.c    | 32 +++++++++++++++-----
 3 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_casf.c b/drivers/gpu/drm/i915/display/intel_casf.c
index 1d9196c4d22f..9f14418dc3c9 100644
--- a/drivers/gpu/drm/i915/display/intel_casf.c
+++ b/drivers/gpu/drm/i915/display/intel_casf.c
@@ -97,6 +97,17 @@ static void intel_casf_compute_win_size(struct intel_crtc_state *crtc_state)
 
 int intel_casf_compute_config(struct intel_crtc_state *crtc_state)
 {
+	struct intel_display *display = to_intel_display(crtc_state);
+
+	if (!HAS_CASF(display))
+		return 0;
+
+	if (crtc_state->uapi.sharpness_strength == 0) {
+		crtc_state->hw.casf_params.casf_enable = false;
+		crtc_state->hw.casf_params.strength = 0;
+		return 0;
+	}
+
 	crtc_state->hw.casf_params.casf_enable = true;
 
 	/*
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 03acf01cac75..a2fb68c7cf7a 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4267,6 +4267,10 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,
 			return ret;
 	}
 
+	ret = intel_casf_compute_config(crtc_state);
+	if (ret)
+		return ret;
+
 	if (DISPLAY_VER(dev_priv) >= 9 ||
 	    IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv)) {
 		ret = hsw_compute_linetime_wm(state, crtc);
diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c
index 93a847c05535..79b6749c157e 100644
--- a/drivers/gpu/drm/i915/display/skl_scaler.c
+++ b/drivers/gpu/drm/i915/display/skl_scaler.c
@@ -957,23 +957,41 @@ void skl_scaler_get_config(struct intel_crtc_state *crtc_state)
 
 	/* find scaler attached to this pipe */
 	for (i = 0; i < crtc->num_scalers; i++) {
-		u32 ctl, pos, size;
+		u32 ctl, pos, size, sharp;
 
 		ctl = intel_de_read(display, SKL_PS_CTRL(crtc->pipe, i));
 		if ((ctl & (PS_SCALER_EN | PS_BINDING_MASK)) != (PS_SCALER_EN | PS_BINDING_PIPE))
 			continue;
 
 		id = i;
-		crtc_state->pch_pfit.enabled = true;
+
+		if (HAS_CASF(display) && id == 1) {
+			sharp = intel_de_read(display, SHARPNESS_CTL(crtc->pipe));
+			if (sharp & FILTER_EN) {
+				if (drm_WARN_ON(display->drm,
+						REG_FIELD_GET(FILTER_STRENGTH_MASK, sharp) < 16))
+					crtc_state->hw.casf_params.strength = 0;
+				else
+					crtc_state->hw.casf_params.strength =
+						REG_FIELD_GET(FILTER_STRENGTH_MASK, sharp) - 16;
+				crtc_state->hw.casf_params.casf_enable = true;
+				crtc_state->hw.casf_params.win_size =
+					REG_FIELD_GET(FILTER_SIZE_MASK, sharp);
+			}
+		}
+
+		if (!crtc_state->hw.casf_params.casf_enable)
+			crtc_state->pch_pfit.enabled = true;
 
 		pos = intel_de_read(display, SKL_PS_WIN_POS(crtc->pipe, i));
 		size = intel_de_read(display, SKL_PS_WIN_SZ(crtc->pipe, i));
 
-		drm_rect_init(&crtc_state->pch_pfit.dst,
-			      REG_FIELD_GET(PS_WIN_XPOS_MASK, pos),
-			      REG_FIELD_GET(PS_WIN_YPOS_MASK, pos),
-			      REG_FIELD_GET(PS_WIN_XSIZE_MASK, size),
-			      REG_FIELD_GET(PS_WIN_YSIZE_MASK, size));
+		if (!crtc_state->hw.casf_params.casf_enable)
+			drm_rect_init(&crtc_state->pch_pfit.dst,
+				      REG_FIELD_GET(PS_WIN_XPOS_MASK, pos),
+				      REG_FIELD_GET(PS_WIN_YPOS_MASK, pos),
+				      REG_FIELD_GET(PS_WIN_XSIZE_MASK, size),
+				      REG_FIELD_GET(PS_WIN_YSIZE_MASK, size));
 
 		scaler_state->scalers[i].in_use = true;
 		break;
-- 
2.25.1


  parent reply	other threads:[~2025-03-04 10:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 10:28 [PATCH 00/10] Introduce drm sharpness property Nemesa Garg
2025-03-04 10:28 ` [PATCH 01/10] drm/i915/display: Introduce sharpness strength property Nemesa Garg
2025-03-04 10:28 ` [PATCH 02/10] drm/i915/display: Introduce HAS_CASF macro Nemesa Garg
2025-03-11 11:55   ` Nautiyal, Ankit K
2025-03-04 10:28 ` [PATCH 03/10] drm/i915/display: Add sharpness strength and winsize Nemesa Garg
2025-03-11 11:58   ` Nautiyal, Ankit K
2025-03-04 10:28 ` [PATCH 04/10] drm/i915/display: Add filter lut values Nemesa Garg
2025-03-11 12:00   ` Nautiyal, Ankit K
2025-03-04 10:28 ` [PATCH 05/10] drm/i915/display: Compute the scaler filter coefficients Nemesa Garg
2025-03-11 12:02   ` Nautiyal, Ankit K
2025-03-04 10:28 ` [PATCH 06/10] drm/i915/display: Add and compute scaler parameter Nemesa Garg
2025-03-11 12:03   ` Nautiyal, Ankit K
2025-03-04 10:28 ` [PATCH 07/10] drm/i915/display: Configure the second scaler for sharpness Nemesa Garg
2025-03-11 12:07   ` Nautiyal, Ankit K
2025-03-04 10:28 ` Nemesa Garg [this message]
2025-03-11 12:11   ` [PATCH 08/10] drm/i915/display: Call the compute function Nautiyal, Ankit K
2025-03-04 10:28 ` [PATCH 09/10] drm/i915/display: Enable/disable casf Nemesa Garg
2025-03-11 12:14   ` Nautiyal, Ankit K
2025-03-04 10:28 ` [PATCH 10/10] drm/i915/display: Expose casf property Nemesa Garg
2025-03-11 12:15   ` Nautiyal, Ankit K
2025-03-04 12:03 ` ✓ CI.Patch_applied: success for Introduce drm sharpness property (rev10) Patchwork
2025-03-04 12:03 ` ✗ CI.checkpatch: warning " Patchwork
2025-03-04 12:04 ` ✓ CI.KUnit: success " Patchwork
2025-03-04 12:21 ` ✓ CI.Build: " Patchwork
2025-03-04 12:23 ` ✓ CI.Hooks: " Patchwork
2025-03-04 12:25 ` ✗ CI.checksparse: warning " Patchwork
2025-03-04 12:43 ` ✓ Xe.CI.BAT: success " Patchwork
2025-03-04 13:46 ` ✗ 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=20250304102857.326544-9-nemesa.garg@intel.com \
    --to=nemesa.garg@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@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