Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	"Juha-Pekka Heikkila" <juhapekka.heikkila@gmail.com>
Subject: [PATCH i-g-t v4 06/11] lib/rendercopy_gen9: Separate xe and xe2 compression format
Date: Wed,  8 May 2024 14:54:38 +0200	[thread overview]
Message-ID: <20240508125443.404402-7-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20240508125443.404402-1-zbigniew.kempczynski@intel.com>

Xe and beyond differ how compression format is handled. For Xe it
is 5-bit long whereas for Xe2+ this is 4-bit long field. Instead of
artifically packing 0-15 into 5-bit field lets separate this structures
to conform with the documentation.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 lib/gen9_render.h     | 31 +++++++++++++++++++++----------
 lib/rendercopy_gen9.c | 24 ++++++++++++++++--------
 2 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/lib/gen9_render.h b/lib/gen9_render.h
index 8ed60a2a54..4c1ed4726a 100644
--- a/lib/gen9_render.h
+++ b/lib/gen9_render.h
@@ -154,16 +154,27 @@ struct gen9_surface_state {
 		uint32_t aux_base_addr_hi;
 	} ss11;
 
-	struct {
-		/*
-		 * compression_format is used only dg2 onward.
-		 * prior to dg2 full ss12 is used for the address
-		 * but due to alignments bits 0..6 will be zero
-		 * and asserted in code to be so
-		 */
-		uint32_t compression_format:5;
-		uint32_t pad0:1;
-		uint32_t clear_address:26;
+	union {
+		struct {
+			/*
+			 * compression_format is used only dg2 onward.
+			 * prior to dg2 full ss12 is used for the address
+			 * but due to alignments bits 0..6 will be zero
+			 * and asserted in code to be so
+			 */
+			uint32_t compression_format:5;
+			uint32_t pad0:1;
+			uint32_t clear_address:26;
+		} xe;
+
+		struct {
+			/*
+			 * On Xe2+ compression format is 4-bit long.
+			 */
+			uint32_t compression_format:4;
+			uint32_t mip_region_depth_in_log:4;
+			uint32_t pad0:24;
+		} xe2;
 	} ss12;
 
 	struct {
diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
index 7c7563d50c..35d79acbab 100644
--- a/lib/rendercopy_gen9.c
+++ b/lib/rendercopy_gen9.c
@@ -264,7 +264,7 @@ gen9_bind_buf(struct intel_bb *ibb, const struct intel_buf *buf, int is_dst,
 			igt_assert(__builtin_ctzl(address + buf->cc.offset) >= 6 &&
 				   (__builtin_clzl(address + buf->cc.offset) >= 16));
 
-			ss->ss12.clear_address = (address + buf->cc.offset) >> 6;
+			ss->ss12.xe.clear_address = (address + buf->cc.offset) >> 6;
 			ss->ss13.clear_address_hi = (address + buf->cc.offset) >> 32;
 		}
 
@@ -274,13 +274,21 @@ gen9_bind_buf(struct intel_bb *ibb, const struct intel_buf *buf, int is_dst,
 			ss->ss7.dg2.disable_support_for_multi_gpu_partial_writes = 1;
 			ss->ss7.dg2.disable_support_for_multi_gpu_atomics = 1;
 
-			/*
-			 * For now here is coming only 32bpp rgb format
-			 * which is marked below as B8G8R8X8_UNORM = '8'
-			 * If here ever arrive other formats below need to be
-			 * fixed to take that into account.
-			 */
-			ss->ss12.compression_format = 8;
+			if (AT_LEAST_GEN(ibb->devid, 20)) {
+				/*
+				 * For Xe2+ R8G8B8A8 best compression ratio is
+				 * achieved with compression format = '2'
+				 */
+				ss->ss12.xe2.compression_format = 2;
+			} else {
+				/*
+				 * For now here is coming only 32bpp rgb format
+				 * which is marked below as B8G8R8X8_UNORM = '8'
+				 * If here ever arrive other formats below need to be
+				 * fixed to take that into account.
+				 */
+				ss->ss12.xe.compression_format = 8;
+			}
 		}
 	}
 
-- 
2.34.1


  parent reply	other threads:[~2024-05-08 12:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 12:54 [PATCH i-g-t v4 00/11] Add render-copy compression on Xe+ Zbigniew Kempczyński
2024-05-08 12:54 ` [PATCH i-g-t v4 01/11] lib/intel_bufops: Store devid on buffer ops creation Zbigniew Kempczyński
2024-05-08 12:54 ` [PATCH i-g-t v4 02/11] lib/intel_blt: Rename confusing fb tile to i915 tile Zbigniew Kempczyński
2024-05-08 12:54 ` [PATCH i-g-t v4 03/11] lib/intel_blt: Add i915 -> blt tile helper converter Zbigniew Kempczyński
2024-05-08 12:54 ` [PATCH i-g-t v4 04/11] lib/intel_bufops: Restrict tilings on non-flatccs platforms Zbigniew Kempczyński
2024-05-08 12:54 ` [PATCH i-g-t v4 05/11] lib/intel_bufops: Start supporting compression on Xe2+ Zbigniew Kempczyński
2024-05-08 12:54 ` Zbigniew Kempczyński [this message]
2024-05-08 12:54 ` [PATCH i-g-t v4 07/11] lib/intel_cmds_info: Define tiling macros Zbigniew Kempczyński
2024-05-08 12:54 ` [PATCH i-g-t v4 08/11] lib/intel_cmds_info: Introduce render tilings Zbigniew Kempczyński
2024-05-08 12:54 ` [PATCH i-g-t v4 09/11] lib/intel_blt: Add render tilings and compression support helper Zbigniew Kempczyński
2024-05-08 12:54 ` [PATCH i-g-t v4 10/11] tests/xe_render_copy: Add subtest which exercises compression Zbigniew Kempczyński
2024-05-08 12:54 ` [PATCH i-g-t v4 11/11] tests/xe_intel_bb: Use supported tilings instead hardcoded ones Zbigniew Kempczyński
2024-05-09  5:18   ` Karolina Stolarek
2024-05-08 17:41 ` ✓ CI.xeBAT: success for Add render-copy compression on Xe+ (rev4) Patchwork
2024-05-08 17:48 ` ✓ Fi.CI.BAT: " Patchwork
2024-05-09  3:22 ` ✗ CI.xeFULL: failure " Patchwork
2024-05-09  8:34 ` ✓ Fi.CI.IGT: success " Patchwork

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=20240508125443.404402-7-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.com \
    /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