From: Jason Ekstrand Date: Wed, 21 Oct 2020 02:29:50 +0000 (-0500) Subject: iris: Add a MEMZONE_BINDLESS and uploader X-Git-Tag: upstream/21.2.3~1272 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=545011b445b31279e9c6b837b71f2953fa42f1f5;p=platform%2Fupstream%2Fmesa.git iris: Add a MEMZONE_BINDLESS and uploader Reviewed-by: Jordan Justen Part-of: --- diff --git a/src/gallium/drivers/iris/iris_binder.c b/src/gallium/drivers/iris/iris_binder.c index 46f3aca..f41444e 100644 --- a/src/gallium/drivers/iris/iris_binder.c +++ b/src/gallium/drivers/iris/iris_binder.c @@ -78,7 +78,7 @@ binder_realloc(struct iris_context *ice) * end of the memory zone...then wrap around to the start again. */ next_address = binder->bo->gtt_offset + IRIS_BINDER_SIZE; - if (next_address >= IRIS_MEMZONE_SURFACE_START) + if (next_address >= IRIS_MEMZONE_BINDLESS_START) next_address = IRIS_MEMZONE_BINDER_START; iris_bo_unreference(binder->bo); diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c index 7cdb447..e74ca19 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.c +++ b/src/gallium/drivers/iris/iris_bufmgr.c @@ -129,11 +129,12 @@ static const char * memzone_name(enum iris_memory_zone memzone) { const char *names[] = { - [IRIS_MEMZONE_SHADER] = "shader", - [IRIS_MEMZONE_BINDER] = "binder", - [IRIS_MEMZONE_SURFACE] = "surface", - [IRIS_MEMZONE_DYNAMIC] = "dynamic", - [IRIS_MEMZONE_OTHER] = "other", + [IRIS_MEMZONE_SHADER] = "shader", + [IRIS_MEMZONE_BINDER] = "binder", + [IRIS_MEMZONE_BINDLESS] = "scratchsurf", + [IRIS_MEMZONE_SURFACE] = "surface", + [IRIS_MEMZONE_DYNAMIC] = "dynamic", + [IRIS_MEMZONE_OTHER] = "other", [IRIS_MEMZONE_BORDER_COLOR_POOL] = "bordercolor", }; assert(memzone < ARRAY_SIZE(names)); @@ -285,10 +286,11 @@ bucket_for_size(struct iris_bufmgr *bufmgr, uint64_t size, bool local) enum iris_memory_zone iris_memzone_for_address(uint64_t address) { - STATIC_ASSERT(IRIS_MEMZONE_OTHER_START > IRIS_MEMZONE_DYNAMIC_START); - STATIC_ASSERT(IRIS_MEMZONE_DYNAMIC_START > IRIS_MEMZONE_SURFACE_START); - STATIC_ASSERT(IRIS_MEMZONE_SURFACE_START > IRIS_MEMZONE_BINDER_START); - STATIC_ASSERT(IRIS_MEMZONE_BINDER_START > IRIS_MEMZONE_SHADER_START); + STATIC_ASSERT(IRIS_MEMZONE_OTHER_START > IRIS_MEMZONE_DYNAMIC_START); + STATIC_ASSERT(IRIS_MEMZONE_DYNAMIC_START > IRIS_MEMZONE_SURFACE_START); + STATIC_ASSERT(IRIS_MEMZONE_SURFACE_START > IRIS_MEMZONE_BINDLESS_START); + STATIC_ASSERT(IRIS_MEMZONE_BINDLESS_START > IRIS_MEMZONE_BINDER_START); + STATIC_ASSERT(IRIS_MEMZONE_BINDER_START > IRIS_MEMZONE_SHADER_START); STATIC_ASSERT(IRIS_BORDER_COLOR_POOL_ADDRESS == IRIS_MEMZONE_DYNAMIC_START); if (address >= IRIS_MEMZONE_OTHER_START) @@ -303,6 +305,9 @@ iris_memzone_for_address(uint64_t address) if (address >= IRIS_MEMZONE_SURFACE_START) return IRIS_MEMZONE_SURFACE; + if (address >= IRIS_MEMZONE_BINDLESS_START) + return IRIS_MEMZONE_BINDLESS; + if (address >= IRIS_MEMZONE_BINDER_START) return IRIS_MEMZONE_BINDER; @@ -1761,9 +1766,12 @@ iris_bufmgr_create(struct intel_device_info *devinfo, int fd, bool bo_reuse) util_vma_heap_init(&bufmgr->vma_allocator[IRIS_MEMZONE_SHADER], PAGE_SIZE, _4GB_minus_1 - PAGE_SIZE); + util_vma_heap_init(&bufmgr->vma_allocator[IRIS_MEMZONE_BINDLESS], + IRIS_MEMZONE_BINDLESS_START, IRIS_BINDLESS_SIZE); util_vma_heap_init(&bufmgr->vma_allocator[IRIS_MEMZONE_SURFACE], IRIS_MEMZONE_SURFACE_START, - _4GB_minus_1 - IRIS_MAX_BINDERS * IRIS_BINDER_SIZE); + _4GB_minus_1 - IRIS_MAX_BINDERS * IRIS_BINDER_SIZE - + IRIS_BINDLESS_SIZE); /* TODO: Why does limiting to 2GB help some state items on gfx12? * - CC Viewport Pointer * - Blend State Pointer diff --git a/src/gallium/drivers/iris/iris_bufmgr.h b/src/gallium/drivers/iris/iris_bufmgr.h index 30b004e..7b235de 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.h +++ b/src/gallium/drivers/iris/iris_bufmgr.h @@ -69,6 +69,7 @@ struct isl_surf; enum iris_memory_zone { IRIS_MEMZONE_SHADER, IRIS_MEMZONE_BINDER, + IRIS_MEMZONE_BINDLESS, IRIS_MEMZONE_SURFACE, IRIS_MEMZONE_DYNAMIC, IRIS_MEMZONE_OTHER, @@ -81,10 +82,12 @@ enum iris_memory_zone { #define IRIS_BINDER_SIZE (64 * 1024) #define IRIS_MAX_BINDERS 100 +#define IRIS_BINDLESS_SIZE (8 * 1024 * 1024) #define IRIS_MEMZONE_SHADER_START (0ull * (1ull << 32)) #define IRIS_MEMZONE_BINDER_START (1ull * (1ull << 32)) -#define IRIS_MEMZONE_SURFACE_START (IRIS_MEMZONE_BINDER_START + IRIS_MAX_BINDERS * IRIS_BINDER_SIZE) +#define IRIS_MEMZONE_BINDLESS_START (IRIS_MEMZONE_BINDER_START + IRIS_MAX_BINDERS * IRIS_BINDER_SIZE) +#define IRIS_MEMZONE_SURFACE_START (IRIS_MEMZONE_BINDLESS_START + IRIS_BINDLESS_SIZE) #define IRIS_MEMZONE_DYNAMIC_START (2ull * (1ull << 32)) #define IRIS_MEMZONE_OTHER_START (3ull * (1ull << 32)) diff --git a/src/gallium/drivers/iris/iris_context.c b/src/gallium/drivers/iris/iris_context.c index 20ae4af..7bec71f 100644 --- a/src/gallium/drivers/iris/iris_context.c +++ b/src/gallium/drivers/iris/iris_context.c @@ -229,6 +229,7 @@ iris_destroy_context(struct pipe_context *ctx) iris_destroy_ctx_measure(ice); u_upload_destroy(ice->state.surface_uploader); + u_upload_destroy(ice->state.bindless_uploader); u_upload_destroy(ice->state.dynamic_uploader); u_upload_destroy(ice->query_buffer_uploader); @@ -326,6 +327,9 @@ iris_create_context(struct pipe_screen *pscreen, void *priv, unsigned flags) ice->state.surface_uploader = u_upload_create(ctx, 64 * 1024, PIPE_BIND_CUSTOM, PIPE_USAGE_IMMUTABLE, IRIS_RESOURCE_FLAG_SURFACE_MEMZONE); + ice->state.bindless_uploader = + u_upload_create(ctx, 64 * 1024, PIPE_BIND_CUSTOM, PIPE_USAGE_IMMUTABLE, + IRIS_RESOURCE_FLAG_BINDLESS_MEMZONE); ice->state.dynamic_uploader = u_upload_create(ctx, 64 * 1024, PIPE_BIND_CUSTOM, PIPE_USAGE_IMMUTABLE, IRIS_RESOURCE_FLAG_DYNAMIC_MEMZONE); diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index f34aead..18a6ff6 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -768,6 +768,7 @@ struct iris_context { struct iris_state_ref null_fb; struct u_upload_mgr *surface_uploader; + struct u_upload_mgr *bindless_uploader; struct u_upload_mgr *dynamic_uploader; struct iris_binder binder; diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 5bdc7a2..6e62499 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -982,6 +982,9 @@ iris_resource_create_for_buffer(struct pipe_screen *pscreen, } else if (templ->flags & IRIS_RESOURCE_FLAG_DYNAMIC_MEMZONE) { memzone = IRIS_MEMZONE_DYNAMIC; name = "dynamic state"; + } else if (templ->flags & IRIS_RESOURCE_FLAG_BINDLESS_MEMZONE) { + memzone = IRIS_MEMZONE_BINDLESS; + name = "bindless surface state"; } unsigned flags = iris_resource_alloc_flags(screen, templ); @@ -1035,7 +1038,8 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, /* These are for u_upload_mgr buffers only */ assert(!(templ->flags & (IRIS_RESOURCE_FLAG_SHADER_MEMZONE | IRIS_RESOURCE_FLAG_SURFACE_MEMZONE | - IRIS_RESOURCE_FLAG_DYNAMIC_MEMZONE))); + IRIS_RESOURCE_FLAG_DYNAMIC_MEMZONE | + IRIS_RESOURCE_FLAG_BINDLESS_MEMZONE))); if (!iris_resource_configure_aux(screen, res, false)) goto fail; diff --git a/src/gallium/drivers/iris/iris_resource.h b/src/gallium/drivers/iris/iris_resource.h index 90105c4..ff4ce11 100644 --- a/src/gallium/drivers/iris/iris_resource.h +++ b/src/gallium/drivers/iris/iris_resource.h @@ -41,9 +41,10 @@ struct iris_format_info { struct isl_swizzle swizzle; }; -#define IRIS_RESOURCE_FLAG_SHADER_MEMZONE (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) -#define IRIS_RESOURCE_FLAG_SURFACE_MEMZONE (PIPE_RESOURCE_FLAG_DRV_PRIV << 1) -#define IRIS_RESOURCE_FLAG_DYNAMIC_MEMZONE (PIPE_RESOURCE_FLAG_DRV_PRIV << 2) +#define IRIS_RESOURCE_FLAG_SHADER_MEMZONE (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) +#define IRIS_RESOURCE_FLAG_SURFACE_MEMZONE (PIPE_RESOURCE_FLAG_DRV_PRIV << 1) +#define IRIS_RESOURCE_FLAG_DYNAMIC_MEMZONE (PIPE_RESOURCE_FLAG_DRV_PRIV << 2) +#define IRIS_RESOURCE_FLAG_BINDLESS_MEMZONE (PIPE_RESOURCE_FLAG_DRV_PRIV << 3) /** * Resources represent a GPU buffer object or image (mipmap tree). diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index abb315e..9e14fb2 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -721,6 +721,8 @@ init_state_base_address(struct iris_batch *batch) sba.GeneralStateBufferSizeModifyEnable = true; sba.DynamicStateBufferSizeModifyEnable = true; #if (GFX_VER >= 9) + sba.BindlessSurfaceStateBaseAddress = ro_bo(NULL, IRIS_MEMZONE_BINDLESS_START); + sba.BindlessSurfaceStateSize = (IRIS_BINDLESS_SIZE >> 12) - 1; sba.BindlessSurfaceStateBaseAddressModifyEnable = true; sba.BindlessSurfaceStateMOCS = mocs; #endif