mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
drm/i915/scaler: abstract scaler searching loop
Add a helper function hiding the search for scaler_id. Changelog: v2->v3 - keep ctl inside the loop (Ville) - separate impure function call from variable declaration block (Ville) 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> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260509164048.627399-9-michal.grzelak@intel.com
This commit is contained in:
parent
fadb1ef10d
commit
e2255e9a5a
|
|
@ -836,6 +836,22 @@ void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
|
|||
PS_WIN_XSIZE(width) | PS_WIN_YSIZE(height));
|
||||
}
|
||||
|
||||
static int skl_pipe_scaler_get_hw_state(struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct intel_display *display = to_intel_display(crtc_state);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
|
||||
|
||||
for (int scaler_id = 0; scaler_id < crtc->num_scalers; scaler_id++) {
|
||||
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))
|
||||
return scaler_id;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
skl_program_plane_scaler(struct intel_dsb *dsb,
|
||||
struct intel_plane *plane,
|
||||
|
|
@ -954,15 +970,8 @@ void skl_scaler_get_config(struct intel_crtc_state *crtc_state)
|
|||
u32 pos, size;
|
||||
|
||||
/* find scaler attached to this pipe */
|
||||
for (scaler_id = 0; scaler_id < crtc->num_scalers; scaler_id++) {
|
||||
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))
|
||||
break;
|
||||
}
|
||||
|
||||
if (scaler_id == crtc->num_scalers)
|
||||
scaler_id = skl_pipe_scaler_get_hw_state(crtc_state);
|
||||
if (scaler_id < 0)
|
||||
return;
|
||||
|
||||
if (scaler_has_casf(display, scaler_id))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user