iris: more uploaders
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 6 Apr 2018 04:48:33 +0000 (21:48 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:05 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_context.c
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_program_cache.c
src/gallium/drivers/iris/iris_resource.c

index f4a912a102fd0607ddf099f930e177397f0d843a..d0656cf2f22d2124bf6bc5056b47d83e6ac66ab6 100644 (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);
 
index e70e6db4713905725829c05e61c49b16a0c36ea6..e0cdcb765ed5da05919ca325fe49ea4e4eaa751a 100644 (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,
index 7fc318c862c08efcd378df37d399201be91b246c..b10f62dd41ec8f8f7b2b072bf74fe7aa09c741a8 100644 (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
index 2a9c8ec11742f668999ee78ed2e8feb8560c9db6..da55a1775be8c96c5ccdcb31cde67fd81d22fe56 100644 (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,