[Intel-gfx] [PATCH] drm/i915: Tidy workaround batch buffer emission
Chris Wilson
chris at chris-wilson.co.uk
Wed Feb 8 13:20:58 UTC 2017
On Wed, Feb 08, 2017 at 01:13:48PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> -static int gen9_init_perctx_bb(struct intel_engine_cs *engine,
> - struct i915_wa_ctx_bb *wa_ctx,
> - uint32_t *batch,
> - uint32_t *offset)
> +static u32 *gen9_init_perctx_bb(struct intel_engine_cs *engine, u32 *batch)
> {
> - uint32_t index = wa_ctx_start(wa_ctx, *offset, CACHELINE_DWORDS);
> -
> - wa_ctx_emit(batch, index, MI_BATCH_BUFFER_END);
> + *batch++ = MI_BATCH_BUFFER_END;
>
> - return wa_ctx_end(wa_ctx, *offset = index, 1);
> + return batch;
> }
Transformation looks reasonable, but I'd like to omit this per-ctx bb
when empty.
> + /*
> + * Emit the two workaround batch buffers, recording the offset from the
> + * start of the workaround batch buffer object for each and their
> + * respective sizes.
> + */
> + for (i = 0; i < ARRAY_SIZE(wa_bb_f); i++) {
> + wa_bb[i]->offset = ALIGN(batch_ptr - batch, CACHELINE_DWORDS);
> + batch_ptr = wa_bb_f[i](engine, batch_ptr);
> + wa_bb[i]->size = batch_ptr - &batch[wa_bb[i]->offset];
Which will break this pattern. At the least we could do
if (!ww_bb_fn[i])
continue;
And then skip loading into the context image if size==0.
I'll double check the mechanical aspects in a bit.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list