[Mesa-dev] [PATCH 2/4] i965: Drop alignment parameter from bo_alloc_internal().

Kenneth Graunke kenneth at whitecape.org
Mon Mar 26 23:51:55 UTC 2018


Buffers are always page aligned on 965+ hardware; I believe this extra
parameter is a vestige from the Gen2-3 era.

All callers pass 0, and in fact we assert that the alignment is 0 unless
BO_ALLOC_BUSY is set (for some reason).  We can just drop the parameter
and set the value to 0 explicitly.
---
 src/mesa/drivers/dri/i965/brw_bufmgr.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index f698123db4c..295211e89f0 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -269,7 +269,7 @@ bo_alloc_internal(struct brw_bufmgr *bufmgr,
                   uint64_t size,
                   unsigned flags,
                   uint32_t tiling_mode,
-                  uint32_t stride, uint64_t alignment)
+                  uint32_t stride)
 {
    struct brw_bo *bo;
    unsigned int page_size = getpagesize();
@@ -320,9 +320,8 @@ retry:
          bo = LIST_ENTRY(struct brw_bo, bucket->head.prev, head);
          list_del(&bo->head);
          alloc_from_cache = true;
-         bo->align = alignment;
+         bo->align = 0;
       } else {
-         assert(alignment == 0);
          /* For non-render-target BOs (where we're probably
           * going to map it first thing in order to fill it
           * with data), check if the last BO in the cache is
@@ -382,7 +381,7 @@ retry:
       bo->gem_handle = create.handle;
 
       bo->bufmgr = bufmgr;
-      bo->align = alignment;
+      bo->align = 0;
 
       bo->tiling_mode = I915_TILING_NONE;
       bo->swizzle_mode = I915_BIT_6_SWIZZLE_NONE;
@@ -431,7 +430,7 @@ struct brw_bo *
 brw_bo_alloc(struct brw_bufmgr *bufmgr,
              const char *name, uint64_t size, uint64_t alignment)
 {
-   return bo_alloc_internal(bufmgr, name, size, 0, I915_TILING_NONE, 0, 0);
+   return bo_alloc_internal(bufmgr, name, size, 0, I915_TILING_NONE, 0);
 }
 
 struct brw_bo *
@@ -439,7 +438,7 @@ brw_bo_alloc_tiled(struct brw_bufmgr *bufmgr, const char *name,
                    uint64_t size, uint32_t tiling_mode, uint32_t pitch,
                    unsigned flags)
 {
-   return bo_alloc_internal(bufmgr, name, size, flags, tiling_mode, pitch, 0);
+   return bo_alloc_internal(bufmgr, name, size, flags, tiling_mode, pitch);
 }
 
 struct brw_bo *
@@ -480,7 +479,7 @@ brw_bo_alloc_tiled_2d(struct brw_bufmgr *bufmgr, const char *name,
    if (tiling == I915_TILING_NONE)
       stride = 0;
 
-   return bo_alloc_internal(bufmgr, name, size, flags, tiling, stride, 0);
+   return bo_alloc_internal(bufmgr, name, size, flags, tiling, stride);
 }
 
 /**
-- 
2.16.3



More information about the mesa-dev mailing list