public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 08/12] drm/i915: Allow calling intel_adjust_tile_offset() multiple times
Date: Wed, 10 Aug 2016 14:17:00 +0300	[thread overview]
Message-ID: <20160810111700.GL4329@intel.com> (raw)
In-Reply-To: <20160810094856.GU6232@phenom.ffwll.local>

On Wed, Aug 10, 2016 at 11:48:56AM +0200, Daniel Vetter wrote:
> On Wed, Aug 10, 2016 at 12:23:17PM +0300, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Minimize the resulting X coordinate after intel_adjust_tile_offset() is
> > done with it's offset adjustment. This allows calling
> > intel_adjust_tile_offset() multiple times in case we need to adjust
> > the offset several times.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Do we check anywhere that y doesn't eventually overflow? Anyway, this
> looks good.

Hmm. I was thinking it's limited by the fb size, but only the plane src
coordinate part is limited like that. The part coming from fb->offsets[]
is extra, so I guess the total might end up too big even for 32 bits.
And the hardware for sure has even lower number of bits available for
the x/y offsets, so we should definitely add some extra checks for
this.

I have a feeling I had some checks like this at some point, but either I
imagined it, or I mistakenly threw them out, or they're in some random
branch I've misplaced.

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index f4b45625703e..40c809593ae9 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -2330,6 +2330,7 @@ static u32 intel_adjust_tile_offset(int *x, int *y,
> >  				    u32 old_offset,
> >  				    u32 new_offset)
> >  {
> > +	unsigned int pitch_pixels = pitch_tiles * tile_width;
> >  	unsigned int tiles;
> >  
> >  	WARN_ON(old_offset & (tile_size - 1));
> > @@ -2341,6 +2342,10 @@ static u32 intel_adjust_tile_offset(int *x, int *y,
> >  	*y += tiles / pitch_tiles * tile_height;
> >  	*x += tiles % pitch_tiles * tile_width;
> >  
> > +	/* minimize x in case it got needlessly big */
> > +	*y += *x / pitch_pixels * tile_height;
> > +	*x %= pitch_pixels;
> > +
> >  	return new_offset;
> >  }
> >  
> > -- 
> > 2.7.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-08-10 11:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10  9:23 [PATCH v5 00/12] drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v5) ville.syrjala
2016-08-10  9:23 ` [PATCH v6 01/12] drm/i915: Rewrite fb rotation GTT handling ville.syrjala
2016-08-10  9:49   ` Daniel Vetter
2016-08-10  9:23 ` [PATCH v3 02/12] drm/i915: Don't pass pitch to intel_compute_page_offset() ville.syrjala
2016-08-10  9:23 ` [PATCH v2 03/12] drm/i915: Move SKL hw stride calculation into a helper ville.syrjala
2016-08-10  9:23 ` [PATCH 04/12] drm/i915: Pass around plane_state instead of fb+rotation ville.syrjala
2016-08-10  9:23 ` [PATCH v4 05/12] drm/i915: Use fb modifiers for display tiling decisions ville.syrjala
2016-08-10  9:23 ` [PATCH v3 06/12] drm/i915: Adjust obj tiling vs. fb modifier rules ville.syrjala
2016-08-10  9:43   ` Daniel Vetter
2016-08-10  9:23 ` [PATCH v2 07/12] drm/i915: Limit fb x offset due to fences ville.syrjala
2016-08-10  9:23 ` [PATCH 08/12] drm/i915: Allow calling intel_adjust_tile_offset() multiple times ville.syrjala
2016-08-10  9:46   ` Chris Wilson
2016-08-10  9:48   ` Daniel Vetter
2016-08-10 11:17     ` Ville Syrjälä [this message]
2016-08-10  9:23 ` [PATCH 09/12] drm/i915: Make intel_adjust_tile_offset() work for linear buffers ville.syrjala
2016-08-10  9:23 ` [PATCH v2 10/12] drm/i915: Compute display surface offset in the plane check hook for SKL+ ville.syrjala
2016-08-10  9:23 ` [PATCH v2 11/12] drm/i915: Deal with NV12 CbCr plane AUX surface on SKL+ ville.syrjala
2016-08-10 10:03   ` Daniel Vetter
2016-08-10 11:26     ` Ville Syrjälä
2016-08-10  9:23 ` [PATCH v2 12/12] drm/i915: Make sure fb offset is (macro)pixel aligned ville.syrjala
2016-08-10 10:04   ` Daniel Vetter
2016-08-10 11:02     ` Ville Syrjälä
2016-08-10 11:33       ` Ville Syrjälä
2016-08-11 16:37         ` Ville Syrjälä
2016-08-10 11:46 ` ✗ Ro.CI.BAT: failure for drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v5) Patchwork
2016-08-10 12:40   ` Ville Syrjälä
  -- strict thread matches above, loose matches on Subject: below --
2016-05-03 15:39 [PATCH v4 00/12] drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v4) ville.syrjala
2016-05-03 15:39 ` [PATCH 08/12] drm/i915: Allow calling intel_adjust_tile_offset() multiple times ville.syrjala
2016-05-27  8:23   ` Ville Syrjälä
2016-05-30 10:14     ` Thulasimani, Sivakumar

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=20160810111700.GL4329@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniel@ffwll.ch \
    --cc=intel-gfx@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