[igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Simplify reloc offsets

Ville Syrjala ville.syrjala at linux.intel.com
Wed Jul 4 16:16:40 UTC 2018


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Remove the hardcoded dword offsets for the relocs and instead rely
fully on intel_batchbuffer_subdata_offset().

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/rendercopy_gen6.c | 2 +-
 lib/rendercopy_gen7.c | 2 +-
 lib/rendercopy_gen8.c | 2 +-
 lib/rendercopy_gen9.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/rendercopy_gen6.c b/lib/rendercopy_gen6.c
index 031d864b6357..3cbe3d0259f2 100644
--- a/lib/rendercopy_gen6.c
+++ b/lib/rendercopy_gen6.c
@@ -95,7 +95,7 @@ gen6_bind_buf(struct intel_batchbuffer *batch, struct igt_buf *buf,
 	ss->ss1.base_addr = buf->bo->offset;
 
 	ret = drm_intel_bo_emit_reloc(batch->bo,
-				      intel_batchbuffer_subdata_offset(batch, ss) + 4,
+				      intel_batchbuffer_subdata_offset(batch, &ss->ss1),
 				      buf->bo, 0,
 				      read_domain, write_domain);
 	igt_assert(ret == 0);
diff --git a/lib/rendercopy_gen7.c b/lib/rendercopy_gen7.c
index bdcf3c7b46d5..706d62760859 100644
--- a/lib/rendercopy_gen7.c
+++ b/lib/rendercopy_gen7.c
@@ -90,7 +90,7 @@ gen7_bind_buf(struct intel_batchbuffer *batch,
 		ss[7] |= HSW_SURFACE_SWIZZLE(RED, GREEN, BLUE, ALPHA);
 
 	ret = drm_intel_bo_emit_reloc(batch->bo,
-				      intel_batchbuffer_subdata_offset(batch, ss) + 4,
+				      intel_batchbuffer_subdata_offset(batch, &ss[1]),
 				      buf->bo, 0,
 				      read_domain, write_domain);
 	igt_assert(ret == 0);
diff --git a/lib/rendercopy_gen8.c b/lib/rendercopy_gen8.c
index 7dd7cc47043d..90b2730b7d46 100644
--- a/lib/rendercopy_gen8.c
+++ b/lib/rendercopy_gen8.c
@@ -175,7 +175,7 @@ gen8_bind_buf(struct intel_batchbuffer *batch,
 	ss->ss8.base_addr = buf->bo->offset;
 
 	ret = drm_intel_bo_emit_reloc(batch->bo,
-				      intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
+				      intel_batchbuffer_subdata_offset(batch, &ss->ss8),
 				      buf->bo, 0,
 				      read_domain, write_domain);
 	igt_assert(ret == 0);
diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
index 331cf056e95f..6707ef8e6aef 100644
--- a/lib/rendercopy_gen9.c
+++ b/lib/rendercopy_gen9.c
@@ -174,7 +174,7 @@ gen8_bind_buf(struct intel_batchbuffer *batch, struct igt_buf *buf,
 	ss->ss8.base_addr = buf->bo->offset;
 
 	ret = drm_intel_bo_emit_reloc(batch->bo,
-				      intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
+				      intel_batchbuffer_subdata_offset(batch, &ss->ss8),
 				      buf->bo, 0,
 				      read_domain, write_domain);
 	assert(ret == 0);
-- 
2.16.4



More information about the igt-dev mailing list