mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-13 21:50:31 +01:00
blorp: add mda support
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40174>
This commit is contained in:
parent
4933e60bc2
commit
5283cbe07c
5 changed files with 80 additions and 22 deletions
|
|
@ -1565,7 +1565,8 @@ blorp_get_blit_kernel_fs(struct blorp_batch *batch,
|
|||
const bool multisample_fbo = key->rt_samples > 1;
|
||||
|
||||
const struct blorp_program p =
|
||||
blorp_compile_fs(blorp, mem_ctx, nir, multisample_fbo, false, false);
|
||||
blorp_compile_fs(blorp, mem_ctx, nir, multisample_fbo, false, false,
|
||||
key, sizeof(*key));
|
||||
|
||||
bool result =
|
||||
blorp->upload_shader(batch, MESA_SHADER_FRAGMENT,
|
||||
|
|
@ -1601,7 +1602,7 @@ blorp_get_blit_kernel_cs(struct blorp_batch *batch,
|
|||
assert(batch->blorp->isl_dev->info->ver >= 30 || prog_key->rt_samples == 1);
|
||||
|
||||
const struct blorp_program p =
|
||||
blorp_compile_cs(blorp, mem_ctx, nir);
|
||||
blorp_compile_cs(blorp, mem_ctx, nir, prog_key, sizeof(*prog_key));
|
||||
|
||||
bool result =
|
||||
blorp->upload_shader(batch, MESA_SHADER_COMPUTE,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,29 @@
|
|||
#include "brw/brw_nir.h"
|
||||
#include "dev/intel_debug.h"
|
||||
|
||||
static debug_archiver *
|
||||
blorp_debug_archiver_open(void *mem_ctx,
|
||||
const struct nir_shader *nir,
|
||||
const void *key,
|
||||
unsigned key_size)
|
||||
{
|
||||
if (!INTEL_DEBUG(DEBUG_MDA) || !INTEL_DEBUG(DEBUG_BLORP))
|
||||
return NULL;
|
||||
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_compute(key, key_size, sha1);
|
||||
char name[SHA1_DIGEST_STRING_LENGTH + 6] = {};
|
||||
_mesa_sha1_format(name, sha1);
|
||||
memcpy(&name[SHA1_DIGEST_STRING_LENGTH - 1], ".blorp", 6);
|
||||
|
||||
debug_archiver *archiver = debug_archiver_open(mem_ctx, name, "blorp");
|
||||
debug_archiver_set_prefix(
|
||||
archiver,
|
||||
_mesa_shader_stage_to_abbrev(nir->info.stage));
|
||||
|
||||
return archiver;
|
||||
}
|
||||
|
||||
static const nir_shader_compiler_options *
|
||||
blorp_nir_options_brw(struct blorp_context *blorp,
|
||||
mesa_shader_stage stage)
|
||||
|
|
@ -22,7 +45,8 @@ blorp_compile_fs_brw(struct blorp_context *blorp, void *mem_ctx,
|
|||
struct nir_shader *nir,
|
||||
bool multisample_fbo,
|
||||
bool is_fast_clear,
|
||||
bool use_repclear)
|
||||
bool use_repclear,
|
||||
const void *key, uint32_t key_size)
|
||||
{
|
||||
const struct brw_compiler *compiler = blorp->compiler->brw;
|
||||
|
||||
|
|
@ -45,12 +69,16 @@ blorp_compile_fs_brw(struct blorp_context *blorp, void *mem_ctx,
|
|||
wm_key.multisample_fbo = multisample_fbo ? INTEL_ALWAYS : INTEL_NEVER;
|
||||
wm_key.nr_color_regions = 1;
|
||||
|
||||
debug_archiver *archiver =
|
||||
blorp_debug_archiver_open(mem_ctx, nir, key, key_size);
|
||||
|
||||
struct brw_compile_fs_params params = {
|
||||
.base = {
|
||||
.mem_ctx = mem_ctx,
|
||||
.nir = nir,
|
||||
.log_data = blorp->driver_ctx,
|
||||
.debug_flag = DEBUG_BLORP,
|
||||
.archiver = archiver,
|
||||
},
|
||||
.key = &wm_key,
|
||||
.prog_data = fs_prog_data,
|
||||
|
|
@ -60,6 +88,9 @@ blorp_compile_fs_brw(struct blorp_context *blorp, void *mem_ctx,
|
|||
};
|
||||
|
||||
const unsigned *kernel = brw_compile_fs(compiler, ¶ms);
|
||||
|
||||
debug_archiver_close(archiver);
|
||||
|
||||
return (struct blorp_program){
|
||||
.kernel = kernel,
|
||||
.kernel_size = fs_prog_data->base.program_size,
|
||||
|
|
@ -70,7 +101,8 @@ blorp_compile_fs_brw(struct blorp_context *blorp, void *mem_ctx,
|
|||
|
||||
static struct blorp_program
|
||||
blorp_compile_vs_brw(struct blorp_context *blorp, void *mem_ctx,
|
||||
struct nir_shader *nir)
|
||||
struct nir_shader *nir,
|
||||
const void *key, uint32_t key_size)
|
||||
{
|
||||
const struct brw_compiler *compiler = blorp->compiler->brw;
|
||||
|
||||
|
|
@ -91,18 +123,25 @@ blorp_compile_vs_brw(struct blorp_context *blorp, void *mem_ctx,
|
|||
|
||||
struct brw_vs_prog_key vs_key = { 0, };
|
||||
|
||||
debug_archiver *archiver =
|
||||
blorp_debug_archiver_open(mem_ctx, nir, key, key_size);
|
||||
|
||||
struct brw_compile_vs_params params = {
|
||||
.base = {
|
||||
.mem_ctx = mem_ctx,
|
||||
.nir = nir,
|
||||
.log_data = blorp->driver_ctx,
|
||||
.debug_flag = DEBUG_BLORP,
|
||||
.archiver = archiver,
|
||||
},
|
||||
.key = &vs_key,
|
||||
.prog_data = vs_prog_data,
|
||||
};
|
||||
|
||||
const unsigned *kernel = brw_compile_vs(compiler, ¶ms);
|
||||
|
||||
debug_archiver_close(archiver);
|
||||
|
||||
return (struct blorp_program) {
|
||||
.kernel = kernel,
|
||||
.kernel_size = vs_prog_data->base.base.program_size,
|
||||
|
|
@ -143,7 +182,8 @@ lower_load_uniform(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
|
||||
static struct blorp_program
|
||||
blorp_compile_cs_brw(struct blorp_context *blorp, void *mem_ctx,
|
||||
struct nir_shader *nir)
|
||||
struct nir_shader *nir,
|
||||
const void *key, uint32_t key_size)
|
||||
{
|
||||
const struct brw_compiler *compiler = blorp->compiler->brw;
|
||||
|
||||
|
|
@ -179,12 +219,16 @@ blorp_compile_cs_brw(struct blorp_context *blorp, void *mem_ctx,
|
|||
struct brw_cs_prog_key cs_key;
|
||||
memset(&cs_key, 0, sizeof(cs_key));
|
||||
|
||||
debug_archiver *archiver =
|
||||
blorp_debug_archiver_open(mem_ctx, nir, key, key_size);
|
||||
|
||||
struct brw_compile_cs_params params = {
|
||||
.base = {
|
||||
.mem_ctx = mem_ctx,
|
||||
.nir = nir,
|
||||
.log_data = blorp->driver_ctx,
|
||||
.debug_flag = DEBUG_BLORP,
|
||||
.archiver = archiver,
|
||||
},
|
||||
.key = &cs_key,
|
||||
.prog_data = cs_prog_data,
|
||||
|
|
@ -192,6 +236,8 @@ blorp_compile_cs_brw(struct blorp_context *blorp, void *mem_ctx,
|
|||
|
||||
const unsigned *kernel = brw_compile_cs(compiler, ¶ms);
|
||||
|
||||
debug_archiver_close(archiver);
|
||||
|
||||
return (struct blorp_program) {
|
||||
.kernel = kernel,
|
||||
.kernel_size = cs_prog_data->base.program_size,
|
||||
|
|
@ -279,7 +325,7 @@ blorp_params_get_layer_offset_vs_brw(struct blorp_batch *batch,
|
|||
}
|
||||
|
||||
const struct blorp_program p =
|
||||
blorp_compile_vs(blorp, mem_ctx, b.shader);
|
||||
blorp_compile_vs(blorp, mem_ctx, b.shader, &blorp_key, sizeof(blorp_key));
|
||||
|
||||
bool result =
|
||||
blorp->upload_shader(batch, MESA_SHADER_VERTEX,
|
||||
|
|
|
|||
|
|
@ -112,7 +112,8 @@ blorp_params_get_clear_kernel_fs(struct blorp_batch *batch,
|
|||
const bool multisample_fbo = false;
|
||||
struct blorp_program p =
|
||||
blorp_compile_fs(blorp, mem_ctx, b.shader, multisample_fbo,
|
||||
is_fast_clear, use_replicated_data);
|
||||
is_fast_clear, use_replicated_data,
|
||||
&blorp_key, sizeof(blorp_key));
|
||||
|
||||
bool result =
|
||||
blorp->upload_shader(batch, MESA_SHADER_FRAGMENT,
|
||||
|
|
@ -203,7 +204,8 @@ blorp_params_get_clear_kernel_cs(struct blorp_batch *batch,
|
|||
nir_pop_if(&b, NULL);
|
||||
|
||||
const struct blorp_program p =
|
||||
blorp_compile_cs(blorp, mem_ctx, b.shader);
|
||||
blorp_compile_cs(blorp, mem_ctx, b.shader,
|
||||
&blorp_key, sizeof(blorp_key));
|
||||
|
||||
bool result =
|
||||
blorp->upload_shader(batch, MESA_SHADER_COMPUTE,
|
||||
|
|
@ -1572,7 +1574,8 @@ blorp_params_get_mcs_partial_resolve_kernel(struct blorp_batch *batch,
|
|||
|
||||
const bool multisample_fbo = true;
|
||||
const struct blorp_program p =
|
||||
blorp_compile_fs(blorp, mem_ctx, b.shader, multisample_fbo, false, false);
|
||||
blorp_compile_fs(blorp, mem_ctx, b.shader, multisample_fbo, false, false,
|
||||
&blorp_key, sizeof(blorp_key));
|
||||
|
||||
bool result =
|
||||
blorp->upload_shader(batch, MESA_SHADER_FRAGMENT,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ blorp_compile_fs_elk(struct blorp_context *blorp, void *mem_ctx,
|
|||
struct nir_shader *nir,
|
||||
bool multisample_fbo,
|
||||
bool is_fast_clear,
|
||||
bool use_repclear)
|
||||
bool use_repclear,
|
||||
const void *key, uint32_t key_size)
|
||||
{
|
||||
const struct elk_compiler *compiler = blorp->compiler->elk;
|
||||
|
||||
|
|
@ -75,7 +76,8 @@ blorp_compile_fs_elk(struct blorp_context *blorp, void *mem_ctx,
|
|||
|
||||
static struct blorp_program
|
||||
blorp_compile_vs_elk(struct blorp_context *blorp, void *mem_ctx,
|
||||
struct nir_shader *nir)
|
||||
struct nir_shader *nir,
|
||||
const void *key, uint32_t key_size)
|
||||
{
|
||||
const struct elk_compiler *compiler = blorp->compiler->elk;
|
||||
|
||||
|
|
@ -132,7 +134,8 @@ lower_base_workgroup_id(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
|
||||
static struct blorp_program
|
||||
blorp_compile_cs_elk(struct blorp_context *blorp, void *mem_ctx,
|
||||
struct nir_shader *nir)
|
||||
struct nir_shader *nir,
|
||||
const void *key, uint32_t key_size)
|
||||
{
|
||||
const struct elk_compiler *compiler = blorp->compiler->elk;
|
||||
|
||||
|
|
@ -331,7 +334,7 @@ blorp_params_get_layer_offset_vs_elk(struct blorp_batch *batch,
|
|||
}
|
||||
|
||||
const struct blorp_program p =
|
||||
blorp_compile_vs(blorp, mem_ctx, b.shader);
|
||||
blorp_compile_vs(blorp, mem_ctx, b.shader, &blorp_key, sizeof(blorp_key));
|
||||
|
||||
bool result =
|
||||
blorp->upload_shader(batch, MESA_SHADER_VERTEX,
|
||||
|
|
|
|||
|
|
@ -52,12 +52,15 @@ struct blorp_compiler {
|
|||
struct nir_shader *nir,
|
||||
bool multisample_fbo,
|
||||
bool is_fast_clear,
|
||||
bool use_repclear);
|
||||
bool use_repclear,
|
||||
const void *key, uint32_t key_size);
|
||||
struct blorp_program (*compile_vs)(struct blorp_context *blorp, void *mem_ctx,
|
||||
struct nir_shader *nir);
|
||||
struct nir_shader *nir,
|
||||
const void *key, uint32_t key_size);
|
||||
|
||||
struct blorp_program (*compile_cs)(struct blorp_context *blorp, void *mem_ctx,
|
||||
struct nir_shader *nir);
|
||||
struct nir_shader *nir,
|
||||
const void *key, uint32_t key_size);
|
||||
|
||||
bool (*ensure_sf_program)(struct blorp_batch *batch,
|
||||
struct blorp_params *params);
|
||||
|
|
@ -471,17 +474,19 @@ blorp_compile_fs(struct blorp_context *blorp, void *mem_ctx,
|
|||
struct nir_shader *nir,
|
||||
bool multisample_fbo,
|
||||
bool is_fast_clear,
|
||||
bool use_repclear)
|
||||
bool use_repclear,
|
||||
const void *key, uint32_t key_size)
|
||||
{
|
||||
return blorp->compiler->compile_fs(blorp, mem_ctx, nir, multisample_fbo,
|
||||
is_fast_clear, use_repclear);
|
||||
is_fast_clear, use_repclear,
|
||||
key, key_size);
|
||||
}
|
||||
|
||||
static inline struct blorp_program
|
||||
blorp_compile_vs(struct blorp_context *blorp, void *mem_ctx,
|
||||
struct nir_shader *nir)
|
||||
struct nir_shader *nir, const void *key, uint32_t key_size)
|
||||
{
|
||||
return blorp->compiler->compile_vs(blorp, mem_ctx, nir);
|
||||
return blorp->compiler->compile_vs(blorp, mem_ctx, nir, key, key_size);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
@ -520,9 +525,9 @@ blorp_set_cs_dims(struct nir_shader *nir, uint8_t local_y)
|
|||
|
||||
static inline struct blorp_program
|
||||
blorp_compile_cs(struct blorp_context *blorp, void *mem_ctx,
|
||||
struct nir_shader *nir)
|
||||
struct nir_shader *nir, const void *key, uint32_t key_size)
|
||||
{
|
||||
return blorp->compiler->compile_cs(blorp, mem_ctx, nir);
|
||||
return blorp->compiler->compile_cs(blorp, mem_ctx, nir, key, key_size);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue