aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-06-13 12:18:23 -0700
committerKenneth Graunke <[email protected]>2016-06-13 12:23:11 -0700
commit5a0d294d38505ae61293ae1a9184e1b3228ef2af (patch)
treea3d660f3742b77f20d2403e6021dbe4ac2f2ede8
parent667e5cec760d1908af73a40de28c53848b5b70a0 (diff)
i965: Fix encode_slm_size() to take a generation, not a device info.
In the Vulkan driver, we have the generation number (a compile time constant) but not necessarily the brw_device_info struct. I meant to rework the function to take a generation number instead of a brw_device_info pointer to accomodate this. But I forgot, and left it taking a brw_device_info pointer, while making Vulkan pass the generation number (8, 9, ...) directly. This led to crashes. Brown paper bag fix for commit 87d062a94080373995170f51063a9649. Cc: "12.0" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96504 Signed-off-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_compiler.h4
-rw-r--r--src/mesa/drivers/dri/i965/gen7_cs_state.c3
2 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
index c944effda0a..10e9f4744be 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -833,7 +833,7 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,
char **error_str);
static inline uint32_t
-encode_slm_size(const struct brw_device_info *devinfo, uint32_t bytes)
+encode_slm_size(unsigned gen, uint32_t bytes)
{
uint32_t slm_size = 0;
@@ -852,7 +852,7 @@ encode_slm_size(const struct brw_device_info *devinfo, uint32_t bytes)
/* Shared Local Memory Size is specified as powers of two. */
slm_size = util_next_power_of_two(bytes);
- if (devinfo->gen >= 9) {
+ if (gen >= 9) {
/* Use a minimum of 1kB; turn an exponent of 10 (1024 kB) into 1. */
slm_size = ffs(MAX2(slm_size, 1024)) - 10;
} else {
diff --git a/src/mesa/drivers/dri/i965/gen7_cs_state.c b/src/mesa/drivers/dri/i965/gen7_cs_state.c
index ba558a64ac9..ff308e6f790 100644
--- a/src/mesa/drivers/dri/i965/gen7_cs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_cs_state.c
@@ -164,7 +164,8 @@ brw_upload_cs_state(struct brw_context *brw)
SET_FIELD(cs_prog_data->threads, MEDIA_GPGPU_THREAD_COUNT);
assert(cs_prog_data->threads <= brw->max_cs_threads);
- const uint32_t slm_size = encode_slm_size(devinfo, prog_data->total_shared);
+ const uint32_t slm_size =
+ encode_slm_size(devinfo->gen, prog_data->total_shared);
desc[dw++] =
SET_FIELD(cs_prog_data->uses_barrier, MEDIA_BARRIER_ENABLE) |