Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Michał Grzelak" <michal.grzelak@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 14/15] drm/i915/pfit: Account for pfit downscaling in pixel rate on GMCH platforms
Date: Thu, 12 Nov 2026 14:42:03 +0200	[thread overview]
Message-ID: <avW0G8HNImWkdT_0@intel.com> (raw)
In-Reply-To: <shbezg62hmcqseiclkdfdgmcqef2x6dcqzg4xwh6lorkshydkq@2ihuuarp5vj7>

On Thu, Nov 12, 2026 at 10:47:47AM +0100, Michał Grzelak wrote:
> On Mon, Oct 19, 2026 at 04:53:08PM GMT, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Now that we have crtc_state->pch.dst populated on GMCH platforms
> > we can use the existing ILK+ code to calculate the downscale
> > adjusted pixel rate correctly on GMCH platforms.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c | 23 +++++++-------------
> >  1 file changed, 8 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index 200426bf0c59..6b813efff955 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -2278,7 +2278,8 @@ static bool intel_crtc_supports_double_wide(const struct intel_crtc *crtc)
> >  		(crtc->pipe == PIPE_A || display->platform.i915g);
> >  }
> >  
> > -static u32 ilk_pipe_pixel_rate(const struct intel_crtc_state *crtc_state)
> > +static unsigned int
> 
> Is there any consensus on when to use u32 and when unsigned int? I see
> that here it is because of pixel_rate_cdclk being defined as unsigned
> int, but asking for general guidance.

My general rules are roughly this:
1. Just plain old 'int' for most things
2. Use 'unsigned int' for some address/offset calculations and whatnot
   where negative values are never a thing
3. u32 for hardware registers and so forth

The pixel rate stuff should perhaps just all be 'int', but that
would probably need to double check a few things before doing that.

The one slight annoyance with signed ints is that stupid static
analyzers may start to nag you about unchecked negative values
even if they're not actually possible.

But a signed int is almost always the safer option in case you end
up using it in some arithmetic expression where negative results are
a possibility. Even a single 'unsigned int' there will probably 
convert the whole expression to unsigned due to C rules on integer
promotion/conversion, and then you negative result will become a
really large positive result.

> 
> Since that's a side question:
> 
> Reviewed-by: Michał Grzelak <michal.grzelak@linux.intel.com>
> 
> BR,
> Michał
> 
> > +intel_pipe_pixel_rate(const struct intel_crtc_state *crtc_state)
> >  {
> >  	u32 pixel_rate = crtc_state->hw.pipe_mode.crtc_clock;
> >  	struct drm_rect src;
> > @@ -2299,7 +2300,8 @@ static u32 ilk_pipe_pixel_rate(const struct intel_crtc_state *crtc_state)
> >  				   pixel_rate);
> >  }
> >  
> > -static u32 ilk_pipe_pixel_rate_cdclk(const struct intel_crtc_state *crtc_state)
> > +static unsigned int
> > +intel_pipe_pixel_rate_cdclk(const struct intel_crtc_state *crtc_state)
> >  {
> >  	struct intel_display *display = to_intel_display(crtc_state);
> >  	u32 pixel_rate = crtc_state->hw.pipe_mode.crtc_clock;
> > @@ -2345,19 +2347,10 @@ static void intel_mode_from_crtc_timings(struct drm_display_mode *mode,
> >  
> >  static void intel_crtc_compute_pixel_rate(struct intel_crtc_state *crtc_state)
> >  {
> > -	struct intel_display *display = to_intel_display(crtc_state);
> > -
> > -	if (HAS_GMCH(display)) {
> > -		/* FIXME calculate proper pipe pixel rate for GMCH pfit */
> > -		crtc_state->pixel_rate =
> > -			crtc_state->hw.pipe_mode.crtc_clock;
> > -		crtc_state->pixel_rate_cdclk = crtc_state->pixel_rate;
> > -	} else {
> > -		crtc_state->pixel_rate =
> > -			ilk_pipe_pixel_rate(crtc_state);
> > -		crtc_state->pixel_rate_cdclk =
> > -			ilk_pipe_pixel_rate_cdclk(crtc_state);
> > -	}
> > +	crtc_state->pixel_rate =
> > +		intel_pipe_pixel_rate(crtc_state);
> > +	crtc_state->pixel_rate_cdclk =
> > +		intel_pipe_pixel_rate_cdclk(crtc_state);
> >  }
> >  
> >  static void intel_joiner_adjust_timings(const struct intel_crtc_state *crtc_state,
> > -- 
> > 2.55.0
> > 
> > 

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-11-12 12:42 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 13:52 [PATCH 00/15] drm/i915/pfit: Make GMCH panel fitter nicer Ville Syrjala
2026-10-19 13:52 ` [PATCH 01/15] drm/i915/pfit: s/pch_pfit/pfit/ Ville Syrjala
2026-10-19 15:48   ` Jani Nikula
2026-10-19 13:52 ` [PATCH 02/15] drm/i915/pfit: s/intel_pch_pfit/ilk_pfit/ Ville Syrjala
2026-10-19 15:49   ` Jani Nikula
2026-10-19 13:52 ` [PATCH 03/15] drm/i915/pfit: Stop using HAS_PCH_SPLIT() in confusing places Ville Syrjala
2026-10-19 15:49   ` Jani Nikula
2026-10-19 13:52 ` [PATCH 04/15] drm/i915/pfit: Introduce intel_pfit_get_config() Ville Syrjala
2026-10-19 15:53   ` Jani Nikula
2026-10-19 13:52 ` [PATCH 05/15] drm/i915/pfit: Rename some pfit functions Ville Syrjala
2026-10-19 15:54   ` Jani Nikula
2026-10-19 13:53 ` [PATCH 06/15] drm/i915/pfit: Extract i965_pfit_get_config() Ville Syrjala
2026-10-19 16:02   ` Jani Nikula
2026-10-19 16:05     ` Jani Nikula
2026-10-19 17:04       ` Ville Syrjälä
2026-10-20 18:38   ` [PATCH v2 " Ville Syrjala
2026-11-12  9:57     ` Michał Grzelak
2026-11-12 12:50       ` Ville Syrjälä
2026-10-19 13:53 ` [PATCH 07/15] drm/i915/pfit: Drop platform check for gmch_pfit.pgm_ratios Ville Syrjala
2026-10-19 16:05   ` Jani Nikula
2026-10-19 13:53 ` [PATCH 08/15] drm/i915/pfit: Unconfuse panel_fitter_scaling() Ville Syrjala
2026-10-19 16:15   ` Jani Nikula
2026-10-19 13:53 ` [PATCH 09/15] drm/i915/pfit: Populate crtc_state->pfit.dst on GMCH platforms Ville Syrjala
2026-10-19 14:23   ` sashiko-bot
2026-10-20 18:40   ` [PATCH v2 " Ville Syrjala
2026-11-12  9:25     ` Michał Grzelak
2026-10-19 13:53 ` [PATCH 10/15] drm/i915/pfit: Check scaling factor on GMCH Ville Syrjala
2026-11-12  9:27   ` Michał Grzelak
2026-10-19 13:53 ` [PATCH 11/15] drm/i915/pfit: Check panel fitter source size " Ville Syrjala
2026-11-12  9:29   ` Michał Grzelak
2026-10-19 13:53 ` [PATCH 12/15] drm/i915/pfit: Extract i9xx_pfit_vscale_ratio() and i9xx_pfit_is_one_line_mode() Ville Syrjala
2026-11-12  9:30   ` Michał Grzelak
2026-10-19 13:53 ` [PATCH 13/15] drm/i915/pfit: No pfit one line mode on i965+ Ville Syrjala
2026-11-12  9:32   ` Michał Grzelak
2026-10-19 13:53 ` [PATCH 14/15] drm/i915/pfit: Account for pfit downscaling in pixel rate on GMCH platforms Ville Syrjala
2026-11-12  9:47   ` Michał Grzelak
2026-11-12 12:42     ` Ville Syrjälä [this message]
2026-10-19 13:53 ` [PATCH 15/15] drm/i915/pfit: Allow downscaling on i966+ Ville Syrjala
2026-10-19 14:47   ` sashiko-bot
2026-10-20 18:31     ` Ville Syrjälä
2026-10-20 18:41   ` [PATCH v2 " Ville Syrjala
2026-11-12  9:48     ` Michał Grzelak
2026-10-19 14:01 ` ✗ CI.checkpatch: warning for drm/i915/pfit: Make GMCH panel fitter nicer Patchwork
2026-10-19 14:04 ` ✓ CI.KUnit: success " Patchwork
2026-10-19 14:45 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-19 17:03 ` ✓ Xe.CI.FULL: " Patchwork
2026-10-20 19:03 ` ✗ CI.checkpatch: warning for drm/i915/pfit: Make GMCH panel fitter nicer (rev4) Patchwork
2026-10-20 19:05 ` ✓ CI.KUnit: success " Patchwork
2026-10-20 19:43 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-21  0:52 ` ✗ 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=avW0G8HNImWkdT_0@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.grzelak@linux.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