public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 01/10] lib/igt_buf: Use compression type consistently
Date: Mon, 30 Dec 2019 05:40:31 +0200	[thread overview]
Message-ID: <20191230034040.21943-2-imre.deak@intel.com> (raw)
In-Reply-To: <20191230034040.21943-1-imre.deak@intel.com>

Use the igt_buf compression field to determine the compression type for
a buffer, instead of the fact that AUX stride is set. We need to look at
the former one anyway to distinguish between compression types.

Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 lib/igt_fb.c            | 5 +++++
 lib/intel_aux_pgtable.c | 8 ++++----
 lib/intel_batchbuffer.h | 5 +++++
 lib/rendercopy_gen9.c   | 6 +++++-
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index e6eb39ac..7e99abb3 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1989,6 +1989,11 @@ static void init_buf(struct fb_blit_upload *blit,
 		else
 			igt_assert_eq(fb->strides[1] & 127, 0);
 
+		if (is_gen12_mc_ccs_modifier(fb->modifier))
+			buf->compression = I915_COMPRESSION_MEDIA;
+		else
+			buf->compression = I915_COMPRESSION_RENDER;
+
 		buf->aux.offset = fb->offsets[1];
 		buf->aux.stride = fb->strides[1];
 	}
diff --git a/lib/intel_aux_pgtable.c b/lib/intel_aux_pgtable.c
index cbb3c320..f8ce6754 100644
--- a/lib/intel_aux_pgtable.c
+++ b/lib/intel_aux_pgtable.c
@@ -434,7 +434,7 @@ aux_pgtable_reserve_range(const struct igt_buf **bufs, int buf_count,
 {
 	int i;
 
-	if (new_buf->aux.stride) {
+	if (igt_buf_compressed(new_buf)) {
 		uint64_t pin_offset = new_buf->bo->offset64;
 
 		if (!pin_offset)
@@ -465,7 +465,7 @@ gen12_aux_pgtable_init(struct aux_pgtable_info *info,
 	int reserved_buf_count;
 	int i;
 
-	if (!src_buf->aux.stride && !dst_buf->aux.stride)
+	if (!igt_buf_compressed(src_buf) && !igt_buf_compressed(dst_buf))
 		return;
 
 	bufs[0] = src_buf;
@@ -492,7 +492,7 @@ gen12_aux_pgtable_init(struct aux_pgtable_info *info,
 
 	/* Next, reserve space for unbound bufs with an AUX surface. */
 	for (i = 0; i < ARRAY_SIZE(bufs); i++)
-		if (!bufs[i]->bo->offset64 && bufs[i]->aux.stride)
+		if (!bufs[i]->bo->offset64 && igt_buf_compressed(bufs[i]))
 			aux_pgtable_reserve_range(reserved_bufs,
 						  reserved_buf_count++,
 						  bufs[i]);
@@ -500,7 +500,7 @@ gen12_aux_pgtable_init(struct aux_pgtable_info *info,
 	/* Create AUX pgtable entries only for bufs with an AUX surface */
 	info->buf_count = 0;
 	for (i = 0; i < reserved_buf_count; i++) {
-		if (!reserved_bufs[i]->aux.stride)
+		if (!igt_buf_compressed(reserved_bufs[i]))
 			continue;
 
 		info->bufs[info->buf_count] = reserved_bufs[i];
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index 37e3affe..c3028343 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -249,6 +249,11 @@ struct igt_buf {
 	unsigned num_tiles;
 };
 
+static inline bool igt_buf_compressed(const struct igt_buf *buf)
+{
+	return buf->compression != I915_COMPRESSION_NONE;
+}
+
 unsigned igt_buf_width(const struct igt_buf *buf);
 unsigned igt_buf_height(const struct igt_buf *buf);
 
diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
index 63b1023d..88a94cbe 100644
--- a/lib/rendercopy_gen9.c
+++ b/lib/rendercopy_gen9.c
@@ -259,7 +259,9 @@ gen8_bind_buf(struct intel_batchbuffer *batch, const struct igt_buf *buf,
 
 	if (buf->compression == I915_COMPRESSION_MEDIA)
 		ss->ss7.tgl.media_compression = 1;
-	else if (buf->aux.stride) {
+	else if (buf->compression == I915_COMPRESSION_RENDER) {
+		igt_assert(buf->aux.stride);
+
 		ss->ss6.aux_mode = 0x5; /* AUX_CCS_E */
 		ss->ss6.aux_pitch = (buf->aux.stride / 128) - 1;
 
@@ -274,6 +276,8 @@ gen8_bind_buf(struct intel_batchbuffer *batch, const struct igt_buf *buf,
 	}
 
 	if (buf->cc.offset) {
+		igt_assert(buf->compression == I915_COMPRESSION_RENDER);
+
 		ss->ss12.clear_address = buf->bo->offset64 + buf->cc.offset;
 		ss->ss13.clear_address_hi = (buf->bo->offset64 + buf->cc.offset) >> 32;
 
-- 
2.23.1

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

  reply	other threads:[~2019-12-30  3:41 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30  3:40 [igt-dev] [PATCH i-g-t 00/10] lib: Add support and coverage for MC YUV formats Imre Deak
2019-12-30  3:40 ` Imre Deak [this message]
2019-12-30 12:00   ` [igt-dev] [PATCH i-g-t 01/10] lib/igt_buf: Use compression type consistently Kahola, Mika
2019-12-30  3:40 ` [igt-dev] [PATCH i-g-t 02/10] lib/igt_buf: Extend igt_buf to include two CCS surfaces Imre Deak
2019-12-30 12:02   ` Kahola, Mika
2019-12-30  3:40 ` [igt-dev] [PATCH i-g-t 03/10] lib/igt_buf: Extend igt_buf to include two color surfaces Imre Deak
2019-12-30 12:06   ` Kahola, Mika
2019-12-30 12:58     ` Imre Deak
2019-12-30 17:58   ` [igt-dev] [PATCH i-g-t v2 " Imre Deak
2019-12-31  8:40     ` Kahola, Mika
2019-12-30  3:40 ` [igt-dev] [PATCH i-g-t 04/10] lib: Add engine copy support for YUV formats Imre Deak
2019-12-30 13:23   ` Kahola, Mika
2019-12-30  3:40 ` [igt-dev] [PATCH i-g-t 05/10] Revert "tests/kms_plane: Disable GEN12 media compression YUV tests" Imre Deak
2019-12-30 13:24   ` Kahola, Mika
2019-12-30  3:40 ` [igt-dev] [PATCH i-g-t 06/10] tests/kms_ccs: Add support for testing multiple formats Imre Deak
2019-12-30  3:40 ` [igt-dev] [PATCH i-g-t 07/10] tests/kms_ccs: Add GEN12 CCS media compression format modifier Imre Deak
2019-12-30  3:40 ` [igt-dev] [PATCH i-g-t 08/10] tests/kms_ccs: Work around CRC mismatch when mixing SDR/HDR planes Imre Deak
2019-12-30  3:40 ` [igt-dev] [PATCH i-g-t 09/10] tests/kms_ccs: Test YUV formats too Imre Deak
2019-12-30  3:40 ` [igt-dev] [PATCH i-g-t 10/10] tests/kms_ccs: Add option to check the CCS planes Imre Deak
2019-12-30 12:47   ` Juha-Pekka Heikkila
2019-12-30 13:12     ` Imre Deak
2019-12-30 13:34       ` Juha-Pekka Heikkila
2019-12-30 17:58   ` [igt-dev] [PATCH i-g-t v2 " Imre Deak
2019-12-30  4:12 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib: Add support and coverage for MC YUV formats Patchwork
2019-12-30  9:00   ` Imre Deak
2019-12-30  9:22     ` Vudum, Lakshminarayana
2019-12-30  9:18 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-12-30 12:50 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-12-30 13:23   ` Imre Deak
2019-12-30 15:53 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2019-12-30 19:02 ` [igt-dev] ✓ Fi.CI.BAT: success for lib: Add support and coverage for MC YUV formats (rev3) Patchwork
2019-12-31  8:45 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-12-31 12:49   ` 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=20191230034040.21943-2-imre.deak@intel.com \
    --to=imre.deak@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox