Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: Gustavo Sousa <gustavo.sousa@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/6] drm/i915/wm: convert tiling mode check in slk_compute_plane_wm() to a switch-case
Date: Mon, 08 Sep 2025 15:57:07 +0300	[thread overview]
Message-ID: <61c2893dd4fdfd0edeba85e8211451a16b18c1ca.camel@coelho.fi> (raw)
In-Reply-To: <175733591378.1838.12709876861986493189@intel.com>

On Mon, 2025-09-08 at 09:51 -0300, Gustavo Sousa wrote:
> Quoting Luca Coelho (2025-09-08 04:35:34-03:00)
> > Make the code a bit clearer by using a switch-case to check the tiling
> > mode in skl_compute_plane_wm(), because all the possible states and
> > the calculations they use are explicitly handled.
> > 
> > Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
> > ---
> > drivers/gpu/drm/i915/display/skl_watermark.c | 24 +++++++++++++++++---
> > 1 file changed, 21 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c
> > index dd4bed02c3c0..21f8d52ec1d2 100644
> > --- a/drivers/gpu/drm/i915/display/skl_watermark.c
> > +++ b/drivers/gpu/drm/i915/display/skl_watermark.c
> > @@ -1833,21 +1833,39 @@ static void skl_compute_plane_wm(const struct intel_crtc_state *crtc_state,
> >                                  latency,
> >                                  wp->plane_blocks_per_line);
> > 
> > -        if (wp->tiling == WM_TILING_Y_FAMILY) {
> > +        switch (wp->tiling) {
> > +        case WM_TILING_Y_FAMILY:
> >                 selected_result = max_fixed16(method2, wp->y_tile_minimum);
> > -        } else {
> > +                break;
> > +
> > +        case WM_TILING_LINEAR:
> > +        case WM_TILING_X_TILED:
> > +                /*
> > +                 * Special case for unrealistically small horizontal
> > +                 * total with plane downscaling.
> > +                 */
> >                 if ((wp->cpp * crtc_state->hw.pipe_mode.crtc_htotal /
> >                      wp->dbuf_block_size < 1) &&
> > -                     (wp->plane_bytes_per_line / wp->dbuf_block_size < 1)) {
> > +                    (wp->plane_bytes_per_line / wp->dbuf_block_size < 1)) {
> >                         selected_result = method2;
> >                 } else if (latency >= wp->linetime_us) {
> > +                        /*
> > +                         * With display version 9, we use the minimum
> > +                         * of both methods.
> > +                         */
> 
> Hm... Isn't this saying what is already clear in the code below?

Very true.  I had more text here, describing the method 1 case below
too, but after removing that, this became mostly irrelevant.  I'll
remove it.


> 
> >                         if (DISPLAY_VER(display) == 9)
> >                                 selected_result = min_fixed16(method1, method2);
> >                         else
> >                                 selected_result = method2;
> >                 } else {
> > +                        /* everything else with linear/X-tiled uses method 1 */
> >                         selected_result = method1;
> >                 }
> > +                break;
> > +
> > +        default:
> > +                drm_err(display->drm, "Invalid tiling mode\n", wp->tiling);
> > +                break;
> 
> If we decide to go with the enumeration solution, I think we should
> change this into a warning and use some default behavior here (perhaps
> WM_TILING_LINEAR?). Otherwise, selected_result would be used
> uninitialized.

Right, I moved this to a fallthrough in a later patch.

--
Cheers,
Luca.

  reply	other threads:[~2025-09-08 12:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08  7:35 [PATCH 0/6] drm/i915/wm: some clean-ups and a bit of refactoring Luca Coelho
2025-09-08  7:35 ` [PATCH 1/6] drm/i915/wm: clarify watermark ops with comments Luca Coelho
2025-09-16  8:52   ` Govindapillai, Vinod
2025-09-22 10:26     ` Luca Coelho
2025-09-08  7:35 ` [PATCH 2/6] drm/i915/wm: move intel_sagv_init() to avoid forward declaration Luca Coelho
2025-09-16  8:53   ` Govindapillai, Vinod
2025-09-08  7:35 ` [PATCH 3/6] drm/i915/wm: remove stale FIXME in skl_needs_memory_bw_wa() Luca Coelho
2025-09-16  9:21   ` Govindapillai, Vinod
2025-09-08  7:35 ` [PATCH 4/6] drm/i915/wm: convert x/y-tiling bools to an enum Luca Coelho
2025-09-08 12:43   ` Gustavo Sousa
2025-09-08 12:53     ` Luca Coelho
2025-09-19  8:36   ` Ville Syrjälä
2025-09-22 12:38     ` Luca Coelho
2025-09-22 12:48       ` Ville Syrjälä
2025-09-08  7:35 ` [PATCH 5/6] drm/i915/wm: convert tiling mode check in slk_compute_plane_wm() to a switch-case Luca Coelho
2025-09-08 12:51   ` Gustavo Sousa
2025-09-08 12:57     ` Luca Coelho [this message]
2025-09-08  7:35 ` [PATCH 6/6] drm/i915/wm: move method selection and calculation to a separate function Luca Coelho
2025-09-19 18:00   ` Ville Syrjälä
2025-09-29  7:21     ` Luca Coelho
2025-09-08 17:20 ` ✓ i915.CI.BAT: success for drm/i915/wm: some clean-ups and a bit of refactoring Patchwork
2025-09-09  2:47 ` ✗ i915.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=61c2893dd4fdfd0edeba85e8211451a16b18c1ca.camel@coelho.fi \
    --to=luca@coelho.fi \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=luciano.coelho@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox