[igt-dev] [PATCH i-g-t] lib/bufops: add surface array to cover ccs pgtable

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon Jul 6 13:08:42 UTC 2020


Rendercopy for gen12+ requires additional aux pgtable. Alter bufops
and tests to use surface[] and ccs[] instead aux. This step is
required to properly rewrite handling aux pgtable to use with
intel_bb.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/gpu_cmds.c              |   4 +-
 lib/intel_batchbuffer.c     |   4 +-
 lib/intel_bufops.c          | 105 ++++++++++++++++++------------------
 lib/intel_bufops.h          |  23 +++++---
 lib/rendercopy_bufmgr.c     |  12 ++---
 tests/i915/api_intel_bb.c   |  58 ++++++++++----------
 tests/i915/gem_gpgpu_fill.c |  14 ++---
 tests/i915/gem_media_fill.c |  12 ++---
 tests/i915/gem_media_vme.c  |   2 +-
 tests/i915/i915_pm_sseu.c   |   9 ++--
 10 files changed, 127 insertions(+), 116 deletions(-)

diff --git a/lib/gpu_cmds.c b/lib/gpu_cmds.c
index 81156d25..a45a9048 100644
--- a/lib/gpu_cmds.c
+++ b/lib/gpu_cmds.c
@@ -116,7 +116,7 @@ gen7_fill_surface_state(struct intel_bb *ibb,
 
 	ss->ss2.height = intel_buf_height(buf) - 1;
 	ss->ss2.width  = intel_buf_width(buf) - 1;
-	ss->ss3.pitch  = buf->stride - 1;
+	ss->ss3.pitch  = buf->surface[0].stride - 1;
 
 	ss->ss7.shader_chanel_select_r = 4;
 	ss->ss7.shader_chanel_select_g = 5;
@@ -168,7 +168,7 @@ gen8_fill_surface_state(struct intel_bb *ibb,
 
 	ss->ss2.height = intel_buf_height(buf) - 1;
 	ss->ss2.width  = intel_buf_width(buf) - 1;
-	ss->ss3.pitch  = buf->stride - 1;
+	ss->ss3.pitch  = buf->surface[0].stride - 1;
 
 	ss->ss7.shader_chanel_select_r = 4;
 	ss->ss7.shader_chanel_select_g = 5;
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index b6ca8e25..57fdbbbc 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -2030,8 +2030,8 @@ void intel_bb_emit_blt_copy(struct intel_bb *ibb,
 
 	igt_assert(bpp*(src_x1 + width) <= 8*src_pitch);
 	igt_assert(bpp*(dst_x1 + width) <= 8*dst_pitch);
-	igt_assert(src_pitch * (src_y1 + height) <= src->size);
-	igt_assert(dst_pitch * (dst_y1 + height) <= dst->size);
+	igt_assert(src_pitch * (src_y1 + height) <= src->surface[0].size);
+	igt_assert(dst_pitch * (dst_y1 + height) <= dst->surface[0].size);
 
 	if (gen >= 4 && src->tiling != I915_TILING_NONE) {
 		src_pitch /= 4;
diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index 6c8bc6fb..2a48fb0c 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -88,9 +88,9 @@
 #define TILE_Yf     TILE_DEF(I915_TILING_Yf)
 #define TILE_Ys     TILE_DEF(I915_TILING_Ys)
 
-#define CCS_OFFSET(buf) (buf->aux.offset)
+#define CCS_OFFSET(buf) (buf->ccs[0].offset)
 #define CCS_SIZE(gen, buf) \
-	(intel_buf_aux_width(gen, buf) * intel_buf_aux_height(gen, buf))
+	(intel_buf_ccs_width(gen, buf) * intel_buf_ccs_height(gen, buf))
 
 typedef void (*bo_copy)(struct buf_ops *, struct intel_buf *, uint32_t *);
 
@@ -216,7 +216,8 @@ static void set_hw_tiled(struct buf_ops *bops, struct intel_buf *buf)
 		return;
 
 	igt_assert_eq(__set_tiling(bops->fd,
-				   buf->handle, buf->tiling, buf->stride,
+				   buf->handle, buf->tiling,
+				   buf->surface[0].stride,
 				   &ret_tiling, &ret_swizzle),
 		      0);
 
@@ -409,10 +410,10 @@ static void *mmap_write(int fd, struct intel_buf *buf)
 	void *map = NULL;
 
 	if (is_cache_coherent(fd, buf->handle)) {
-		map = __gem_mmap_offset__cpu(fd, buf->handle, 0, buf->size,
+		map = __gem_mmap_offset__cpu(fd, buf->handle, 0, buf->surface[0].size,
 					     PROT_READ | PROT_WRITE);
 		if (!map)
-			map = __gem_mmap__cpu(fd, buf->handle, 0, buf->size,
+			map = __gem_mmap__cpu(fd, buf->handle, 0, buf->surface[0].size,
 					      PROT_READ | PROT_WRITE);
 
 		if (map)
@@ -422,10 +423,10 @@ static void *mmap_write(int fd, struct intel_buf *buf)
 	}
 
 	if (!map) {
-		map = __gem_mmap_offset__wc(fd, buf->handle, 0, buf->size,
+		map = __gem_mmap_offset__wc(fd, buf->handle, 0, buf->surface[0].size,
 					    PROT_READ | PROT_WRITE);
 		if (!map)
-			map = gem_mmap__wc(fd, buf->handle, 0, buf->size,
+			map = gem_mmap__wc(fd, buf->handle, 0, buf->surface[0].size,
 					   PROT_READ | PROT_WRITE);
 
 		gem_set_domain(fd, buf->handle,
@@ -441,9 +442,9 @@ static void *mmap_read(int fd, struct intel_buf *buf)
 
 	if (gem_has_llc(fd) || is_cache_coherent(fd, buf->handle)) {
 		map = __gem_mmap_offset__cpu(fd, buf->handle, 0,
-					     buf->size, PROT_READ);
+					     buf->surface[0].size, PROT_READ);
 		if (!map)
-			map = __gem_mmap__cpu(fd, buf->handle, 0, buf->size,
+			map = __gem_mmap__cpu(fd, buf->handle, 0, buf->surface[0].size,
 					      PROT_READ);
 
 		if (map)
@@ -451,10 +452,10 @@ static void *mmap_read(int fd, struct intel_buf *buf)
 	}
 
 	if (!map) {
-		map = __gem_mmap_offset__wc(fd, buf->handle, 0, buf->size,
+		map = __gem_mmap_offset__wc(fd, buf->handle, 0, buf->surface[0].size,
 					    PROT_READ);
 		if (!map)
-			map = gem_mmap__wc(fd, buf->handle, 0, buf->size,
+			map = gem_mmap__wc(fd, buf->handle, 0, buf->surface[0].size,
 					   PROT_READ);
 
 		gem_set_domain(fd, buf->handle, I915_GEM_DOMAIN_WC, 0);
@@ -474,7 +475,7 @@ static void __copy_linear_to(int fd, struct intel_buf *buf,
 
 	for (int y = 0; y < height; y++) {
 		for (int x = 0; x < width; x++) {
-			uint32_t *ptr = fn(map, x, y, buf->stride, buf->bpp/8);
+			uint32_t *ptr = fn(map, x, y, buf->surface[0].stride, buf->bpp/8);
 
 			if (swizzle)
 				ptr = from_user_pointer(swizzle_addr(ptr,
@@ -483,7 +484,7 @@ static void __copy_linear_to(int fd, struct intel_buf *buf,
 		}
 	}
 
-	munmap(map, buf->size);
+	munmap(map, buf->surface[0].size);
 }
 
 static void copy_linear_to_x(struct buf_ops *bops, struct intel_buf *buf,
@@ -524,7 +525,7 @@ static void __copy_to_linear(int fd, struct intel_buf *buf,
 
 	for (int y = 0; y < height; y++) {
 		for (int x = 0; x < width; x++) {
-			uint32_t *ptr = fn(map, x, y, buf->stride, buf->bpp/8);
+			uint32_t *ptr = fn(map, x, y, buf->surface[0].stride, buf->bpp/8);
 
 			if (swizzle)
 				ptr = from_user_pointer(swizzle_addr(ptr,
@@ -533,7 +534,7 @@ static void __copy_to_linear(int fd, struct intel_buf *buf,
 		}
 	}
 
-	munmap(map, buf->size);
+	munmap(map, buf->surface[0].size);
 }
 
 static void copy_x_to_linear(struct buf_ops *bops, struct intel_buf *buf,
@@ -572,14 +573,14 @@ static void copy_linear_to_gtt(struct buf_ops *bops, struct intel_buf *buf,
 	DEBUGFN();
 
 	map = gem_mmap__gtt(bops->fd, buf->handle,
-			    buf->size, PROT_READ | PROT_WRITE);
+			    buf->surface[0].size, PROT_READ | PROT_WRITE);
 
 	gem_set_domain(bops->fd, buf->handle,
 		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 
-	memcpy(map, linear, buf->size);
+	memcpy(map, linear, buf->surface[0].size);
 
-	munmap(map, buf->size);
+	munmap(map, buf->surface[0].size);
 }
 
 static void copy_gtt_to_linear(struct buf_ops *bops, struct intel_buf *buf,
@@ -590,14 +591,14 @@ static void copy_gtt_to_linear(struct buf_ops *bops, struct intel_buf *buf,
 	DEBUGFN();
 
 	map = gem_mmap__gtt(bops->fd, buf->handle,
-			    buf->size, PROT_READ);
+			    buf->surface[0].size, PROT_READ);
 
 	gem_set_domain(bops->fd, buf->handle,
 		       I915_GEM_DOMAIN_GTT, 0);
 
-	igt_memcpy_from_wc(linear, map, buf->size);
+	igt_memcpy_from_wc(linear, map, buf->surface[0].size);
 
-	munmap(map, buf->size);
+	munmap(map, buf->surface[0].size);
 }
 
 static void copy_linear_to_wc(struct buf_ops *bops, struct intel_buf *buf,
@@ -608,8 +609,8 @@ static void copy_linear_to_wc(struct buf_ops *bops, struct intel_buf *buf,
 	DEBUGFN();
 
 	map = mmap_write(bops->fd, buf);
-	memcpy(map, linear, buf->size);
-	munmap(map, buf->size);
+	memcpy(map, linear, buf->surface[0].size);
+	munmap(map, buf->surface[0].size);
 }
 
 static void copy_wc_to_linear(struct buf_ops *bops, struct intel_buf *buf,
@@ -620,8 +621,8 @@ static void copy_wc_to_linear(struct buf_ops *bops, struct intel_buf *buf,
 	DEBUGFN();
 
 	map = mmap_read(bops->fd, buf);
-	igt_memcpy_from_wc(linear, map, buf->size);
-	munmap(map, buf->size);
+	igt_memcpy_from_wc(linear, map, buf->surface[0].size);
+	munmap(map, buf->surface[0].size);
 }
 
 void intel_buf_to_linear(struct buf_ops *bops, struct intel_buf *buf,
@@ -723,25 +724,25 @@ static void __intel_buf_init(struct buf_ops *bops,
 		 * turn mapped by one L1 AUX page table entry.
 		 */
 		if (bops->intel_gen >= 12)
-			buf->stride = ALIGN(width * (bpp / 8), 128 * 4);
+			buf->surface[0].stride = ALIGN(width * (bpp / 8), 128 * 4);
 		else
-			buf->stride = ALIGN(width * (bpp / 8), 128);
+			buf->surface[0].stride = ALIGN(width * (bpp / 8), 128);
 
 		if (bops->intel_gen >= 12)
 			height = ALIGN(height, 4 * 32);
 
-		buf->size = buf->stride * height;
+		buf->surface[0].size = buf->surface[0].stride * height;
 		buf->tiling = tiling;
 		buf->bpp = bpp;
 		buf->compression = compression;
 
-		aux_width = intel_buf_aux_width(bops->intel_gen, buf);
-		aux_height = intel_buf_aux_height(bops->intel_gen, buf);
+		aux_width = intel_buf_ccs_width(bops->intel_gen, buf);
+		aux_height = intel_buf_ccs_height(bops->intel_gen, buf);
 
-		buf->aux.offset = buf->stride * ALIGN(height, 32);
-		buf->aux.stride = aux_width;
+		buf->ccs[0].offset = buf->surface[0].stride * ALIGN(height, 32);
+		buf->ccs[0].stride = aux_width;
 
-		size = buf->aux.offset + aux_width * aux_height;
+		size = buf->ccs[0].offset + aux_width * aux_height;
 	} else {
 		if (buf->tiling) {
 			devid =  intel_get_drm_devid(bops->fd);
@@ -754,16 +755,16 @@ static void __intel_buf_init(struct buf_ops *bops,
 			else
 				tile_width = 128;
 
-			buf->stride = ALIGN(width * (bpp / 8), tile_width);
+			buf->surface[0].stride = ALIGN(width * (bpp / 8), tile_width);
 		} else {
-			buf->stride = ALIGN(width * (bpp / 8), alignment ?: 4);
+			buf->surface[0].stride = ALIGN(width * (bpp / 8), alignment ?: 4);
 		}
 
-		buf->size = buf->stride * height;
+		buf->surface[0].size = buf->surface[0].stride * height;
 		buf->tiling = tiling;
 		buf->bpp = bpp;
 
-		size = buf->stride * ALIGN(height, 32);
+		size = buf->surface[0].stride * ALIGN(height, 32);
 	}
 
 	if (handle)
@@ -875,14 +876,14 @@ void intel_buf_print(const struct intel_buf *buf)
 	igt_info("[%u]: w: %u, h: %u, stride: %u, size: %u, bo-size: %u, "
 		 "bpp: %u, tiling: %u, compress: %u\n",
 		 buf->handle, intel_buf_width(buf), intel_buf_height(buf),
-		 buf->stride, buf->size,
+		 buf->surface[0].stride, buf->surface[0].size,
 		 intel_buf_bo_size(buf), buf->bpp,
 		 buf->tiling, buf->compression);
-	igt_info(" aux <offset: %u, stride: %u, w: %u, h: %u> cc <offset: %u>\n",
-		 buf->aux.offset,
-		 intel_buf_aux_width(buf->bops->intel_gen, buf),
-		 intel_buf_aux_height(buf->bops->intel_gen, buf),
-		 buf->aux.stride, buf->cc.offset);
+	igt_info(" ccs <offset: %u, stride: %u, w: %u, h: %u> cc <offset: %u>\n",
+		 buf->ccs[0].offset,
+		 intel_buf_ccs_width(buf->bops->intel_gen, buf),
+		 intel_buf_ccs_height(buf->bops->intel_gen, buf),
+		 buf->ccs[0].stride, buf->cc.offset);
 	igt_info(" addr <offset: %p, ctx: %u>\n",
 		 from_user_pointer(buf->addr.offset), buf->addr.ctx);
 }
@@ -895,7 +896,7 @@ const char *intel_buf_set_name(struct intel_buf *buf, const char *name)
 static void __intel_buf_write_to_png(struct buf_ops *bops,
 				     struct intel_buf *buf,
 				     const char *filename,
-				     bool write_aux)
+				     bool write_ccs)
 {
 	cairo_surface_t *surface;
 	cairo_status_t ret;
@@ -905,11 +906,11 @@ static void __intel_buf_write_to_png(struct buf_ops *bops,
 
 	igt_assert_eq(posix_memalign(&linear, 16, intel_buf_bo_size(buf)), 0);
 
-	format = write_aux ? CAIRO_FORMAT_A8 : CAIRO_FORMAT_RGB24;
-	width = write_aux ? intel_buf_aux_width(gen, buf) : intel_buf_width(buf);
-	height = write_aux ? intel_buf_aux_height(gen, buf) : intel_buf_height(buf);
-	stride = write_aux ? buf->aux.stride : buf->stride;
-	offset = write_aux ? buf->aux.offset : 0;
+	format = write_ccs ? CAIRO_FORMAT_A8 : CAIRO_FORMAT_RGB24;
+	width = write_ccs ? intel_buf_ccs_width(gen, buf) : intel_buf_width(buf);
+	height = write_ccs ? intel_buf_ccs_height(gen, buf) : intel_buf_height(buf);
+	stride = write_ccs ? buf->ccs[0].stride : buf->surface[0].stride;
+	offset = write_ccs ? buf->ccs[0].offset : 0;
 
 	intel_buf_to_linear(bops, buf, linear);
 
@@ -1044,10 +1045,10 @@ static void idempotency_selftest(struct buf_ops *bops, uint32_t tiling)
 
 		linear_to_intel_buf(bops, &buf, (uint32_t *) linear_in);
 		map = __gem_mmap_offset__cpu(bops->fd, buf.handle, 0,
-					   buf.size, PROT_READ);
+					     buf.surface[0].size, PROT_READ);
 		if (!map)
 			map = gem_mmap__cpu(bops->fd, buf.handle, 0,
-					    buf.size, PROT_READ);
+					    buf.surface[0].size, PROT_READ);
 		gem_set_domain(bops->fd, buf.handle, I915_GEM_DOMAIN_CPU, 0);
 		igt_assert(memcmp(linear_in, map, size));
 		munmap(map, size);
@@ -1067,7 +1068,7 @@ static void idempotency_selftest(struct buf_ops *bops, uint32_t tiling)
 
 int intel_buf_bo_size(const struct intel_buf *buf)
 {
-	int offset = CCS_OFFSET(buf) ?: buf->size;
+	int offset = CCS_OFFSET(buf) ?: buf->surface[0].size;
 	int ccs_size =
 		buf->compression ? CCS_SIZE(buf->bops->intel_gen, buf) : 0;
 
diff --git a/lib/intel_bufops.h b/lib/intel_bufops.h
index d332f87f..f4f3751e 100644
--- a/lib/intel_bufops.h
+++ b/lib/intel_bufops.h
@@ -3,6 +3,7 @@
 
 #include <stdint.h>
 #include "igt_aux.h"
+#include "intel_batchbuffer.h"
 
 struct buf_ops;
 
@@ -11,16 +12,19 @@ struct buf_ops;
 struct intel_buf {
 	struct buf_ops *bops;
 	uint32_t handle;
-	uint32_t stride;
 	uint32_t tiling;
 	uint32_t bpp;
-	uint32_t size;
 	uint32_t compression;
 	uint32_t swizzle_mode;
 	struct {
 		uint32_t offset;
 		uint32_t stride;
-	} aux;
+		uint32_t size;
+	} surface[2];
+	struct {
+		uint32_t offset;
+		uint32_t stride;
+	} ccs[2];
 	struct {
 		uint32_t offset;
 	} cc;
@@ -33,18 +37,23 @@ struct intel_buf {
 	char name[INTEL_BUF_NAME_MAXSIZE + 1];
 };
 
+static inline bool intel_buf_compressed(const struct intel_buf *buf)
+{
+	return buf->compression != I915_COMPRESSION_NONE;
+}
+
 static inline unsigned int intel_buf_width(const struct intel_buf *buf)
 {
-	return buf->stride / (buf->bpp / 8);
+	return buf->surface[0].stride / (buf->bpp / 8);
 }
 
 static inline unsigned int intel_buf_height(const struct intel_buf *buf)
 {
-	return buf->size / buf->stride;
+	return buf->surface[0].size / buf->surface[0].stride;
 }
 
 static inline unsigned int
-intel_buf_aux_width(int gen, const struct intel_buf *buf)
+intel_buf_ccs_width(int gen, const struct intel_buf *buf)
 {
 	/*
 	 * GEN12+: The AUX CCS unit size is 64 bytes mapping 4 main surface
@@ -58,7 +67,7 @@ intel_buf_aux_width(int gen, const struct intel_buf *buf)
 }
 
 static inline unsigned int
-intel_buf_aux_height(int gen, const struct intel_buf *buf)
+intel_buf_ccs_height(int gen, const struct intel_buf *buf)
 {
 	/*
 	 * GEN12+: The AUX CCS unit size is 64 bytes mapping 4 main surface
diff --git a/lib/rendercopy_bufmgr.c b/lib/rendercopy_bufmgr.c
index dc38d530..5cb588fa 100644
--- a/lib/rendercopy_bufmgr.c
+++ b/lib/rendercopy_bufmgr.c
@@ -62,13 +62,13 @@ struct rendercopy_bufmgr {
 static void __igt_buf_to_intel_buf(struct igt_buf *buf, struct intel_buf *ibuf)
 {
 	ibuf->handle = buf->bo->handle;
-	ibuf->stride = buf->surface[0].stride;
+	ibuf->surface[0].stride = buf->surface[0].stride;
 	ibuf->tiling = buf->tiling;
 	ibuf->bpp = buf->bpp;
-	ibuf->size = buf->surface[0].size;
+	ibuf->surface[0].size = buf->surface[0].size;
 	ibuf->compression = buf->compression;
-	ibuf->aux.offset = buf->ccs[0].offset;
-	ibuf->aux.stride = buf->ccs[0].stride;
+	ibuf->ccs[0].offset = buf->ccs[0].offset;
+	ibuf->ccs[0].stride = buf->ccs[0].stride;
 }
 
 void igt_buf_to_linear(struct rendercopy_bufmgr *bmgr, struct igt_buf *buf,
@@ -166,6 +166,6 @@ void igt_buf_init(struct rendercopy_bufmgr *bmgr, struct igt_buf *buf,
 				    width, height, bpp, 0,
 				    tiling, compression);
 
-	buf->ccs[0].offset = ibuf.aux.offset;
-	buf->ccs[0].stride = ibuf.aux.stride;
+	buf->ccs[0].offset = ibuf.ccs[0].offset;
+	buf->ccs[0].stride = ibuf.ccs[0].stride;
 }
diff --git a/tests/i915/api_intel_bb.c b/tests/i915/api_intel_bb.c
index d16b558c..6967fc5d 100644
--- a/tests/i915/api_intel_bb.c
+++ b/tests/i915/api_intel_bb.c
@@ -74,13 +74,13 @@ static void fill_buf(struct intel_buf *buf, uint8_t color)
 	int i915 = buf_ops_get_fd(buf->bops);
 	int i;
 
-	ptr = gem_mmap__device_coherent(i915, buf->handle, 0, buf->size,
-					PROT_WRITE);
+	ptr = gem_mmap__device_coherent(i915, buf->handle, 0,
+					buf->surface[0].size, PROT_WRITE);
 
-	for (i = 0; i < buf->size; i++)
+	for (i = 0; i < buf->surface[0].size; i++)
 		ptr[i] = color;
 
-	munmap(ptr, buf->size);
+	munmap(ptr, buf->surface[0].size);
 }
 
 static void check_buf(struct intel_buf *buf, uint8_t color)
@@ -89,13 +89,13 @@ static void check_buf(struct intel_buf *buf, uint8_t color)
 	int i915 = buf_ops_get_fd(buf->bops);
 	int i;
 
-	ptr = gem_mmap__device_coherent(i915, buf->handle, 0, buf->size,
-					PROT_READ);
+	ptr = gem_mmap__device_coherent(i915, buf->handle, 0,
+					buf->surface[0].size, PROT_READ);
 
-	for (i = 0; i < buf->size; i++)
+	for (i = 0; i < buf->surface[0].size; i++)
 		igt_assert(ptr[i] == color);
 
-	munmap(ptr, buf->size);
+	munmap(ptr, buf->surface[0].size);
 }
 
 
@@ -118,12 +118,12 @@ static void print_buf(struct intel_buf *buf, const char *name)
 	uint8_t *ptr;
 	int i915 = buf_ops_get_fd(buf->bops);
 
-	ptr = gem_mmap__device_coherent(i915, buf->handle, 0, buf->size,
-					PROT_READ);
+	ptr = gem_mmap__device_coherent(i915, buf->handle, 0,
+					buf->surface[0].size, PROT_READ);
 	igt_debug("[%s] Buf handle: %d, size: %d, v: 0x%02x, presumed_addr: %p\n",
-		  name, buf->handle, buf->size, ptr[0],
+		  name, buf->handle, buf->surface[0].size, ptr[0],
 			from_user_pointer(buf->addr.offset));
-	munmap(ptr, buf->size);
+	munmap(ptr, buf->surface[0].size);
 }
 
 static void simple_bb(struct buf_ops *bops, bool use_context)
@@ -194,7 +194,7 @@ static void __emit_blit(struct intel_bb *ibb,
 		     XY_SRC_COPY_BLT_WRITE_ALPHA |
 		     XY_SRC_COPY_BLT_WRITE_RGB |
 		     (6 + 2 * has_64b_reloc));
-	intel_bb_out(ibb, 3 << 24 | 0xcc << 16 | dst->stride);
+	intel_bb_out(ibb, 3 << 24 | 0xcc << 16 | dst->surface[0].stride);
 	intel_bb_out(ibb, 0);
 	intel_bb_out(ibb, intel_buf_height(dst) << 16 | intel_buf_width(dst));
 	intel_bb_emit_reloc_fenced(ibb, dst->handle,
@@ -202,7 +202,7 @@ static void __emit_blit(struct intel_bb *ibb,
 				   I915_GEM_DOMAIN_RENDER,
 				   0, dst->addr.offset);
 	intel_bb_out(ibb, 0);
-	intel_bb_out(ibb, src->stride);
+	intel_bb_out(ibb, src->surface[0].stride);
 	intel_bb_emit_reloc_fenced(ibb, src->handle,
 				   I915_GEM_DOMAIN_RENDER, 0,
 				   0, src->addr.offset);
@@ -351,13 +351,13 @@ static void scratch_buf_draw_pattern(struct buf_ops *bops,
 	cairo_t *cr;
 	void *linear;
 
-	linear = alloc_aligned(buf->size);
+	linear = alloc_aligned(buf->surface[0].size);
 
 	surface = cairo_image_surface_create_for_data(linear,
 						      CAIRO_FORMAT_RGB24,
 						      intel_buf_width(buf),
 						      intel_buf_height(buf),
-						      buf->stride);
+						      buf->surface[0].stride);
 
 	cr = cairo_create(surface);
 
@@ -435,21 +435,21 @@ static int compare_bufs(struct intel_buf *buf1, struct intel_buf *buf2,
 	void *ptr1, *ptr2;
 	int fd1, fd2, ret;
 
-	igt_assert(buf1->size == buf2->size);
+	igt_assert(buf1->surface[0].size == buf2->surface[0].size);
 
 	fd1 = buf_ops_get_fd(buf1->bops);
 	fd2 = buf_ops_get_fd(buf2->bops);
 
-	ptr1 = gem_mmap__device_coherent(fd1, buf1->handle, 0, buf1->size,
-					 PROT_READ);
-	ptr2 = gem_mmap__device_coherent(fd2, buf2->handle, 0, buf2->size,
-					 PROT_READ);
-	ret = memcmp(ptr1, ptr2, buf1->size);
+	ptr1 = gem_mmap__device_coherent(fd1, buf1->handle, 0,
+					 buf1->surface[0].size, PROT_READ);
+	ptr2 = gem_mmap__device_coherent(fd2, buf2->handle, 0,
+					 buf2->surface[0].size, PROT_READ);
+	ret = memcmp(ptr1, ptr2, buf1->surface[0].size);
 	if (detail_compare)
-		ret = compare_detail(ptr1, ptr2, buf1->size);
+		ret = compare_detail(ptr1, ptr2, buf1->surface[0].size);
 
-	munmap(ptr1, buf1->size);
-	munmap(ptr2, buf2->size);
+	munmap(ptr1, buf1->surface[0].size);
+	munmap(ptr2, buf2->surface[0].size);
 
 	return ret;
 }
@@ -484,15 +484,15 @@ static int __do_intel_bb_blit(struct buf_ops *bops, uint32_t tiling)
 				 0, 0, width, height, 0);
 
 	intel_bb_blt_copy(ibb,
-			  &src, 0, 0, src.stride,
-			  &dst, 0, 0, dst.stride,
+			  &src, 0, 0, src.surface[0].stride,
+			  &dst, 0, 0, dst.surface[0].stride,
 			  intel_buf_width(&dst),
 			  intel_buf_height(&dst),
 			  dst.bpp);
 
 	intel_bb_blt_copy(ibb,
-			  &dst, 0, 0, dst.stride,
-			  &final, 0, 0, final.stride,
+			  &dst, 0, 0, dst.surface[0].stride,
+			  &final, 0, 0, final.surface[0].stride,
 			  intel_buf_width(&dst),
 			  intel_buf_height(&dst),
 			  dst.bpp);
diff --git a/tests/i915/gem_gpgpu_fill.c b/tests/i915/gem_gpgpu_fill.c
index e1d3a288..c605629f 100644
--- a/tests/i915/gem_gpgpu_fill.c
+++ b/tests/i915/gem_gpgpu_fill.c
@@ -78,13 +78,13 @@ create_buf(data_t *data, int width, int height, uint8_t color)
 	intel_buf_init(data->bops, buf, width/4, height, 32, 0,
 		       I915_TILING_NONE, 0);
 
-	ptr = gem_mmap__cpu_coherent(data->drm_fd,
-				     buf->handle, 0, buf->size, PROT_WRITE);
+	ptr = gem_mmap__cpu_coherent(data->drm_fd, buf->handle, 0,
+				     buf->surface[0].size, PROT_WRITE);
 
-	for (i = 0; i < buf->size; i++)
+	for (i = 0; i < buf->surface[0].size; i++)
 		ptr[i] = color;
 
-	munmap(ptr, buf->size);
+	munmap(ptr, buf->surface[0].size);
 
 	return buf;
 }
@@ -106,8 +106,8 @@ static void gpgpu_fill(data_t *data, igt_fillfunc_t fill)
 	int i, j;
 
 	buf = create_buf(data, WIDTH, HEIGHT, COLOR_C4);
-	ptr = gem_mmap__device_coherent(data->drm_fd, buf->handle,
-					0, buf->size, PROT_READ);
+	ptr = gem_mmap__device_coherent(data->drm_fd, buf->handle, 0,
+					buf->surface[0].size, PROT_READ);
 	for (i = 0; i < WIDTH; i++)
 		for (j = 0; j < HEIGHT; j++)
 			buf_check(ptr, i, j, COLOR_C4);
@@ -121,7 +121,7 @@ static void gpgpu_fill(data_t *data, igt_fillfunc_t fill)
 			else
 				buf_check(ptr, i, j, COLOR_C4);
 
-	munmap(ptr, buf->size);
+	munmap(ptr, buf->surface[0].size);
 }
 
 igt_simple_main
diff --git a/tests/i915/gem_media_fill.c b/tests/i915/gem_media_fill.c
index 934a9402..24d17fab 100644
--- a/tests/i915/gem_media_fill.c
+++ b/tests/i915/gem_media_fill.c
@@ -80,13 +80,13 @@ create_buf(data_t *data, int width, int height, uint8_t color)
 	intel_buf_init(data->bops, buf, width/4, height, 32, 0,
 		       I915_TILING_NONE, 0);
 
-	ptr = gem_mmap__cpu_coherent(data->drm_fd,
-				     buf->handle, 0, buf->size, PROT_WRITE);
+	ptr = gem_mmap__cpu_coherent(data->drm_fd, buf->handle, 0,
+				     buf->surface[0].size, PROT_WRITE);
 
-	for (i = 0; i < buf->size; i++)
+	for (i = 0; i < buf->surface[0].size; i++)
 		ptr[i] = color;
 
-	munmap(ptr, buf->size);
+	munmap(ptr, buf->surface[0].size);
 
 	return buf;
 }
@@ -109,7 +109,7 @@ static void media_fill(data_t *data, igt_fillfunc_t fill)
 
 	buf = create_buf(data, WIDTH, HEIGHT, COLOR_C4);
 	ptr = gem_mmap__device_coherent(data->drm_fd, buf->handle,
-					0, buf->size, PROT_READ);
+					0, buf->surface[0].size, PROT_READ);
 	for (i = 0; i < WIDTH; i++)
 		for (j = 0; j < HEIGHT; j++)
 			buf_check(ptr, i, j, COLOR_C4);
@@ -123,7 +123,7 @@ static void media_fill(data_t *data, igt_fillfunc_t fill)
 			else
 				buf_check(ptr, i, j, COLOR_C4);
 
-	munmap(ptr, buf->size);
+	munmap(ptr, buf->surface[0].size);
 }
 
 igt_simple_main
diff --git a/tests/i915/gem_media_vme.c b/tests/i915/gem_media_vme.c
index 391a76d9..3ea70386 100644
--- a/tests/i915/gem_media_vme.c
+++ b/tests/i915/gem_media_vme.c
@@ -116,7 +116,7 @@ igt_simple_main
 	/* This comes from OUTPUT_SIZE requirements */
 	intel_buf_init(bops, &dst, 56, sizeof(int), 8, 56,
 		       I915_TILING_NONE, 0);
-	dst.stride = 1;
+	dst.surface[0].stride = 1;
 
 	ctx = gem_context_create(drm_fd);
 	igt_assert(ctx);
diff --git a/tests/i915/i915_pm_sseu.c b/tests/i915/i915_pm_sseu.c
index 30b7cfec..1b428c9b 100644
--- a/tests/i915/i915_pm_sseu.c
+++ b/tests/i915/i915_pm_sseu.c
@@ -258,13 +258,14 @@ gem_get_target_spins(double dt)
 			       I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
 
 		ptr = gem_mmap__device_coherent(gem.drm_fd, gem.buf.handle,
-						0, gem.buf.size, PROT_READ);
+						0, gem.buf.surface[0].size,
+						PROT_READ);
 
 		clock_gettime(CLOCK_MONOTONIC, &tdone);
 
 		gem_check_spin(ptr, spins);
 
-		munmap(ptr, gem.buf.size);
+		munmap(ptr, gem.buf.surface[0].size);
 
 		cur_dt = to_dt(&tstart, &tdone);
 		if (cur_dt > dt)
@@ -361,9 +362,9 @@ full_enable(void)
 	gem_set_domain(gem.drm_fd, gem.buf.handle,
 		       I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
 	ptr = gem_mmap__device_coherent(gem.drm_fd, gem.buf.handle,
-					0, gem.buf.size, PROT_READ);
+					0, gem.buf.surface[0].size, PROT_READ);
 	gem_check_spin(ptr, spins);
-	munmap(ptr, gem.buf.size);
+	munmap(ptr, gem.buf.surface[0].size);
 
 	check_full_enable(&stat);
 }
-- 
2.26.0



More information about the igt-dev mailing list