summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-04-22 21:25:51 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:06 -0800
commitb8a11ad256ddae35314bd870266dfad9fbe68f56 (patch)
tree823033dd22e969a24ecd7e3e996da4870693fabb /src/gallium/drivers
parente2ba98ba398011f3b4f2c62c446053ed1303ebdc (diff)
iris: fix blorp prog data crashes
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/iris/iris_program_cache.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gallium/drivers/iris/iris_program_cache.c b/src/gallium/drivers/iris/iris_program_cache.c
index 6c286fd6640..a993a933743 100644
--- a/src/gallium/drivers/iris/iris_program_cache.c
+++ b/src/gallium/drivers/iris/iris_program_cache.c
@@ -203,7 +203,7 @@ iris_upload_shader(struct iris_context *ice,
uint32_t key_size,
const void *key,
const void *assembly,
- const struct brw_stage_prog_data *prog_data)
+ struct brw_stage_prog_data *prog_data)
{
struct iris_screen *screen = (void *) ice->ctx.screen;
struct gen_device_info *devinfo = &screen->devinfo;
@@ -231,6 +231,10 @@ iris_upload_shader(struct iris_context *ice,
shader->prog_data = prog_data;
+ ralloc_steal(shader, shader->prog_data);
+ ralloc_steal(shader->prog_data, prog_data->param);
+ ralloc_steal(shader->prog_data, prog_data->pull_param);
+
/* Store the 3DSTATE shader packets and other derived state. */
ice->vtbl.set_derived_program_state(devinfo, cache_id, shader);
@@ -258,10 +262,6 @@ iris_upload_and_bind_shader(struct iris_context *ice,
iris_upload_shader(ice, cache_id, key_size_for_cache(cache_id), key,
assembly, prog_data);
- ralloc_steal(shader, shader->prog_data);
- ralloc_steal(shader->prog_data, prog_data->param);
- ralloc_steal(shader->prog_data, prog_data->pull_param);
-
ice->shaders.prog[cache_id] = shader;
ice->state.dirty |= dirty_flag_for_cache(cache_id);
}
@@ -293,7 +293,7 @@ bool
iris_blorp_upload_shader(struct blorp_batch *blorp_batch,
const void *key, uint32_t key_size,
const void *kernel, UNUSED uint32_t kernel_size,
- const struct brw_stage_prog_data *prog_data,
+ const struct brw_stage_prog_data *prog_data_templ,
UNUSED uint32_t prog_data_size,
uint32_t *kernel_out, void *prog_data_out)
{
@@ -301,6 +301,9 @@ iris_blorp_upload_shader(struct blorp_batch *blorp_batch,
struct iris_context *ice = blorp->driver_ctx;
struct iris_batch *batch = blorp_batch->driver_batch;
+ void *prog_data = ralloc_size(NULL, prog_data_size);
+ memcpy(prog_data, prog_data_templ, prog_data_size);
+
struct iris_compiled_shader *shader =
iris_upload_shader(ice, IRIS_CACHE_BLORP, key_size, key, kernel,
prog_data);