> -----Original Message----- > From: Grzelak, Michal <[email protected]> > Sent: Wednesday, June 10, 2026 4:42 AM > To: [email protected]; [email protected] > Cc: Grzelak, Michal <[email protected]>; Garg, Nemesa > <[email protected]>; Ville Syrjälä <[email protected]> > Subject: [PATCH v1 9/9] drm/i915/scaler: move CASF alloc check into > setup_crtc_scaler() > > Move CASF allocation check to the caller of intel_atomic_setup_scaler(). > Add intel_display to make the check work. Remove casf_scaler from > intel_atomic_setup_scaler()'s argument list since it is no longer used. > > Do not add the check into setup_plane_scaler() as it calls > intel_atomic_setup_scaler() with casf_scaler set to false. > > Cc: Nemesa Garg <[email protected]> > Cc: Ville Syrjälä <[email protected]> > Signed-off-by: Michał Grzelak <[email protected]> > --- > drivers/gpu/drm/i915/display/skl_scaler.c | 32 +++++++++++------------ > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c > b/drivers/gpu/drm/i915/display/skl_scaler.c > index b40c9e500bbc..da9c7ef8610d 100644 > --- a/drivers/gpu/drm/i915/display/skl_scaler.c > +++ b/drivers/gpu/drm/i915/display/skl_scaler.c > @@ -389,7 +389,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, bool casf_scaler) > + int *scaler_id) > { > struct intel_display *display = to_intel_display(crtc); > struct intel_crtc_scaler_state *scaler_state = &crtc_state- > >scaler_state; @@ -397,17 +397,8 @@ static int > intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state, > int hscale = 0; > int vscale = 0; > > - if (*scaler_id < 0) { > - if (casf_scaler) { > - if (HAS_CASF(display) && crtc->num_scalers >= 2 && > - !scaler_state->scalers[1].in_use) { > - scaler_state->scalers[1].in_use = true; > - *scaler_id = 1; > - } > - } else { > - *scaler_id = intel_allocate_scaler(scaler_state, crtc); > - } > - } > + if (*scaler_id < 0) > + *scaler_id = intel_allocate_scaler(scaler_state, crtc); > > if (drm_WARN(display->drm, *scaler_id < 0, > "Cannot find scaler for %s:%d\n", name, idx)) @@ -534,16 > +525,26 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state > *crtc_state, static int setup_crtc_scaler(struct intel_atomic_state *state, > struct intel_crtc *crtc) > { > + struct intel_display *display = to_intel_display(state); > struct intel_crtc_state *crtc_state = > intel_atomic_get_new_crtc_state(state, crtc); > struct intel_crtc_scaler_state *scaler_state = > &crtc_state->scaler_state; > > + if (scaler_state->scaler_id < 0) { > + if (crtc_state->pch_pfit.casf.enable) { > + if (HAS_CASF(display) && crtc->num_scalers >= 2 && > + !scaler_state->scalers[1].in_use) { > + scaler_state->scalers[1].in_use = true; > + scaler_state->scaler_id = 1; > + } > + } > + } > + > return intel_atomic_setup_scaler(crtc_state, > hweight32(scaler_state- > >scaler_users), > crtc, "CRTC", crtc->base.base.id, > - NULL, &scaler_state->scaler_id, > - crtc_state->pch_pfit.casf.enable); > + NULL, &scaler_state->scaler_id); > } > > static int setup_plane_scaler(struct intel_atomic_state *state, @@ -578,8 > +579,7 @@ 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, > - false); > + plane_state, &plane_state- > >scaler_id); > } > Hi Michal,
The rational behind adding CASF in allocate_scaler() was to have all scaler related stuff together. As CASF also needs scaler and before allocating we need to check its availability, so not sure whether we should move it outside of allocation function or keep as it is. Thanks and Regards, Nemesa > /** > -- > 2.45.2
