From: Nemesa Garg <nemesa.garg@intel.com>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
intel-xe@lists.freedesktop.org
Cc: Nemesa Garg <nemesa.garg@intel.com>,
Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Subject: [PATCH 07/10] drm/i915/display: Configure the second scaler
Date: Thu, 24 Jul 2025 19:15:41 +0530 [thread overview]
Message-ID: <20250724134544.284371-8-nemesa.garg@intel.com> (raw)
In-Reply-To: <20250724134544.284371-1-nemesa.garg@intel.com>
Both sharpness and panel fitter use pipe scaler,
but only one can be enabled at a time. Furthermore
sharpness uses second scaler. So for CASF, check if
second scaler is available and make sure that only
either of panel fitter or sharpness is enabled at
a time.
v2: Add the panel fitting check before enabling sharpness
v3: Reframe commit message[Arun]
v4: Replace string based comparison with plane_state[Jani]
v5: Rebase
v6: Fix build issue
v7: Remove scaler id from verify_crtc_state[Ankit]
v8: Change the patch title. Add code comment.
Move the config part in patch#6. [Ankit]
v9: Refactor the patch[Ankit]
v10: Modify the header of patch[Ankit]
Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
drivers/gpu/drm/i915/display/intel_casf.c | 8 +++++++
drivers/gpu/drm/i915/display/intel_casf.h | 1 +
drivers/gpu/drm/i915/display/intel_display.c | 4 +++-
drivers/gpu/drm/i915/display/skl_scaler.c | 25 +++++++++++++++-----
4 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_casf.c b/drivers/gpu/drm/i915/display/intel_casf.c
index b2d2aea9108b..d5d5b967bf05 100644
--- a/drivers/gpu/drm/i915/display/intel_casf.c
+++ b/drivers/gpu/drm/i915/display/intel_casf.c
@@ -159,6 +159,14 @@ void intel_casf_sharpness_get_config(struct intel_crtc_state *crtc_state)
}
}
+bool intel_casf_needs_scaler(const struct intel_crtc_state *crtc_state)
+{
+ if (crtc_state->hw.casf_params.casf_enable)
+ return true;
+
+ return false;
+}
+
static int casf_coeff_tap(int i)
{
return i % SCALER_FILTER_NUM_TAPS;
diff --git a/drivers/gpu/drm/i915/display/intel_casf.h b/drivers/gpu/drm/i915/display/intel_casf.h
index 031d2e41701e..a546f88a65bb 100644
--- a/drivers/gpu/drm/i915/display/intel_casf.h
+++ b/drivers/gpu/drm/i915/display/intel_casf.h
@@ -17,5 +17,6 @@ void intel_casf_sharpness_get_config(struct intel_crtc_state *crtc_state);
void intel_casf_filter_lut_load(struct intel_crtc *crtc,
const struct intel_crtc_state *crtc_state);
void intel_casf_scaler_compute_config(struct intel_crtc_state *crtc_state);
+bool intel_casf_needs_scaler(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 7035c1fc9033..706ebb7af99e 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -60,6 +60,7 @@
#include "intel_audio.h"
#include "intel_bo.h"
#include "intel_bw.h"
+#include "intel_casf.h"
#include "intel_cdclk.h"
#include "intel_clock_gating.h"
#include "intel_color.h"
@@ -4254,7 +4255,8 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,
if (DISPLAY_VER(display) >= 9) {
if (intel_crtc_needs_modeset(crtc_state) ||
- intel_crtc_needs_fastset(crtc_state)) {
+ intel_crtc_needs_fastset(crtc_state) ||
+ intel_casf_needs_scaler(crtc_state)) {
ret = skl_update_scaler_crtc(crtc_state);
if (ret)
return ret;
diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c
index 1c6da9be486c..f1f38d9739e6 100644
--- a/drivers/gpu/drm/i915/display/skl_scaler.c
+++ b/drivers/gpu/drm/i915/display/skl_scaler.c
@@ -6,6 +6,7 @@
#include <drm/drm_print.h>
#include "i915_utils.h"
+#include "intel_casf.h"
#include "intel_casf_regs.h"
#include "intel_de.h"
#include "intel_display_regs.h"
@@ -282,7 +283,8 @@ int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state)
drm_rect_width(&crtc_state->pipe_src),
drm_rect_height(&crtc_state->pipe_src),
width, height, NULL, 0,
- crtc_state->pch_pfit.enabled);
+ crtc_state->pch_pfit.enabled ||
+ intel_casf_needs_scaler(crtc_state));
}
/**
@@ -321,7 +323,9 @@ int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
}
static int intel_allocate_scaler(struct intel_crtc_scaler_state *scaler_state,
- struct intel_crtc *crtc)
+ struct intel_crtc *crtc,
+ struct intel_plane_state *plane_state,
+ bool casf_scaler)
{
int i;
@@ -329,6 +333,10 @@ static int intel_allocate_scaler(struct intel_crtc_scaler_state *scaler_state,
if (scaler_state->scalers[i].in_use)
continue;
+ /* CASF needs second scaler */
+ if (!plane_state && casf_scaler && i != 1)
+ continue;
+
scaler_state->scalers[i].in_use = true;
return i;
@@ -379,7 +387,7 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state,
int num_scalers_need, struct intel_crtc *crtc,
const char *name, int idx,
struct intel_plane_state *plane_state,
- int *scaler_id)
+ int *scaler_id, bool casf_scaler)
{
struct intel_display *display = to_intel_display(crtc);
struct intel_crtc_scaler_state *scaler_state = &crtc_state->scaler_state;
@@ -388,7 +396,7 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state,
int vscale = 0;
if (*scaler_id < 0)
- *scaler_id = intel_allocate_scaler(scaler_state, crtc);
+ *scaler_id = intel_allocate_scaler(scaler_state, crtc, plane_state, casf_scaler);
if (drm_WARN(display->drm, *scaler_id < 0,
"Cannot find scaler for %s:%d\n", name, idx))
@@ -520,10 +528,14 @@ static int setup_crtc_scaler(struct intel_atomic_state *state,
struct intel_crtc_scaler_state *scaler_state =
&crtc_state->scaler_state;
+ if (intel_casf_needs_scaler(crtc_state) && crtc_state->pch_pfit.enabled)
+ return -EINVAL;
+
return intel_atomic_setup_scaler(crtc_state,
hweight32(scaler_state->scaler_users),
crtc, "CRTC", crtc->base.base.id,
- NULL, &scaler_state->scaler_id);
+ NULL, &scaler_state->scaler_id,
+ intel_casf_needs_scaler(crtc_state));
}
static int setup_plane_scaler(struct intel_atomic_state *state,
@@ -558,7 +570,8 @@ static int setup_plane_scaler(struct intel_atomic_state *state,
return intel_atomic_setup_scaler(crtc_state,
hweight32(scaler_state->scaler_users),
crtc, "PLANE", plane->base.base.id,
- plane_state, &plane_state->scaler_id);
+ plane_state, &plane_state->scaler_id,
+ false);
}
/**
--
2.25.1
next prev parent reply other threads:[~2025-07-24 13:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 13:45 [PATCH 00/10] Introduce drm sharpness property Nemesa Garg
2025-07-24 13:45 ` [PATCH 01/10] drm/drm-crtc: Introduce sharpness strength property Nemesa Garg
2025-07-25 11:22 ` [01/10] " Xaver Hugl
2025-09-09 10:28 ` Simona Vetter
2025-08-07 5:51 ` [PATCH 01/10] " Nautiyal, Ankit K
2025-08-07 5:57 ` Nautiyal, Ankit K
2025-07-24 13:45 ` [PATCH 02/10] drm/i915/display: Introduce HAS_CASF for sharpness support Nemesa Garg
2025-07-30 7:32 ` Jani Nikula
2025-07-30 7:33 ` Jani Nikula
2025-07-31 8:56 ` Garg, Nemesa
2025-07-24 13:45 ` [PATCH 03/10] drm/i915/display: Add strength and winsize register Nemesa Garg
2025-07-24 13:45 ` [PATCH 04/10] drm/i915/display: Add filter lut values Nemesa Garg
2025-07-24 13:45 ` [PATCH 05/10] drm/i915/display: Compute the scaler coefficients Nemesa Garg
2025-07-24 13:45 ` [PATCH 06/10] drm/i915/display: Add and compute scaler parameter Nemesa Garg
2025-07-24 13:45 ` Nemesa Garg [this message]
2025-07-24 13:45 ` [PATCH 08/10] drm/i915/display: Set and get the casf config Nemesa Garg
2025-07-24 13:45 ` [PATCH 09/10] drm/i915/display: Enable/disable casf Nemesa Garg
2025-07-24 13:45 ` [PATCH 10/10] drm/i915/display: Expose sharpness strength property Nemesa Garg
2025-07-28 11:42 ` [PATCH 00/10] Introduce drm sharpness property Garg, Nemesa
-- strict thread matches above, loose matches on Subject: below --
2025-10-26 17:26 Nemesa Garg
2025-10-26 17:26 ` [PATCH 07/10] drm/i915/display: Configure the second scaler Nemesa Garg
2025-10-01 6:34 [PATCH 00/10] Introduce drm sharpness property Nemesa Garg
2025-10-01 6:34 ` [PATCH 07/10] drm/i915/display: Configure the second scaler Nemesa Garg
2025-09-26 11:37 [PATCH 00/10] Introduce drm sharpness property Nemesa Garg
2025-09-26 11:37 ` [PATCH 07/10] drm/i915/display: Configure the second scaler Nemesa Garg
2025-08-07 9:28 [PATCH 00/10] Introduce drm sharpness property Nemesa Garg
2025-08-07 9:28 ` [PATCH 07/10] drm/i915/display: Configure the second scaler Nemesa Garg
2025-05-19 12:26 [PATCH 00/10] Introduce drm sharpness property Nemesa Garg
2025-05-19 12:26 ` [PATCH 07/10] drm/i915/display: Configure the second scaler Nemesa Garg
2025-04-08 10:24 [PATCH 00/10] Introduce drm sharpness property Nemesa Garg
2025-04-08 10:25 ` [PATCH 07/10] drm/i915/display: Configure the second scaler Nemesa Garg
2025-04-02 12:56 [PATCH 00/10] Introduce drm sharpness property Nemesa Garg
2025-04-02 12:56 ` [PATCH 07/10] drm/i915/display: Configure the second scaler Nemesa Garg
2025-04-07 6:26 ` Nautiyal, Ankit K
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=20250724134544.284371-8-nemesa.garg@intel.com \
--to=nemesa.garg@intel.com \
--cc=ankit.k.nautiyal@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