intel/blorp: Plumb the stage through blorp upload_shader
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Thu, 12 Mar 2020 21:27:13 +0000 (14:27 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tue, 17 Mar 2020 15:24:46 +0000 (08:24 -0700)
Vulkan uses that for its own upload function -- even though for BLORP
it doesn't really currently care.  Neither Iris and i965 makes use of
it at the moment.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4170>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4170>

src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_program_cache.c
src/intel/blorp/blorp.c
src/intel/blorp/blorp.h
src/intel/blorp/blorp_blit.c
src/intel/blorp/blorp_clear.c
src/intel/vulkan/anv_blorp.c
src/mesa/drivers/dri/i965/brw_blorp.c

index 0963601d1470d3db125b224cf2ad3990403e2715..e6a7af1732c6f34baf5d73e68b3ebd228a018068 100644 (file)
@@ -956,7 +956,7 @@ bool iris_blorp_lookup_shader(struct blorp_batch *blorp_batch,
                               uint32_t key_size,
                               uint32_t *kernel_out,
                               void *prog_data_out);
-bool iris_blorp_upload_shader(struct blorp_batch *blorp_batch,
+bool iris_blorp_upload_shader(struct blorp_batch *blorp_batch, uint32_t stage,
                               const void *key, uint32_t key_size,
                               const void *kernel, uint32_t kernel_size,
                               const struct brw_stage_prog_data *prog_data,
index 2c1224482c299db4570f83aac6f7a423430611dd..a46b717dcb6486ca0e330e9676dff24bf5ed4430 100644 (file)
@@ -221,7 +221,7 @@ iris_blorp_lookup_shader(struct blorp_batch *blorp_batch,
 }
 
 bool
-iris_blorp_upload_shader(struct blorp_batch *blorp_batch,
+iris_blorp_upload_shader(struct blorp_batch *blorp_batch, uint32_t stage,
                          const void *key, uint32_t key_size,
                          const void *kernel, UNUSED uint32_t kernel_size,
                          const struct brw_stage_prog_data *prog_data_templ,
index f93662ccae86304ec9566b747cb80db483cb2417..60585797ab81e411461a2a4b61c90c03e75bb922 100644 (file)
@@ -292,7 +292,8 @@ blorp_ensure_sf_program(struct blorp_batch *batch,
                             &prog_data_tmp, &vue_map, &program_size);
 
    bool result =
-      blorp->upload_shader(batch, &key, sizeof(key), program, program_size,
+      blorp->upload_shader(batch, MESA_SHADER_NONE,
+                           &key, sizeof(key), program, program_size,
                            (void *)&prog_data_tmp, sizeof(prog_data_tmp),
                            &params->sf_prog_kernel, &params->sf_prog_data);
 
index afee0a96a8c9dbe3da418981212a5e6fff74bea6..9ab537177fb44591825c9aee89a5855ca110ac27 100644 (file)
@@ -49,6 +49,7 @@ struct blorp_context {
                          const void *key, uint32_t key_size,
                          uint32_t *kernel_out, void *prog_data_out);
    bool (*upload_shader)(struct blorp_batch *batch,
+                         uint32_t stage,
                          const void *key, uint32_t key_size,
                          const void *kernel, uint32_t kernel_size,
                          const struct brw_stage_prog_data *prog_data,
index 8fd46cb559910e0aa8e9fee8e2b5f180a70ead5b..1a738edb67c75902bc9a81f5181bc32782393fca 100644 (file)
@@ -1520,7 +1520,8 @@ brw_blorp_get_blit_kernel(struct blorp_batch *batch,
                               &prog_data);
 
    bool result =
-      blorp->upload_shader(batch, prog_key, sizeof(*prog_key),
+      blorp->upload_shader(batch, MESA_SHADER_FRAGMENT,
+                           prog_key, sizeof(*prog_key),
                            program, prog_data.base.program_size,
                            &prog_data.base, sizeof(prog_data),
                            &params->wm_prog_kernel, &params->wm_prog_data);
index 27299d568693aea7f66d420a8c673aae32dbf24e..6999101c58eaef8277550a2bc19601d211c5aa54 100644 (file)
@@ -100,7 +100,8 @@ blorp_params_get_clear_kernel(struct blorp_batch *batch,
                        &prog_data);
 
    bool result =
-      blorp->upload_shader(batch, &blorp_key, sizeof(blorp_key),
+      blorp->upload_shader(batch, MESA_SHADER_FRAGMENT,
+                           &blorp_key, sizeof(blorp_key),
                            program, prog_data.base.program_size,
                            &prog_data.base, sizeof(prog_data),
                            &params->wm_prog_kernel, &params->wm_prog_data);
@@ -192,7 +193,8 @@ blorp_params_get_layer_offset_vs(struct blorp_batch *batch,
       blorp_compile_vs(blorp, mem_ctx, b.shader, &vs_prog_data);
 
    bool result =
-      blorp->upload_shader(batch, &blorp_key, sizeof(blorp_key),
+      blorp->upload_shader(batch, MESA_SHADER_VERTEX,
+                           &blorp_key, sizeof(blorp_key),
                            program, vs_prog_data.base.base.program_size,
                            &vs_prog_data.base.base, sizeof(vs_prog_data),
                            &params->vs_prog_kernel, &params->vs_prog_data);
@@ -1170,7 +1172,8 @@ blorp_params_get_mcs_partial_resolve_kernel(struct blorp_batch *batch,
                        &prog_data);
 
    bool result =
-      blorp->upload_shader(batch, &blorp_key, sizeof(blorp_key),
+      blorp->upload_shader(batch, MESA_SHADER_FRAGMENT,
+                           &blorp_key, sizeof(blorp_key),
                            program, prog_data.base.program_size,
                            &prog_data.base, sizeof(prog_data),
                            &params->wm_prog_kernel, &params->wm_prog_data);
index 1d61b7fc4d55897e9712e141650915f995285e24..8cbe6aaaa8996a7e88d9db71b3afc017c9cfdafb 100644 (file)
@@ -51,7 +51,7 @@ lookup_blorp_shader(struct blorp_batch *batch,
 }
 
 static bool
-upload_blorp_shader(struct blorp_batch *batch,
+upload_blorp_shader(struct blorp_batch *batch, uint32_t stage,
                     const void *key, uint32_t key_size,
                     const void *kernel, uint32_t kernel_size,
                     const struct brw_stage_prog_data *prog_data,
@@ -69,12 +69,6 @@ upload_blorp_shader(struct blorp_batch *batch,
       .sampler_count = 0,
    };
 
-   /* The stage in anv_shader_bin is only useful for pipeline shaders, so just pass
-    * a dummy value here so we don't need to change BLORP API.
-    *
-    * TODO: Plumb the stage information to BLORP.
-    */
-   gl_shader_stage stage = MESA_SHADER_NONE;
    struct anv_shader_bin *bin =
       anv_pipeline_cache_upload_kernel(&device->default_pipeline_cache, stage,
                                        key, key_size, kernel, kernel_size,
index 337294306387607d1ff28fa03595ee4c018ffcc7..93ca63ff1a21870a71d1b17dcdad5b088872373f 100644 (file)
@@ -53,7 +53,7 @@ brw_blorp_lookup_shader(struct blorp_batch *batch,
 }
 
 static bool
-brw_blorp_upload_shader(struct blorp_batch *batch,
+brw_blorp_upload_shader(struct blorp_batch *batch, uint32_t stage,
                         const void *key, uint32_t key_size,
                         const void *kernel, uint32_t kernel_size,
                         const struct brw_stage_prog_data *prog_data,