void *driver_ctx;
const struct isl_device *isl_dev;
+
+ bool (*lookup_shader)(struct blorp_context *blorp,
+ const void *key, uint32_t key_size,
+ uint32_t *kernel_out, void *prog_data_out);
+ void (*upload_shader)(struct blorp_context *blorp,
+ const void *key, uint32_t key_size,
+ const void *kernel, uint32_t kernel_size,
+ const void *prog_data, uint32_t prog_data_size,
+ uint32_t *kernel_out, void *prog_data_out);
};
void blorp_init(struct blorp_context *blorp, void *driver_ctx,
#include "blorp_priv.h"
#include "brw_context.h"
-#include "brw_state.h"
#include "brw_meta_util.h"
#define FILE_DEBUG_FLAG DEBUG_BLORP
struct brw_blorp_params *params,
const struct brw_blorp_blit_prog_key *prog_key)
{
- if (brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG,
- prog_key, sizeof(*prog_key),
- ¶ms->wm_prog_kernel, ¶ms->wm_prog_data))
+ if (brw->blorp.lookup_shader(&brw->blorp, prog_key, sizeof(*prog_key),
+ ¶ms->wm_prog_kernel, ¶ms->wm_prog_data))
return;
const unsigned *program;
program = brw_blorp_compile_nir_shader(brw, nir, &wm_key, false,
&prog_data, &program_size);
- brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG,
- prog_key, sizeof(*prog_key),
- program, program_size,
- &prog_data, sizeof(prog_data),
- ¶ms->wm_prog_kernel, ¶ms->wm_prog_data);
+ brw->blorp.upload_shader(&brw->blorp, prog_key, sizeof(*prog_key),
+ program, program_size,
+ &prog_data, sizeof(prog_data),
+ ¶ms->wm_prog_kernel, ¶ms->wm_prog_data);
}
static void
#include "brw_meta_util.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_state.h"
#include "nir_builder.h"
memset(&blorp_key, 0, sizeof(blorp_key));
blorp_key.use_simd16_replicated_data = use_replicated_data;
- if (brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG,
- &blorp_key, sizeof(blorp_key),
- ¶ms->wm_prog_kernel, ¶ms->wm_prog_data))
+ if (brw->blorp.lookup_shader(&brw->blorp, &blorp_key, sizeof(blorp_key),
+ ¶ms->wm_prog_kernel, ¶ms->wm_prog_data))
return;
void *mem_ctx = ralloc_context(NULL);
brw_blorp_compile_nir_shader(brw, b.shader, &wm_key, use_replicated_data,
&prog_data, &program_size);
- brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG,
- &blorp_key, sizeof(blorp_key),
- program, program_size,
- &prog_data, sizeof(prog_data),
- ¶ms->wm_prog_kernel, ¶ms->wm_prog_data);
+ brw->blorp.upload_shader(&brw->blorp, &blorp_key, sizeof(blorp_key),
+ program, program_size,
+ &prog_data, sizeof(prog_data),
+ ¶ms->wm_prog_kernel, ¶ms->wm_prog_data);
ralloc_free(mem_ctx);
}
#define FILE_DEBUG_FLAG DEBUG_BLORP
+static bool
+brw_blorp_lookup_shader(struct blorp_context *blorp,
+ const void *key, uint32_t key_size,
+ uint32_t *kernel_out, void *prog_data_out)
+{
+ struct brw_context *brw = blorp->driver_ctx;
+ return brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG,
+ key, key_size, kernel_out, prog_data_out);
+}
+
+static void
+brw_blorp_upload_shader(struct blorp_context *blorp,
+ const void *key, uint32_t key_size,
+ const void *kernel, uint32_t kernel_size,
+ const void *prog_data, uint32_t prog_data_size,
+ uint32_t *kernel_out, void *prog_data_out)
+{
+ struct brw_context *brw = blorp->driver_ctx;
+ brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG, key, key_size,
+ kernel, kernel_size, prog_data, prog_data_size,
+ kernel_out, prog_data_out);
+}
+
void
brw_blorp_init(struct brw_context *brw)
{
blorp_init(&brw->blorp, brw, &brw->isl_dev);
+
+ brw->blorp.lookup_shader = brw_blorp_lookup_shader;
+ brw->blorp.upload_shader = brw_blorp_upload_shader;
}
static void