From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Shankar, Uma" <uma.shankar@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: Re: [RFC][PATCH 06/11] drm/i195/wm: Add WM0 prefill helpers
Date: Tue, 14 Oct 2025 00:49:54 +0300 [thread overview]
Message-ID: <aO10AiKxoC-uKzg0@intel.com> (raw)
In-Reply-To: <DM4PR11MB6360E7A89CAF8C2E64384053F4EAA@DM4PR11MB6360.namprd11.prod.outlook.com>
On Mon, Oct 13, 2025 at 06:30:20PM +0000, Shankar, Uma wrote:
>
>
> > -----Original Message-----
> > From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Ville
> > Syrjala
> > Sent: Wednesday, October 8, 2025 11:56 PM
> > To: intel-gfx@lists.freedesktop.org
> > Cc: intel-xe@lists.freedesktop.org
> > Subject: [RFC][PATCH 06/11] drm/i195/wm: Add WM0 prefill helpers
> >
>
> Nit: Typo in i915
>
> Overall looks good to me. More refinement can be done later for the FIXME's
> and Todo's
Actually I think I can just drop a bunch of it since this will only
get used for the VRR guardband calculation, so we definitely don't
have to worry about any pre-icl stuff here. I'll probably throw in
a WARN(!HAS_VRR)+comment as a reminder.
> Reviewed-by: Uma Shankar <uma.shankar@intel.com>
>
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Add skl_wm0_prefill_lines() (based on the actual state) and
> > skl_wm0_prefill_lines_worst() (worst case estimate) which tell us how many extra
> > lines are needed in prefill for WM0.
> >
> > The returned numbers are in .16 binary fixed point.
> >
> > TODO: skl_wm0_prefill_lines_worst() is a bit rough still
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > drivers/gpu/drm/i915/display/skl_scaler.c | 32 ++++++++++-
> > drivers/gpu/drm/i915/display/skl_scaler.h | 4 ++
> > drivers/gpu/drm/i915/display/skl_watermark.c | 59 ++++++++++++++++++++
> > drivers/gpu/drm/i915/display/skl_watermark.h | 3 +
> > 4 files changed, 97 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c
> > b/drivers/gpu/drm/i915/display/skl_scaler.c
> > index 6e90639494ca..783fee985e84 100644
> > --- a/drivers/gpu/drm/i915/display/skl_scaler.c
> > +++ b/drivers/gpu/drm/i915/display/skl_scaler.c
> > @@ -1089,7 +1089,37 @@ static unsigned int _skl_scaler_max_scale(const
> > struct intel_crtc_state *crtc_st
> > crtc_state-
> > >hw.pipe_mode.crtc_clock));
> > }
> >
> > -static unsigned int skl_scaler_max_scale(const struct intel_crtc_state
> > *crtc_state)
> > +unsigned int skl_scaler_max_total_scale(const struct intel_crtc_state
> > +*crtc_state) {
> > + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> > + unsigned int max_scale;
> > +
> > + if (crtc->num_scalers < 1)
> > + return 0x10000;
> > +
> > + /* FIXME find out the max downscale factors properly */
> > + max_scale = 9 << 16;
> > + if (crtc->num_scalers > 1)
> > + max_scale *= 9;
> > +
> > + return _skl_scaler_max_scale(crtc_state, max_scale); }
> > +
> > +unsigned int skl_scaler_max_hscale(const struct intel_crtc_state
> > +*crtc_state) {
> > + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> > + unsigned int max_scale;
> > +
> > + if (crtc->num_scalers < 1)
> > + return 0x10000;
> > +
> > + /* FIXME find out the max downscale factors properly */
> > + max_scale = 3 << 16;
> > +
> > + return _skl_scaler_max_scale(crtc_state, max_scale); }
> > +
> > +unsigned int skl_scaler_max_scale(const struct intel_crtc_state
> > +*crtc_state)
> > {
> > struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> > unsigned int max_scale;
> > diff --git a/drivers/gpu/drm/i915/display/skl_scaler.h
> > b/drivers/gpu/drm/i915/display/skl_scaler.h
> > index 6fab40d2b4ee..5deabca909e6 100644
> > --- a/drivers/gpu/drm/i915/display/skl_scaler.h
> > +++ b/drivers/gpu/drm/i915/display/skl_scaler.h
> > @@ -46,6 +46,10 @@ void adl_scaler_ecc_mask(const struct intel_crtc_state
> > *crtc_state);
> >
> > void adl_scaler_ecc_unmask(const struct intel_crtc_state *crtc_state);
> >
> > +unsigned int skl_scaler_max_total_scale(const struct intel_crtc_state
> > +*crtc_state); unsigned int skl_scaler_max_scale(const struct
> > +intel_crtc_state *crtc_state); unsigned int skl_scaler_max_hscale(const
> > +struct intel_crtc_state *crtc_state);
> > +
> > unsigned int skl_scaler_1st_prefill_adjustment_worst(const struct intel_crtc_state
> > *crtc_state); unsigned int skl_scaler_2nd_prefill_adjustment_worst(const struct
> > intel_crtc_state *crtc_state); unsigned int
> > skl_scaler_1st_prefill_lines_worst(const struct intel_crtc_state *crtc_state); diff --
> > git a/drivers/gpu/drm/i915/display/skl_watermark.c
> > b/drivers/gpu/drm/i915/display/skl_watermark.c
> > index 9df9ee137bf9..aac3ca8f6c0f 100644
> > --- a/drivers/gpu/drm/i915/display/skl_watermark.c
> > +++ b/drivers/gpu/drm/i915/display/skl_watermark.c
> > @@ -29,6 +29,7 @@
> > #include "intel_pcode.h"
> > #include "intel_plane.h"
> > #include "intel_wm.h"
> > +#include "skl_scaler.h"
> > #include "skl_universal_plane_regs.h"
> > #include "skl_watermark.h"
> > #include "skl_watermark_regs.h"
> > @@ -2244,6 +2245,59 @@ skl_is_vblank_too_short(const struct intel_crtc_state
> > *crtc_state,
> > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vblank_start;
> > }
> >
> > +unsigned int skl_wm0_prefill_lines_worst(const struct intel_crtc_state
> > +*crtc_state) {
> > + struct intel_display *display = to_intel_display(crtc_state);
> > + struct intel_plane *plane = to_intel_plane(crtc_state->uapi.crtc->primary);
> > + const struct drm_display_mode *pipe_mode = &crtc_state-
> > >hw.pipe_mode;
> > + int ret, pixel_rate, width, level = 0;
> > + struct skl_wm_level wm = {};
> > + struct skl_wm_params wp;
> > + unsigned int latency;
> > + u64 modifier;
> > +
> > + /*
> > + * FIXME rather ugly to pick this by hand but maybe no other way?
> > + * FIXME older hw doesn't support 16bpc+scaling so we should figure
> > + * out a more realistic modifier+scaling combo on those...
> > + */
> > + if (DISPLAY_VER(display) == 9)
> > + modifier = I915_FORMAT_MOD_Y_TILED_CCS;
> > + else if (HAS_4TILE(display))
> > + modifier = I915_FORMAT_MOD_4_TILED;
> > + else
> > + modifier = I915_FORMAT_MOD_Y_TILED;
> > +
> > + pixel_rate =
> > DIV_ROUND_UP_ULL(mul_u32_u32(skl_scaler_max_total_scale(crtc_state),
> > + pipe_mode->crtc_clock),
> > + 0x10000);
> > +
> > + /* FIXME limit to max plane width? */
> > + width =
> > DIV_ROUND_UP_ULL(mul_u32_u32(skl_scaler_max_hscale(crtc_state),
> > + pipe_mode->crtc_hdisplay),
> > + 0x10000);
> > +
> > + /* FIXME is 90/270 rotation worse than 0/180? */
> > + ret = skl_compute_wm_params(crtc_state, width,
> > +
> > drm_format_info(DRM_FORMAT_XBGR16161616F),
> > + modifier, DRM_MODE_ROTATE_0,
> > + pixel_rate, &wp, 0, 1);
> > + drm_WARN_ON(display->drm, ret);
> > +
> > + latency = skl_wm_latency(display, level, &wp);
> > +
> > + skl_compute_plane_wm(crtc_state, plane, level, latency, &wp, &wm,
> > +&wm);
> > +
> > + /*
> > + * FIXME Is this sane? Older hw doesn't even have wm.lines for WM0 so
> > + * those will never hit this and just return the computed wm.lines.
> > + */
> > + if (wm.min_ddb_alloc == U16_MAX)
> > + wm.lines = skl_wm_max_lines(display);
> > +
> > + return wm.lines << 16;
> > +}
> > +
> > static int skl_max_wm0_lines(const struct intel_crtc_state *crtc_state) {
> > struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> > @@ -2260,6 +2314,11 @@ static int skl_max_wm0_lines(const struct
> > intel_crtc_state *crtc_state)
> > return wm0_lines;
> > }
> >
> > +unsigned int skl_wm0_prefill_lines(const struct intel_crtc_state
> > +*crtc_state) {
> > + return skl_max_wm0_lines(crtc_state) << 16; }
> > +
> > /*
> > * TODO: In case we use PKG_C_LATENCY to allow C-states when the delayed
> > vblank
> > * size is too small for the package C exit latency we need to notify PSR about
> > diff --git a/drivers/gpu/drm/i915/display/skl_watermark.h
> > b/drivers/gpu/drm/i915/display/skl_watermark.h
> > index 62790816f030..6bc2ec9164bf 100644
> > --- a/drivers/gpu/drm/i915/display/skl_watermark.h
> > +++ b/drivers/gpu/drm/i915/display/skl_watermark.h
> > @@ -79,5 +79,8 @@ void intel_program_dpkgc_latency(struct intel_atomic_state
> > *state);
> >
> > bool intel_dbuf_pmdemand_needs_update(struct intel_atomic_state *state);
> >
> > +unsigned int skl_wm0_prefill_lines_worst(const struct intel_crtc_state
> > +*crtc_state); unsigned int skl_wm0_prefill_lines(const struct
> > +intel_crtc_state *crtc_state);
> > +
> > #endif /* __SKL_WATERMARK_H__ */
> >
> > --
> > 2.49.1
>
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2025-10-13 21:50 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-08 18:25 [RFC][PATCH 00/11] drm/i915/prefill: Introduce helpers for prefill latency calculations Ville Syrjala
2025-10-08 18:25 ` [RFC][PATCH 01/11] drm/i915: Reject modes with linetime > 64 usec Ville Syrjala
2025-10-13 15:15 ` Shankar, Uma
2025-10-08 18:25 ` [RFC][PATCH 02/11] drm/i915/cdclk: Add prefill helpers for CDCLK Ville Syrjala
2025-10-13 16:11 ` Shankar, Uma
2025-10-08 18:25 ` [RFC][PATCH 03/11] drm/i915/cdclk: Add intel_cdclk_min_cdclk_for_prefill() Ville Syrjala
2025-10-13 16:25 ` Shankar, Uma
2025-10-08 18:25 ` [RFC][PATCH 04/11] drm/i915/dsc: Add prefill helper for DSC Ville Syrjala
2025-10-13 16:26 ` Shankar, Uma
2025-10-08 18:25 ` [RFC][PATCH 05/11] drm/i915/scaler: Add scaler prefill helpers Ville Syrjala
2025-10-13 17:56 ` Shankar, Uma
2025-10-08 18:25 ` [RFC][PATCH 06/11] drm/i195/wm: Add WM0 " Ville Syrjala
2025-10-13 18:30 ` Shankar, Uma
2025-10-13 21:49 ` Ville Syrjälä [this message]
2025-10-08 18:25 ` [RFC][PATCH 07/11] drm/i915: Introduce intel_compute_global_watermarks_late() Ville Syrjala
2025-10-13 18:36 ` Shankar, Uma
2025-10-13 20:35 ` Ville Syrjälä
2025-10-08 18:25 ` [RFC][PATCH 08/11] drm/i915/prefill: Introduce intel_prefill.c Ville Syrjala
2025-10-13 18:42 ` Shankar, Uma
2025-10-13 21:37 ` Ville Syrjälä
2025-10-08 18:25 ` [RFC][PATCH 09/11] drm/i915/wm: Use intel_prefill Ville Syrjala
2025-10-13 18:43 ` Shankar, Uma
2025-10-08 18:25 ` [RFC][PATCH 10/11] drm/i915/prefill: Print the prefill details Ville Syrjala
2025-10-13 18:45 ` Shankar, Uma
2025-10-08 18:25 ` [RFC][PATCH 11/11] drm/i915/prefill: Also print out the worst case estimates Ville Syrjala
2025-10-13 18:47 ` Shankar, Uma
2025-10-08 19:10 ` ✗ CI.checkpatch: warning for drm/i915/prefill: Introduce helpers for prefill latency calculations Patchwork
2025-10-08 19:11 ` ✓ CI.KUnit: success " Patchwork
2025-10-08 19:26 ` ✗ CI.checksparse: warning " Patchwork
2025-10-08 19:58 ` ✓ Xe.CI.BAT: success " Patchwork
2025-10-08 23:13 ` ✗ Xe.CI.Full: 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=aO10AiKxoC-uKzg0@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=uma.shankar@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.