iris: Better handle decoder base addresses
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 12 Jul 2019 20:52:35 +0000 (13:52 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 15 Jul 2019 18:49:19 +0000 (11:49 -0700)
It can be useful to call the decoder on a single batch.  But, that batch
may not contain STATE_BASE_ADDRESS, at which point the decoder will have
no idea how to find any buffers.  We can initialize the two static bases
at the beginning of time, so it has them even if it never sees SBA.

Surface base address changes dynamically, possibly in the middle of a
batch.  So we update it at the start of each batch, making it always
start at the value we inherited from the previous one.  SBA commands
inside the batch can update it to a proper value.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/iris/iris_batch.c

index 5508256..3840518 100644 (file)
@@ -238,6 +238,8 @@ iris_init_batch(struct iris_batch *batch,
       gen_batch_decode_ctx_init(&batch->decoder, &screen->devinfo,
                                 stderr, decode_flags, NULL,
                                 decode_get_bo, decode_get_state_size, batch);
+      batch->decoder.dynamic_base = IRIS_MEMZONE_DYNAMIC_START;
+      batch->decoder.instruction_base = IRIS_MEMZONE_SHADER_START;
       batch->decoder.max_vbo_decoded_lines = 32;
    }
 
@@ -374,6 +376,7 @@ iris_batch_reset(struct iris_batch *batch)
    iris_bo_unreference(batch->bo);
    batch->primary_batch_size = 0;
    batch->contains_draw = false;
+   batch->decoder.surface_base = batch->last_surface_base_address;
 
    create_batch(batch);
    assert(batch->bo->index == 0);