From 1a16f83b7c2f8410404c10a2b4ec3cab0016021b 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 cf56e42..44885eb 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 * @@ -477,7 +478,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, @@ -832,7 +837,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); @@ -1247,6 +1252,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, 1024, scratch_size); + 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, @@ -4276,6 +4296,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