diff options
author | Jordan Justen <jordan.l.justen@intel.com> | 2015-07-28 15:30:30 -0700 |
---|---|---|
committer | Jordan Justen <jordan.l.justen@intel.com> | 2015-12-09 23:50:38 -0800 |
commit | b1fe3af0da6275a31fb45eb6f445dbdc7f8d0688 (patch) | |
tree | 257fdc056002a633774e1581acd6829fb4833087 /src/mesa/drivers/dri/i965/gen7_cs_state.c | |
parent | faddb301ff72bd7ac8d4274e0d895ca37a4d3bce (diff) | |
download | external_mesa3d-b1fe3af0da6275a31fb45eb6f445dbdc7f8d0688.zip external_mesa3d-b1fe3af0da6275a31fb45eb6f445dbdc7f8d0688.tar.gz external_mesa3d-b1fe3af0da6275a31fb45eb6f445dbdc7f8d0688.tar.bz2 |
i965: Enable shared local memory for CS shared variables
v3:
* Check shared variable size at link time
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen7_cs_state.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_cs_state.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_cs_state.c b/src/mesa/drivers/dri/i965/gen7_cs_state.c index 0922c22..1fde69c 100644 --- a/src/mesa/drivers/dri/i965/gen7_cs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_cs_state.c @@ -166,8 +166,20 @@ brw_upload_cs_state(struct brw_context *brw) SET_FIELD(threads, GEN8_MEDIA_GPGPU_THREAD_COUNT) : SET_FIELD(threads, MEDIA_GPGPU_THREAD_COUNT); assert(threads <= brw->max_cs_threads); + + assert(prog_data->total_shared <= 64 * 1024); + uint32_t slm_size = 0; + if (prog_data->total_shared > 0) { + /* slm_size is in 4k increments, but must be a power of 2. */ + slm_size = 4 * 1024; + while (slm_size < prog_data->total_shared) + slm_size <<= 1; + slm_size /= 4 * 1024; + } + desc[dw++] = SET_FIELD(cs_prog_data->uses_barrier, MEDIA_BARRIER_ENABLE) | + SET_FIELD(slm_size, MEDIA_SHARED_LOCAL_MEMORY_SIZE) | media_threads; BEGIN_BATCH(4); |