iris: Add a MEMZONE_BINDLESS and uploader
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11582>
This commit is contained in:
parent
8ca0513eca
commit
545011b445
|
@ -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);
|
||||
|
|
|
@ -131,6 +131,7 @@ memzone_name(enum iris_memory_zone memzone)
|
|||
const char *names[] = {
|
||||
[IRIS_MEMZONE_SHADER] = "shader",
|
||||
[IRIS_MEMZONE_BINDER] = "binder",
|
||||
[IRIS_MEMZONE_BINDLESS] = "scratchsurf",
|
||||
[IRIS_MEMZONE_SURFACE] = "surface",
|
||||
[IRIS_MEMZONE_DYNAMIC] = "dynamic",
|
||||
[IRIS_MEMZONE_OTHER] = "other",
|
||||
|
@ -287,7 +288,8 @@ 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_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);
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -44,6 +44,7 @@ struct iris_format_info {
|
|||
#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).
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue