All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Brian Welty <brian.welty@intel.com>
Subject: [igt-dev] [PATCH v2 2/3] tests/gem_render_copy: Adjust the tgl+ compressed buf alignments
Date: Tue,  5 Nov 2019 21:34:53 +0200	[thread overview]
Message-ID: <20191105193454.4611-2-imre.deak@intel.com> (raw)
In-Reply-To: <20191105193454.4611-1-imre.deak@intel.com>

GEN12+ the render and media compressed surface have different alignment
requiremens than ICL, so adjust that.

v2:
- Clarify a bit the comments about AUX CCS units vs. main surface tiles.
  (Ville)

Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Brian Welty <brian.welty@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 tests/i915/gem_render_copy.c | 51 ++++++++++++++++++++++++++++--------
 1 file changed, 40 insertions(+), 11 deletions(-)

diff --git a/tests/i915/gem_render_copy.c b/tests/i915/gem_render_copy.c
index 261833d2..fd139e91 100644
--- a/tests/i915/gem_render_copy.c
+++ b/tests/i915/gem_render_copy.c
@@ -218,21 +218,37 @@ static void scratch_buf_write_to_png(data_t *data, struct igt_buf *buf,
 	free(linear);
 }
 
-static int scratch_buf_aux_width(const struct igt_buf *buf)
+static int scratch_buf_aux_width(uint32_t devid, const struct igt_buf *buf)
 {
+	/*
+	 * GEN12+: The AUX CCS unit size is 64 bytes mapping 4 main surface
+	 * tiles. Thus the width of the CCS unit is 4*32=128 pixels on the
+	 * main surface.
+	 */
+	if (intel_gen(devid) >= 12)
+		return DIV_ROUND_UP(igt_buf_width(buf), 128) * 64;
+
 	return DIV_ROUND_UP(igt_buf_width(buf), 1024) * 128;
 }
 
-static int scratch_buf_aux_height(const struct igt_buf *buf)
+static int scratch_buf_aux_height(uint32_t devid, const struct igt_buf *buf)
 {
+	/*
+	 * GEN12+: The AUX CCS unit size is 64 bytes mapping 4 main surface
+	 * tiles. Thus the height of the CCS unit is 32 pixel rows on the main
+	 * surface.
+	 */
+	if (intel_gen(devid) >= 12)
+		return DIV_ROUND_UP(igt_buf_height(buf), 32);
+
 	return DIV_ROUND_UP(igt_buf_height(buf), 512) * 32;
 }
 
 static void *linear_copy_aux(data_t *data, struct igt_buf *buf)
 {
 	void *map, *linear;
-	int aux_size = scratch_buf_aux_width(buf) *
-		scratch_buf_aux_height(buf);
+	int aux_size = scratch_buf_aux_width(data->devid, buf) *
+		scratch_buf_aux_height(data->devid, buf);
 
 	igt_assert_eq(posix_memalign(&linear, 16, aux_size), 0);
 
@@ -261,8 +277,8 @@ static void scratch_buf_aux_write_to_png(data_t *data,
 
 	surface = cairo_image_surface_create_for_data(linear,
 						      CAIRO_FORMAT_A8,
-						      scratch_buf_aux_width(buf),
-						      scratch_buf_aux_height(buf),
+						      scratch_buf_aux_width(data->devid, buf),
+						      scratch_buf_aux_height(data->devid, buf),
 						      buf->aux.stride);
 	ret = cairo_surface_write_to_png(surface, make_filename(filename));
 	igt_assert(ret == CAIRO_STATUS_SUCCESS);
@@ -413,13 +429,26 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
 		igt_assert(tiling == I915_TILING_Y ||
 			   tiling == I915_TILING_Yf);
 
-		buf->stride = ALIGN(width * (bpp / 8), 128);
+		/*
+		 * On GEN12+ we align the main surface to 4 * 4 main surface
+		 * tiles, which is 64kB. These 16 tiles are mapped by 4 AUX
+		 * CCS units, that is 4 * 64 bytes. These 4 CCS units are in
+		 * turn mapped by one L1 AUX page table entry.
+		 */
+		if (intel_gen(data->devid) >= 12)
+			buf->stride = ALIGN(width * (bpp / 8), 128 * 4);
+		else
+			buf->stride = ALIGN(width * (bpp / 8), 128);
+
+		if (intel_gen(data->devid) >= 12)
+			height = ALIGN(height, 4 * 32);
+
 		buf->size = buf->stride * height;
 		buf->tiling = tiling;
 		buf->bpp = bpp;
 
-		aux_width = scratch_buf_aux_width(buf);
-		aux_height = scratch_buf_aux_height(buf);
+		aux_width = scratch_buf_aux_width(data->devid, buf);
+		aux_height = scratch_buf_aux_height(data->devid, buf);
 
 		buf->aux.offset = buf->stride * ALIGN(height, 32);
 		buf->aux.stride = aux_width;
@@ -525,8 +554,8 @@ scratch_buf_check_all(data_t *data,
 static void scratch_buf_aux_check(data_t *data,
 				  struct igt_buf *buf)
 {
-	int aux_size = scratch_buf_aux_width(buf) *
-		scratch_buf_aux_height(buf);
+	int aux_size = scratch_buf_aux_width(data->devid, buf) *
+		scratch_buf_aux_height(data->devid, buf);
 	uint8_t *linear;
 	int i;
 
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-11-05 19:36 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 19:34 [igt-dev] [PATCH v2 1/3] lib/rendercopy: Add AUX page table support Imre Deak
2019-11-05 19:34 ` Imre Deak [this message]
2019-11-05 19:34 ` [igt-dev] [PATCH v2 3/3] tests/gem_render_copy: Add compressed src to compressed dst subtests Imre Deak
2019-11-08 15:09   ` [igt-dev] [PATCH v3 " Imre Deak
2019-11-13 14:32     ` [igt-dev] [PATCH v4 " Imre Deak
2019-11-12 20:15   ` [igt-dev] [PATCH v2 " Brian Welty
2019-11-13 14:34     ` Imre Deak
2019-11-05 20:14 ` [igt-dev] ✗ GitLab.Pipeline: failure for series starting with [v2,1/3] lib/rendercopy: Add AUX page table support Patchwork
2019-11-05 20:27 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-11-05 21:42 ` [igt-dev] [PATCH v3 1/3] " Imre Deak
2019-11-05 22:24   ` Chris Wilson
2019-11-05 22:33     ` Imre Deak
2019-11-06  6:53   ` [igt-dev] [PATCH v4 " Imre Deak
2019-11-07 18:36     ` [igt-dev] [PATCH v5 " Imre Deak
2019-11-06 11:11   ` [igt-dev] [PATCH v3 " Chris Wilson
2019-11-06 16:00     ` Imre Deak
2019-11-06 16:14       ` Chris Wilson
2019-11-06 16:36         ` Imre Deak
2019-11-06 17:02           ` Chris Wilson
2019-11-06 19:04             ` Imre Deak
2019-11-06 21:25               ` Chris Wilson
2019-11-07 12:41                 ` Chris Wilson
2019-11-07 18:37                   ` Imre Deak
2019-11-05 21:59 ` [igt-dev] ✗ GitLab.Pipeline: failure for series starting with [v3,1/3] lib/rendercopy: Add AUX page table support (rev2) Patchwork
2019-11-05 22:11 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-11-06  7:17 ` [igt-dev] ✗ GitLab.Pipeline: failure for series starting with [v4,1/3] lib/rendercopy: Add AUX page table support (rev3) Patchwork
2019-11-06  7:36 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-11-06 16:57 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [v2,1/3] lib/rendercopy: Add AUX page table support Patchwork
2019-11-06 18:50 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [v3,1/3] lib/rendercopy: Add AUX page table support (rev2) Patchwork
2019-11-07  0:23 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [v4,1/3] lib/rendercopy: Add AUX page table support (rev3) Patchwork
2019-11-07 19:13 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v5,1/3] lib/rendercopy: Add AUX page table support (rev4) Patchwork
2019-11-07 19:15 ` [igt-dev] ✗ GitLab.Pipeline: failure " Patchwork
2019-11-08 16:25 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v5,1/3] lib/rendercopy: Add AUX page table support (rev5) Patchwork
2019-11-09  0:57 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [v5,1/3] lib/rendercopy: Add AUX page table support (rev4) Patchwork
2019-11-10  7:23 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [v5,1/3] lib/rendercopy: Add AUX page table support (rev5) Patchwork
2019-11-13 15:36 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v5,1/3] lib/rendercopy: Add AUX page table support (rev6) Patchwork
2019-11-14  4:52 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-11-14 16:15   ` Imre Deak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191105193454.4611-2-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=brian.welty@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.