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 5/5] drm/i915/display: Introduce skl_pipe_scaler_setup()
Date: Tue, 9 Dec 2025 11:55:27 +0530 [thread overview]
Message-ID: <20251209062527.620382-6-nemesa.garg@intel.com> (raw)
In-Reply-To: <20251209062527.620382-1-nemesa.garg@intel.com>
As skl_pfit_enable and skl_scaler_setup_casf
have similar logic for pipe scaler registers
so to avoid duplicacy introduce new helper
skl_pipe_scaler_setup. This helper consolidates
common scaler setup steps and is now called
from both skl_pfit_enable() and skl_scaler_setup_casf().
Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
---
drivers/gpu/drm/i915/display/skl_scaler.c | 72 ++++++++++-------------
drivers/gpu/drm/i915/display/skl_scaler.h | 2 +
2 files changed, 33 insertions(+), 41 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c
index 4c4deac7f9c8..703d13e6f1c7 100644
--- a/drivers/gpu/drm/i915/display/skl_scaler.c
+++ b/drivers/gpu/drm/i915/display/skl_scaler.c
@@ -761,41 +761,14 @@ static void skl_scaler_setup_filter(struct intel_display *display,
void skl_scaler_setup_casf(struct intel_crtc_state *crtc_state)
{
- struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
- struct intel_display *display = to_intel_display(crtc);
struct drm_display_mode *adjusted_mode =
- &crtc_state->hw.adjusted_mode;
- struct intel_crtc_scaler_state *scaler_state =
- &crtc_state->scaler_state;
- struct drm_rect src, dest;
- int id, width, height;
- int x = 0, y = 0;
- enum pipe pipe = crtc->pipe;
- u32 ps_ctrl;
+ &crtc_state->hw.adjusted_mode;
+ int width, height, x = 0, y = 0;
width = adjusted_mode->crtc_hdisplay;
height = adjusted_mode->crtc_vdisplay;
- drm_rect_init(&dest, x, y, width, height);
-
- width = drm_rect_width(&dest);
- height = drm_rect_height(&dest);
- id = scaler_state->scaler_id;
-
- drm_rect_init(&src, 0, 0,
- drm_rect_width(&crtc_state->pipe_src) << 16,
- drm_rect_height(&crtc_state->pipe_src) << 16);
-
- trace_intel_pipe_scaler_update_arm(crtc, id, x, y, width, height);
-
- ps_ctrl = PS_SCALER_EN | PS_BINDING_PIPE | scaler_state->scalers[id].mode |
- CASF_SCALER_FILTER_SELECT;
-
- intel_de_write_fw(display, SKL_PS_CTRL(pipe, id), ps_ctrl);
- intel_de_write_fw(display, SKL_PS_WIN_POS(pipe, id),
- PS_WIN_XPOS(x) | PS_WIN_YPOS(y));
- intel_de_write_fw(display, SKL_PS_WIN_SZ(pipe, id),
- PS_WIN_XSIZE(width) | PS_WIN_YSIZE(height));
+ skl_pipe_scaler_setup(crtc_state, width, height, x, y);
}
void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
@@ -805,16 +778,15 @@ void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
const struct intel_crtc_scaler_state *scaler_state =
&crtc_state->scaler_state;
const struct drm_rect *dst = &crtc_state->pch_pfit.dst;
+ struct drm_rect src;
u16 uv_rgb_hphase, uv_rgb_vphase;
- enum pipe pipe = crtc->pipe;
+ int hscale, vscale;
int width = drm_rect_width(dst);
int height = drm_rect_height(dst);
int x = dst->x1;
int y = dst->y1;
- int hscale, vscale;
- struct drm_rect src;
int id;
- u32 ps_ctrl;
+ enum pipe pipe = crtc->pipe;
if (!crtc_state->pch_pfit.enabled)
return;
@@ -836,10 +808,34 @@ void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
uv_rgb_hphase = skl_scaler_calc_phase(1, hscale, false);
uv_rgb_vphase = skl_scaler_calc_phase(1, vscale, false);
+ skl_pipe_scaler_setup(crtc_state, width, height, x, y);
+
+ id = scaler_state->scaler_id;
+
+ intel_de_write_fw(display, SKL_PS_VPHASE(pipe, id),
+ PS_Y_PHASE(0) | PS_UV_RGB_PHASE(uv_rgb_vphase));
+ intel_de_write_fw(display, SKL_PS_HPHASE(pipe, id),
+ PS_Y_PHASE(0) | PS_UV_RGB_PHASE(uv_rgb_hphase));
+ intel_de_write_fw(display, SKL_PS_WIN_SZ(pipe, id),
+ PS_WIN_XSIZE(width) | PS_WIN_YSIZE(height));
+}
+
+void skl_pipe_scaler_setup(const struct intel_crtc_state *crtc_state,
+ int width, int height, int x, int y)
+{
+ struct intel_display *display = to_intel_display(crtc_state);
+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+ const struct intel_crtc_scaler_state *scaler_state =
+ &crtc_state->scaler_state;
+ enum pipe pipe = crtc->pipe;
+ int id;
+ u32 ps_ctrl;
+
id = scaler_state->scaler_id;
ps_ctrl = PS_SCALER_EN | PS_BINDING_PIPE | scaler_state->scalers[id].mode |
- skl_scaler_get_filter_select(crtc_state->hw.scaling_filter);
+ skl_scaler_get_filter_select(crtc_state->hw.scaling_filter) |
+ CASF_SCALER_FILTER_SELECT;
trace_intel_pipe_scaler_update_arm(crtc, id, x, y, width, height);
@@ -848,14 +844,8 @@ void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
intel_de_write_fw(display, SKL_PS_CTRL(pipe, id), ps_ctrl);
- intel_de_write_fw(display, SKL_PS_VPHASE(pipe, id),
- PS_Y_PHASE(0) | PS_UV_RGB_PHASE(uv_rgb_vphase));
- intel_de_write_fw(display, SKL_PS_HPHASE(pipe, id),
- PS_Y_PHASE(0) | PS_UV_RGB_PHASE(uv_rgb_hphase));
intel_de_write_fw(display, SKL_PS_WIN_POS(pipe, id),
PS_WIN_XPOS(x) | PS_WIN_YPOS(y));
- intel_de_write_fw(display, SKL_PS_WIN_SZ(pipe, id),
- PS_WIN_XSIZE(width) | PS_WIN_YSIZE(height));
}
void
diff --git a/drivers/gpu/drm/i915/display/skl_scaler.h b/drivers/gpu/drm/i915/display/skl_scaler.h
index 7e8d819c019d..94bde5d1c06a 100644
--- a/drivers/gpu/drm/i915/display/skl_scaler.h
+++ b/drivers/gpu/drm/i915/display/skl_scaler.h
@@ -30,6 +30,8 @@ void skl_program_plane_scaler(struct intel_dsb *dsb,
struct intel_plane *plane,
const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state);
+void skl_pipe_scaler_setup(const struct intel_crtc_state *crtc_state,
+ int width, int height, int x, int y);
void skl_detach_scalers(struct intel_dsb *dsb,
const struct intel_crtc_state *crtc_state);
void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state);
--
2.25.1
next prev 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 ` [PATCH 4/5] drm/i915/display: Add intel_casf_arm() to enable casf Nemesa Garg
2025-12-09 6:25 ` Nemesa Garg [this message]
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-6-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