iris: Add an alignment parameter to iris_bo_alloc()

This is rarely useful, but after the next patch removes tiling tracking,
this would literally be the only difference between iris_bo_alloc and
iris_bo_alloc_tiled, so we may as well add it.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11169>
This commit is contained in:
Kenneth Graunke 2021-06-02 16:16:53 -07:00
parent 539494e767
commit 32c5d6d1dc
10 changed files with 17 additions and 13 deletions

View File

@ -359,7 +359,8 @@ create_batch(struct iris_batch *batch)
struct iris_bufmgr *bufmgr = screen->bufmgr;
batch->bo = iris_bo_alloc(bufmgr, "command buffer",
BATCH_SZ + BATCH_RESERVED, IRIS_MEMZONE_OTHER, 0);
BATCH_SZ + BATCH_RESERVED, 1,
IRIS_MEMZONE_OTHER, 0);
batch->bo->kflags |= EXEC_OBJECT_CAPTURE;
batch->map = iris_bo_map(NULL, batch->bo, MAP_READ | MAP_WRITE);
batch->map_next = batch->map;

View File

@ -85,7 +85,7 @@ binder_realloc(struct iris_context *ice)
}
binder->bo = iris_bo_alloc(bufmgr, "binder", IRIS_BINDER_SIZE,
binder->bo = iris_bo_alloc(bufmgr, "binder", IRIS_BINDER_SIZE, 1,
IRIS_MEMZONE_BINDER, 0);
binder->bo->gtt_offset = next_address;
binder->map = iris_bo_map(NULL, binder->bo, MAP_WRITE);

View File

@ -71,7 +71,7 @@ iris_reset_border_color_pool(struct iris_border_color_pool *pool,
iris_bo_unreference(pool->bo);
pool->bo = iris_bo_alloc(bufmgr, "border colors",
IRIS_BORDER_COLOR_POOL_SIZE,
IRIS_BORDER_COLOR_POOL_SIZE, 1,
IRIS_MEMZONE_BORDER_COLOR_POOL, 0);
pool->map = iris_bo_map(NULL, pool->bo, MAP_WRITE);

View File

@ -622,10 +622,11 @@ struct iris_bo *
iris_bo_alloc(struct iris_bufmgr *bufmgr,
const char *name,
uint64_t size,
uint32_t alignment,
enum iris_memory_zone memzone,
unsigned flags)
{
return bo_alloc_internal(bufmgr, name, size, 1, memzone,
return bo_alloc_internal(bufmgr, name, size, alignment, memzone,
flags, I915_TILING_NONE, 0);
}
@ -1643,8 +1644,8 @@ intel_aux_map_buffer_alloc(void *driver_ctx, uint32_t size)
struct iris_bufmgr *bufmgr = (struct iris_bufmgr *)driver_ctx;
struct iris_bo *bo =
iris_bo_alloc_tiled(bufmgr, "aux-map", size, 64 * 1024,
IRIS_MEMZONE_OTHER, I915_TILING_NONE, 0, 0);
iris_bo_alloc(bufmgr, "aux-map", size, 64 * 1024,
IRIS_MEMZONE_OTHER, 0);
buf->driver_bo = bo;
buf->gpu = bo->gtt_offset;

View File

@ -258,6 +258,7 @@ struct iris_bo {
struct iris_bo *iris_bo_alloc(struct iris_bufmgr *bufmgr,
const char *name,
uint64_t size,
uint32_t alignment,
enum iris_memory_zone memzone,
unsigned flags);

View File

@ -103,7 +103,7 @@ iris_init_batch_measure(struct iris_context *ice, struct iris_batch *batch)
struct iris_measure_batch *measure = batch->measure;
measure->bo = iris_bo_alloc(bufmgr, "measure",
config->batch_size * sizeof(uint64_t),
config->batch_size * sizeof(uint64_t), 1,
IRIS_MEMZONE_OTHER, BO_ALLOC_ZEROED);
measure->base.timestamps = iris_bo_map(NULL, measure->bo, MAP_READ);
measure->base.framebuffer =

View File

@ -26,7 +26,7 @@
static void *
iris_oa_bo_alloc(void *bufmgr, const char *name, uint64_t size)
{
return iris_bo_alloc(bufmgr, name, size, IRIS_MEMZONE_OTHER, 0);
return iris_bo_alloc(bufmgr, name, size, 1, IRIS_MEMZONE_OTHER, 0);
}
static void

View File

@ -2207,7 +2207,7 @@ iris_get_scratch_space(struct iris_context *ice,
uint32_t size = per_thread_scratch * max_threads[stage];
*bop = iris_bo_alloc(bufmgr, "scratch", size, IRIS_MEMZONE_SHADER, 0);
*bop = iris_bo_alloc(bufmgr, "scratch", size, 1, IRIS_MEMZONE_SHADER, 0);
}
return *bop;

View File

@ -905,7 +905,7 @@ iris_resource_finish_aux_import(struct pipe_screen *pscreen,
if (iris_get_aux_clear_color_state_size(screen) > 0) {
res->aux.clear_color_bo =
iris_bo_alloc(screen->bufmgr, "clear color_buffer",
iris_get_aux_clear_color_state_size(screen),
iris_get_aux_clear_color_state_size(screen), 1,
IRIS_MEMZONE_OTHER, BO_ALLOC_ZEROED);
}
} else if (num_main_planes == 1 && num_planes == 3) {
@ -963,7 +963,7 @@ iris_resource_create_for_buffer(struct pipe_screen *pscreen,
name = "dynamic state";
}
res->bo = iris_bo_alloc(screen->bufmgr, name, templ->width0, memzone, 0);
res->bo = iris_bo_alloc(screen->bufmgr, name, templ->width0, 1, memzone, 0);
if (!res->bo) {
iris_resource_destroy(pscreen, &res->base.b);
return NULL;
@ -1514,7 +1514,7 @@ iris_invalidate_resource(struct pipe_context *ctx,
struct iris_bo *old_bo = res->bo;
struct iris_bo *new_bo =
iris_bo_alloc(screen->bufmgr, res->bo->name, resource->width0,
iris_bo_alloc(screen->bufmgr, res->bo->name, resource->width0, 1,
iris_memzone_for_address(old_bo->gtt_offset), 0);
if (!new_bo)
return;

View File

@ -812,7 +812,8 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
screen->no_hw = true;
screen->workaround_bo =
iris_bo_alloc(screen->bufmgr, "workaround", 4096, IRIS_MEMZONE_OTHER, 0);
iris_bo_alloc(screen->bufmgr, "workaround", 4096, 1,
IRIS_MEMZONE_OTHER, 0);
if (!screen->workaround_bo)
return NULL;