From cd1a062aa41f104a34af294d1c3fb48ce131b0ec Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 26 Jul 2012 11:06:43 +0100 Subject: [PATCH] sna/gen7: Allocate some scratch space for WM threads Signed-off-by: Chris Wilson --- src/sna/gen7_render.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index f23ef4c..77f0344 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -54,6 +54,7 @@ #define NO_RING_SWITCH 0 #define GEN7_MAX_SIZE 16384 +#define SCRATCH_ADDRESS 1024 /* XXX Todo * @@ -484,7 +485,11 @@ static void gen7_emit_state_base_address(struct sna *sna) { OUT_BATCH(GEN7_STATE_BASE_ADDRESS | (10 - 2)); - OUT_BATCH(0); /* general */ + OUT_BATCH(kgem_add_reloc(&sna->kgem, /* general */ + sna->kgem.nbatch, + sna->render_state.gen7.general_bo, + I915_GEM_DOMAIN_INSTRUCTION << 16, + BASE_ADDRESS_MODIFY)); OUT_BATCH(kgem_add_reloc(&sna->kgem, /* surface */ sna->kgem.nbatch, NULL, @@ -839,7 +844,7 @@ gen7_emit_wm(struct sna *sna, int kernel) OUT_BATCH(sna->render_state.gen7.wm_kernel[kernel]); OUT_BATCH(1 << GEN7_PS_SAMPLER_COUNT_SHIFT | wm_kernels[kernel].num_surfaces << GEN7_PS_BINDING_TABLE_ENTRY_COUNT_SHIFT); - OUT_BATCH(0); /* scratch address */ + OUT_BATCH(SCRATCH_ADDRESS); /* scratch address */ OUT_BATCH(sna->render_state.gen7.info->max_wm_threads | GEN7_PS_ATTRIBUTE_ENABLE | GEN7_PS_16_DISPATCH_ENABLE); @@ -1254,6 +1259,21 @@ static void null_create(struct sna_static_stream *stream) sna_static_stream_map(stream, 64, 64); } +static void scratch_create(struct sna_static_stream *stream, + struct gen7_render_state *state) +{ + int scratch_size; + void *ptr; + + /* There are always more WM threads than anything else */ + scratch_size = state->info->max_wm_threads * 1024; + + /* Fix the position of the scratch space to be at 1k */ + ptr = sna_static_stream_map(stream, scratch_size, 1024); + assert(sna_static_stream_offsetof(stream, ptr) == SCRATCH_ADDRESS); + (void)ptr; +} + static void sampler_state_init(struct gen7_sampler_state *sampler_state, sampler_filter_t filter, @@ -4285,6 +4305,7 @@ static bool gen7_render_setup(struct sna *sna) * dumps, you know it points to zero. */ null_create(&general); + scratch_create(&general, state); for (m = 0; m < GEN7_WM_KERNEL_COUNT; m++) state->wm_kernel[m] = -- 1.7.10.4