[Mesa-dev] [PATCH 3/5] i965: Rename brw_bo::offset64 to presumed_offset.

Kenneth Graunke kenneth at whitecape.org
Thu Aug 31 20:17:58 UTC 2017


We can drop the meaningless "64" suffix - libdrm_intel originally had
an "offset" field that was an "unsigned long" which was the wrong size,
and we couldn't remove/alter that field without breaking ABI, so we had
to add a uint64_t "offset64" field.

"presumed_offset" is a bit more descriptive than "offset".
---
 src/mesa/drivers/dri/i965/brw_bufmgr.c        |  2 +-
 src/mesa/drivers/dri/i965/brw_bufmgr.h        |  2 +-
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 13 +++++++------
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index 5b4e784ae24..4fae824d80d 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -517,7 +517,7 @@ brw_bo_gem_create_from_name(struct brw_bufmgr *bufmgr,
    p_atomic_set(&bo->refcount, 1);
 
    bo->size = open_arg.size;
-   bo->offset64 = 0;
+   bo->presumed_offset = 0;
    bo->bufmgr = bufmgr;
    bo->gem_handle = open_arg.handle;
    bo->name = name;
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.h b/src/mesa/drivers/dri/i965/brw_bufmgr.h
index 7423dde2d36..c88d1ecac6b 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.h
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.h
@@ -74,7 +74,7 @@ struct brw_bo {
     * aperture) for the object.  This should be used to fill relocation
     * entries when calling brw_bo_emit_reloc()
     */
-   uint64_t offset64;
+   uint64_t presumed_offset;
 
    /**
     * The validation list index for this buffer, or -1 when not in a batch.
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index daed8526eae..6e67a523ca5 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -130,7 +130,7 @@ add_exec_bo(struct intel_batchbuffer *batch, struct brw_bo *bo)
       (struct drm_i915_gem_exec_object2) {
          .handle = bo->gem_handle,
          .alignment = bo->align,
-         .offset = bo->offset64,
+         .offset = bo->presumed_offset,
          .flags = bo->kflags,
       };
 
@@ -310,7 +310,7 @@ do_batch_dump(struct brw_context *brw)
 
    uint32_t *data = map ? map : batch->map;
    uint32_t *end = data + USED_BATCH(*batch);
-   uint32_t gtt_offset = map ? batch->bo->offset64 : 0;
+   uint32_t gtt_offset = map ? batch->bo->presumed_offset : 0;
    int length;
 
    bool color = INTEL_DEBUG & DEBUG_COLOR;
@@ -614,11 +614,12 @@ execbuffer(int fd,
       bo->idle = false;
       bo->index = -1;
 
-      /* Update brw_bo::offset64 */
-      if (batch->validation_list[i].offset != bo->offset64) {
+      /* Update brw_bo::presumed_offset */
+      if (batch->validation_list[i].offset != bo->presumed_offset) {
          DBG("BO %d migrated: 0x%" PRIx64 " -> 0x%llx\n",
-             bo->gem_handle, bo->offset64, batch->validation_list[i].offset);
-         bo->offset64 = batch->validation_list[i].offset;
+             bo->gem_handle, bo->presumed_offset,
+             batch->validation_list[i].offset);
+         bo->presumed_offset = batch->validation_list[i].offset;
       }
    }
 
-- 
2.14.1



More information about the mesa-dev mailing list