iris: more uploaders

This commit is contained in:
Kenneth Graunke 2018-04-05 21:48:33 -07:00
parent 3861d24e23
commit 68229caa38
4 changed files with 23 additions and 3 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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

View File

@ -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,