[PATCH i-g-t 3/8] lib/intel_bufops: Add Xe path in bufops
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Thu Mar 23 21:11:58 UTC 2023
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
lib/intel_bufops.c | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index cdc7a1698b..bda1a19d7f 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -26,6 +26,8 @@
#include <cairo.h>
#include "i915/gem_create.h"
+#include "xe/xe_ioctl.h"
+#include "xe/xe_query.h"
#include "igt.h"
#include "igt_x86.h"
#include "intel_bufops.h"
@@ -488,6 +490,9 @@ static void *mmap_write(int fd, struct intel_buf *buf)
{
void *map = NULL;
+ if (is_xe_device(fd))
+ return xe_bo_map(fd, buf->handle, buf->surface[0].size);
+
if (gem_has_lmem(fd)) {
/*
* set/get_caching and set_domain are no longer supported on
@@ -530,6 +535,9 @@ static void *mmap_read(int fd, struct intel_buf *buf)
{
void *map = NULL;
+ if (is_xe_device(fd))
+ return xe_bo_map(fd, buf->handle, buf->surface[0].size);
+
if (gem_has_lmem(fd)) {
/*
* set/get_caching and set_domain are no longer supported on
@@ -899,9 +907,18 @@ static void __intel_buf_init(struct buf_ops *bops,
buf->size = size;
buf->handle = handle;
- if (!handle)
- if (__gem_create_in_memory_regions(bops->fd, &buf->handle, &size, region))
- igt_assert_eq(__gem_create(bops->fd, &size, &buf->handle), 0);
+ if (!handle) {
+ if (is_i915_device(bops->fd)) {
+ if (__gem_create_in_memory_regions(bops->fd, &buf->handle, &size, region))
+ igt_assert_eq(__gem_create(bops->fd, &size, &buf->handle), 0);
+ } else {
+ size = ALIGN(size, xe_get_default_alignment(bops->fd));
+ buf->handle = xe_bo_create_flags(bops->fd, 0, size,
+ xe_has_vram(bops->fd) ?
+ vram_memory(bops->fd, 0) :
+ system_memory(bops->fd));
+ }
+ }
/* Store gem bo size */
buf->bo_size = size;
@@ -1423,6 +1440,18 @@ static struct buf_ops *__buf_ops_create(int fd, bool check_idempotency)
igt_debug("generation: %d, supported tiles: 0x%02x\n",
bops->intel_gen, bops->supported_tiles);
+ /* No tiling support in XE. */
+ if (is_xe_device(fd)) {
+ bops->supported_hw_tiles = TILE_NONE;
+
+ bops->linear_to_x = copy_linear_to_x;
+ bops->x_to_linear = copy_x_to_linear;
+ bops->linear_to_y = copy_linear_to_y;
+ bops->y_to_linear = copy_y_to_linear;
+
+ return bops;
+ }
+
/*
* Warning!
*
--
2.34.1
More information about the Intel-gfx-trybot
mailing list