diff --git a/src/gallium/drivers/iris/iris_context.c b/src/gallium/drivers/iris/iris_context.c index f4a912a102f..d0656cf2f22 100644 --- a/src/gallium/drivers/iris/iris_context.c +++ b/src/gallium/drivers/iris/iris_context.c @@ -80,6 +80,8 @@ iris_destroy_context(struct pipe_context *ctx) u_upload_destroy(ctx->stream_uploader); iris_destroy_program_cache(ice); + u_upload_destroy(ice->state.surface_uploader); + u_upload_destroy(ice->state.dynamic_uploader); iris_batch_free(&ice->render_batch); @@ -134,6 +136,13 @@ iris_create_context(struct pipe_screen *pscreen, void *priv, unsigned flags) iris_init_program_cache(ice); + ice->state.surface_uploader = + u_upload_create(&ice->ctx, 16384, PIPE_BIND_CUSTOM, PIPE_USAGE_IMMUTABLE, + IRIS_RESOURCE_FLAG_SURFACE_MEMZONE); + ice->state.dynamic_uploader = + u_upload_create(&ice->ctx, 16384, PIPE_BIND_CUSTOM, PIPE_USAGE_IMMUTABLE, + IRIS_RESOURCE_FLAG_DYNAMIC_MEMZONE); + genX_call(devinfo, init_state, ice); ice->state.init_render_context(screen, &ice->render_batch, &ice->dbg); diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index e70e6db4713..e0cdcb765ed 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -34,7 +34,9 @@ struct iris_bo; struct iris_batch; -#define IRIS_RESOURCE_FLAG_INSTRUCTION_CACHE (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) +#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_MAX_TEXTURE_SAMPLERS 32 #define IRIS_MAX_VIEWPORTS 16 @@ -183,6 +185,9 @@ struct iris_context { struct iris_sampler_state *samplers[MESA_SHADER_STAGES][IRIS_MAX_TEXTURE_SAMPLERS]; + struct u_upload_mgr *surface_uploader; + struct u_upload_mgr *dynamic_uploader; + void (*destroy_state)(struct iris_context *ice); void (*init_render_context)(struct iris_screen *screen, struct iris_batch *batch, diff --git a/src/gallium/drivers/iris/iris_program_cache.c b/src/gallium/drivers/iris/iris_program_cache.c index 7fc318c862c..b10f62dd41e 100644 --- a/src/gallium/drivers/iris/iris_program_cache.c +++ b/src/gallium/drivers/iris/iris_program_cache.c @@ -238,7 +238,7 @@ iris_init_program_cache(struct iris_context *ice) ice->shaders.uploader = u_upload_create(&ice->ctx, 16384, PIPE_BIND_CUSTOM, PIPE_USAGE_IMMUTABLE, - IRIS_RESOURCE_FLAG_INSTRUCTION_CACHE); + IRIS_RESOURCE_FLAG_SHADER_MEMZONE); } void diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 2a9c8ec1174..da55a1775be 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -258,9 +258,15 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, enum iris_memory_zone memzone = IRIS_MEMZONE_OTHER; const char *name = "resource"; - if (templ->flags & IRIS_RESOURCE_FLAG_INSTRUCTION_CACHE) { + if (templ->flags & IRIS_RESOURCE_FLAG_SHADER_MEMZONE) { memzone = IRIS_MEMZONE_SHADER; name = "shader kernels"; + } else if (templ->flags & IRIS_RESOURCE_FLAG_SURFACE_MEMZONE) { + memzone = IRIS_MEMZONE_SURFACE; + name = "surface state"; + } else if (templ->flags & IRIS_RESOURCE_FLAG_DYNAMIC_MEMZONE) { + memzone = IRIS_MEMZONE_DYNAMIC; + name = "dynamic state"; } res->bo = iris_bo_alloc_tiled(screen->bufmgr, name, res->surf.size_B,