[RFC v2 4/6] drm/i915/scaler: Compute scling factors for pipe scaler
Nautiyal, Ankit K
ankit.k.nautiyal at intel.com
Mon Dec 23 09:52:09 UTC 2024
typo in subject : 'scaling'
On 12/17/2024 11:37 PM, Mitul Golani wrote:
> Compute scaling factors and scaler user for pipe scaler if
> perticular scaler user is pipe scaler.
typo: particular
>
> Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani at intel.com>
> ---
> drivers/gpu/drm/i915/display/skl_scaler.c | 37 ++++++++++++++++++++---
> 1 file changed, 33 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c
> index 1c65b53b45f0..1a4aba434d8c 100644
> --- a/drivers/gpu/drm/i915/display/skl_scaler.c
> +++ b/drivers/gpu/drm/i915/display/skl_scaler.c
> @@ -319,6 +319,7 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state,
> &crtc_state->scaler_state;
> struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> u32 mode;
> + int hscale, vscale, user;
>
> if (*scaler_id < 0)
> *scaler_id = intel_allocate_scaler(scaler_state, crtc);
> @@ -375,7 +376,7 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state,
> const struct drm_framebuffer *fb = plane_state->hw.fb;
> const struct drm_rect *src = &plane_state->uapi.src;
> const struct drm_rect *dst = &plane_state->uapi.dst;
> - int hscale, vscale, max_vscale, max_hscale;
> + int max_vscale, max_hscale;
>
> /*
> * FIXME: When two scalers are needed, but only one of
> @@ -426,11 +427,39 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state,
> return -EINVAL;
> }
>
> - scaler_state->scalers[*scaler_id].hscale = hscale;
> - scaler_state->scalers[*scaler_id].vscale = vscale;
> - scaler_state->scalers[*scaler_id].user = SKL_PLANE_SCALER;
> + user = SKL_PLANE_SCALER;
> }
>
> + if (crtc_state->pch_pfit.enabled) {
> + struct drm_rect src;
> + int hscale, vscale;
> +
> + drm_rect_init(&src, 0, 0,
> + drm_rect_width(&crtc_state->pipe_src) << 16,
> + drm_rect_height(&crtc_state->pipe_src) << 16);
> +
> + hscale = drm_rect_calc_hscale(&src, &crtc_state->pch_pfit.dst,
> + 0, INT_MAX);
> + vscale = drm_rect_calc_vscale(&src, &crtc_state->pch_pfit.dst,
> + 0, INT_MAX);
> +
> + if (hscale < 0 || vscale < 0) {
> + drm_dbg_kms(display->drm,
> + "Scaler %d doesn't support required plane scaling\n",
typo: pipe scaling.
There is a #FIXME to check scalar factors for pfit, so with this we can
remove that.
There are some considerations for joiner, there are patches for that in
review. [1]
[1] https://patchwork.freedesktop.org/series/136561/
Regards,
Ankit
> + *scaler_id);
> + drm_rect_debug_print("src: ", &src, true);
> + drm_rect_debug_print("dst: ", &crtc_state->pch_pfit.dst, false);
> +
> + return -EINVAL;
> + }
> +
> + user = SKL_PIPE_SCALER;
> + }
> +
> + scaler_state->scalers[*scaler_id].hscale = hscale;
> + scaler_state->scalers[*scaler_id].vscale = vscale;
> + scaler_state->scalers[*scaler_id].user = user;
> +
> drm_dbg_kms(display->drm, "Attached scaler id %u.%u to %s:%d\n",
> crtc->pipe, *scaler_id, name, idx);
> scaler_state->scalers[*scaler_id].mode = mode;
More information about the Intel-xe
mailing list