mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-27 09:31:03 +00:00
iris: Add a flags argument to iris_bo_alloc()
Based on a patch by Rafael Antognolli. We already had a flags parameter, but omitted it from the simple alloc interface because most callers were passing 0. However, we'll want to use it for selecting between device local memory and system memory, and possibly mmap cacheability modes, in the future. At that point, many more callers will want to specify, so I think we should include flags in iris_bo_alloc() as well. A few places used the iris_bo_alloc_tiled() function simply to pass flags, so this patch converts them to use iris_bo_alloc() instead now it does everything they want. 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:
parent
9e0fd49858
commit
539494e767
@ -359,7 +359,7 @@ 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);
|
||||
BATCH_SZ + BATCH_RESERVED, 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;
|
||||
|
@ -85,8 +85,8 @@ binder_realloc(struct iris_context *ice)
|
||||
}
|
||||
|
||||
|
||||
binder->bo =
|
||||
iris_bo_alloc(bufmgr, "binder", IRIS_BINDER_SIZE, IRIS_MEMZONE_BINDER);
|
||||
binder->bo = iris_bo_alloc(bufmgr, "binder", IRIS_BINDER_SIZE,
|
||||
IRIS_MEMZONE_BINDER, 0);
|
||||
binder->bo->gtt_offset = next_address;
|
||||
binder->map = iris_bo_map(NULL, binder->bo, MAP_WRITE);
|
||||
binder->insert_point = INIT_INSERT_POINT;
|
||||
|
@ -72,7 +72,7 @@ iris_reset_border_color_pool(struct iris_border_color_pool *pool,
|
||||
|
||||
pool->bo = iris_bo_alloc(bufmgr, "border colors",
|
||||
IRIS_BORDER_COLOR_POOL_SIZE,
|
||||
IRIS_MEMZONE_BORDER_COLOR_POOL);
|
||||
IRIS_MEMZONE_BORDER_COLOR_POOL, 0);
|
||||
pool->map = iris_bo_map(NULL, pool->bo, MAP_WRITE);
|
||||
|
||||
/* Don't make 0 a valid offset - tools treat that as a NULL pointer. */
|
||||
|
@ -622,10 +622,11 @@ struct iris_bo *
|
||||
iris_bo_alloc(struct iris_bufmgr *bufmgr,
|
||||
const char *name,
|
||||
uint64_t size,
|
||||
enum iris_memory_zone memzone)
|
||||
enum iris_memory_zone memzone,
|
||||
unsigned flags)
|
||||
{
|
||||
return bo_alloc_internal(bufmgr, name, size, 1, memzone,
|
||||
0, I915_TILING_NONE, 0);
|
||||
flags, I915_TILING_NONE, 0);
|
||||
}
|
||||
|
||||
struct iris_bo *
|
||||
|
@ -258,7 +258,8 @@ struct iris_bo {
|
||||
struct iris_bo *iris_bo_alloc(struct iris_bufmgr *bufmgr,
|
||||
const char *name,
|
||||
uint64_t size,
|
||||
enum iris_memory_zone memzone);
|
||||
enum iris_memory_zone memzone,
|
||||
unsigned flags);
|
||||
|
||||
/**
|
||||
* Allocate a tiled buffer object.
|
||||
|
@ -102,13 +102,9 @@ iris_init_batch_measure(struct iris_context *ice, struct iris_batch *batch)
|
||||
memset(batch->measure, 0, batch_bytes);
|
||||
struct iris_measure_batch *measure = batch->measure;
|
||||
|
||||
measure->bo = iris_bo_alloc_tiled(bufmgr, "measure",
|
||||
config->batch_size * sizeof(uint64_t),
|
||||
1, /* alignment */
|
||||
IRIS_MEMZONE_OTHER,
|
||||
I915_TILING_NONE,
|
||||
0, /* pitch */
|
||||
BO_ALLOC_ZEROED);
|
||||
measure->bo = iris_bo_alloc(bufmgr, "measure",
|
||||
config->batch_size * sizeof(uint64_t),
|
||||
IRIS_MEMZONE_OTHER, BO_ALLOC_ZEROED);
|
||||
measure->base.timestamps = iris_bo_map(NULL, measure->bo, MAP_READ);
|
||||
measure->base.framebuffer =
|
||||
(uintptr_t)util_hash_crc32(&ice->state.framebuffer,
|
||||
|
@ -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);
|
||||
return iris_bo_alloc(bufmgr, name, size, IRIS_MEMZONE_OTHER, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -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);
|
||||
*bop = iris_bo_alloc(bufmgr, "scratch", size, IRIS_MEMZONE_SHADER, 0);
|
||||
}
|
||||
|
||||
return *bop;
|
||||
|
@ -904,10 +904,9 @@ iris_resource_finish_aux_import(struct pipe_screen *pscreen,
|
||||
/* Add on a clear color BO. */
|
||||
if (iris_get_aux_clear_color_state_size(screen) > 0) {
|
||||
res->aux.clear_color_bo =
|
||||
iris_bo_alloc_tiled(screen->bufmgr, "clear color_buffer",
|
||||
iris_get_aux_clear_color_state_size(screen),
|
||||
1, IRIS_MEMZONE_OTHER, I915_TILING_NONE, 0,
|
||||
BO_ALLOC_ZEROED);
|
||||
iris_bo_alloc(screen->bufmgr, "clear color_buffer",
|
||||
iris_get_aux_clear_color_state_size(screen),
|
||||
IRIS_MEMZONE_OTHER, BO_ALLOC_ZEROED);
|
||||
}
|
||||
} else if (num_main_planes == 1 && num_planes == 3) {
|
||||
import_aux_info(r[0], r[1]);
|
||||
@ -964,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);
|
||||
res->bo = iris_bo_alloc(screen->bufmgr, name, templ->width0, memzone, 0);
|
||||
if (!res->bo) {
|
||||
iris_resource_destroy(pscreen, &res->base.b);
|
||||
return NULL;
|
||||
@ -1516,7 +1515,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_memzone_for_address(old_bo->gtt_offset));
|
||||
iris_memzone_for_address(old_bo->gtt_offset), 0);
|
||||
if (!new_bo)
|
||||
return;
|
||||
|
||||
|
@ -812,7 +812,7 @@ 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);
|
||||
iris_bo_alloc(screen->bufmgr, "workaround", 4096, IRIS_MEMZONE_OTHER, 0);
|
||||
if (!screen->workaround_bo)
|
||||
return NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user