From: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: ankit.k.nautiyal@intel.com
Subject: [RFC v2 4/6] drm/i915/scaler: Compute scling factors for pipe scaler
Date: Tue, 17 Dec 2024 23:37:08 +0530 [thread overview]
Message-ID: <20241217180710.1048355-5-mitulkumar.ajitkumar.golani@intel.com> (raw)
In-Reply-To: <20241217180710.1048355-1-mitulkumar.ajitkumar.golani@intel.com>
Compute scaling factors and scaler user for pipe scaler if
perticular scaler user is pipe scaler.
Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani@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",
+ *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;
--
2.46.0
next prev parent reply other threads:[~2024-12-17 18:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 18:07 [RFC v2 0/6] Check if is vblank too short Mitul Golani
2024-12-17 18:07 ` [RFC v2 1/6] drm/i915/scaler: Add and compute scaling factors Mitul Golani
2024-12-23 8:28 ` Nautiyal, Ankit K
2025-01-06 16:59 ` Golani, Mitulkumar Ajitkumar
2024-12-17 18:07 ` [RFC v2 2/6] drm/i915/scaler: Add member to track scaler user Mitul Golani
2024-12-23 8:29 ` Nautiyal, Ankit K
2024-12-17 18:07 ` [RFC v2 3/6] drm/i915/scaler: Use crtc_state to setup plane or pipe scaler Mitul Golani
2024-12-23 9:09 ` Nautiyal, Ankit K
2024-12-17 18:07 ` Mitul Golani [this message]
2024-12-23 9:52 ` [RFC v2 4/6] drm/i915/scaler: Compute scling factors for " Nautiyal, Ankit K
2024-12-17 18:07 ` [RFC v2 5/6] drm/i915/scaler: Check if vblank is sufficient for scaler Mitul Golani
2024-12-23 9:59 ` Nautiyal, Ankit K
2024-12-30 14:17 ` Jani Nikula
2024-12-17 18:07 ` [RFC v2 6/6] drm/i915/dsc: Check if dsc prefill sufficient for vblank Mitul Golani
2024-12-23 10:05 ` Nautiyal, Ankit K
2024-12-18 9:07 ` ✗ Fi.CI.SPARSE: warning for Check if is vblank too short Patchwork
2024-12-18 9:19 ` ✗ i915.CI.BAT: 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=20241217180710.1048355-5-mitulkumar.ajitkumar.golani@intel.com \
--to=mitulkumar.ajitkumar.golani@intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
/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