aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/blorp.h9
-rw-r--r--src/mesa/drivers/dri/i965/blorp_blit.c15
-rw-r--r--src/mesa/drivers/dri/i965/blorp_clear.c15
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp.c26
4 files changed, 47 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/blorp.h b/src/mesa/drivers/dri/i965/blorp.h
index 7dbf022b74b..602d97e2d9d 100644
--- a/src/mesa/drivers/dri/i965/blorp.h
+++ b/src/mesa/drivers/dri/i965/blorp.h
@@ -41,6 +41,15 @@ struct blorp_context {
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,
diff --git a/src/mesa/drivers/dri/i965/blorp_blit.c b/src/mesa/drivers/dri/i965/blorp_blit.c
index a4b3fe0e5b1..0291e01da8e 100644
--- a/src/mesa/drivers/dri/i965/blorp_blit.c
+++ b/src/mesa/drivers/dri/i965/blorp_blit.c
@@ -32,7 +32,6 @@
#include "blorp_priv.h"
#include "brw_context.h"
-#include "brw_state.h"
#include "brw_meta_util.h"
#define FILE_DEBUG_FLAG DEBUG_BLORP
@@ -1196,9 +1195,8 @@ brw_blorp_get_blit_kernel(struct brw_context *brw,
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),
- &params->wm_prog_kernel, &params->wm_prog_data))
+ if (brw->blorp.lookup_shader(&brw->blorp, prog_key, sizeof(*prog_key),
+ &params->wm_prog_kernel, &params->wm_prog_data))
return;
const unsigned *program;
@@ -1219,11 +1217,10 @@ brw_blorp_get_blit_kernel(struct brw_context *brw,
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),
- &params->wm_prog_kernel, &params->wm_prog_data);
+ brw->blorp.upload_shader(&brw->blorp, prog_key, sizeof(*prog_key),
+ program, program_size,
+ &prog_data, sizeof(prog_data),
+ &params->wm_prog_kernel, &params->wm_prog_data);
}
static void
diff --git a/src/mesa/drivers/dri/i965/blorp_clear.c b/src/mesa/drivers/dri/i965/blorp_clear.c
index 2da08f83c7a..5b8ceec5cf0 100644
--- a/src/mesa/drivers/dri/i965/blorp_clear.c
+++ b/src/mesa/drivers/dri/i965/blorp_clear.c
@@ -35,7 +35,6 @@
#include "brw_meta_util.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_state.h"
#include "nir_builder.h"
@@ -56,9 +55,8 @@ brw_blorp_params_get_clear_kernel(struct brw_context *brw,
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),
- &params->wm_prog_kernel, &params->wm_prog_data))
+ if (brw->blorp.lookup_shader(&brw->blorp, &blorp_key, sizeof(blorp_key),
+ &params->wm_prog_kernel, &params->wm_prog_data))
return;
void *mem_ctx = ralloc_context(NULL);
@@ -88,11 +86,10 @@ brw_blorp_params_get_clear_kernel(struct brw_context *brw,
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),
- &params->wm_prog_kernel, &params->wm_prog_data);
+ brw->blorp.upload_shader(&brw->blorp, &blorp_key, sizeof(blorp_key),
+ program, program_size,
+ &prog_data, sizeof(prog_data),
+ &params->wm_prog_kernel, &params->wm_prog_data);
ralloc_free(mem_ctx);
}
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index 727be632560..3dcec1de47c 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -37,10 +37,36 @@
#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