[Mesa-dev] [PATCH 1/2] i965: Allow passing target_bo=NULL to brw_emit_reloc()

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 14 08:26:03 UTC 2017


Sometimes we want to emit a relocation to a NULL surface when the
constructing the batch. If we push the NULL handling into the common
brw_emit_reloc() we can streamline the batch construction.

Cc: Kenneth Graunke <kenneth at whitecape.org>
Cc: Matt Turner <mattst88 at gmail.com>
Cc: Jason Ekstrand <jason.ekstrand at intel.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 28c2f474c0..4ddce87c0f 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -756,6 +756,9 @@ brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
                struct brw_bo *target, uint32_t target_offset,
                uint32_t read_domains, uint32_t write_domain)
 {
+   if (!target)
+      return target_offset;
+
    uint64_t offset64;
 
    if (batch->reloc_count == batch->reloc_array_size) {
-- 
2.13.2



More information about the mesa-dev mailing list