[Mesa-dev] [PATCH 8/8] i965/drm: Make brw_emit_reloc take a uint64_t target_offset.

Kenneth Graunke kenneth at whitecape.org
Tue Apr 11 16:02:51 UTC 2017


If we have buffers larger than 4GB, then target_offset will need to
become a 64-bit value.  Delta is only a __u32 though, so we downcast.

Suggested by Chris Wilson.
---
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 4 ++--
 src/mesa/drivers/dri/i965/intel_batchbuffer.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 6e4b55cf9ec..abaeb6bcbfe 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -734,7 +734,7 @@ brw_batch_references(struct intel_batchbuffer *batch, struct brw_bo *bo)
  */
 uint64_t
 brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
-               struct brw_bo *target, uint32_t target_offset,
+               struct brw_bo *target, uint64_t target_offset,
                uint32_t read_domains, uint32_t write_domain)
 {
    uint64_t offset64;
@@ -761,7 +761,7 @@ brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
    /* ensure gcc doesn't reload */
    offset64 = *((volatile uint64_t *)&target->offset64);
    reloc->offset = batch_offset;
-   reloc->delta = target_offset;
+   reloc->delta = (uint32_t) target_offset;
    reloc->target_handle = target->gem_handle;
    reloc->read_domains = read_domains;
    reloc->write_domain = write_domain;
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
index 2783ba3c0fb..b7443e45c82 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
@@ -71,7 +71,7 @@ bool brw_batch_has_aperture_space(struct brw_context *brw,
 bool brw_batch_references(struct intel_batchbuffer *batch, struct brw_bo *bo);
 
 uint64_t brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
-                        struct brw_bo *target, uint32_t target_offset,
+                        struct brw_bo *target, uint64_t target_offset,
                         uint32_t read_domains, uint32_t write_domain);
 
 static inline uint32_t
-- 
2.12.1



More information about the mesa-dev mailing list