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>
Subject: [PATCH i-g-t v3 05/11] lib/intel_bufops: Start supporting compression on Xe2+
Date: Tue,  7 May 2024 09:58:30 +0200	[thread overview]
Message-ID: <20240507075836.259581-6-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20240507075836.259581-1-zbigniew.kempczynski@intel.com>

Xe2+ uses unified compression where PAT index determines using
compressed pages so lets add support of that to intel-buf. It is
necessary to run render-copy with compression on those platforms.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 lib/intel_bufops.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index 7118272e5f..f5611c037b 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -934,8 +934,14 @@ static void __intel_buf_init(struct buf_ops *bops,
 			if (__gem_create_in_memory_regions(bops->fd, &buf->handle, &bo_size, region))
 				igt_assert_eq(__gem_create(bops->fd, &bo_size, &buf->handle), 0);
 		} else {
+			uint16_t cpu_caching = __xe_default_cpu_caching(bops->fd, region, 0);
+
+			if (AT_LEAST_GEN(bops->devid, 20) && compression)
+				cpu_caching = DRM_XE_GEM_CPU_CACHING_WC;
+
 			bo_size = ALIGN(bo_size, xe_get_default_alignment(bops->fd));
-			buf->handle = xe_bo_create(bops->fd, 0, bo_size, region, 0);
+			buf->handle = xe_bo_create_caching(bops->fd, 0, bo_size, region, 0,
+							   cpu_caching);
 		}
 	}
 
@@ -970,11 +976,16 @@ void intel_buf_init(struct buf_ops *bops,
 		    uint32_t tiling, uint32_t compression)
 {
 	uint64_t region;
+	uint8_t pat_index = DEFAULT_PAT_INDEX;
+
+	if (compression && AT_LEAST_GEN(bops->devid, 20))
+		pat_index = intel_get_pat_idx_uc_comp(bops->fd);
 
 	region = bops->driver == INTEL_DRIVER_I915 ? I915_SYSTEM_MEMORY :
 						     system_memory(bops->fd);
 	__intel_buf_init(bops, 0, buf, width, height, bpp, alignment,
-			 tiling, compression, 0, 0, region, DEFAULT_PAT_INDEX,
+			 tiling, compression, 0, 0, region,
+			 pat_index,
 			 DEFAULT_MOCS_INDEX);
 
 	intel_buf_set_ownership(buf, true);
@@ -991,8 +1002,14 @@ void intel_buf_init_in_region(struct buf_ops *bops,
 			      uint32_t tiling, uint32_t compression,
 			      uint64_t region)
 {
+	uint8_t pat_index = DEFAULT_PAT_INDEX;
+
+	if (compression && AT_LEAST_GEN(bops->devid, 20))
+		pat_index = intel_get_pat_idx_uc_comp(bops->fd);
+
 	__intel_buf_init(bops, 0, buf, width, height, bpp, alignment,
-			 tiling, compression, 0, 0, region, DEFAULT_PAT_INDEX,
+			 tiling, compression, 0, 0, region,
+			 pat_index,
 			 DEFAULT_MOCS_INDEX);
 
 	intel_buf_set_ownership(buf, true);
-- 
2.34.1


  parent reply	other threads:[~2024-05-07  7:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07  7:58 [PATCH i-g-t v3 00/11] Add render-copy compression on Xe+ Zbigniew Kempczyński
2024-05-07  7:58 ` [PATCH i-g-t v3 01/11] lib/intel_bufops: Store devid on buffer ops creation Zbigniew Kempczyński
2024-05-07 14:05   ` Juha-Pekka Heikkila
2024-05-07  7:58 ` [PATCH i-g-t v3 02/11] lib/intel_blt: Rename confusing fb tile to i915 tile Zbigniew Kempczyński
2024-05-07  7:58 ` [PATCH i-g-t v3 03/11] lib/intel_blt: Add i915 -> blt tile helper converter Zbigniew Kempczyński
2024-05-07  7:58 ` [PATCH i-g-t v3 04/11] lib/intel_bufops: Restrict tilings on non-flatccs platforms Zbigniew Kempczyński
2024-05-07 14:07   ` Juha-Pekka Heikkila
2024-05-07  7:58 ` Zbigniew Kempczyński [this message]
2024-05-07  7:58 ` [PATCH i-g-t v3 06/11] lib/rendercopy_gen9: Allow to use all tilings on flatccs platforms Zbigniew Kempczyński
2024-05-07 12:59   ` Juha-Pekka Heikkila
2024-05-08  5:59     ` Zbigniew Kempczyński
2024-05-07  7:58 ` [PATCH i-g-t v3 07/11] lib/intel_cmds_info: Define tiling macros Zbigniew Kempczyński
2024-05-07 14:27   ` Juha-Pekka Heikkila
2024-05-08  7:13     ` Zbigniew Kempczyński
2024-05-08 11:53       ` Juha-Pekka Heikkila
2024-05-07  7:58 ` [PATCH i-g-t v3 08/11] lib/intel_cmds_info: Introduce render tilings Zbigniew Kempczyński
2024-05-07  7:58 ` [PATCH i-g-t v3 09/11] lib/intel_blt: Add render tilings and compression support helper Zbigniew Kempczyński
2024-05-07  7:58 ` [PATCH i-g-t v3 10/11] tests/xe_render_copy: Add subtest which exercises compression Zbigniew Kempczyński
2024-05-07  7:58 ` [PATCH i-g-t v3 11/11] tests/xe_intel_bb: Use supported tilings instead hardcoded ones Zbigniew Kempczyński
2024-05-07  9:25 ` ✓ Fi.CI.BAT: success for Add render-copy compression on Xe+ (rev3) Patchwork
2024-05-07 13:07 ` ✗ Fi.CI.IGT: failure " 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=20240507075836.259581-6-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@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