From: Imre Deak <imre.deak@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/5] drm/i915: fix gtt space allocated for tiled objects
Date: Fri, 04 Jan 2013 19:23:42 +0200 [thread overview]
Message-ID: <1357320222.2737.9.camel@localhost> (raw)
In-Reply-To: <b94cdc$81fpb7@fmsmga001.fm.intel.com>
On Fri, 2013-01-04 at 17:07 +0000, Chris Wilson wrote:
> On Fri, 4 Jan 2013 18:42:00 +0200, Imre Deak <imre.deak@intel.com> wrote:
> > The gtt space needed for tiled objects might be bigger than the linear
> > size programmed into the correpsonding fence register. For example for
> > the following buffer on a Gen5+ HW:
> >
> > - allocation size: 4096 bytes
> > - tiling mode: X tiled
> > - stride: 1536
> >
> > we need (1536 / 512) * 4096 bytes of gtt space to cover all the pixels
> > in the buffer, but at the moment we allocate only 4096. This means that
> > any buffer following this tiled buffer in the gtt space will be
> > corrupted if pixels belonging to the 2nd and 3rd tiles are written.
> >
> > Fix this by rounding up the size of the allocated gtt space to the next
> > tile row address. The page frames beyond the allocation size will be
> > backed by the single gtt scratch page used already elsewhere for similar
> > padding.
> >
> > Note that this is more of a security/robustness problem and not fixing any
> > reported issue that I know of. This is because applications will normally
> > access only the part of the buffer that is tile row size aligned.
>
> There should not be any reported issues because all userspace already
> allocates up to the end of tile-row and stride should be enforced to be
> a multiple of tile-width. So the use of DIV_ROUND_UP implies a
> programming error that should have been reported back to userspace
> earlier. We can extend that by checking to make sure userspace has
> allocated a valid buffer, that is, it has allocated sufficient pages for
> the sampler access into the tiled buffer (or reject the set-tiling).
> -Chris
Ok, I tested this with older UXA that still allocated non-aligned
buffers. If that's not the case any more then rejecting set-tiling if
it's called on a non tile-row size aligned buffer would work too.
--Imre
next prev parent reply other threads:[~2013-01-04 17:23 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-04 16:41 [PATCH 0/5] drm/i915: fix gtt space allocated for tiled objects Imre Deak
2013-01-04 16:41 ` [PATCH 1/5] drm/i915: merge get_gtt_alignment/get_unfenced_gtt_alignment() Imre Deak
2013-01-04 16:41 ` [PATCH 2/5] drm/i915: merge {i965, sandybridge}_write_fence_reg() Imre Deak
2013-01-04 16:41 ` [PATCH 3/5] drm/i915: use gtt_get_size() instead of open coding it Imre Deak
2013-01-04 16:41 ` [PATCH 4/5] drm/i915: factor out i915_gem_get_tile_width() Imre Deak
2013-01-04 16:42 ` [PATCH 5/5] drm/i915: fix gtt space allocated for tiled objects Imre Deak
2013-01-04 17:07 ` Chris Wilson
2013-01-04 17:23 ` Imre Deak [this message]
2013-01-04 17:47 ` Chris Wilson
2013-01-04 19:18 ` Imre Deak
2013-01-04 20:32 ` Chris Wilson
2013-01-04 20:54 ` Imre Deak
2013-01-07 19:47 ` [PATCH v2 0/7] " Imre Deak
2013-01-07 19:47 ` [PATCH v2 1/7] drm/i915: merge get_gtt_alignment/get_unfenced_gtt_alignment() Imre Deak
2013-01-07 19:47 ` [PATCH v2 2/7] drm/i915: merge {i965, sandybridge}_write_fence_reg() Imre Deak
2013-01-07 19:47 ` [PATCH v2 3/7] drm/i915: use gtt_get_size() instead of open coding it Imre Deak
2013-01-14 16:14 ` Daniel Vetter
2013-01-14 16:28 ` Imre Deak
2013-01-07 19:47 ` [PATCH v2 4/7] drm/i915: factor out i915_gem_get_tile_width() Imre Deak
2013-01-07 19:47 ` [PATCH v2 5/7] drm/i915: reject tiling for objects smaller than their tile row size Imre Deak
2013-01-09 15:18 ` [PATCH v3 " Imre Deak
2013-01-07 19:47 ` [PATCH v2 6/7] drm/i915: check tile object alignment explicitly Imre Deak
2013-01-07 19:47 ` [PATCH v2 7/7] drm/i915: fix gtt space allocated for tiled objects Imre Deak
2013-01-08 9:59 ` Chris Wilson
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=1357320222.2737.9.camel@localhost \
--to=imre.deak@intel.com \
--cc=chris@chris-wilson.co.uk \
--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 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.