[igt-dev] [PATCH i-g-t 1/2] lib/i915_crc: Use system memory buffer on integrated platforms

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Feb 1 13:26:56 UTC 2023


Previous assumption crc32 will be calculated only on discrete is
not valid anymore - MTL supports extended ALU SHL/SHR instructions
so we can calculate crc there as well.

Instead of enforcing local memory as target of buffers involved
in calculations use system memory on integrated.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 lib/i915/i915_crc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/i915/i915_crc.c b/lib/i915/i915_crc.c
index 70b84a815a..cdd3cef6df 100644
--- a/lib/i915/i915_crc.c
+++ b/lib/i915/i915_crc.c
@@ -244,10 +244,11 @@ uint32_t i915_crc32(int i915, uint64_t ahnd, const intel_ctx_t *ctx,
 	uint64_t bb_offset, table_offset, data_offset;
 	uint32_t bb, table, crc, table_size = 4096;
 	uint32_t *ptr;
+	uint32_t region = gem_has_lmem(i915) ? REGION_LMEM(0) : REGION_SMEM;
 
 	igt_assert(data_size % 4 == 0);
 
-	table = gem_create_in_memory_regions(i915, table_size, REGION_LMEM(0));
+	table = gem_create_in_memory_regions(i915, table_size, region);
 	gem_write(i915, table, 0, igt_crc32_tab, sizeof(igt_crc32_tab));
 
 	table_offset = get_offset(ahnd, table, table_size, 0);
@@ -261,7 +262,7 @@ uint32_t i915_crc32(int i915, uint64_t ahnd, const intel_ctx_t *ctx,
 	obj[1].flags = EXEC_OBJECT_PINNED;
 	obj[1].handle = data_handle;
 
-	bb = gem_create_in_memory_regions(i915, BBSIZE, REGION_LMEM(0));
+	bb = gem_create_in_memory_regions(i915, BBSIZE, region);
 	bb_offset = get_offset(ahnd, bb, BBSIZE, 0);
 	fill_batch(i915, bb, bb_offset, table_offset, data_offset, data_size);
 	obj[2].offset = bb_offset;
-- 
2.34.1



More information about the igt-dev mailing list