[igt-dev] [PATCH i-g-t v2 1/4] lib/intel_bufops: add fields for keeping offset and context

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Thu Jun 4 09:13:54 UTC 2020


To avoid relocations when intel_buf is used we need to keep previous
offset and context. Add addr structure with offset and ctx fields.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/gpu_cmds.c     | 6 +++---
 lib/intel_bufops.h | 4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/gpu_cmds.c b/lib/gpu_cmds.c
index 8c284eb1..417253a7 100644
--- a/lib/gpu_cmds.c
+++ b/lib/gpu_cmds.c
@@ -109,7 +109,7 @@ gen7_fill_surface_state(struct intel_bb *ibb,
 
 	address = intel_bb_offset_reloc(ibb, buf->handle,
 					read_domain, write_domain,
-					offset + 4, 0x0);
+					offset + 4, buf->addr.offset);
 	igt_assert(address >> 32 == 0);
 
 	ss->ss1.base_addr = address;
@@ -161,7 +161,7 @@ gen8_fill_surface_state(struct intel_bb *ibb,
 
 	address = intel_bb_offset_reloc(ibb, buf->handle,
 					read_domain, write_domain,
-					offset + 4 * 8, 0x0);
+					offset + 4 * 8, buf->addr.offset);
 
 	ss->ss8.base_addr = (uint32_t) address;
 	ss->ss9.base_addr_hi = address >> 32;
@@ -218,7 +218,7 @@ gen11_fill_surface_state(struct intel_bb *ibb,
 
 	address = intel_bb_offset_reloc(ibb, buf->handle,
 					read_domain, write_domain,
-					offset + 4 * 8, 0x0);
+					offset + 4 * 8, buf->addr.offset);
 
 	ss->ss8.base_addr = (uint32_t) address;
 	ss->ss9.base_addr_hi = address >> 32;
diff --git a/lib/intel_bufops.h b/lib/intel_bufops.h
index 3a4fae4e..95217cfe 100644
--- a/lib/intel_bufops.h
+++ b/lib/intel_bufops.h
@@ -18,6 +18,10 @@ struct intel_buf {
 		uint32_t offset;
 		uint32_t stride;
 	} aux;
+	struct {
+		uint64_t offset;
+		uint32_t ctx;
+	} addr;
 };
 
 static inline unsigned int intel_buf_width(const struct intel_buf *buf)
-- 
2.26.0



More information about the igt-dev mailing list