[Mesa-dev] [PATCH v4 1/2] intel/ppgtt: memory address alignment

Kenneth Graunke kenneth at whitecape.org
Tue Aug 14 17:39:40 UTC 2018


Hi Sergii,

This patch causes 2,384 failures in CI.  The issue is that we're
apparently trying to allocate 0 size BOs in some places, which are
getting rounded up to 4096 with the current code...but with your patch,
we get ALIGN(0, 4096) == 0, and assert(bo_size) triggers.

We might want to continue rounding up for now.  Additionally, we
probably ought to fix the callers to stop allocating 0 size BOs.
It looks like most of them come from the 3DSTATE_SO_BUFFER code,
where one stream has valid transform feedback info, and the other
3 are empty.  Whoops.

Would you like to fix that, or should I?

--Ken

On Tuesday, August 14, 2018 4:28:35 AM PDT Sergii Romantsov wrote:
> Hello,
> seems some part of the World is still may waiting for a possibility to play
> Dying Light... till pushed :)
> 
> On Mon, Aug 6, 2018 at 4:26 PM, Lionel Landwerlin <
> lionel.g.landwerlin at intel.com> wrote:
> 
> > On 06/08/18 13:41, Sergii Romantsov wrote:
> >
> >> Kernel (for ppgtt) requires memory address to be
> >> aligned to page size (4096).
> >>
> >> -v2: added marking that also fixes initial commit 01058a552294.
> >> -v3: numbers replaced by PAGE_SIZE; buffer-object size is aligned
> >> instead of alignment of offsets (Chris Wilson).
> >> -v4: changes related to PAGE_SIZE moved to separate commit
> >>
> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106997
> >> Fixes: a363bb2cd0e2 (i965: Allocate VMA in userspace for full-PPGTT
> >> systems.)
> >> Fixes: 01058a552294 (i965: Add virtual memory allocator infrastructure to
> >> brw_bufmgr.)
> >> Signed-off-by: Sergii Romantsov <sergii.romantsov at globallogic.com>
> >>
> >
> > Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> >
> > Thanks!
> >
> >
> > ---
> >>   src/mesa/drivers/dri/i965/brw_bufmgr.c | 7 +++----
> >>   1 file changed, 3 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c
> >> b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> >> index 09d45e3..8274c2e 100644
> >> --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
> >> +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> >> @@ -496,7 +496,6 @@ bo_alloc_internal(struct brw_bufmgr *bufmgr,
> >>                     uint32_t stride)
> >>   {
> >>      struct brw_bo *bo;
> >> -   unsigned int page_size = getpagesize();
> >>      int ret;
> >>      struct bo_cache_bucket *bucket;
> >>      bool alloc_from_cache;
> >> @@ -522,12 +521,12 @@ bo_alloc_internal(struct brw_bufmgr *bufmgr,
> >>       * allocation up.
> >>       */
> >>      if (bucket == NULL) {
> >> -      bo_size = size;
> >> -      if (bo_size < page_size)
> >> -         bo_size = page_size;
> >> +      unsigned int page_size = getpagesize();
> >> +      bo_size = ALIGN(size, page_size);
> >>      } else {
> >>         bo_size = bucket->size;
> >>      }
> >> +   assert(bo_size);
> >>        mtx_lock(&bufmgr->lock);
> >>      /* Get a buffer out of the cache if available */
> >>
> >
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> 
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180814/a554c9d6/attachment.sig>


More information about the mesa-dev mailing list