[PATCH v1 07/10] drm/i915/casf: unloop scaler readout that is run once

Michał Grzelak
2026-03-28T14:33:24Z

Most of the loop's code is run once because of the continue statement at
it's start and break statement at it's end. Kick it out of the loop.

Cc: Nemesa Garg <nemesa.garg@intel.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
---
drivers/gpu/drm/i915/display/skl_scaler.c | 36 ++++++++++++-----------
1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c
index 5954f5beb19c..802130df6561 100644
--- a/drivers/gpu/drm/i915/display/skl_scaler.c
+++ b/drivers/gpu/drm/i915/display/skl_scaler.c
@@ -970,35 +970,37 @@ void skl_scaler_get_config(struct intel_crtc_state *crtc_state)
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct intel_crtc_scaler_state *scaler_state = &crtc_state->scaler_state;
int scaler_id;
+ u32 pos, size;

/* find scaler attached to this pipe */
for (scaler_id = 0; scaler_id < crtc->num_scalers; scaler_id++) {
- u32 ctl, pos, size;
+ u32 ctl;

ctl = intel_de_read(display, SKL_PS_CTRL(crtc->pipe, scaler_id));
if ((ctl & (PS_SCALER_EN | PS_BINDING_MASK)) != (PS_SCALER_EN | PS_BINDING_PIPE))
continue;

- /* Read CASF regs for second scaler */
- if (HAS_CASF(display) && scaler_id == 1)
- intel_casf_sharpness_get_config(crtc_state);
+ break;
+ }

- if (!crtc_state->hw.casf_params.casf_enable)
- crtc_state->pch_pfit.enabled = true;
+ /* Read CASF regs for second scaler */
+ if (HAS_CASF(display) && scaler_id == 1)
+ intel_casf_sharpness_get_config(crtc_state);

- pos = intel_de_read(display, SKL_PS_WIN_POS(crtc->pipe, scaler_id));
- size = intel_de_read(display, SKL_PS_WIN_SZ(crtc->pipe, scaler_id));
+ if (!crtc_state->hw.casf_params.casf_enable)
+ crtc_state->pch_pfit.enabled = true;

- 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));
+ pos = intel_de_read(display, SKL_PS_WIN_POS(crtc->pipe, scaler_id));
+ size = intel_de_read(display, SKL_PS_WIN_SZ(crtc->pipe, scaler_id));

- scaler_state->scalers[scaler_id].in_use = true;
- break;
- }
+ 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[scaler_id].in_use = true;

scaler_state->scaler_id = scaler_id;
if (scaler_id >= 0)
--
2.45.2