Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 1/2] lib/xe_ioctl: fix default cpu_caching helper
Date: Mon, 11 Dec 2023 10:58:43 +0000	[thread overview]
Message-ID: <20231211105844.30534-1-matthew.auld@intel.com> (raw)

The placement and flags were split in some recent refactoring, but looks
like we forgot to update __xe_default_cpu_caching_from_placement to
account for flags and placement. In particular we are no longer
considering the FLAG_SCANOUT here.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Francois Dugast <francois.dugast@intel.com>
---
 lib/xe/xe_ioctl.c       | 6 +++---
 lib/xe/xe_ioctl.h       | 2 +-
 tests/intel/xe_create.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c
index 8b12c0369..cdad3d7e2 100644
--- a/lib/xe/xe_ioctl.c
+++ b/lib/xe/xe_ioctl.c
@@ -230,10 +230,10 @@ void xe_vm_destroy(int fd, uint32_t vm)
 	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_VM_DESTROY, &destroy), 0);
 }
 
-uint16_t __xe_default_cpu_caching_from_placement(int fd, uint32_t placement)
+uint16_t __xe_default_cpu_caching(int fd, uint32_t placement, uint32_t flags)
 {
 	if ((placement & all_memory_regions(fd)) != system_memory(fd) ||
-	    placement & DRM_XE_GEM_CREATE_FLAG_SCANOUT)
+	    flags & DRM_XE_GEM_CREATE_FLAG_SCANOUT)
 		/* VRAM placements or scanout should always use WC */
 		return DRM_XE_GEM_CPU_CACHING_WC;
 
@@ -283,7 +283,7 @@ static uint32_t ___xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t pla
 uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t placement,
 			uint32_t flags, uint32_t *handle)
 {
-	uint16_t cpu_caching = __xe_default_cpu_caching_from_placement(fd, placement);
+	uint16_t cpu_caching = __xe_default_cpu_caching(fd, placement, flags);
 
 	return ___xe_bo_create(fd, vm, size, placement, flags, cpu_caching, handle);
 }
diff --git a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h
index bbfa40391..c8d46fb29 100644
--- a/lib/xe/xe_ioctl.h
+++ b/lib/xe/xe_ioctl.h
@@ -72,7 +72,7 @@ uint32_t __xe_bo_create_caching(int fd, uint32_t vm, uint64_t size, uint32_t pla
 				uint32_t flags, uint16_t cpu_caching, uint32_t *handle);
 uint32_t xe_bo_create_caching(int fd, uint32_t vm, uint64_t size, uint32_t placement,
 			      uint32_t flags, uint16_t cpu_caching);
-uint16_t __xe_default_cpu_caching_from_placement(int fd, uint32_t placement);
+uint16_t __xe_default_cpu_caching(int fd, uint32_t placement, uint32_t flags);
 int __xe_exec_queue_create(int fd, uint32_t vm,
 			   struct drm_xe_engine_class_instance *instance,
 			   uint64_t ext, uint32_t *exec_queue_id);
diff --git a/tests/intel/xe_create.c b/tests/intel/xe_create.c
index 64eadc734..1ed48a5d3 100644
--- a/tests/intel/xe_create.c
+++ b/tests/intel/xe_create.c
@@ -32,7 +32,7 @@ static int __create_bo(int fd, uint32_t vm, uint64_t size, uint32_t placement,
 	struct drm_xe_gem_create create = {
 		.vm_id = vm,
 		.size = size,
-		.cpu_caching = __xe_default_cpu_caching_from_placement(fd, placement),
+		.cpu_caching = __xe_default_cpu_caching(fd, placement, 0),
 		.placement = placement,
 	};
 	int ret = 0;
-- 
2.43.0

             reply	other threads:[~2023-12-11 10:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 10:58 Matthew Auld [this message]
2023-12-11 10:58 ` [PATCH i-g-t 2/2] lib: restore FLAG_SCANOUT usage for Xe Matthew Auld
2023-12-11 11:04   ` Francois Dugast
2023-12-11 11:41 ` [PATCH i-g-t 1/2] lib/xe_ioctl: fix default cpu_caching helper Francois Dugast
2023-12-11 15:53 ` ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
2023-12-11 16:20 ` ✓ CI.xeBAT: " Patchwork
2023-12-11 17:14 ` ✗ 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=20231211105844.30534-1-matthew.auld@intel.com \
    --to=matthew.auld@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