Integrate intel-bb with Xe
Subsystems (2)
v6 cover Integrate intel-bb with Xe
Series touches intel-bb + intel-buf which are rendercopy, gpgpu fill and media fill facilities. Exercise both paths on CI (i915 and xe) to check there's no regression in common part.
v2: fix allocator issue
v3: address review comments (Kamil)
v4: address review comments (Christoph)
v5: - address review comments (Kamil)
- add region awareness in bufops (Zbigniew)
v6: alter igt_draw and kms_big_fb to be region aware (Zbigniew)
Zbigniew Kempczyński (15):
lib/xe_ioctl: Add missing header for direct resolving lib/xe_query: Add region helpers and missing doc lib/xe_query: Remove commented out function prototype lib/intel_allocator: Add allocator support for Xe lib/drmtest: Add driver enum for i915/xe lib/intel_bufops: Add Xe support in bufops lib/intel_batchbuffer: Rename i915 -> fd as preparation step for xe lib/intel_batchbuffer: Add Xe support in intel-bb tests/xe_intel_bb: Check if intel-bb Xe support correctness tests/xe-fast-feedback: Add xe_intel_bb test to BAT lib/gpgpu_fill: Use RENDER engine flag to work on Xe tests/xe_gpgpu_fill: Exercise gpgpu fill on Xe lib/igt_fb: For xe assume vram is used on discrete lib/igt_draw: Pass region while building intel_buf from flink tests/kms_big_fb: Deduce region for xe framebuffer
lib/drmtest.h | 8 + lib/gpgpu_fill.c | 4 +- lib/gpu_cmds.c | 2 +- lib/igt_draw.c | 14 +- lib/igt_fb.c | 17 +- lib/intel_allocator.c | 40 +- lib/intel_aux_pgtable.c | 2 +- lib/intel_batchbuffer.c | 424 ++++++-- lib/intel_batchbuffer.h | 22 +- lib/intel_bufops.c | 120 ++- lib/intel_bufops.h | 24 +- lib/xe/xe_ioctl.h | 1 + lib/xe/xe_query.c | 45 + lib/xe/xe_query.h | 3 +- tests/i915/gem_caching.c | 4 +- tests/i915/gem_pxp.c | 2 +- tests/i915/kms_big_fb.c | 10 +- tests/intel-ci/xe-fast-feedback.testlist | 19 + tests/meson.build | 2 + tests/xe/xe_gpgpu_fill.c | 135 +++ tests/xe/xe_intel_bb.c | 1185 ++++++++++++++++++++++ 21 files changed, 1932 insertions(+), 151 deletions(-) create mode 100644 tests/xe/xe_gpgpu_fill.c create mode 100644 tests/xe/xe_intel_bb.c
Signature · 1 line
2.34.1
PATCH v6 1/15 lib/xe_ioctl: Add missing header for direct resolving
xe_ioctl.h user expects all types resolving. Add missing stddef.h header which contains size_t definition.
--- lib/xe/xe_ioctl.h | 1 + 1 file changed, 1 insertion(+)
lib/xe/xe_ioctl.h +1 -0
@@ -11,6 +11,7 @@#ifndef XE_IOCTL_H #define XE_IOCTL_H +#include <stddef.h> #include <stdint.h> #include <xe_drm.h>
Signature · 1 line
2.34.1
PATCH v6 2/15 lib/xe_query: Add region helpers and missing doc
In reply to Zbigniew KempczyńskiFor easier iterate over memory regions and produce dynamic subtests add xe_region_name() helper.
As Xe requires buffer size alignment during creating bo add xe_min_page_size() helper.
--- lib/xe/xe_query.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ lib/xe/xe_query.h | 2 ++ 2 files changed, 47 insertions(+)
lib/xe/xe_query.c +45 -0
@@ -422,6 +422,13 @@ struct drm_xe_engine_class_instance *xe_hw_engine(int fd, int idx)return &xe_dev->hw_engines[idx]; } +/** +* xe_mem_region: +* @fd: xe device fd +* @region: region mask +* +* Returns memory region structure for @region mask. +*/ struct drm_xe_query_mem_region *xe_mem_region (int fd,uint64_t region) {struct xe_device *xe_dev;
@@ -434,6 +441,44 @@ struct drm_xe_query_mem_region *xe_mem_region(int fd, uint64_t region)return &xe_dev->mem_usage->regions[region_idx]; } +/** +* xe_region_name: +* @region: region mask +* +* Returns region string like "system" or "vram-n" where n=0...62. +*/ +const char *xe_region_name (uint64_t region) +{ +static char **vrams; +int region_idx =ffs (region) -1 ; + +/* Populate the array */ +if (!vrams) { + vrams =calloc (64 ,sizeof (char *)); +for (int i =0 ; i <64 ; i++) { +if (i !=0 ) +asprintf (&vrams[i],"vram-%d" , i -1 ); +else +asprintf (&vrams[i],"system" ); +igt_assert (vrams[i]); + } + } + +return vrams[region_idx]; +} + +/** +* xe_min_page_size: +* @fd: xe device fd +* @region: region mask +* +* Returns minimum page size for @region. +*/ +uint32_t xe_min_page_size (int fd,uint64_t region) +{ +return xe_mem_region (fd, region)->min_page_size; +} +/** * xe_number_hw_engine: * @fd: xe device fd
lib/xe/xe_query.h +2 -0
@@ -84,6 +84,8 @@ uint64_t vram_if_possible(int fd, int gt);struct drm_xe_engine_class_instance *xe_hw_engines (int fd);struct drm_xe_engine_class_instance *xe_hw_engine (int fd,int idx);struct drm_xe_query_mem_region *xe_mem_region (int fd,uint64_t region); +const char *xe_region_name (uint64_t region); +uint32_t xe_min_page_size (int fd,uint64_t region);unsigned int xe_number_hw_engines (int fd);bool xe_has_vram (int fd);//uint64_t xe_vram_size(int fd);
Signature · 1 line
2.34.1
PATCH v6 3/15 lib/xe_query: Remove commented out function prototype
In reply to Zbigniew KempczyńskiRemove unnecessary commented out code.
--- lib/xe/xe_query.h | 1 - 1 file changed, 1 deletion(-)
lib/xe/xe_query.h +0 -1
@@ -88,7 +88,6 @@ const char *xe_region_name(uint64_t region);uint32_t xe_min_page_size (int fd,uint64_t region);unsigned int xe_number_hw_engines (int fd);bool xe_has_vram (int fd); -//uint64_t xe_vram_size(int fd); uint64_t xe_vram_size (int fd,int gt);uint32_t xe_get_default_alignment (int fd);uint32_t xe_va_bits (int fd);
Signature · 1 line
2.34.1
PATCH v6 4/15 lib/intel_allocator: Add allocator support for Xe
In reply to Zbigniew KempczyńskiStart supporting va range configuration for xe allocator.
During opening allocator has to be aware of vm range (start and end). i915 driver doesn't expose vm range information so those variables have to be detected. In xe driver we get information of va size from the kernel query so va end can be directly configured. At the moment there's no autodetection of va start for xe what might need to be address in the future if for some reason lower offsets might not be in use.
--- lib/intel_allocator.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-)
lib/intel_allocator.c +25 -15
@@ -16,6 +16,7 @@#include "igt_map.h" #include "intel_allocator.h" #include "intel_allocator_msgchannel.h" +#include "xe/xe_query.h" //#define ALLOCDBG #ifdef ALLOCDBG
@@ -910,24 +911,33 @@ static uint64_t __intel_allocator_open_full(int fd, uint32_t ctx,struct alloc_resp resp;uint64_t gtt_size; -if (!start) - req.open.start =gem_detect_safe_start_offset (fd); +if (is_i915_device (fd)) { +if (!start) + req.open.start =gem_detect_safe_start_offset (fd); -if (!end) { -igt_assert_f (can_report_gtt_size (fd),"Invalid fd\n" ); - gtt_size =gem_aperture_size (fd); -if (!gem_uses_full_ppgtt (fd)) - gtt_size /=2 ; -else - gtt_size -=RESERVED ; +if (!end) { +igt_assert_f (can_report_gtt_size (fd),"Invalid fd\n" ); + gtt_size =gem_aperture_size (fd); +if (!gem_uses_full_ppgtt (fd)) + gtt_size /=2 ; +else + gtt_size -=RESERVED ; - req.open.end = gtt_size; - } + req.open.end = gtt_size; + } -if (!default_alignment) - req.open.default_alignment =gem_detect_safe_alignment (fd); +if (!default_alignment) + req.open.default_alignment =gem_detect_safe_alignment (fd); + + req.open.start =ALIGN (req.open.start, req.open.default_alignment); + }else { +struct xe_device *xe_dev =xe_device_get (fd); - req.open.start =ALIGN (req.open.start, req.open.default_alignment); +igt_assert (xe_dev); + +if (!end) + req.open.end =1ull << xe_dev->va_bits; + }/* Get child_tid only once at open() */ if (child_tid ==-1 )
@@ -998,7 +1008,7 @@ uint64_t intel_allocator_open_vm_full(int fd, uint32_t vm,/** * intel_allocator_open: -* @fd: i915 descriptor +* @fd: i915 or xe descriptor * @ctx: context * @allocator_type: one of INTEL_ALLOCATOR_* define *
Signature · 1 line
2.34.1
PATCH v6 5/15 lib/drmtest: Add driver enum for i915/xe
In reply to Zbigniew KempczyńskiLibrary code like intel-bb and intel-buf which requires adoption to handle both drivers should store driver on which fd they are working on instead of calling costful is_i915/xe_device() helper.
Introduce intel_driver enum which will be used on library code adoption to Xe.
--- lib/drmtest.h | 8 ++++++++ 1 file changed, 8 insertions(+)
lib/drmtest.h +8 -0
@@ -62,6 +62,14 @@*/ #define DRIVER_ANY ~(DRIVER_VGEM) +/* +* Compile friendly enum for i915/xe. +*/ +enum intel_driver { +INTEL_DRIVER_I915 =1 , +INTEL_DRIVER_XE , +}; +void __set_forced_driver (const char *name);/**
Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 05/15] lib/drmtest: Add driver enum for i915/xe
Hi Zbigniew,
Quoted 6 lines · Zbigniew Kempczyński
Library code like intel-bb and intel-buf which requires adoption to handle both drivers should store driver on which fd they are working on instead of calling costful is_i915/xe_device() helper.
Introduce
intel_driverenum which will be used on library code adoption to Xe.
Agree - this is a better place than intel_batchbuffer.
But then the question arises - how does this relate to the 'DRIVER_INTEL' and 'DRIVER_XE' value above? Looks like we could use those values instead.
Christoph
Quoted 25 lines
Signed-off-by Zbigniew Kempczyński <[email protected]>--- lib/drmtest.h | 8 ++++++++ 1 file changed, 8 insertions(+)lib/drmtest.h +8
-0@@ -62,6 +62,14 @@*/ #define DRIVER_ANY ~(DRIVER_VGEM) +/* +* Compile friendly enum for i915/xe. +*/ +enum intel_driver { +INTEL_DRIVER_I915 =1 , +INTEL_DRIVER_XE , +}; +void __set_forced_driver (const char *name);/**
Manszewski, Christoph
Reviewed-byRe: [igt-dev] [PATCH i-g-t v6 05/15] lib/drmtest: Add driver enum for i915/xe
Quoted 7 lines · Christoph
Hi Zbigniew,
Quoted 4 lines · Zbigniew Kempczyński
Library code like intel-bb and intel-buf which requires adoption to handle both drivers should store driver on which fd they are working on instead of calling costful is_i915/xe_device() helper.
Quoted 6 lines
Quoted 2 lines
Introduce
intel_driverenum which will be used on library code adoption to Xe.Agree - this is a better place than
intel_batchbuffer.But then the question arises - how does this relate to the '
DRIVER_INTEL' and 'DRIVER_XE' value above? Looks like we could use those values instead.
As discussed offline - it's flag vs enum. So:
Christoph
Quoted 27 lines
Christoph
Quoted 23 lines
Signed-off-by Zbigniew Kempczyński <[email protected]>---
lib/drmtest.h| 8 ++++++++1 file changed, 8 insertions(+)lib/drmtest.h +8
-0@@ -62,6 +62,14 @@*/ #define DRIVER_ANY ~(DRIVER_VGEM) +/* +* Compile friendly enum for i915/xe. +*/ +enum intel_driver { + INTEL_DRIVER_I915 = 1, + INTEL_DRIVER_XE, +}; + void __set_forced_driver(const char *name); /**
Re: [igt-dev] [PATCH i-g-t v6 05/15] lib/drmtest: Add driver enum for i915/xe
In reply to Manszewski, ChristophQuoted 7 lines · Christoph
Hi Zbigniew,
Quoted 4 lines · Zbigniew Kempczyński
Library code like intel-bb and intel-buf which requires adoption to handle both drivers should store driver on which fd they are working on instead of calling costful is_i915/xe_device() helper.
Quoted 7 lines
Quoted 2 lines
Introduce
intel_driverenum which will be used on library code adoption to Xe.Agree - this is a better place than
intel_batchbuffer.But then the question arises - how does this relate to the '
DRIVER_INTEL' and 'DRIVER_XE' value above? Looks like we could use those values instead.
Above values are not related to enum I introduced. I wanted to have enum as compiler may check you're using valid values (like in switch() for ex.).
--
Zbigniew
Quoted 27 lines
Christoph
Quoted 23 lines
Signed-off-by Zbigniew Kempczyński <[email protected]>--- lib/drmtest.h | 8 ++++++++ 1 file changed, 8 insertions(+)lib/drmtest.h +8
-0@@ -62,6 +62,14 @@*/ #define DRIVER_ANY ~(DRIVER_VGEM) +/* +* Compile friendly enum for i915/xe. +*/ +enum intel_driver { +INTEL_DRIVER_I915 =1 , +INTEL_DRIVER_XE , +}; +void __set_forced_driver (const char *name);/**
PATCH v6 6/15 lib/intel_bufops: Add Xe support in bufops
In reply to Zbigniew KempczyńskiExtend bufops to support Xe:
- change region to 64bit region mask,
- add initialization helper (full) which allows passing handle, size and region,
- mapping functions (read + write) selects driver specific mapping
---
v5: add intel_buf_create_full() for future lib/igt_fb changes
regarding region
v6: - fix igt_assert_f()
- add buf_ops_get_driver() helper
--- lib/intel_bufops.c | 120 +++++++++++++++++++++++++++++++++++++++++---- lib/intel_bufops.h | 24 ++++++++- 2 files changed, 133 insertions(+), 11 deletions(-)
lib/intel_bufops.c +110 -10
@@ -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"
@@ -106,6 +108,7 @@ typedef void (*bo_copy)(struct buf_ops *, struct intel_buf *, uint32_t *);struct buf_ops {int fd; +enum intel_driver driver;int gen_start;int gen_end;unsigned int intel_gen;
@@ -488,6 +491,9 @@ static void *mmap_write(int fd, struct intel_buf *buf) {void *map =NULL ; +if (buf->bops->driver ==INTEL_DRIVER_XE ) +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 +536,9 @@ static void *mmap_read(int fd, struct intel_buf *buf) {void *map =NULL ; +if (buf->bops->driver ==INTEL_DRIVER_XE ) +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
@@ -809,7 +818,7 @@ static void __intel_buf_init(struct buf_ops *bops, int width, int height, int bpp, int alignment, uint32_t req_tiling, uint32_t compression, uint64_t bo_size, int bo_stride, - uint32_t region) + uint64_t region) { uint32_t tiling = req_tiling;uint64_t size;
@@ -899,9 +908,19 @@ 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 (bops->driver ==INTEL_DRIVER_I915 ) { +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, region); + } + } +if (bops->driver ==INTEL_DRIVER_XE ) +igt_assert_f (region !=-1 ,"Xe requires region awareness, " +"use api which passes valid region\n" ); + buf->region = region;/* Store gem bo size */ buf->bo_size = size;
@@ -930,8 +949,12 @@ void intel_buf_init(struct buf_ops *bops, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression) { + uint64_t region; + + 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, I915_SYSTEM_MEMORY); + tiling, compression,0 ,0 , region);intel_buf_set_ownership (buf, true); }
@@ -945,7 +968,7 @@ void intel_buf_init_in_region(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression, - uint32_t region) + uint64_t region) { __intel_buf_init(bops, 0, buf, width, height, bpp, alignment, tiling, compression, 0, 0, region);
@@ -1010,6 +1033,43 @@ void intel_buf_init_using_handle(struct buf_ops *bops, req_tiling, compression, 0, 0, -1); } +/** +* intel_buf_init_full +* @bops: pointer to buf_ops +* @handle: BO handle created by the caller +* @buf: pointer to intel_buf structure to be filled +* @width: surface width +* @height: surface height +* @bpp: bits-per-pixel (8 / 16 / 32 / 64) +* @alignment: alignment of the stride for linear surfaces +* @req_tiling: surface tiling +* @compression: surface compression type +* @size: real bo size +* @stride: bo stride +* @region: region +* +* Function configures BO handle within intel_buf structure passed by the caller +* (with all its metadata - width, height, ...). Useful if BO was created +* outside. Allows passing real size which caller is aware of. +* +* Note: intel_buf_close() can be used because intel_buf is aware it is not +* buffer owner so it won't close it underneath. +*/ +void intel_buf_init_full (struct buf_ops *bops, +uint32_t handle, +struct intel_buf *buf, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region) +{ +__intel_buf_init (bops, handle, buf, width, height, bpp, alignment, + req_tiling, compression, size, stride, region); +} +/** * intel_buf_create * @bops: pointer to buf_ops
@@ -1084,6 +1144,20 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,uint32_t compression, uint64_t size, int stride) +{ + return intel_buf_create_full(bops, handle, width, height, bpp, alignment, + req_tiling, compression, size, stride, -1); +} + +struct intel_buf *intel_buf_create_full (struct buf_ops *bops, +uint32_t handle, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region) {struct intel_buf *buf;
@@ -1093,12 +1167,11 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,igt_assert (buf);__intel_buf_init (bops, handle, buf, width, height, bpp, alignment, - req_tiling, compression, size, stride,-1 ); + req_tiling, compression, size, stride, region);return buf; } -/** * intel_buf_destroy * @buf: intel_buf
@@ -1420,8 +1493,24 @@ static struct buf_ops *__buf_ops_create(int fd, bool check_idempotency) bops->fd = fd; bops->intel_gen = generation; -igt_debug ("generation: %d, supported tiles: 0x%02x\n" , - bops->intel_gen, bops->supported_tiles); + bops->driver =is_i915_device (fd) ?INTEL_DRIVER_I915 : +is_xe_device (fd) ?INTEL_DRIVER_XE :0 ; +igt_assert (bops->driver); +igt_debug ("generation: %d, supported tiles: 0x%02x, driver: %s\n" , + bops->intel_gen, bops->supported_tiles, + bops->driver ==INTEL_DRIVER_I915 ?"i915" :"xe" ); + +/* No tiling support in XE. */ +if (bops->driver ==INTEL_DRIVER_XE ) { + 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!
@@ -1569,6 +1658,17 @@ int buf_ops_get_fd(struct buf_ops *bops)return bops->fd; } +/** +* buf_ops_get_driver +* @bops: pointer to buf_ops +* +* Returns: intel driver enum value +*/ +enum intel_driver buf_ops_get_driver (struct buf_ops *bops) +{ +return bops->driver; +} +/** * buf_ops_set_software_tiling * @bops: pointer to buf_ops
lib/intel_bufops.h +23 -1
@@ -43,6 +43,7 @@ struct intel_buf { } addr;uint64_t bo_size; +uint64_t region;/* Tracking */ struct intel_bb *ibb;
@@ -109,6 +110,7 @@ struct buf_ops *buf_ops_create(int fd);struct buf_ops *buf_ops_create_with_selftest (int fd);void buf_ops_destroy (struct buf_ops *bops);int buf_ops_get_fd (struct buf_ops *bops); +enum intel_driver buf_ops_get_driver (struct buf_ops *bops); bool buf_ops_set_software_tiling(struct buf_ops *bops, uint32_t tiling,
@@ -135,7 +137,7 @@ void intel_buf_init_in_region(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression, - uint32_t region); + uint64_t region);void intel_buf_close (struct buf_ops *bops,struct intel_buf *buf); void intel_buf_init_using_handle(struct buf_ops *bops,
@@ -143,6 +145,16 @@ void intel_buf_init_using_handle(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t req_tiling, uint32_t compression); +void intel_buf_init_full (struct buf_ops *bops, +uint32_t handle, +struct intel_buf *buf, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region); struct intel_buf *intel_buf_create(struct buf_ops *bops, int width, int height,
@@ -164,6 +176,16 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,uint32_t compression, uint64_t size, int stride); + +struct intel_buf *intel_buf_create_full (struct buf_ops *bops, +uint32_t handle, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region);void intel_buf_destroy (struct intel_buf *buf);static inline void intel_buf_set_pxp (struct intel_buf *buf,bool new_pxp_state)
Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 06/15] lib/intel_bufops: Add Xe support in bufops
Hi Zbigniew,
Quoted 223 lines · Zbigniew Kempczyński
Extend bufops to support Xe:
- change region to 64bit region mask,
- add initialization helper (full) which allows passing handle, size and region,
- mapping functions (read + write) selects driver specific mappingSigned-off-by Zbigniew Kempczyński <[email protected]>Signed-off-by Bhanuprakash Modem <[email protected]>---
v5: addintel_buf_create_full()for futurelib/igt_fbchanges
regarding region
v6: - fixigt_assert_f()
- addbuf_ops_get_driver()helper--- lib/intel_bufops.c | 120 +++++++++++++++++++++++++++++++++++++++++---- lib/intel_bufops.h | 24 ++++++++- 2 files changed, 133 insertions(+), 11 deletions(-)lib/intel_bufops.c +99
-10@@ -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" @@ -106,6 +108,7 @@ typedef void (*bo_copy)(struct buf_ops *, struct intel_buf *, uint32_t *);struct buf_ops {int fd; +enum intel_driver driver;int gen_start;int gen_end;unsigned int intel_gen;@@ -488,6 +491,9 @@ static void *mmap_write(int fd, struct intel_buf *buf) {void *map =NULL ; +if (buf->bops->driver ==INTEL_DRIVER_XE ) +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 +536,9 @@ static void *mmap_read(int fd, struct intel_buf *buf) {void *map =NULL ; +if (buf->bops->driver ==INTEL_DRIVER_XE ) +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 @@ -809,7 +818,7 @@ static void __intel_buf_init(struct buf_ops *bops, int width, int height, int bpp, int alignment, uint32_t req_tiling, uint32_t compression, uint64_t bo_size, int bo_stride, - uint32_t region) + uint64_t region) { uint32_t tiling = req_tiling;uint64_t size;@@ -899,9 +908,19 @@ 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 (bops->driver ==INTEL_DRIVER_I915 ) { +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, region); + } + } +if (bops->driver ==INTEL_DRIVER_XE ) +igt_assert_f (region !=-1 ,"Xe requires region awareness, " +"use api which passes valid region\n" ); + buf->region = region;/* Store gem bo size */ buf->bo_size = size;@@ -930,8 +949,12 @@ void intel_buf_init(struct buf_ops *bops, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression) { + uint64_t region; + + 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, I915_SYSTEM_MEMORY); + tiling, compression,0 ,0 , region);intel_buf_set_ownership (buf, true); }@@ -945,7 +968,7 @@ void intel_buf_init_in_region(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression, - uint32_t region) + uint64_t region) { __intel_buf_init(bops, 0, buf, width, height, bpp, alignment, tiling, compression, 0, 0, region);@@ -1010,6 +1033,43 @@ void intel_buf_init_using_handle(struct buf_ops *bops, req_tiling, compression, 0, 0, -1); } +/** +* intel_buf_init_full +* @bops: pointer to buf_ops +* @handle: BO handle created by the caller +* @buf: pointer to intel_buf structure to be filled +* @width: surface width +* @height: surface height +* @bpp: bits-per-pixel (8 / 16 / 32 / 64) +* @alignment: alignment of the stride for linear surfaces +* @req_tiling: surface tiling +* @compression: surface compression type +* @size: real bo size +* @stride: bo stride +* @region: region +* +* Function configures BO handle within intel_buf structure passed by the caller +* (with all its metadata - width, height, ...). Useful if BO was created +* outside. Allows passing real size which caller is aware of. +* +* Note: intel_buf_close() can be used because intel_buf is aware it is not +* buffer owner so it won't close it underneath. +*/ +void intel_buf_init_full (struct buf_ops *bops, +uint32_t handle, +struct intel_buf *buf, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region) +{ +__intel_buf_init (bops, handle, buf, width, height, bpp, alignment, + req_tiling, compression, size, stride, region); +} +/** * intel_buf_create * @bops: pointer to buf_ops @@ -1084,6 +1144,20 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,uint32_t compression, uint64_t size, int stride) +{ + return intel_buf_create_full(bops, handle, width, height, bpp, alignment, + req_tiling, compression, size, stride, -1); +} + +struct intel_buf *intel_buf_create_full (struct buf_ops *bops, +uint32_t handle, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region) {struct intel_buf *buf;@@ -1093,12 +1167,11 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,igt_assert (buf);__intel_buf_init (bops, handle, buf, width, height, bpp, alignment, - req_tiling, compression, size, stride,-1 ); + req_tiling, compression, size, stride, region);return buf; } -/** * intel_buf_destroy * @buf: intel_buf @@ -1420,8 +1493,24 @@ static struct buf_ops *__buf_ops_create(int fd, bool check_idempotency) bops->fd = fd; bops->intel_gen = generation; -igt_debug ("generation: %d, supported tiles: 0x%02x\n" , - bops->intel_gen, bops->supported_tiles); + bops->driver =is_i915_device (fd) ?INTEL_DRIVER_I915 : +is_xe_device (fd) ?INTEL_DRIVER_XE :0 ; +igt_assert (bops->driver); +igt_debug ("generation: %d, supported tiles: 0x%02x, driver: %s\n" , + bops->intel_gen, bops->supported_tiles, + bops->driver ==INTEL_DRIVER_I915 ?"i915" :"xe" ); + +/* No tiling support in XE. */ +if (bops->driver ==INTEL_DRIVER_XE ) { + 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! @@ -1569,6 +1658,17 @@ int buf_ops_get_fd(struct buf_ops *bops)return bops->fd;
lib/intel_bufops.c int buf_ops_get_fd(struct buf_ops *bops) · line 1668
Quoted 10 lines
lib/intel_bufops.c +8
-0} +/** +* buf_ops_get_driver +* @bops: pointer to buf_ops +* +* Returns: intel driver enum value +*/ +enum intel_driver buf_ops_get_driver (struct buf_ops *bops) +{
Maybe 'igt_assert(bops)' here? At least that's what buf_ops_get_fd does, and it adds some layer of protection over just wrapping 'bops->driver'.
Anyway:
Quoted 68 lines
lib/intel_bufops.c +2
-0+return bops->driver; +} > +/** * buf_ops_set_software_tiling * @bops: pointer to buf_ops lib/intel_bufops.h +23
-1@@ -43,6 +43,7 @@ struct intel_buf { } addr;uint64_t bo_size; +uint64_t region;/* Tracking */ struct intel_bb *ibb;@@ -109,6 +110,7 @@ struct buf_ops *buf_ops_create(int fd);struct buf_ops *buf_ops_create_with_selftest (int fd);void buf_ops_destroy (struct buf_ops *bops);int buf_ops_get_fd (struct buf_ops *bops); +enum intel_driver buf_ops_get_driver (struct buf_ops *bops); bool buf_ops_set_software_tiling(struct buf_ops *bops, uint32_t tiling,@@ -135,7 +137,7 @@ void intel_buf_init_in_region(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression, - uint32_t region); + uint64_t region);void intel_buf_close (struct buf_ops *bops,struct intel_buf *buf); void intel_buf_init_using_handle(struct buf_ops *bops,@@ -143,6 +145,16 @@ void intel_buf_init_using_handle(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t req_tiling, uint32_t compression); +void intel_buf_init_full (struct buf_ops *bops, +uint32_t handle, +struct intel_buf *buf, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region); struct intel_buf *intel_buf_create(struct buf_ops *bops, int width, int height,@@ -164,6 +176,16 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,uint32_t compression, uint64_t size, int stride); + +struct intel_buf *intel_buf_create_full (struct buf_ops *bops, +uint32_t handle, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region);void intel_buf_destroy (struct intel_buf *buf);static inline void intel_buf_set_pxp (struct intel_buf *buf,bool new_pxp_state)
Re: [igt-dev] [PATCH i-g-t v6 06/15] lib/intel_bufops: Add Xe support in bufops
Quoted 11 lines · Christoph
lib/intel_bufops.c int buf_ops_get_fd(struct buf_ops *bops) · line 1668
Quoted 8 lines
lib/intel_bufops.c +8
-0+/** +* buf_ops_get_driver +* @bops: pointer to buf_ops +* +* Returns: intel driver enum value +*/ +enum intel_driver buf_ops_get_driver (struct buf_ops *bops) +{Maybe '
igt_assert(bops)' here? At least that's whatbuf_ops_get_fddoes, and it adds some layer of protection over just wrapping 'bops->driver'.
Agree, this is public function and checking bops != null makes sense.
--
Zbigniew
Quoted 4 lines
Anyway:
Reviewed-by Christoph Manszewski <[email protected]>
Re: [igt-dev] [PATCH i-g-t v6 06/15] lib/intel_bufops: Add Xe support in bufops
In reply to Zbigniew KempczyńskiHi Zbigniew,
Quoted 24 lines · Zbigniew Kempczyński
Extend bufops to support Xe:
- change region to 64bit region mask,
- add initialization helper (full) which allows passing handle, size and region,
- mapping functions (read + write) selects driver specific mappingSigned-off-by Zbigniew Kempczyński <[email protected]>Signed-off-by Bhanuprakash Modem <[email protected]>---
v5: addintel_buf_create_full()for futurelib/igt_fbchanges
regarding region
v6: - fixigt_assert_f()
- addbuf_ops_get_driver()helper--- lib/intel_bufops.c | 120 +++++++++++++++++++++++++++++++++++++++++---- lib/intel_bufops.h | 24 ++++++++- 2 files changed, 133 insertions(+), 11 deletions(-)lib/intel_bufops.c +0
-0
lib/intel_bufops.c line 30
Quoted 5 lines
lib/intel_bufops.c +2
-0@@ -26,6 +26,8 @@#include <cairo.h> #include "i915/gem_create.h" +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h"
------------ ^
Put in alphabetical order.
Quoted 50 lines
lib/intel_bufops.c +11
-4#include "igt.h" #include "igt_x86.h" #include "intel_bufops.h" @@ -106,6 +108,7 @@ typedef void (*bo_copy)(struct buf_ops *, struct intel_buf *, uint32_t *);struct buf_ops {int fd; +enum intel_driver driver;int gen_start;int gen_end;unsigned int intel_gen;@@ -488,6 +491,9 @@ static void *mmap_write(int fd, struct intel_buf *buf) {void *map =NULL ; +if (buf->bops->driver ==INTEL_DRIVER_XE ) +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 +536,9 @@ static void *mmap_read(int fd, struct intel_buf *buf) {void *map =NULL ; +if (buf->bops->driver ==INTEL_DRIVER_XE ) +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 @@ -809,7 +818,7 @@ static void __intel_buf_init(struct buf_ops *bops, int width, int height, int bpp, int alignment, uint32_t req_tiling, uint32_t compression, uint64_t bo_size, int bo_stride, - uint32_t region) + uint64_t region) { uint32_t tiling = req_tiling;uint64_t size;@@ -899,9 +908,19 @@ 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 (bops->driver ==INTEL_DRIVER_I915 ) { +if (__gem_create_in_memory_regions (bops->fd, &buf->handle, &size, region))
lib/intel_bufops.c static void __intel_buf_init(struct buf_ops *bops, · line 923
Quoted 10 lines
lib/intel_bufops.c +10
-0+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, region); + } + } +if (bops->driver ==INTEL_DRIVER_XE ) +igt_assert_f (region !=-1 ,"Xe requires region awareness, " +"use api which passes valid region\n" ); + buf->region = region;
Place this "if() ... region" before if(!handle)
Regards,
Kamil
Quoted 216 lines
lib/intel_bufops.c +87
-6/* Store gem bo size */ buf->bo_size = size;@@ -930,8 +949,12 @@ void intel_buf_init(struct buf_ops *bops, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression) { + uint64_t region; + + 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, I915_SYSTEM_MEMORY); + tiling, compression,0 ,0 , region);intel_buf_set_ownership (buf, true); }@@ -945,7 +968,7 @@ void intel_buf_init_in_region(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression, - uint32_t region) + uint64_t region) { __intel_buf_init(bops, 0, buf, width, height, bpp, alignment, tiling, compression, 0, 0, region);@@ -1010,6 +1033,43 @@ void intel_buf_init_using_handle(struct buf_ops *bops, req_tiling, compression, 0, 0, -1); } +/** +* intel_buf_init_full +* @bops: pointer to buf_ops +* @handle: BO handle created by the caller +* @buf: pointer to intel_buf structure to be filled +* @width: surface width +* @height: surface height +* @bpp: bits-per-pixel (8 / 16 / 32 / 64) +* @alignment: alignment of the stride for linear surfaces +* @req_tiling: surface tiling +* @compression: surface compression type +* @size: real bo size +* @stride: bo stride +* @region: region +* +* Function configures BO handle within intel_buf structure passed by the caller +* (with all its metadata - width, height, ...). Useful if BO was created +* outside. Allows passing real size which caller is aware of. +* +* Note: intel_buf_close() can be used because intel_buf is aware it is not +* buffer owner so it won't close it underneath. +*/ +void intel_buf_init_full (struct buf_ops *bops, +uint32_t handle, +struct intel_buf *buf, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region) +{ +__intel_buf_init (bops, handle, buf, width, height, bpp, alignment, + req_tiling, compression, size, stride, region); +} +/** * intel_buf_create * @bops: pointer to buf_ops @@ -1084,6 +1144,20 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,uint32_t compression, uint64_t size, int stride) +{ + return intel_buf_create_full(bops, handle, width, height, bpp, alignment, + req_tiling, compression, size, stride, -1); +} + +struct intel_buf *intel_buf_create_full (struct buf_ops *bops, +uint32_t handle, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region) {struct intel_buf *buf;@@ -1093,12 +1167,11 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,igt_assert (buf);__intel_buf_init (bops, handle, buf, width, height, bpp, alignment, - req_tiling, compression, size, stride,-1 ); + req_tiling, compression, size, stride, region);return buf; } -/** * intel_buf_destroy * @buf: intel_buf @@ -1420,8 +1493,24 @@ static struct buf_ops *__buf_ops_create(int fd, bool check_idempotency) bops->fd = fd; bops->intel_gen = generation; -igt_debug ("generation: %d, supported tiles: 0x%02x\n" , - bops->intel_gen, bops->supported_tiles); + bops->driver =is_i915_device (fd) ?INTEL_DRIVER_I915 : +is_xe_device (fd) ?INTEL_DRIVER_XE :0 ; +igt_assert (bops->driver); +igt_debug ("generation: %d, supported tiles: 0x%02x, driver: %s\n" , + bops->intel_gen, bops->supported_tiles, + bops->driver ==INTEL_DRIVER_I915 ?"i915" :"xe" ); + +/* No tiling support in XE. */ +if (bops->driver ==INTEL_DRIVER_XE ) { + 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! @@ -1569,6 +1658,17 @@ int buf_ops_get_fd(struct buf_ops *bops)return bops->fd; } +/** +* buf_ops_get_driver +* @bops: pointer to buf_ops +* +* Returns: intel driver enum value +*/ +enum intel_driver buf_ops_get_driver (struct buf_ops *bops) +{ +return bops->driver; +} +/** * buf_ops_set_software_tiling * @bops: pointer to buf_ops lib/intel_bufops.h +23
-1@@ -43,6 +43,7 @@ struct intel_buf { } addr;uint64_t bo_size; +uint64_t region;/* Tracking */ struct intel_bb *ibb;@@ -109,6 +110,7 @@ struct buf_ops *buf_ops_create(int fd);struct buf_ops *buf_ops_create_with_selftest (int fd);void buf_ops_destroy (struct buf_ops *bops);int buf_ops_get_fd (struct buf_ops *bops); +enum intel_driver buf_ops_get_driver (struct buf_ops *bops); bool buf_ops_set_software_tiling(struct buf_ops *bops, uint32_t tiling,@@ -135,7 +137,7 @@ void intel_buf_init_in_region(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression, - uint32_t region); + uint64_t region);void intel_buf_close (struct buf_ops *bops,struct intel_buf *buf); void intel_buf_init_using_handle(struct buf_ops *bops,@@ -143,6 +145,16 @@ void intel_buf_init_using_handle(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t req_tiling, uint32_t compression); +void intel_buf_init_full (struct buf_ops *bops, +uint32_t handle, +struct intel_buf *buf, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region); struct intel_buf *intel_buf_create(struct buf_ops *bops, int width, int height,@@ -164,6 +176,16 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,uint32_t compression, uint64_t size, int stride); + +struct intel_buf *intel_buf_create_full (struct buf_ops *bops, +uint32_t handle, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region);void intel_buf_destroy (struct intel_buf *buf);static inline void intel_buf_set_pxp (struct intel_buf *buf,bool new_pxp_state)Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 06/15] lib/intel_bufops: Add Xe support in bufops
Quoted 29 lines · Kamil Konieczny
Hi Zbigniew,
Quoted 26 lines · Zbigniew Kempczyński
Extend bufops to support Xe:
- change region to 64bit region mask,
- add initialization helper (full) which allows passing handle, size and region,
- mapping functions (read + write) selects driver specific mappingSigned-off-by Zbigniew Kempczyński <[email protected]>Signed-off-by Bhanuprakash Modem <[email protected]>---
v5: addintel_buf_create_full()for futurelib/igt_fbchanges
regarding region
v6: - fixigt_assert_f()
- addbuf_ops_get_driver()helper--- lib/intel_bufops.c | 120 +++++++++++++++++++++++++++++++++++++++++---- lib/intel_bufops.h | 24 ++++++++- 2 files changed, 133 insertions(+), 11 deletions(-)lib/intel_bufops.c +0
-0@@ -26,6 +26,8 @@#include <cairo.h>
Quoted 5 lines
lib/intel_bufops.c line 30
Quoted 3 lines
lib/intel_bufops.c +2
-0#include "i915/gem_create.h" +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h" ------------ ^
Put in alphabetical order.
Ack.
Quoted 55 lines
Quoted 55 lines
lib/intel_bufops.c +15
-4#include "igt.h" #include "igt_x86.h" #include "intel_bufops.h" @@ -106,6 +108,7 @@ typedef void (*bo_copy)(struct buf_ops *, struct intel_buf *, uint32_t *);struct buf_ops {int fd; +enum intel_driver driver;int gen_start;int gen_end;unsigned int intel_gen;@@ -488,6 +491,9 @@ static void *mmap_write(int fd, struct intel_buf *buf) {void *map =NULL ; +if (buf->bops->driver ==INTEL_DRIVER_XE ) +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 +536,9 @@ static void *mmap_read(int fd, struct intel_buf *buf) {void *map =NULL ; +if (buf->bops->driver ==INTEL_DRIVER_XE ) +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 @@ -809,7 +818,7 @@ static void __intel_buf_init(struct buf_ops *bops, int width, int height, int bpp, int alignment, uint32_t req_tiling, uint32_t compression, uint64_t bo_size, int bo_stride, - uint32_t region) + uint64_t region) { uint32_t tiling = req_tiling;uint64_t size;@@ -899,9 +908,19 @@ 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 (bops->driver ==INTEL_DRIVER_I915 ) { +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, region);
Quoted 9 lines
lib/intel_bufops.c static void __intel_buf_init(struct buf_ops *bops, · line 923
Quoted 6 lines
lib/intel_bufops.c +6
-0+ } + } +if (bops->driver ==INTEL_DRIVER_XE ) +igt_assert_f (region !=-1 ,"Xe requires region awareness, " +"use api which passes valid region\n" ); + buf->region = region;Place this "
if()... region" before if(!handle)
Yes, makes sense if assert will fail.
--
Zbigniew
Quoted 219 lines
Regards,
KamilQuoted 216 lines
lib/intel_bufops.c +87
-6/* Store gem bo size */ buf->bo_size = size;@@ -930,8 +949,12 @@ void intel_buf_init(struct buf_ops *bops, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression) { + uint64_t region; + + 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, I915_SYSTEM_MEMORY); + tiling, compression,0 ,0 , region);intel_buf_set_ownership (buf, true); }@@ -945,7 +968,7 @@ void intel_buf_init_in_region(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression, - uint32_t region) + uint64_t region) { __intel_buf_init(bops, 0, buf, width, height, bpp, alignment, tiling, compression, 0, 0, region);@@ -1010,6 +1033,43 @@ void intel_buf_init_using_handle(struct buf_ops *bops, req_tiling, compression, 0, 0, -1); } +/** +* intel_buf_init_full +* @bops: pointer to buf_ops +* @handle: BO handle created by the caller +* @buf: pointer to intel_buf structure to be filled +* @width: surface width +* @height: surface height +* @bpp: bits-per-pixel (8 / 16 / 32 / 64) +* @alignment: alignment of the stride for linear surfaces +* @req_tiling: surface tiling +* @compression: surface compression type +* @size: real bo size +* @stride: bo stride +* @region: region +* +* Function configures BO handle within intel_buf structure passed by the caller +* (with all its metadata - width, height, ...). Useful if BO was created +* outside. Allows passing real size which caller is aware of. +* +* Note: intel_buf_close() can be used because intel_buf is aware it is not +* buffer owner so it won't close it underneath. +*/ +void intel_buf_init_full (struct buf_ops *bops, +uint32_t handle, +struct intel_buf *buf, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region) +{ +__intel_buf_init (bops, handle, buf, width, height, bpp, alignment, + req_tiling, compression, size, stride, region); +} +/** * intel_buf_create * @bops: pointer to buf_ops @@ -1084,6 +1144,20 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,uint32_t compression, uint64_t size, int stride) +{ + return intel_buf_create_full(bops, handle, width, height, bpp, alignment, + req_tiling, compression, size, stride, -1); +} + +struct intel_buf *intel_buf_create_full (struct buf_ops *bops, +uint32_t handle, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region) {struct intel_buf *buf;@@ -1093,12 +1167,11 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,igt_assert (buf);__intel_buf_init (bops, handle, buf, width, height, bpp, alignment, - req_tiling, compression, size, stride,-1 ); + req_tiling, compression, size, stride, region);return buf; } -/** * intel_buf_destroy * @buf: intel_buf @@ -1420,8 +1493,24 @@ static struct buf_ops *__buf_ops_create(int fd, bool check_idempotency) bops->fd = fd; bops->intel_gen = generation; -igt_debug ("generation: %d, supported tiles: 0x%02x\n" , - bops->intel_gen, bops->supported_tiles); + bops->driver =is_i915_device (fd) ?INTEL_DRIVER_I915 : +is_xe_device (fd) ?INTEL_DRIVER_XE :0 ; +igt_assert (bops->driver); +igt_debug ("generation: %d, supported tiles: 0x%02x, driver: %s\n" , + bops->intel_gen, bops->supported_tiles, + bops->driver ==INTEL_DRIVER_I915 ?"i915" :"xe" ); + +/* No tiling support in XE. */ +if (bops->driver ==INTEL_DRIVER_XE ) { + 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! @@ -1569,6 +1658,17 @@ int buf_ops_get_fd(struct buf_ops *bops)return bops->fd; } +/** +* buf_ops_get_driver +* @bops: pointer to buf_ops +* +* Returns: intel driver enum value +*/ +enum intel_driver buf_ops_get_driver (struct buf_ops *bops) +{ +return bops->driver; +} +/** * buf_ops_set_software_tiling * @bops: pointer to buf_ops lib/intel_bufops.h +23
-1@@ -43,6 +43,7 @@ struct intel_buf { } addr;uint64_t bo_size; +uint64_t region;/* Tracking */ struct intel_bb *ibb;@@ -109,6 +110,7 @@ struct buf_ops *buf_ops_create(int fd);struct buf_ops *buf_ops_create_with_selftest (int fd);void buf_ops_destroy (struct buf_ops *bops);int buf_ops_get_fd (struct buf_ops *bops); +enum intel_driver buf_ops_get_driver (struct buf_ops *bops); bool buf_ops_set_software_tiling(struct buf_ops *bops, uint32_t tiling,@@ -135,7 +137,7 @@ void intel_buf_init_in_region(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t tiling, uint32_t compression, - uint32_t region); + uint64_t region);void intel_buf_close (struct buf_ops *bops,struct intel_buf *buf); void intel_buf_init_using_handle(struct buf_ops *bops,@@ -143,6 +145,16 @@ void intel_buf_init_using_handle(struct buf_ops *bops,struct intel_buf *buf, int width, int height, int bpp, int alignment, uint32_t req_tiling, uint32_t compression); +void intel_buf_init_full (struct buf_ops *bops, +uint32_t handle, +struct intel_buf *buf, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region); struct intel_buf *intel_buf_create(struct buf_ops *bops, int width, int height,@@ -164,6 +176,16 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,uint32_t compression, uint64_t size, int stride); + +struct intel_buf *intel_buf_create_full (struct buf_ops *bops, +uint32_t handle, +int width,int height, +int bpp,int alignment, +uint32_t req_tiling, +uint32_t compression, +uint64_t size, +int stride, +uint64_t region);void intel_buf_destroy (struct intel_buf *buf);static inline void intel_buf_set_pxp (struct intel_buf *buf,bool new_pxp_state)Signature · 1 line
2.34.1
PATCH v6 7/15 lib/intel_batchbuffer: Rename i915 -> fd as preparation step for xe
In reply to Zbigniew KempczyńskiUntil now intel-bb was designed to handle i915 (relocations and softpinning). We want to reuse it also for xe as softpinning which requires allocator also unblocks this for vm_bind used in xe.
This is preparation step which stops using i915 as internal fd to avoid confusion.
--- lib/gpu_cmds.c | 2 +- lib/intel_aux_pgtable.c | 2 +- lib/intel_batchbuffer.c | 116 +++++++++++++++++++-------------------- lib/intel_batchbuffer.h | 16 +++--- tests/i915/gem_caching.c | 4 +- tests/i915/gem_pxp.c | 2 +- 6 files changed, 71 insertions(+), 71 deletions(-)
lib/gpu_cmds.c +1 -1
@@ -251,7 +251,7 @@ gen7_fill_binding_table(struct intel_bb *ibb, {uint32_t binding_table_offset;uint32_t *binding_table; -uint32_t devid =intel_get_drm_devid (ibb->i915); +uint32_t devid =intel_get_drm_devid (ibb->fd);intel_bb_ptr_align (ibb,64 ); binding_table_offset =intel_bb_offset (ibb);
lib/intel_aux_pgtable.c +1 -1
@@ -481,7 +481,7 @@ intel_aux_pgtable_create(struct intel_bb *ibb,intel_bb_add_intel_buf_with_alignment (ibb, pgt->buf, pgt->max_align, false); -pgt_map (ibb->i915, pgt); +pgt_map (ibb->fd, pgt);pgt_populate_entries (pgt, bufs, buf_count);pgt_unmap (pgt);
lib/intel_batchbuffer.c +58 -58
358 lines not on this page · raw message
lib/intel_batchbuffer.h +8 -8
@@ -246,7 +246,7 @@ struct intel_bb {uint8_t allocator_type;enum allocator_strategy allocator_strategy; -int i915; +int fd;unsigned int gen;bool debug;bool dump_base64;
@@ -299,21 +299,21 @@ struct intel_bb { };struct intel_bb * -intel_bb_create_full (int i915,uint32_t ctx,const intel_ctx_cfg_t *cfg, +intel_bb_create_full (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size,uint64_t start,uint64_t end,uint8_t allocator_type,enum allocator_strategy strategy);struct intel_bb * -intel_bb_create_with_allocator (int i915,uint32_t ctx,const intel_ctx_cfg_t *cfg, +intel_bb_create_with_allocator (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size,uint8_t allocator_type); -struct intel_bb *intel_bb_create (int i915,uint32_t size); +struct intel_bb *intel_bb_create (int fd,uint32_t size);struct intel_bb * -intel_bb_create_with_context (int i915,uint32_t ctx,const intel_ctx_cfg_t *cfg, +intel_bb_create_with_context (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size); -struct intel_bb *intel_bb_create_with_relocs (int i915,uint32_t size); +struct intel_bb *intel_bb_create_with_relocs (int fd,uint32_t size);struct intel_bb * -intel_bb_create_with_relocs_and_context (int i915,uint32_t ctx, +intel_bb_create_with_relocs_and_context (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size); -struct intel_bb *intel_bb_create_no_relocs (int i915,uint32_t size); +struct intel_bb *intel_bb_create_no_relocs (int fd,uint32_t size);void intel_bb_destroy (struct intel_bb *ibb);/* make it safe to use intel_allocator after failed test */
tests/i915/gem_caching.c +2 -2
@@ -83,7 +83,7 @@ copy_bo(struct intel_bb *ibb, struct intel_buf *src, struct intel_buf *dst)intel_bb_add_intel_buf (ibb, src, false);intel_bb_add_intel_buf (ibb, dst, true); -if (blt_has_xy_src_copy (ibb->i915)) { +if (blt_has_xy_src_copy (ibb->fd)) { intel_bb_out(ibb, XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
@@ -93,7 +93,7 @@ copy_bo(struct intel_bb *ibb, struct intel_buf *src, struct intel_buf *dst)intel_bb_out (ibb, (3 <<24 ) |/* 32 bits */ (0xcc <<16 ) |/* copy ROP */ 4096 ); - }else if (blt_has_fast_copy (ibb->i915)) { + }else if (blt_has_fast_copy (ibb->fd)) {intel_bb_out (ibb,XY_FAST_COPY_BLT );intel_bb_out (ibb,XY_FAST_COPY_COLOR_DEPTH_32 |4096 ); }else {
tests/i915/gem_pxp.c +1 -1
@@ -809,7 +809,7 @@ static int gem_execbuf_flush_store_dw(int i915, struct intel_bb *ibb, uint32_t c ret =__intel_bb_exec (ibb,intel_bb_offset (ibb),I915_EXEC_RENDER |I915_EXEC_NO_RELOC , false);if (ret ==0 ) { -gem_sync (ibb->i915, fence->handle); +gem_sync (ibb->fd, fence->handle);assert_pipectl_storedw_done (i915, fence->handle); }return ret;
Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 07/15] lib/intel_batchbuffer: Rename i915 -> fd as preparation step for xe
Quoted 8 lines · Zbigniew Kempczyński
Until now intel-bb was designed to handle i915 (relocations and softpinning). We want to reuse it also for xe as softpinning which requires allocator also unblocks this for
vm_bindused in xe.This is preparation step which stops using i915 as internal fd to avoid confusion.
Separated from previously reviewed patch so I uphold:
Christoph
Quoted 504 lines
Signed-off-by Zbigniew Kempczyński <[email protected]>--- lib/gpu_cmds.c | 2 +- lib/intel_aux_pgtable.c | 2 +- lib/intel_batchbuffer.c | 116 +++++++++++++++++++-------------------- lib/intel_batchbuffer.h | 16 +++--- tests/i915/gem_caching.c | 4 +- tests/i915/gem_pxp.c | 2 +- 6 files changed, 71 insertions(+), 71 deletions(-)lib/gpu_cmds.c +1
-1@@ -251,7 +251,7 @@ gen7_fill_binding_table(struct intel_bb *ibb, {uint32_t binding_table_offset;uint32_t *binding_table; -uint32_t devid =intel_get_drm_devid (ibb->i915); +uint32_t devid =intel_get_drm_devid (ibb->fd);intel_bb_ptr_align (ibb,64 ); binding_table_offset =intel_bb_offset (ibb);lib/intel_aux_pgtable.c +1
-1@@ -481,7 +481,7 @@ intel_aux_pgtable_create(struct intel_bb *ibb,intel_bb_add_intel_buf_with_alignment (ibb, pgt->buf, pgt->max_align, false); -pgt_map (ibb->i915, pgt); +pgt_map (ibb->fd, pgt);pgt_populate_entries (pgt, bufs, buf_count);pgt_unmap (pgt);lib/intel_batchbuffer.c +58
-58@@ -828,7 +828,7 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,/** * __intel_bb_create: -* @i915: drm fd +* @fd: drm fd * @ctx: context id * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -873,7 +873,7 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,* Pointer the intel_bb, asserts on failure. */ static struct intel_bb * -__intel_bb_create (int i915,uint32_t ctx,const intel_ctx_cfg_t *cfg, +__intel_bb_create (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size,bool do_relocs,uint64_t start,uint64_t end,uint8_t allocator_type,enum allocator_strategy strategy)@@ -883,8 +883,8 @@ __intel_bb_create(int i915, uint32_t ctx, const intel_ctx_cfg_t *cfg,igt_assert (ibb); - ibb->uses_full_ppgtt =gem_uses_full_ppgtt (i915); - ibb->devid =intel_get_drm_devid (i915); + ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); + ibb->devid =intel_get_drm_devid (fd); ibb->gen =intel_gen (ibb->devid);/* @@ -900,16 +900,16 @@ __intel_bb_create(int i915, uint32_t ctx, const intel_ctx_cfg_t *cfg,* so we want kernel to not interfere with this. */ if (do_relocs) - ibb->allows_obj_alignment =gem_allows_obj_alignment (i915); + ibb->allows_obj_alignment =gem_allows_obj_alignment (fd);/* Use safe start offset instead assuming 0x0 is safe */ - start =max_t (uint64_t, start,gem_detect_safe_start_offset (i915)); + start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd));/* if relocs are set we won't use an allocator */ if (do_relocs) allocator_type =INTEL_ALLOCATOR_NONE ;else - ibb->allocator_handle =intel_allocator_open_full (i915, ctx, + ibb->allocator_handle =intel_allocator_open_full (fd, ctx, start, end, allocator_type, strategy,0 );@@ -918,11 +918,11 @@ __intel_bb_create(int i915, uint32_t ctx, const intel_ctx_cfg_t *cfg, ibb->allocator_start = start; ibb->allocator_end = end; - ibb->i915 = i915; + ibb->fd = fd; ibb->enforce_relocs = do_relocs; - ibb->handle =gem_create (i915, size); + ibb->handle =gem_create (fd, size); ibb->size = size; - ibb->alignment =gem_detect_safe_alignment (i915); + ibb->alignment =gem_detect_safe_alignment (fd); ibb->ctx = ctx; ibb->vm_id =0 ; ibb->batch =calloc (1 , size);@@ -937,7 +937,7 @@ __intel_bb_create(int i915, uint32_t ctx, const intel_ctx_cfg_t *cfg,memcpy (ibb->cfg, cfg,sizeof (*cfg)); } - ibb->gtt_size =gem_aperture_size (i915); + ibb->gtt_size =gem_aperture_size (fd);if ((ibb->gtt_size -1 ) >>32 ) ibb->supports_48b_address = true;@@ -961,7 +961,7 @@ __intel_bb_create(int i915, uint32_t ctx, const intel_ctx_cfg_t *cfg,/** * intel_bb_create_full: -* @i915: drm fd +* @fd: drm fd * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -980,19 +980,19 @@ __intel_bb_create(int i915, uint32_t ctx, const intel_ctx_cfg_t *cfg,* * Pointer the intel_bb, asserts on failure. */ -struct intel_bb *intel_bb_create_full (int i915,uint32_t ctx, +struct intel_bb *intel_bb_create_full (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size,uint64_t start,uint64_t end,uint8_t allocator_type,enum allocator_strategy strategy) { -return __intel_bb_create (i915, ctx, cfg, size, false, start, end, +return __intel_bb_create (fd, ctx, cfg, size, false, start, end, allocator_type, strategy); }/** * intel_bb_create_with_allocator: -* @i915: drm fd +* @fd: drm fd * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1006,18 +1006,18 @@ struct intel_bb *intel_bb_create_full(int i915, uint32_t ctx,* * Pointer the intel_bb, asserts on failure. */ -struct intel_bb *intel_bb_create_with_allocator (int i915,uint32_t ctx, +struct intel_bb *intel_bb_create_with_allocator (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size,uint8_t allocator_type) { -return __intel_bb_create (i915, ctx, cfg, size, false,0 ,0 , +return __intel_bb_create (fd, ctx, cfg, size, false,0 ,0 , allocator_type,ALLOC_STRATEGY_HIGH_TO_LOW ); } -static bool aux_needs_softpin (int i915) +static bool aux_needs_softpin (int fd) { -return intel_gen (intel_get_drm_devid (i915)) >=12 ; +return intel_gen (intel_get_drm_devid (fd)) >=12 ; }static bool has_ctx_cfg (struct intel_bb *ibb)@@ -1027,7 +1027,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)/** * intel_bb_create: -* @i915: drm fd +* @fd: drm fd * @size: size of the batchbuffer * * Creates bb with default context. @@ -1045,19 +1045,19 @@ static bool has_ctx_cfg(struct intel_bb *ibb)* connection to it inside intel_bb is not valid anymore. * Trying to use it leads to catastrofic errors. */ -struct intel_bb *intel_bb_create (int i915,uint32_t size) +struct intel_bb *intel_bb_create (int fd,uint32_t size) { -bool relocs =gem_has_relocations (i915); +bool relocs =gem_has_relocations (fd); -return __intel_bb_create (i915,0 ,NULL , size, - relocs && !aux_needs_softpin (i915),0 ,0 , +return __intel_bb_create (fd,0 ,NULL , size, + relocs && !aux_needs_softpin (fd),0 ,0 ,INTEL_ALLOCATOR_SIMPLE ,ALLOC_STRATEGY_HIGH_TO_LOW ); }/** * intel_bb_create_with_context: -* @i915: drm fd +* @fd: drm fd * @ctx: context id * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1070,20 +1070,20 @@ struct intel_bb *intel_bb_create(int i915, uint32_t size)* Pointer the intel_bb, asserts on failure. */ struct intel_bb * -intel_bb_create_with_context (int i915,uint32_t ctx, +intel_bb_create_with_context (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size) { -bool relocs =gem_has_relocations (i915); +bool relocs =gem_has_relocations (fd); -return __intel_bb_create (i915, ctx, cfg, size, - relocs && !aux_needs_softpin (i915),0 ,0 , +return __intel_bb_create (fd, ctx, cfg, size, + relocs && !aux_needs_softpin (fd),0 ,0 ,INTEL_ALLOCATOR_SIMPLE ,ALLOC_STRATEGY_HIGH_TO_LOW ); }/** * intel_bb_create_with_relocs: -* @i915: drm fd +* @fd: drm fd * @size: size of the batchbuffer * * Creates bb which will disable passing addresses. @@ -1093,17 +1093,17 @@ intel_bb_create_with_context(int i915, uint32_t ctx,* * Pointer the intel_bb, asserts on failure. */ -struct intel_bb *intel_bb_create_with_relocs (int i915,uint32_t size) +struct intel_bb *intel_bb_create_with_relocs (int fd,uint32_t size) { -igt_require (gem_has_relocations (i915)); +igt_require (gem_has_relocations (fd)); -return __intel_bb_create (i915,0 ,NULL , size, true,0 ,0 , +return __intel_bb_create (fd,0 ,NULL , size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE ); }/** * intel_bb_create_with_relocs_and_context: -* @i915: drm fd +* @fd: drm fd * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1116,19 +1116,19 @@ struct intel_bb *intel_bb_create_with_relocs(int i915, uint32_t size)* Pointer the intel_bb, asserts on failure. */ struct intel_bb * -intel_bb_create_with_relocs_and_context (int i915,uint32_t ctx, +intel_bb_create_with_relocs_and_context (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size) { -igt_require (gem_has_relocations (i915)); +igt_require (gem_has_relocations (fd)); -return __intel_bb_create (i915, ctx, cfg, size, true,0 ,0 , +return __intel_bb_create (fd, ctx, cfg, size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE ); }/** * intel_bb_create_no_relocs: -* @i915: drm fd +* @fd: drm fd * @size: size of the batchbuffer * * Creates bb with disabled relocations. @@ -1138,11 +1138,11 @@ intel_bb_create_with_relocs_and_context(int i915, uint32_t ctx,* * Pointer the intel_bb, asserts on failure. */ -struct intel_bb *intel_bb_create_no_relocs (int i915,uint32_t size) +struct intel_bb *intel_bb_create_no_relocs (int fd,uint32_t size) { -igt_require (gem_uses_full_ppgtt (i915)); +igt_require (gem_uses_full_ppgtt (fd)); -return __intel_bb_create (i915,0 ,NULL , size, false,0 ,0 , +return __intel_bb_create (fd,0 ,NULL , size, false,0 ,0 ,INTEL_ALLOCATOR_SIMPLE ,ALLOC_STRATEGY_HIGH_TO_LOW ); }@@ -1217,7 +1217,7 @@ void intel_bb_destroy(struct intel_bb *ibb)intel_allocator_free (ibb->allocator_handle, ibb->handle);intel_allocator_close (ibb->allocator_handle); } -gem_close (ibb->i915, ibb->handle); +gem_close (ibb->fd, ibb->handle);if (ibb->fence >=0 )close (ibb->fence);@@ -1277,8 +1277,8 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)intel_bb_remove_object (ibb, ibb->handle, ibb->batch_offset, ibb->size); -gem_close (ibb->i915, ibb->handle); - ibb->handle =gem_create (ibb->i915, ibb->size); +gem_close (ibb->fd, ibb->handle); + ibb->handle =gem_create (ibb->fd, ibb->size);/* Keep address for bb in reloc mode and RANDOM allocator */ if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE )@@ -1325,7 +1325,7 @@ int intel_bb_sync(struct intel_bb *ibb)void intel_bb_print (struct intel_bb *ibb) {igt_info ("drm fd: %d, gen: %d, devid: %u, debug: %d\n" , - ibb->i915, ibb->gen, ibb->devid, ibb->debug); + ibb->fd, ibb->gen, ibb->devid, ibb->debug);igt_info ("handle: %u, size: %u, batch: %p, ptr: %p\n" , ibb->handle, ibb->size, ibb->batch, ibb->ptr); igt_info("gtt_size: %" PRIu64 ", supports 48bit: %d\n",@@ -1350,7 +1350,7 @@ void intel_bb_dump(struct intel_bb *ibb, const char *filename)FILE *out;void *ptr; - ptr =gem_mmap__device_coherent (ibb->i915, ibb->handle,0 , ibb->size, + ptr =gem_mmap__device_coherent (ibb->fd, ibb->handle,0 , ibb->size,PROT_READ ); out =fopen (filename,"wb" );igt_assert (out);@@ -1524,7 +1524,7 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,igt_assert (is_power_of_two (alignment)); object =__add_to_cache (ibb, handle); - alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->i915)); + alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd));__add_to_objects (ibb, object);/* @@ -1999,7 +1999,7 @@ static void intel_bb_dump_execbuf(struct intel_bb *ibb,uint64_t address;igt_debug ("execbuf [pid: %ld, fd: %d, ctx: %u]\n" , - (long )getpid (), ibb->i915, ibb->ctx); + (long )getpid (), ibb->fd, ibb->ctx);igt_debug ("execbuf batch len: %u, start offset: 0x%x, " "DR1: 0x%x, DR4: 0x%x, " "num clip: %u, clipptr: 0x%llx, "@@ -2160,7 +2160,7 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset, ibb->objects[0 ]->handle = ibb->handle; ibb->objects[0 ]->offset = ibb->batch_offset; -gem_write (ibb->i915, ibb->handle,0 , ibb->batch, ibb->size); +gem_write (ibb->fd, ibb->handle,0 , ibb->batch, ibb->size);memset (&execbuf,0 ,sizeof (execbuf)); objects =create_objects_array (ibb);@@ -2179,7 +2179,7 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,/* For debugging on CI, remove in final series */ intel_bb_dump_execbuf (ibb, &execbuf); - ret =__gem_execbuf_wr (ibb->i915, &execbuf); + ret =__gem_execbuf_wr (ibb->fd, &execbuf);if (ret) {intel_bb_dump_execbuf (ibb, &execbuf);free (objects);@@ -2409,13 +2409,13 @@ uint32_t intel_bb_copy_data(struct intel_bb *ibb,*/ void intel_bb_blit_start (struct intel_bb *ibb,uint32_t flags) { -if (blt_has_xy_src_copy (ibb->i915)) +if (blt_has_xy_src_copy (ibb->fd))intel_bb_out (ibb,XY_SRC_COPY_BLT_CMD |XY_SRC_COPY_BLT_WRITE_ALPHA |XY_SRC_COPY_BLT_WRITE_RGB | flags | (6 +2 * (ibb->gen >=8 ))); -else if (blt_has_fast_copy (ibb->i915)) +else if (blt_has_fast_copy (ibb->fd))intel_bb_out (ibb,XY_FAST_COPY_BLT | flags);else igt_assert_f (0 ,"No supported blit command found\n" );@@ -2456,9 +2456,9 @@ void intel_bb_emit_blt_copy(struct intel_bb *ibb,if (gen >=4 && src->tiling !=I915_TILING_NONE ) { src_pitch /=4 ; -if (blt_has_xy_src_copy (ibb->i915)) +if (blt_has_xy_src_copy (ibb->fd)) cmd_bits |=XY_SRC_COPY_BLT_SRC_TILED ; -else if (blt_has_fast_copy (ibb->i915)) +else if (blt_has_fast_copy (ibb->fd)) cmd_bits |=fast_copy_dword0 (src->tiling, dst->tiling);else igt_assert_f (0 ,"No supported blit command found\n" );@@ -2466,7 +2466,7 @@ void intel_bb_emit_blt_copy(struct intel_bb *ibb,if (gen >=4 && dst->tiling !=I915_TILING_NONE ) { dst_pitch /=4 ; -if (blt_has_xy_src_copy (ibb->i915)) +if (blt_has_xy_src_copy (ibb->fd)) cmd_bits |=XY_SRC_COPY_BLT_DST_TILED ;else cmd_bits |=fast_copy_dword0 (src->tiling, dst->tiling);@@ -2480,7 +2480,7 @@ void intel_bb_emit_blt_copy(struct intel_bb *ibb,CHECK_RANGE (src_pitch);CHECK_RANGE (dst_pitch); br13_bits =0 ; -if (blt_has_xy_src_copy (ibb->i915)) { +if (blt_has_xy_src_copy (ibb->fd)) {switch (bpp) {case 8 :break ;@@ -2496,7 +2496,7 @@ void intel_bb_emit_blt_copy(struct intel_bb *ibb,igt_fail (IGT_EXIT_FAILURE ); } }else { - br13_bits =fast_copy_dword1 (ibb->i915, src->tiling, dst->tiling, bpp); + br13_bits =fast_copy_dword1 (ibb->fd, src->tiling, dst->tiling, bpp); }if ((src->tiling | dst->tiling) >=I915_TILING_Y ) {@@ -2631,7 +2631,7 @@ static void __intel_bb_reinit_alloc(struct intel_bb *ibb)if (ibb->allocator_type ==INTEL_ALLOCATOR_NONE )return ; - ibb->allocator_handle = intel_allocator_open_full(ibb->i915, ibb->ctx, + ibb->allocator_handle = intel_allocator_open_full(ibb->fd, ibb->ctx, ibb->allocator_start, ibb->allocator_end, ibb->allocator_type, ibb->allocator_strategy,lib/intel_batchbuffer.h +8
-8@@ -246,7 +246,7 @@ struct intel_bb {uint8_t allocator_type;enum allocator_strategy allocator_strategy; -int i915; +int fd;unsigned int gen;bool debug;bool dump_base64;@@ -299,21 +299,21 @@ struct intel_bb { };struct intel_bb * -intel_bb_create_full (int i915,uint32_t ctx,const intel_ctx_cfg_t *cfg, +intel_bb_create_full (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size,uint64_t start,uint64_t end,uint8_t allocator_type,enum allocator_strategy strategy);struct intel_bb * -intel_bb_create_with_allocator (int i915,uint32_t ctx,const intel_ctx_cfg_t *cfg, +intel_bb_create_with_allocator (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size,uint8_t allocator_type); -struct intel_bb *intel_bb_create (int i915,uint32_t size); +struct intel_bb *intel_bb_create (int fd,uint32_t size);struct intel_bb * -intel_bb_create_with_context (int i915,uint32_t ctx,const intel_ctx_cfg_t *cfg, +intel_bb_create_with_context (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size); -struct intel_bb *intel_bb_create_with_relocs (int i915,uint32_t size); +struct intel_bb *intel_bb_create_with_relocs (int fd,uint32_t size);struct intel_bb * -intel_bb_create_with_relocs_and_context (int i915,uint32_t ctx, +intel_bb_create_with_relocs_and_context (int fd,uint32_t ctx,const intel_ctx_cfg_t *cfg,uint32_t size); -struct intel_bb *intel_bb_create_no_relocs (int i915,uint32_t size); +struct intel_bb *intel_bb_create_no_relocs (int fd,uint32_t size);void intel_bb_destroy (struct intel_bb *ibb);/* make it safe to use intel_allocator after failed test */ tests/i915/gem_caching.c +2
-2@@ -83,7 +83,7 @@ copy_bo(struct intel_bb *ibb, struct intel_buf *src, struct intel_buf *dst)intel_bb_add_intel_buf (ibb, src, false);intel_bb_add_intel_buf (ibb, dst, true); -if (blt_has_xy_src_copy (ibb->i915)) { +if (blt_has_xy_src_copy (ibb->fd)) { intel_bb_out(ibb, XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |@@ -93,7 +93,7 @@ copy_bo(struct intel_bb *ibb, struct intel_buf *src, struct intel_buf *dst)intel_bb_out (ibb, (3 <<24 ) |/* 32 bits */ (0xcc <<16 ) |/* copy ROP */ 4096 ); - }else if (blt_has_fast_copy (ibb->i915)) { + }else if (blt_has_fast_copy (ibb->fd)) {intel_bb_out (ibb,XY_FAST_COPY_BLT );intel_bb_out (ibb,XY_FAST_COPY_COLOR_DEPTH_32 |4096 ); }else {tests/i915/gem_pxp.c +1
-1@@ -809,7 +809,7 @@ static int gem_execbuf_flush_store_dw(int i915, struct intel_bb *ibb, uint32_t c ret =__intel_bb_exec (ibb,intel_bb_offset (ibb),I915_EXEC_RENDER |I915_EXEC_NO_RELOC , false);if (ret ==0 ) { -gem_sync (ibb->i915, fence->handle); +gem_sync (ibb->fd, fence->handle);assert_pipectl_storedw_done (i915, fence->handle); }return ret;
PATCH v6 8/15 lib/intel_batchbuffer: Add Xe support in intel-bb
In reply to Zbigniew KempczyńskiIntention of creating intel-bb was to replace libdrm for i915. Due to many code relies on it (kms for example) most rational way is to extend and add Xe path to it.
--- lib/intel_batchbuffer.c | 350 +++++++++++++++++++++++++++++++++------- lib/intel_batchbuffer.h | 6 + 2 files changed, 295 insertions(+), 61 deletions(-)
lib/intel_batchbuffer.c +289 -61
@@ -29,6 +29,8 @@#include <glib.h> #include "i915/gem_create.h" +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h" #include "intel_batchbuffer.h" #include "intel_bufops.h" #include "intel_chipset.h"
@@ -38,6 +40,8 @@#include "veboxcopy.h" #include "sw_sync.h" #include "gpgpu_fill.h" +#include "igt_aux.h" +#include "igt_syncobj.h" #include "huc_copy.h" #include "i915/i915_blt.h"
@@ -828,21 +832,22 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,/** * __intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id -* @cfg: intel_ctx configuration, NULL for default context or legacy mode +* @cfg: for i915 intel_ctx configuration, NULL for default context or legacy mode, +* unused for xe * @size: size of the batchbuffer * @do_relocs: use relocations or allocator * @allocator_type: allocator type, must be INTEL_ALLOCATOR_NONE for relocations * * intel-bb assumes it will work in one of two modes - with relocations or -* with using allocator (currently RANDOM and SIMPLE are implemented). +* with using allocator (currently RELOC and SIMPLE are implemented). * Some description is required to describe how they maintain the addresses. * * Before entering into each scenarios generic rule is intel-bb keeps objects * and their offsets in the internal cache and reuses in subsequent execs. * -* 1. intel-bb with relocations +* 1. intel-bb with relocations (i915 only) * * Creating new intel-bb adds handle to cache implicitly and sets its address * to 0. Objects added to intel-bb later also have address 0 set for first run.
@@ -850,14 +855,15 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,* works in reloc mode addresses are only suggestion to the driver and we * cannot be sure they won't change at next exec. * -* 2. with allocator +* 2. with allocator (i915 or xe) * * This mode is valid only for ppgtt. Addresses are acquired from allocator -* and softpinned. intel-bb cache must be then coherent with allocator -* (simple is coherent, random is not due to fact we don't keep its state). +* and softpinned (i915) or vm-binded (xe). intel-bb cache must be then +* coherent with allocator (simple is coherent, reloc partially [doesn't +* support address reservation]). * When we do intel-bb reset with purging cache it has to reacquire addresses * from allocator (allocator should return same address - what is true for -* simple allocator and false for random as mentioned before). +* simple and reloc allocators). * * If we do reset without purging caches we use addresses from intel-bb cache * during execbuf objects construction.
@@ -883,48 +889,83 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,igt_assert (ibb); - ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); ibb->devid =intel_get_drm_devid (fd); ibb->gen =intel_gen (ibb->devid); + ibb->ctx = ctx; + + ibb->fd = fd; + ibb->driver =is_i915_device (fd) ?INTEL_DRIVER_I915 : +is_xe_device (fd) ?INTEL_DRIVER_XE :0 ; +igt_assert (ibb->driver);/* * If we don't have full ppgtt driver can change our addresses * so allocator is useless in this case. Just enforce relocations * for such gens and don't use allocator at all. */ -if (!ibb->uses_full_ppgtt) - do_relocs = true; +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); -/* -* For softpin mode allocator has full control over offsets allocation -* so we want kernel to not interfere with this. -*/ -if (do_relocs) - ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); +if (!ibb->uses_full_ppgtt) + do_relocs = true; -/* Use safe start offset instead assuming 0x0 is safe */ - start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd)); +/* +* For softpin mode allocator has full control over offsets allocation +* so we want kernel to not interfere with this. +*/ +if (do_relocs) { + ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); + allocator_type =INTEL_ALLOCATOR_NONE ; + }else { +/* Use safe start offset instead assuming 0x0 is safe */ + start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd)); + +/* if relocs are set we won't use an allocator */ + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, + start, end, + allocator_type, + strategy,0 ); + } + + ibb->vm_id =0 ; + }else { +igt_assert (!do_relocs); + +if (!ctx) + ctx =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + + ibb->uses_full_ppgtt =1 ; + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, start, end, + allocator_type, + strategy, +xe_get_default_alignment (fd)); + ibb->vm_id = ctx; + ibb->last_engine = ~0U ; + } -/* if relocs are set we won't use an allocator */ -if (do_relocs) - allocator_type =INTEL_ALLOCATOR_NONE ; -else - ibb->allocator_handle =intel_allocator_open_full (fd, ctx, - start, end, - allocator_type, - strategy,0 ); ibb->allocator_type = allocator_type; ibb->allocator_strategy = strategy; ibb->allocator_start = start; ibb->allocator_end = end; - - ibb->fd = fd; ibb->enforce_relocs = do_relocs; - ibb->handle =gem_create (fd, size); + +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->handle =gem_create (fd, size); + ibb->alignment =gem_detect_safe_alignment (fd); + ibb->gtt_size =gem_aperture_size (fd); + }else { + ibb->alignment =xe_get_default_alignment (fd); + size =ALIGN (size, ibb->alignment); + ibb->handle =xe_bo_create_flags (fd,0 , size, +xe_has_vram (fd) ? +vram_memory (fd,0 ) : +system_memory (fd)); + ibb->gtt_size =1ull <<xe_va_bits (fd); + } + ibb->size = size; - ibb->alignment =gem_detect_safe_alignment (fd); - ibb->ctx = ctx; - ibb->vm_id =0 ; ibb->batch =calloc (1 , size);igt_assert (ibb->batch); ibb->ptr = ibb->batch;
@@ -937,7 +978,6 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,memcpy (ibb->cfg, cfg,sizeof (*cfg)); } - ibb->gtt_size =gem_aperture_size (fd);if ((ibb->gtt_size -1 ) >>32 ) ibb->supports_48b_address = true;
@@ -961,13 +1001,13 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,/** * intel_bb_create_full: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer * @start: allocator vm start address * @end: allocator vm start address -* @allocator_type: allocator type, SIMPLE, RANDOM, ... +* @allocator_type: allocator type, SIMPLE, RELOC, ... * @strategy: allocation strategy * * Creates bb with context passed in @ctx, size in @size and allocator type
@@ -992,7 +1032,7 @@ struct intel_bb *intel_bb_create_full(int fd, uint32_t ctx,/** * intel_bb_create_with_allocator: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer
@@ -1027,7 +1067,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)/** * intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @size: size of the batchbuffer * * Creates bb with default context.
@@ -1047,7 +1087,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)*/ struct intel_bb *intel_bb_create (int fd,uint32_t size) { -bool relocs =gem_has_relocations (fd); +bool relocs =is_i915_device (fd) &&gem_has_relocations (fd); return __intel_bb_create(fd, 0, NULL, size, relocs && !aux_needs_softpin(fd), 0, 0,
@@ -1057,7 +1097,7 @@ struct intel_bb *intel_bb_create(int fd, uint32_t size)/** * intel_bb_create_with_context: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer
@@ -1073,7 +1113,7 @@ struct intel_bb * intel_bb_create_with_context(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, uint32_t size) { - bool relocs = gem_has_relocations(fd); + bool relocs = is_i915_device(fd) && gem_has_relocations(fd); return __intel_bb_create(fd, ctx, cfg, size, relocs && !aux_needs_softpin(fd), 0, 0,
@@ -1083,7 +1123,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,/** * intel_bb_create_with_relocs: -* @fd: drm fd +* @fd: drm fd - i915 * @size: size of the batchbuffer * * Creates bb which will disable passing addresses.
@@ -1095,7 +1135,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,*/ struct intel_bb *intel_bb_create_with_relocs (int fd,uint32_t size) { -igt_require (gem_has_relocations (fd)); +igt_require (is_i915_device (fd) &&gem_has_relocations (fd));return __intel_bb_create (fd,0 ,NULL , size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );
@@ -1103,7 +1143,7 @@ struct intel_bb *intel_bb_create_with_relocs(int fd, uint32_t size)/** * intel_bb_create_with_relocs_and_context: -* @fd: drm fd +* @fd: drm fd - i915 * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer
@@ -1120,7 +1160,7 @@ intel_bb_create_with_relocs_and_context(int fd, uint32_t ctx,const intel_ctx_cfg_t *cfg, uint32_t size) { -igt_require (gem_has_relocations (fd )); + igt_require(is_i915_device(fd) && gem_has_relocations(fd));return __intel_bb_create (fd, ctx, cfg, size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );
@@ -1221,12 +1261,76 @@ void intel_bb_destroy(struct intel_bb *ibb)if (ibb->fence >=0 )close (ibb->fence); +if (ibb->engine_syncobj) +syncobj_destroy (ibb->fd, ibb->engine_syncobj); +if (ibb->vm_id && !ibb->ctx) +xe_vm_destroy (ibb->fd, ibb->vm_id);free (ibb->batch);free (ibb->cfg);free (ibb); } +static struct drm_xe_vm_bind_op *xe_alloc_bind_ops (struct intel_bb *ibb, +uint32_t op,uint32_t region) +{ +struct drm_i915_gem_exec_object2 **objects = ibb->objects; +struct drm_xe_vm_bind_op *bind_ops, *ops; +bool set_obj = (op &0xffff ) ==XE_VM_BIND_OP_MAP ; + + bind_ops =calloc (ibb->num_objects,sizeof (*bind_ops)); +igt_assert (bind_ops); + +igt_debug ("bind_ops: %s\n" , set_obj ?"MAP" :"UNMAP" ); +for (int i =0 ; i < ibb->num_objects; i++) { + ops = &bind_ops[i]; + +if (set_obj) + ops->obj = objects[i]->handle; + + ops->op = op; + ops->obj_offset =0 ; + ops->addr = objects[i]->offset; + ops->range = objects[i]->rsvd1; + ops->region = region; + +igt_debug (" [%d]: handle: %u, offset: %llx, size: %llx\n" , + i, ops->obj, (long long )ops->addr, (long long )ops->range); + } + +return bind_ops; +} + +static void __unbind_xe_objects (struct intel_bb *ibb) +{ +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +int ret; + + syncs[0 ].handle = ibb->engine_syncobj; + syncs[1 ].handle =syncobj_create (ibb->fd,0 ); + +if (ibb->num_objects >1 ) { +struct drm_xe_vm_bind_op *bind_ops; +uint32_t op =XE_VM_BIND_OP_UNMAP |XE_VM_BIND_FLAG_ASYNC ; + + bind_ops =xe_alloc_bind_ops (ibb, op,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,2 ); +free (bind_ops); + }else { +xe_vm_unbind_async (ibb->fd, ibb->vm_id,0 ,0 , + ibb->batch_offset, ibb->size, syncs,2 ); + } + ret =syncobj_wait_err (ibb->fd, &syncs[1 ].handle,1 ,INT64_MAX ,0 ); +igt_assert_eq (ret,0 ); +syncobj_destroy (ibb->fd, syncs[1 ].handle); + + ibb->xe_bound = false; +} +/* * intel_bb_reset: * @ibb: pointer to intel_bb
@@ -1258,6 +1362,9 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)for (i =0 ; i < ibb->num_objects; i++) ibb->objects[i]->flags &=EXEC_OBJECT_SUPPORTS_48B_ADDRESS ; +if (is_xe_device (ibb->fd) && ibb->xe_bound) +__unbind_xe_objects (ibb); +__intel_bb_destroy_relocations (ibb);__intel_bb_destroy_objects (ibb);__reallocate_objects (ibb);
@@ -1278,10 +1385,15 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) ibb->size);gem_close (ibb->fd, ibb->handle); - ibb->handle =gem_create (ibb->fd, ibb->size); +if (is_i915_device (ibb->fd)) + ibb->handle =gem_create (ibb->fd, ibb->size); +else + ibb->handle =xe_bo_create_flags (ibb->fd,0 , ibb->size, +vram_if_possible (ibb->fd,0 )); -/* Keep address for bb in reloc mode and RANDOM allocator */ -if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE ) +/* Reacquire offset for RELOC and SIMPLE */ +if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE || + ibb->allocator_type ==INTEL_ALLOCATOR_RELOC ) ibb->batch_offset = __intel_bb_get_offset(ibb, ibb->handle, ibb->size,
@@ -1304,13 +1416,19 @@ int intel_bb_sync(struct intel_bb *ibb) {int ret; -if (ibb->fence <0 ) +if (ibb->fence <0 && !ibb->engine_syncobj)return 0 ; - ret =sync_fence_wait (ibb->fence,-1 ); -if (ret ==0 ) { -close (ibb->fence); - ibb->fence =-1 ; +if (ibb->fence >=0 ) { + ret =sync_fence_wait (ibb->fence,-1 ); +if (ret ==0 ) { +close (ibb->fence); + ibb->fence =-1 ; + } + }else { +igt_assert_neq (ibb->engine_syncobj,0 ); + ret =syncobj_wait_err (ibb->fd, &ibb->engine_syncobj, +1 ,INT64_MAX ,0 ); }return ret;
@@ -1501,7 +1619,7 @@ static void __remove_from_objects(struct intel_bb *ibb, }/** -* intel_bb_add_object: +* __intel_bb_add_object: * @ibb: pointer to intel_bb * @handle: which handle to add to objects array * @size: object size
@@ -1513,9 +1631,9 @@ static void __remove_from_objects(struct intel_bb *ibb,* in the object tree. When object is a render target it has to * be marked with EXEC_OBJECT_WRITE flag. */ -struct drm_i915_gem_exec_object2 * -intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, -uint64_t offset,uint64_t alignment,bool write) +static struct drm_i915_gem_exec_object2 * +__intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) {struct drm_i915_gem_exec_object2 *object;
@@ -1523,8 +1641,12 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size, || ALIGN(offset, alignment) == offset);igt_assert (is_power_of_two (alignment)); +if (ibb->driver ==INTEL_DRIVER_I915 ) + alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd)); +else + alignment =max_t (uint64_t, ibb->alignment, alignment); + object =__add_to_cache (ibb, handle); - alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd));__add_to_objects (ibb, object);/*
@@ -1584,9 +1706,27 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,if (ibb->allows_obj_alignment) object->alignment = alignment; +if (ibb->driver ==INTEL_DRIVER_XE ) { + object->alignment = alignment; + object->rsvd1 = size; + } +return object; } +struct drm_i915_gem_exec_object2 * +intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) +{ +struct drm_i915_gem_exec_object2 *obj =NULL ; + + obj =__intel_bb_add_object (ibb, handle, size, offset, + alignment, write); +igt_assert (obj); + +return obj; +} +bool intel_bb_remove_object (struct intel_bb *ibb,uint32_t handle,uint64_t offset,uint64_t size) {
@@ -2135,6 +2275,82 @@ static void update_offsets(struct intel_bb *ibb, }#define LINELEN 76 + +static int +__xe_bb_exec (struct intel_bb *ibb,uint64_t flags,bool sync) +{ +uint32_t engine = flags & (I915_EXEC_BSD_MASK |I915_EXEC_RING_MASK ); +uint32_t engine_id; +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +struct drm_xe_vm_bind_op *bind_ops; +void *map; + +igt_assert_eq (ibb->num_relocs,0 ); +igt_assert_eq (ibb->xe_bound, false); + +if (ibb->last_engine != engine) { +struct drm_xe_engine_class_instance inst = { }; + + inst.engine_instance = + (flags &I915_EXEC_BSD_MASK ) >>I915_EXEC_BSD_SHIFT ; + +switch (flags &I915_EXEC_RING_MASK ) { +case I915_EXEC_DEFAULT : +case I915_EXEC_BLT : + inst.engine_class =DRM_XE_ENGINE_CLASS_COPY ; +break ; +case I915_EXEC_BSD : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_DECODE ; +break ; +case I915_EXEC_RENDER : + inst.engine_class =DRM_XE_ENGINE_CLASS_RENDER ; +break ; +case I915_EXEC_VEBOX : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE ; +break ; +default : +igt_assert_f (false,"Unknown engine: %x" , (uint32_t ) flags); + } +igt_debug ("Run on %s\n" ,xe_engine_class_string (inst.engine_class)); + + ibb->engine_id = engine_id = +xe_engine_create (ibb->fd, ibb->vm_id, &inst,0 ); + }else { + engine_id = ibb->engine_id; + } + ibb->last_engine = engine; + + map =xe_bo_map (ibb->fd, ibb->handle, ibb->size); +memcpy (map, ibb->batch, ibb->size); +gem_munmap (map, ibb->size); + + syncs[0 ].handle =syncobj_create (ibb->fd,0 ); +if (ibb->num_objects >1 ) { + bind_ops =xe_alloc_bind_ops (ibb,XE_VM_BIND_OP_MAP |XE_VM_BIND_FLAG_ASYNC ,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,1 ); + ibb->xe_bound = true; +free (bind_ops); + }else { +xe_vm_bind_async (ibb->fd, ibb->vm_id,0 , ibb->handle,0 , + ibb->batch_offset, ibb->size, syncs,1 ); + } + + syncs[0 ].flags &= ~DRM_XE_SYNC_SIGNAL ; + ibb->engine_syncobj =syncobj_create (ibb->fd,0 ); + syncs[1 ].handle = ibb->engine_syncobj; + +xe_exec_sync (ibb->fd, engine_id, ibb->batch_offset, syncs,2 ); + +if (sync) +intel_bb_sync (ibb); + +return 0 ; +} +/* * __intel_bb_exec: * @ibb: pointer to intel_bb
@@ -2220,7 +2436,7 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,/** * intel_bb_exec: * @ibb: pointer to intel_bb -* @end_offset: offset of the last instruction in the bb +* @end_offset: offset of the last instruction in the bb (for i915) * @flags: flags passed directly to execbuf * @sync: if true wait for execbuf completion, otherwise caller is responsible * to wait for completion
@@ -2230,7 +2446,13 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,void intel_bb_exec (struct intel_bb *ibb,uint32_t end_offset,uint64_t flags,bool sync) { -igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +if (ibb->dump_base64) +intel_bb_dump_base64 (ibb,LINELEN ); + +if (ibb->driver ==INTEL_DRIVER_I915 ) +igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +else +igt_assert_eq (__xe_bb_exec (ibb, flags, sync),0 ); }/**
@@ -2628,14 +2850,20 @@ void intel_bb_track(bool do_tracking)static void __intel_bb_reinit_alloc (struct intel_bb *ibb) { +uint64_t alignment =0 ; +if (ibb->allocator_type ==INTEL_ALLOCATOR_NONE )return ; +if (ibb->driver ==INTEL_DRIVER_XE ) + alignment =xe_get_default_alignment (ibb->fd); + ibb->allocator_handle =intel_allocator_open_full (ibb->fd, ibb->ctx, ibb->allocator_start, ibb->allocator_end, ibb->allocator_type, ibb->allocator_strategy, -0 ); + alignment); +intel_bb_reset (ibb, true); }
lib/intel_batchbuffer.h +6 -0
@@ -246,6 +246,7 @@ struct intel_bb {uint8_t allocator_type;enum allocator_strategy allocator_strategy; +enum intel_driver driver;int fd;unsigned int gen;bool debug;
@@ -268,6 +269,11 @@ struct intel_bb {uint32_t ctx;uint32_t vm_id; +bool xe_bound; +uint32_t engine_syncobj; +uint32_t engine_id; +uint32_t last_engine; +/* Context configuration */ intel_ctx_cfg_t *cfg;
Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 08/15] lib/intel_batchbuffer: Add Xe support in intel-bb
Quoted 5 lines · Zbigniew Kempczyński
Intention of creating intel-bb was to replace libdrm for i915. Due to many code relies on it (kms for example) most rational way is to extend and add Xe path to it.
Signed-off-by Zbigniew Kempczyński <[email protected]>
I missed Signed-off-by: Bhanuprakash Modem <[email protected]>
--
Zbigniew
Quoted 639 lines
--- lib/intel_batchbuffer.c | 350 +++++++++++++++++++++++++++++++++------- lib/intel_batchbuffer.h | 6 + 2 files changed, 295 insertions(+), 61 deletions(-)lib/intel_batchbuffer.c +289
-61@@ -29,6 +29,8 @@#include <glib.h> #include "i915/gem_create.h" +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h" #include "intel_batchbuffer.h" #include "intel_bufops.h" #include "intel_chipset.h" @@ -38,6 +40,8 @@#include "veboxcopy.h" #include "sw_sync.h" #include "gpgpu_fill.h" +#include "igt_aux.h" +#include "igt_syncobj.h" #include "huc_copy.h" #include "i915/i915_blt.h" @@ -828,21 +832,22 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,/** * __intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id -* @cfg: intel_ctx configuration, NULL for default context or legacy mode +* @cfg: for i915 intel_ctx configuration, NULL for default context or legacy mode, +* unused for xe * @size: size of the batchbuffer * @do_relocs: use relocations or allocator * @allocator_type: allocator type, must be INTEL_ALLOCATOR_NONE for relocations * * intel-bb assumes it will work in one of two modes - with relocations or -* with using allocator (currently RANDOM and SIMPLE are implemented). +* with using allocator (currently RELOC and SIMPLE are implemented). * Some description is required to describe how they maintain the addresses. * * Before entering into each scenarios generic rule is intel-bb keeps objects * and their offsets in the internal cache and reuses in subsequent execs. * -* 1. intel-bb with relocations +* 1. intel-bb with relocations (i915 only) * * Creating new intel-bb adds handle to cache implicitly and sets its address * to 0. Objects added to intel-bb later also have address 0 set for first run. @@ -850,14 +855,15 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,* works in reloc mode addresses are only suggestion to the driver and we * cannot be sure they won't change at next exec. * -* 2. with allocator +* 2. with allocator (i915 or xe) * * This mode is valid only for ppgtt. Addresses are acquired from allocator -* and softpinned. intel-bb cache must be then coherent with allocator -* (simple is coherent, random is not due to fact we don't keep its state). +* and softpinned (i915) or vm-binded (xe). intel-bb cache must be then +* coherent with allocator (simple is coherent, reloc partially [doesn't +* support address reservation]). * When we do intel-bb reset with purging cache it has to reacquire addresses * from allocator (allocator should return same address - what is true for -* simple allocator and false for random as mentioned before). +* simple and reloc allocators). * * If we do reset without purging caches we use addresses from intel-bb cache * during execbuf objects construction. @@ -883,48 +889,83 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,igt_assert (ibb); - ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); ibb->devid =intel_get_drm_devid (fd); ibb->gen =intel_gen (ibb->devid); + ibb->ctx = ctx; + + ibb->fd = fd; + ibb->driver =is_i915_device (fd) ?INTEL_DRIVER_I915 : +is_xe_device (fd) ?INTEL_DRIVER_XE :0 ; +igt_assert (ibb->driver);/* * If we don't have full ppgtt driver can change our addresses * so allocator is useless in this case. Just enforce relocations * for such gens and don't use allocator at all. */ -if (!ibb->uses_full_ppgtt) - do_relocs = true; +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); -/* -* For softpin mode allocator has full control over offsets allocation -* so we want kernel to not interfere with this. -*/ -if (do_relocs) - ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); +if (!ibb->uses_full_ppgtt) + do_relocs = true; -/* Use safe start offset instead assuming 0x0 is safe */ - start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd)); +/* +* For softpin mode allocator has full control over offsets allocation +* so we want kernel to not interfere with this. +*/ +if (do_relocs) { + ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); + allocator_type =INTEL_ALLOCATOR_NONE ; + }else { +/* Use safe start offset instead assuming 0x0 is safe */ + start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd)); + +/* if relocs are set we won't use an allocator */ + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, + start, end, + allocator_type, + strategy,0 ); + } + + ibb->vm_id =0 ; + }else { +igt_assert (!do_relocs); + +if (!ctx) + ctx =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + + ibb->uses_full_ppgtt =1 ; + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, start, end, + allocator_type, + strategy, +xe_get_default_alignment (fd)); + ibb->vm_id = ctx; + ibb->last_engine = ~0U ; + } -/* if relocs are set we won't use an allocator */ -if (do_relocs) - allocator_type =INTEL_ALLOCATOR_NONE ; -else - ibb->allocator_handle =intel_allocator_open_full (fd, ctx, - start, end, - allocator_type, - strategy,0 ); ibb->allocator_type = allocator_type; ibb->allocator_strategy = strategy; ibb->allocator_start = start; ibb->allocator_end = end; - - ibb->fd = fd; ibb->enforce_relocs = do_relocs; - ibb->handle =gem_create (fd, size); + +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->handle =gem_create (fd, size); + ibb->alignment =gem_detect_safe_alignment (fd); + ibb->gtt_size =gem_aperture_size (fd); + }else { + ibb->alignment =xe_get_default_alignment (fd); + size =ALIGN (size, ibb->alignment); + ibb->handle =xe_bo_create_flags (fd,0 , size, +xe_has_vram (fd) ? +vram_memory (fd,0 ) : +system_memory (fd)); + ibb->gtt_size =1ull <<xe_va_bits (fd); + } + ibb->size = size; - ibb->alignment =gem_detect_safe_alignment (fd); - ibb->ctx = ctx; - ibb->vm_id =0 ; ibb->batch =calloc (1 , size);igt_assert (ibb->batch); ibb->ptr = ibb->batch;@@ -937,7 +978,6 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,memcpy (ibb->cfg, cfg,sizeof (*cfg)); } - ibb->gtt_size =gem_aperture_size (fd);if ((ibb->gtt_size -1 ) >>32 ) ibb->supports_48b_address = true;@@ -961,13 +1001,13 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,/** * intel_bb_create_full: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer * @start: allocator vm start address * @end: allocator vm start address -* @allocator_type: allocator type, SIMPLE, RANDOM, ... +* @allocator_type: allocator type, SIMPLE, RELOC, ... * @strategy: allocation strategy * * Creates bb with context passed in @ctx, size in @size and allocator type @@ -992,7 +1032,7 @@ struct intel_bb *intel_bb_create_full(int fd, uint32_t ctx,/** * intel_bb_create_with_allocator: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1027,7 +1067,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)/** * intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @size: size of the batchbuffer * * Creates bb with default context. @@ -1047,7 +1087,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)*/ struct intel_bb *intel_bb_create (int fd,uint32_t size) { -bool relocs =gem_has_relocations (fd); +bool relocs =is_i915_device (fd) &&gem_has_relocations (fd); return __intel_bb_create(fd, 0, NULL, size, relocs && !aux_needs_softpin(fd), 0, 0,@@ -1057,7 +1097,7 @@ struct intel_bb *intel_bb_create(int fd, uint32_t size)/** * intel_bb_create_with_context: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1073,7 +1113,7 @@ struct intel_bb * intel_bb_create_with_context(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, uint32_t size) { - bool relocs = gem_has_relocations(fd); + bool relocs = is_i915_device(fd) && gem_has_relocations(fd); return __intel_bb_create(fd, ctx, cfg, size, relocs && !aux_needs_softpin(fd), 0, 0,@@ -1083,7 +1123,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,/** * intel_bb_create_with_relocs: -* @fd: drm fd +* @fd: drm fd - i915 * @size: size of the batchbuffer * * Creates bb which will disable passing addresses. @@ -1095,7 +1135,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,*/ struct intel_bb *intel_bb_create_with_relocs (int fd,uint32_t size) { -igt_require (gem_has_relocations (fd)); +igt_require (is_i915_device (fd) &&gem_has_relocations (fd));return __intel_bb_create (fd,0 ,NULL , size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );@@ -1103,7 +1143,7 @@ struct intel_bb *intel_bb_create_with_relocs(int fd, uint32_t size)/** * intel_bb_create_with_relocs_and_context: -* @fd: drm fd +* @fd: drm fd - i915 * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1120,7 +1160,7 @@ intel_bb_create_with_relocs_and_context(int fd, uint32_t ctx,const intel_ctx_cfg_t *cfg, uint32_t size) { -igt_require (gem_has_relocations (fd )); + igt_require(is_i915_device(fd) && gem_has_relocations(fd));return __intel_bb_create (fd, ctx, cfg, size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );@@ -1221,12 +1261,76 @@ void intel_bb_destroy(struct intel_bb *ibb)if (ibb->fence >=0 )close (ibb->fence); +if (ibb->engine_syncobj) +syncobj_destroy (ibb->fd, ibb->engine_syncobj); +if (ibb->vm_id && !ibb->ctx) +xe_vm_destroy (ibb->fd, ibb->vm_id);free (ibb->batch);free (ibb->cfg);free (ibb); } +static struct drm_xe_vm_bind_op *xe_alloc_bind_ops (struct intel_bb *ibb, +uint32_t op,uint32_t region) +{ +struct drm_i915_gem_exec_object2 **objects = ibb->objects; +struct drm_xe_vm_bind_op *bind_ops, *ops; +bool set_obj = (op &0xffff ) ==XE_VM_BIND_OP_MAP ; + + bind_ops =calloc (ibb->num_objects,sizeof (*bind_ops)); +igt_assert (bind_ops); + +igt_debug ("bind_ops: %s\n" , set_obj ?"MAP" :"UNMAP" ); +for (int i =0 ; i < ibb->num_objects; i++) { + ops = &bind_ops[i]; + +if (set_obj) + ops->obj = objects[i]->handle; + + ops->op = op; + ops->obj_offset =0 ; + ops->addr = objects[i]->offset; + ops->range = objects[i]->rsvd1; + ops->region = region; + +igt_debug (" [%d]: handle: %u, offset: %llx, size: %llx\n" , + i, ops->obj, (long long )ops->addr, (long long )ops->range); + } + +return bind_ops; +} + +static void __unbind_xe_objects (struct intel_bb *ibb) +{ +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +int ret; + + syncs[0 ].handle = ibb->engine_syncobj; + syncs[1 ].handle =syncobj_create (ibb->fd,0 ); + +if (ibb->num_objects >1 ) { +struct drm_xe_vm_bind_op *bind_ops; +uint32_t op =XE_VM_BIND_OP_UNMAP |XE_VM_BIND_FLAG_ASYNC ; + + bind_ops =xe_alloc_bind_ops (ibb, op,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,2 ); +free (bind_ops); + }else { +xe_vm_unbind_async (ibb->fd, ibb->vm_id,0 ,0 , + ibb->batch_offset, ibb->size, syncs,2 ); + } + ret =syncobj_wait_err (ibb->fd, &syncs[1 ].handle,1 ,INT64_MAX ,0 ); +igt_assert_eq (ret,0 ); +syncobj_destroy (ibb->fd, syncs[1 ].handle); + + ibb->xe_bound = false; +} +/* * intel_bb_reset: * @ibb: pointer to intel_bb @@ -1258,6 +1362,9 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)for (i =0 ; i < ibb->num_objects; i++) ibb->objects[i]->flags &=EXEC_OBJECT_SUPPORTS_48B_ADDRESS ; +if (is_xe_device (ibb->fd) && ibb->xe_bound) +__unbind_xe_objects (ibb); +__intel_bb_destroy_relocations (ibb);__intel_bb_destroy_objects (ibb);__reallocate_objects (ibb);@@ -1278,10 +1385,15 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) ibb->size);gem_close (ibb->fd, ibb->handle); - ibb->handle =gem_create (ibb->fd, ibb->size); +if (is_i915_device (ibb->fd)) + ibb->handle =gem_create (ibb->fd, ibb->size); +else + ibb->handle =xe_bo_create_flags (ibb->fd,0 , ibb->size, +vram_if_possible (ibb->fd,0 )); -/* Keep address for bb in reloc mode and RANDOM allocator */ -if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE ) +/* Reacquire offset for RELOC and SIMPLE */ +if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE || + ibb->allocator_type ==INTEL_ALLOCATOR_RELOC ) ibb->batch_offset = __intel_bb_get_offset(ibb, ibb->handle, ibb->size,@@ -1304,13 +1416,19 @@ int intel_bb_sync(struct intel_bb *ibb) {int ret; -if (ibb->fence <0 ) +if (ibb->fence <0 && !ibb->engine_syncobj)return 0 ; - ret =sync_fence_wait (ibb->fence,-1 ); -if (ret ==0 ) { -close (ibb->fence); - ibb->fence =-1 ; +if (ibb->fence >=0 ) { + ret =sync_fence_wait (ibb->fence,-1 ); +if (ret ==0 ) { +close (ibb->fence); + ibb->fence =-1 ; + } + }else { +igt_assert_neq (ibb->engine_syncobj,0 ); + ret =syncobj_wait_err (ibb->fd, &ibb->engine_syncobj, +1 ,INT64_MAX ,0 ); }return ret;@@ -1501,7 +1619,7 @@ static void __remove_from_objects(struct intel_bb *ibb, }/** -* intel_bb_add_object: +* __intel_bb_add_object: * @ibb: pointer to intel_bb * @handle: which handle to add to objects array * @size: object size @@ -1513,9 +1631,9 @@ static void __remove_from_objects(struct intel_bb *ibb,* in the object tree. When object is a render target it has to * be marked with EXEC_OBJECT_WRITE flag. */ -struct drm_i915_gem_exec_object2 * -intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, -uint64_t offset,uint64_t alignment,bool write) +static struct drm_i915_gem_exec_object2 * +__intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) {struct drm_i915_gem_exec_object2 *object;@@ -1523,8 +1641,12 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size, || ALIGN(offset, alignment) == offset);igt_assert (is_power_of_two (alignment)); +if (ibb->driver ==INTEL_DRIVER_I915 ) + alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd)); +else + alignment =max_t (uint64_t, ibb->alignment, alignment); + object =__add_to_cache (ibb, handle); - alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd));__add_to_objects (ibb, object);/* @@ -1584,9 +1706,27 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,if (ibb->allows_obj_alignment) object->alignment = alignment; +if (ibb->driver ==INTEL_DRIVER_XE ) { + object->alignment = alignment; + object->rsvd1 = size; + } +return object; } +struct drm_i915_gem_exec_object2 * +intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) +{ +struct drm_i915_gem_exec_object2 *obj =NULL ; + + obj =__intel_bb_add_object (ibb, handle, size, offset, + alignment, write); +igt_assert (obj); + +return obj; +} +bool intel_bb_remove_object (struct intel_bb *ibb,uint32_t handle,uint64_t offset,uint64_t size) {@@ -2135,6 +2275,82 @@ static void update_offsets(struct intel_bb *ibb, }#define LINELEN 76 + +static int +__xe_bb_exec (struct intel_bb *ibb,uint64_t flags,bool sync) +{ +uint32_t engine = flags & (I915_EXEC_BSD_MASK |I915_EXEC_RING_MASK ); +uint32_t engine_id; +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +struct drm_xe_vm_bind_op *bind_ops; +void *map; + +igt_assert_eq (ibb->num_relocs,0 ); +igt_assert_eq (ibb->xe_bound, false); + +if (ibb->last_engine != engine) { +struct drm_xe_engine_class_instance inst = { }; + + inst.engine_instance = + (flags &I915_EXEC_BSD_MASK ) >>I915_EXEC_BSD_SHIFT ; + +switch (flags &I915_EXEC_RING_MASK ) { +case I915_EXEC_DEFAULT : +case I915_EXEC_BLT : + inst.engine_class =DRM_XE_ENGINE_CLASS_COPY ; +break ; +case I915_EXEC_BSD : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_DECODE ; +break ; +case I915_EXEC_RENDER : + inst.engine_class =DRM_XE_ENGINE_CLASS_RENDER ; +break ; +case I915_EXEC_VEBOX : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE ; +break ; +default : +igt_assert_f (false,"Unknown engine: %x" , (uint32_t ) flags); + } +igt_debug ("Run on %s\n" ,xe_engine_class_string (inst.engine_class)); + + ibb->engine_id = engine_id = +xe_engine_create (ibb->fd, ibb->vm_id, &inst,0 ); + }else { + engine_id = ibb->engine_id; + } + ibb->last_engine = engine; + + map =xe_bo_map (ibb->fd, ibb->handle, ibb->size); +memcpy (map, ibb->batch, ibb->size); +gem_munmap (map, ibb->size); + + syncs[0 ].handle =syncobj_create (ibb->fd,0 ); +if (ibb->num_objects >1 ) { + bind_ops =xe_alloc_bind_ops (ibb,XE_VM_BIND_OP_MAP |XE_VM_BIND_FLAG_ASYNC ,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,1 ); + ibb->xe_bound = true; +free (bind_ops); + }else { +xe_vm_bind_async (ibb->fd, ibb->vm_id,0 , ibb->handle,0 , + ibb->batch_offset, ibb->size, syncs,1 ); + } + + syncs[0 ].flags &= ~DRM_XE_SYNC_SIGNAL ; + ibb->engine_syncobj =syncobj_create (ibb->fd,0 ); + syncs[1 ].handle = ibb->engine_syncobj; + +xe_exec_sync (ibb->fd, engine_id, ibb->batch_offset, syncs,2 ); + +if (sync) +intel_bb_sync (ibb); + +return 0 ; +} +/* * __intel_bb_exec: * @ibb: pointer to intel_bb @@ -2220,7 +2436,7 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,/** * intel_bb_exec: * @ibb: pointer to intel_bb -* @end_offset: offset of the last instruction in the bb +* @end_offset: offset of the last instruction in the bb (for i915) * @flags: flags passed directly to execbuf * @sync: if true wait for execbuf completion, otherwise caller is responsible * to wait for completion @@ -2230,7 +2446,13 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,void intel_bb_exec (struct intel_bb *ibb,uint32_t end_offset,uint64_t flags,bool sync) { -igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +if (ibb->dump_base64) +intel_bb_dump_base64 (ibb,LINELEN ); + +if (ibb->driver ==INTEL_DRIVER_I915 ) +igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +else +igt_assert_eq (__xe_bb_exec (ibb, flags, sync),0 ); }/** @@ -2628,14 +2850,20 @@ void intel_bb_track(bool do_tracking)static void __intel_bb_reinit_alloc (struct intel_bb *ibb) { +uint64_t alignment =0 ; +if (ibb->allocator_type ==INTEL_ALLOCATOR_NONE )return ; +if (ibb->driver ==INTEL_DRIVER_XE ) + alignment =xe_get_default_alignment (ibb->fd); + ibb->allocator_handle =intel_allocator_open_full (ibb->fd, ibb->ctx, ibb->allocator_start, ibb->allocator_end, ibb->allocator_type, ibb->allocator_strategy, -0 ); + alignment); +intel_bb_reset (ibb, true); }lib/intel_batchbuffer.h +6
-0@@ -246,6 +246,7 @@ struct intel_bb {uint8_t allocator_type;enum allocator_strategy allocator_strategy; +enum intel_driver driver;int fd;unsigned int gen;bool debug;@@ -268,6 +269,11 @@ struct intel_bb {uint32_t ctx;uint32_t vm_id; +bool xe_bound; +uint32_t engine_syncobj; +uint32_t engine_id; +uint32_t last_engine; +/* Context configuration */ intel_ctx_cfg_t *cfg;Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 08/15] lib/intel_batchbuffer: Add Xe support in intel-bb
In reply to Zbigniew KempczyńskiHi Zbigniew,
Quoted 114 lines · Zbigniew Kempczyński
Intention of creating intel-bb was to replace libdrm for i915. Due to many code relies on it (kms for example) most rational way is to extend and add Xe path to it.
Signed-off-by Zbigniew Kempczyński <[email protected]>--- lib/intel_batchbuffer.c | 350 +++++++++++++++++++++++++++++++++------- lib/intel_batchbuffer.h | 6 + 2 files changed, 295 insertions(+), 61 deletions(-)lib/intel_batchbuffer.c +24
-19@@ -29,6 +29,8 @@#include <glib.h> #include "i915/gem_create.h" +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h" #include "intel_batchbuffer.h" #include "intel_bufops.h" #include "intel_chipset.h" @@ -38,6 +40,8 @@#include "veboxcopy.h" #include "sw_sync.h" #include "gpgpu_fill.h" +#include "igt_aux.h" +#include "igt_syncobj.h" #include "huc_copy.h" #include "i915/i915_blt.h" @@ -828,21 +832,22 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,/** * __intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id -* @cfg: intel_ctx configuration, NULL for default context or legacy mode +* @cfg: for i915 intel_ctx configuration, NULL for default context or legacy mode, +* unused for xe * @size: size of the batchbuffer * @do_relocs: use relocations or allocator * @allocator_type: allocator type, must be INTEL_ALLOCATOR_NONE for relocations * * intel-bb assumes it will work in one of two modes - with relocations or -* with using allocator (currently RANDOM and SIMPLE are implemented). +* with using allocator (currently RELOC and SIMPLE are implemented). * Some description is required to describe how they maintain the addresses. * * Before entering into each scenarios generic rule is intel-bb keeps objects * and their offsets in the internal cache and reuses in subsequent execs. * -* 1. intel-bb with relocations +* 1. intel-bb with relocations (i915 only) * * Creating new intel-bb adds handle to cache implicitly and sets its address * to 0. Objects added to intel-bb later also have address 0 set for first run. @@ -850,14 +855,15 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,* works in reloc mode addresses are only suggestion to the driver and we * cannot be sure they won't change at next exec. * -* 2. with allocator +* 2. with allocator (i915 or xe) * * This mode is valid only for ppgtt. Addresses are acquired from allocator -* and softpinned. intel-bb cache must be then coherent with allocator -* (simple is coherent, random is not due to fact we don't keep its state). +* and softpinned (i915) or vm-binded (xe). intel-bb cache must be then +* coherent with allocator (simple is coherent, reloc partially [doesn't +* support address reservation]). * When we do intel-bb reset with purging cache it has to reacquire addresses * from allocator (allocator should return same address - what is true for -* simple allocator and false for random as mentioned before). +* simple and reloc allocators). * * If we do reset without purging caches we use addresses from intel-bb cache * during execbuf objects construction. @@ -883,48 +889,83 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,igt_assert (ibb); - ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); ibb->devid =intel_get_drm_devid (fd); ibb->gen =intel_gen (ibb->devid); + ibb->ctx = ctx; + + ibb->fd = fd; + ibb->driver =is_i915_device (fd) ?INTEL_DRIVER_I915 : +is_xe_device (fd) ?INTEL_DRIVER_XE :0 ; +igt_assert (ibb->driver);/* * If we don't have full ppgtt driver can change our addresses * so allocator is useless in this case. Just enforce relocations * for such gens and don't use allocator at all. */ -if (!ibb->uses_full_ppgtt) - do_relocs = true; +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); -/* -* For softpin mode allocator has full control over offsets allocation -* so we want kernel to not interfere with this. -*/ -if (do_relocs) - ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); +if (!ibb->uses_full_ppgtt) + do_relocs = true; -/* Use safe start offset instead assuming 0x0 is safe */ - start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd));
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 921
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+/* +* For softpin mode allocator has full control over offsets allocation +* so we want kernel to not interfere with this. +*/ +if (do_relocs) { + ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); + allocator_type =INTEL_ALLOCATOR_NONE ; + }else { +/* Use safe start offset instead assuming 0x0 is safe */ + start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd));
I'm not sure this is relevant since it should be related to the allocator scenario, however originally we executed this line regardless of the 'do_relocs' value.
Upholding:
Christoph
Quoted 517 lines
lib/intel_batchbuffer.c +255
-42+ +/* if relocs are set we won't use an allocator */ + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, + start, end, + allocator_type, + strategy,0 ); + } + + ibb->vm_id =0 ; + }else { +igt_assert (!do_relocs); + +if (!ctx) + ctx =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + + ibb->uses_full_ppgtt =1 ; + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, start, end, + allocator_type, + strategy, +xe_get_default_alignment (fd)); + ibb->vm_id = ctx; + ibb->last_engine = ~0U ; + } -/* if relocs are set we won't use an allocator */ -if (do_relocs) - allocator_type =INTEL_ALLOCATOR_NONE ; -else - ibb->allocator_handle =intel_allocator_open_full (fd, ctx, - start, end, - allocator_type, - strategy,0 ); ibb->allocator_type = allocator_type; ibb->allocator_strategy = strategy; ibb->allocator_start = start; ibb->allocator_end = end; - - ibb->fd = fd; ibb->enforce_relocs = do_relocs; - ibb->handle =gem_create (fd, size); + +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->handle =gem_create (fd, size); + ibb->alignment =gem_detect_safe_alignment (fd); + ibb->gtt_size =gem_aperture_size (fd); + }else { + ibb->alignment =xe_get_default_alignment (fd); + size =ALIGN (size, ibb->alignment); + ibb->handle =xe_bo_create_flags (fd,0 , size, +xe_has_vram (fd) ? +vram_memory (fd,0 ) : +system_memory (fd)); + ibb->gtt_size =1ull <<xe_va_bits (fd); + } + ibb->size = size; - ibb->alignment =gem_detect_safe_alignment (fd); - ibb->ctx = ctx; - ibb->vm_id =0 ; ibb->batch =calloc (1 , size);igt_assert (ibb->batch); ibb->ptr = ibb->batch;@@ -937,7 +978,6 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,memcpy (ibb->cfg, cfg,sizeof (*cfg)); } - ibb->gtt_size =gem_aperture_size (fd);if ((ibb->gtt_size -1 ) >>32 ) ibb->supports_48b_address = true;@@ -961,13 +1001,13 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,/** * intel_bb_create_full: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer * @start: allocator vm start address * @end: allocator vm start address -* @allocator_type: allocator type, SIMPLE, RANDOM, ... +* @allocator_type: allocator type, SIMPLE, RELOC, ... * @strategy: allocation strategy * * Creates bb with context passed in @ctx, size in @size and allocator type @@ -992,7 +1032,7 @@ struct intel_bb *intel_bb_create_full(int fd, uint32_t ctx,/** * intel_bb_create_with_allocator: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1027,7 +1067,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)/** * intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @size: size of the batchbuffer * * Creates bb with default context. @@ -1047,7 +1087,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)*/ struct intel_bb *intel_bb_create (int fd,uint32_t size) { -bool relocs =gem_has_relocations (fd); +bool relocs =is_i915_device (fd) &&gem_has_relocations (fd); return __intel_bb_create(fd, 0, NULL, size, relocs && !aux_needs_softpin(fd), 0, 0,@@ -1057,7 +1097,7 @@ struct intel_bb *intel_bb_create(int fd, uint32_t size)/** * intel_bb_create_with_context: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1073,7 +1113,7 @@ struct intel_bb * intel_bb_create_with_context(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, uint32_t size) { - bool relocs = gem_has_relocations(fd); + bool relocs = is_i915_device(fd) && gem_has_relocations(fd); return __intel_bb_create(fd, ctx, cfg, size, relocs && !aux_needs_softpin(fd), 0, 0,@@ -1083,7 +1123,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,/** * intel_bb_create_with_relocs: -* @fd: drm fd +* @fd: drm fd - i915 * @size: size of the batchbuffer * * Creates bb which will disable passing addresses. @@ -1095,7 +1135,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,*/ struct intel_bb *intel_bb_create_with_relocs (int fd,uint32_t size) { -igt_require (gem_has_relocations (fd)); +igt_require (is_i915_device (fd) &&gem_has_relocations (fd));return __intel_bb_create (fd,0 ,NULL , size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );@@ -1103,7 +1143,7 @@ struct intel_bb *intel_bb_create_with_relocs(int fd, uint32_t size)/** * intel_bb_create_with_relocs_and_context: -* @fd: drm fd +* @fd: drm fd - i915 * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1120,7 +1160,7 @@ intel_bb_create_with_relocs_and_context(int fd, uint32_t ctx,const intel_ctx_cfg_t *cfg, uint32_t size) { -igt_require (gem_has_relocations (fd )); + igt_require(is_i915_device(fd) && gem_has_relocations(fd));return __intel_bb_create (fd, ctx, cfg, size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );@@ -1221,12 +1261,76 @@ void intel_bb_destroy(struct intel_bb *ibb)if (ibb->fence >=0 )close (ibb->fence); +if (ibb->engine_syncobj) +syncobj_destroy (ibb->fd, ibb->engine_syncobj); +if (ibb->vm_id && !ibb->ctx) +xe_vm_destroy (ibb->fd, ibb->vm_id);free (ibb->batch);free (ibb->cfg);free (ibb); } +static struct drm_xe_vm_bind_op *xe_alloc_bind_ops (struct intel_bb *ibb, +uint32_t op,uint32_t region) +{ +struct drm_i915_gem_exec_object2 **objects = ibb->objects; +struct drm_xe_vm_bind_op *bind_ops, *ops; +bool set_obj = (op &0xffff ) ==XE_VM_BIND_OP_MAP ; + + bind_ops =calloc (ibb->num_objects,sizeof (*bind_ops)); +igt_assert (bind_ops); + +igt_debug ("bind_ops: %s\n" , set_obj ?"MAP" :"UNMAP" ); +for (int i =0 ; i < ibb->num_objects; i++) { + ops = &bind_ops[i]; + +if (set_obj) + ops->obj = objects[i]->handle; + + ops->op = op; + ops->obj_offset =0 ; + ops->addr = objects[i]->offset; + ops->range = objects[i]->rsvd1; + ops->region = region; + +igt_debug (" [%d]: handle: %u, offset: %llx, size: %llx\n" , + i, ops->obj, (long long )ops->addr, (long long )ops->range); + } + +return bind_ops; +} + +static void __unbind_xe_objects (struct intel_bb *ibb) +{ +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +int ret; + + syncs[0 ].handle = ibb->engine_syncobj; + syncs[1 ].handle =syncobj_create (ibb->fd,0 ); + +if (ibb->num_objects >1 ) { +struct drm_xe_vm_bind_op *bind_ops; +uint32_t op =XE_VM_BIND_OP_UNMAP |XE_VM_BIND_FLAG_ASYNC ; + + bind_ops =xe_alloc_bind_ops (ibb, op,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,2 ); +free (bind_ops); + }else { +xe_vm_unbind_async (ibb->fd, ibb->vm_id,0 ,0 , + ibb->batch_offset, ibb->size, syncs,2 ); + } + ret =syncobj_wait_err (ibb->fd, &syncs[1 ].handle,1 ,INT64_MAX ,0 ); +igt_assert_eq (ret,0 ); +syncobj_destroy (ibb->fd, syncs[1 ].handle); + + ibb->xe_bound = false; +} +/* * intel_bb_reset: * @ibb: pointer to intel_bb @@ -1258,6 +1362,9 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)for (i =0 ; i < ibb->num_objects; i++) ibb->objects[i]->flags &=EXEC_OBJECT_SUPPORTS_48B_ADDRESS ; +if (is_xe_device (ibb->fd) && ibb->xe_bound) +__unbind_xe_objects (ibb); +__intel_bb_destroy_relocations (ibb);__intel_bb_destroy_objects (ibb);__reallocate_objects (ibb);@@ -1278,10 +1385,15 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) ibb->size);gem_close (ibb->fd, ibb->handle); - ibb->handle =gem_create (ibb->fd, ibb->size); +if (is_i915_device (ibb->fd)) + ibb->handle =gem_create (ibb->fd, ibb->size); +else + ibb->handle =xe_bo_create_flags (ibb->fd,0 , ibb->size, +vram_if_possible (ibb->fd,0 )); -/* Keep address for bb in reloc mode and RANDOM allocator */ -if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE ) +/* Reacquire offset for RELOC and SIMPLE */ +if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE || + ibb->allocator_type ==INTEL_ALLOCATOR_RELOC ) ibb->batch_offset = __intel_bb_get_offset(ibb, ibb->handle, ibb->size,@@ -1304,13 +1416,19 @@ int intel_bb_sync(struct intel_bb *ibb) {int ret; -if (ibb->fence <0 ) +if (ibb->fence <0 && !ibb->engine_syncobj)return 0 ; - ret =sync_fence_wait (ibb->fence,-1 ); -if (ret ==0 ) { -close (ibb->fence); - ibb->fence =-1 ; +if (ibb->fence >=0 ) { + ret =sync_fence_wait (ibb->fence,-1 ); +if (ret ==0 ) { +close (ibb->fence); + ibb->fence =-1 ; + } + }else { +igt_assert_neq (ibb->engine_syncobj,0 ); + ret =syncobj_wait_err (ibb->fd, &ibb->engine_syncobj, +1 ,INT64_MAX ,0 ); }return ret;@@ -1501,7 +1619,7 @@ static void __remove_from_objects(struct intel_bb *ibb, }/** -* intel_bb_add_object: +* __intel_bb_add_object: * @ibb: pointer to intel_bb * @handle: which handle to add to objects array * @size: object size @@ -1513,9 +1631,9 @@ static void __remove_from_objects(struct intel_bb *ibb,* in the object tree. When object is a render target it has to * be marked with EXEC_OBJECT_WRITE flag. */ -struct drm_i915_gem_exec_object2 * -intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, -uint64_t offset,uint64_t alignment,bool write) +static struct drm_i915_gem_exec_object2 * +__intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) {struct drm_i915_gem_exec_object2 *object;@@ -1523,8 +1641,12 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size, || ALIGN(offset, alignment) == offset);igt_assert (is_power_of_two (alignment)); +if (ibb->driver ==INTEL_DRIVER_I915 ) + alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd)); +else + alignment =max_t (uint64_t, ibb->alignment, alignment); + object =__add_to_cache (ibb, handle); - alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd));__add_to_objects (ibb, object);/* @@ -1584,9 +1706,27 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,if (ibb->allows_obj_alignment) object->alignment = alignment; +if (ibb->driver ==INTEL_DRIVER_XE ) { + object->alignment = alignment; + object->rsvd1 = size; + } +return object; } +struct drm_i915_gem_exec_object2 * +intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) +{ +struct drm_i915_gem_exec_object2 *obj =NULL ; + + obj =__intel_bb_add_object (ibb, handle, size, offset, + alignment, write); +igt_assert (obj); + +return obj; +} +bool intel_bb_remove_object (struct intel_bb *ibb,uint32_t handle,uint64_t offset,uint64_t size) {@@ -2135,6 +2275,82 @@ static void update_offsets(struct intel_bb *ibb, }#define LINELEN 76 + +static int +__xe_bb_exec (struct intel_bb *ibb,uint64_t flags,bool sync) +{ +uint32_t engine = flags & (I915_EXEC_BSD_MASK |I915_EXEC_RING_MASK ); +uint32_t engine_id; +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +struct drm_xe_vm_bind_op *bind_ops; +void *map; + +igt_assert_eq (ibb->num_relocs,0 ); +igt_assert_eq (ibb->xe_bound, false); + +if (ibb->last_engine != engine) { +struct drm_xe_engine_class_instance inst = { }; + + inst.engine_instance = + (flags &I915_EXEC_BSD_MASK ) >>I915_EXEC_BSD_SHIFT ; + +switch (flags &I915_EXEC_RING_MASK ) { +case I915_EXEC_DEFAULT : +case I915_EXEC_BLT : + inst.engine_class =DRM_XE_ENGINE_CLASS_COPY ; +break ; +case I915_EXEC_BSD : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_DECODE ; +break ; +case I915_EXEC_RENDER : + inst.engine_class =DRM_XE_ENGINE_CLASS_RENDER ; +break ; +case I915_EXEC_VEBOX : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE ; +break ; +default : +igt_assert_f (false,"Unknown engine: %x" , (uint32_t ) flags); + } +igt_debug ("Run on %s\n" ,xe_engine_class_string (inst.engine_class)); + + ibb->engine_id = engine_id = +xe_engine_create (ibb->fd, ibb->vm_id, &inst,0 ); + }else { + engine_id = ibb->engine_id; + } + ibb->last_engine = engine; + + map =xe_bo_map (ibb->fd, ibb->handle, ibb->size); +memcpy (map, ibb->batch, ibb->size); +gem_munmap (map, ibb->size); + + syncs[0 ].handle =syncobj_create (ibb->fd,0 ); +if (ibb->num_objects >1 ) { + bind_ops =xe_alloc_bind_ops (ibb,XE_VM_BIND_OP_MAP |XE_VM_BIND_FLAG_ASYNC ,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,1 ); + ibb->xe_bound = true; +free (bind_ops); + }else { +xe_vm_bind_async (ibb->fd, ibb->vm_id,0 , ibb->handle,0 , + ibb->batch_offset, ibb->size, syncs,1 ); + } + + syncs[0 ].flags &= ~DRM_XE_SYNC_SIGNAL ; + ibb->engine_syncobj =syncobj_create (ibb->fd,0 ); + syncs[1 ].handle = ibb->engine_syncobj; + +xe_exec_sync (ibb->fd, engine_id, ibb->batch_offset, syncs,2 ); + +if (sync) +intel_bb_sync (ibb); + +return 0 ; +} +/* * __intel_bb_exec: * @ibb: pointer to intel_bb @@ -2220,7 +2436,7 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,/** * intel_bb_exec: * @ibb: pointer to intel_bb -* @end_offset: offset of the last instruction in the bb +* @end_offset: offset of the last instruction in the bb (for i915) * @flags: flags passed directly to execbuf * @sync: if true wait for execbuf completion, otherwise caller is responsible * to wait for completion @@ -2230,7 +2446,13 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,void intel_bb_exec (struct intel_bb *ibb,uint32_t end_offset,uint64_t flags,bool sync) { -igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +if (ibb->dump_base64) +intel_bb_dump_base64 (ibb,LINELEN ); + +if (ibb->driver ==INTEL_DRIVER_I915 ) +igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +else +igt_assert_eq (__xe_bb_exec (ibb, flags, sync),0 ); }/** @@ -2628,14 +2850,20 @@ void intel_bb_track(bool do_tracking)static void __intel_bb_reinit_alloc (struct intel_bb *ibb) { +uint64_t alignment =0 ; +if (ibb->allocator_type ==INTEL_ALLOCATOR_NONE )return ; +if (ibb->driver ==INTEL_DRIVER_XE ) + alignment =xe_get_default_alignment (ibb->fd); + ibb->allocator_handle =intel_allocator_open_full (ibb->fd, ibb->ctx, ibb->allocator_start, ibb->allocator_end, ibb->allocator_type, ibb->allocator_strategy, -0 ); + alignment); +intel_bb_reset (ibb, true); }lib/intel_batchbuffer.h +6
-0@@ -246,6 +246,7 @@ struct intel_bb {uint8_t allocator_type;enum allocator_strategy allocator_strategy; +enum intel_driver driver;int fd;unsigned int gen;bool debug;@@ -268,6 +269,11 @@ struct intel_bb {uint32_t ctx;uint32_t vm_id; +bool xe_bound; +uint32_t engine_syncobj; +uint32_t engine_id; +uint32_t last_engine; +/* Context configuration */ intel_ctx_cfg_t *cfg;
Re: [igt-dev] [PATCH i-g-t v6 08/15] lib/intel_batchbuffer: Add Xe support in intel-bb
Quoted 6 lines · Christoph
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 921
Quoted 2 lines
lib/intel_batchbuffer.c +2
-0+/* Use safe start offset instead assuming 0x0 is safe */ + start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd));I'm not sure this is relevant since it should be related to the allocator scenario, however originally we executed this line regardless of the '
do_relocs' value.
If you mean allocator also adopts start/end for intel-bb we want to override this, just to not rely on default allocator start/end offset detection.
Quoted 3 lines
Upholding:
Reviewed-by Christoph Manszewski <[email protected]>
Thank you for the review.
--
Zbigniew
Quoted 11 lines
Christoph
Quoted 7 lines
lib/intel_batchbuffer.c +7
-0+ +/* if relocs are set we won't use an allocator */ + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, + start, end, + allocator_type, + strategy,0 );
Re: [igt-dev] [PATCH i-g-t v6 08/15] lib/intel_batchbuffer: Add Xe support in intel-bb
In reply to Zbigniew KempczyńskiHi Zbigniew,
Quoted 8 lines · Zbigniew Kempczyński
Intention of creating intel-bb was to replace libdrm for i915. Due to many code relies on it (kms for example) most rational way is to extend and add Xe path to it.
Signed-off-by Zbigniew Kempczyński <[email protected]>--- lib/intel_batchbuffer.c | 350 +++++++++++++++++++++++++++++++++------- lib/intel_batchbuffer.h | 6 +
Thank you for separating i195 -> fd rename, now it is easier to review.
lib/intel_batchbuffer.c line 33
Quoted 12 lines
2 files changed, 295 insertions(+), 61 deletions(-)lib/intel_batchbuffer.c +2
-0@@ -29,6 +29,8 @@#include <glib.h> #include "i915/gem_create.h" +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h"
Please sort it alphabetically.
lib/intel_batchbuffer.c line 44
Quoted 9 lines
lib/intel_batchbuffer.c +2
-0#include "intel_batchbuffer.h" #include "intel_bufops.h" #include "intel_chipset.h" @@ -38,6 +40,8 @@#include "veboxcopy.h" #include "sw_sync.h" #include "gpgpu_fill.h" +#include "igt_aux.h" +#include "igt_syncobj.h"
Same here, please put in in alphabetical order.
Quoted 10 lines
lib/intel_batchbuffer.c +1
-1#include "huc_copy.h" #include "i915/i915_blt.h" @@ -828,21 +832,22 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,/** * __intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id
lib/intel_batchbuffer.c static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb, · line 844
Quoted 10 lines
lib/intel_batchbuffer.c +3
-2-* @cfg: intel_ctx configuration, NULL for default context or legacy mode +* @cfg: for i915 intel_ctx configuration, NULL for default context or legacy mode, +* unused for xe * @size: size of the batchbuffer * @do_relocs: use relocations or allocator * @allocator_type: allocator type, must be INTEL_ALLOCATOR_NONE for relocations * * intel-bb assumes it will work in one of two modes - with relocations or -* with using allocator (currently RANDOM and SIMPLE are implemented). +* with using allocator (currently RELOC and SIMPLE are implemented).
These should be done in separate patch ? Or at least write about it in patch description. Also you can write about relocations can not be used in xe and that RELOC allocator can.
Quoted 74 lines
lib/intel_batchbuffer.c +25
-16* Some description is required to describe how they maintain the addresses. * * Before entering into each scenarios generic rule is intel-bb keeps objects * and their offsets in the internal cache and reuses in subsequent execs. * -* 1. intel-bb with relocations +* 1. intel-bb with relocations (i915 only) * * Creating new intel-bb adds handle to cache implicitly and sets its address * to 0. Objects added to intel-bb later also have address 0 set for first run. @@ -850,14 +855,15 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,* works in reloc mode addresses are only suggestion to the driver and we * cannot be sure they won't change at next exec. * -* 2. with allocator +* 2. with allocator (i915 or xe) * * This mode is valid only for ppgtt. Addresses are acquired from allocator -* and softpinned. intel-bb cache must be then coherent with allocator -* (simple is coherent, random is not due to fact we don't keep its state). +* and softpinned (i915) or vm-binded (xe). intel-bb cache must be then +* coherent with allocator (simple is coherent, reloc partially [doesn't +* support address reservation]). * When we do intel-bb reset with purging cache it has to reacquire addresses * from allocator (allocator should return same address - what is true for -* simple allocator and false for random as mentioned before). +* simple and reloc allocators). * * If we do reset without purging caches we use addresses from intel-bb cache * during execbuf objects construction. @@ -883,48 +889,83 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,igt_assert (ibb); - ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); ibb->devid =intel_get_drm_devid (fd); ibb->gen =intel_gen (ibb->devid); + ibb->ctx = ctx; + + ibb->fd = fd; + ibb->driver =is_i915_device (fd) ?INTEL_DRIVER_I915 : +is_xe_device (fd) ?INTEL_DRIVER_XE :0 ; +igt_assert (ibb->driver);/* * If we don't have full ppgtt driver can change our addresses * so allocator is useless in this case. Just enforce relocations * for such gens and don't use allocator at all. */ -if (!ibb->uses_full_ppgtt) - do_relocs = true; +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); -/* -* For softpin mode allocator has full control over offsets allocation -* so we want kernel to not interfere with this. -*/ -if (do_relocs) - ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); +if (!ibb->uses_full_ppgtt) + do_relocs = true; -/* Use safe start offset instead assuming 0x0 is safe */ - start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd)); +/* +* For softpin mode allocator has full control over offsets allocation +* so we want kernel to not interfere with this. +*/ +if (do_relocs) { + ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); + allocator_type =INTEL_ALLOCATOR_NONE ; + }else { +/* Use safe start offset instead assuming 0x0 is safe */
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 930
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+ start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd)); + +/* if relocs are set we won't use an allocator */ + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, + start, end, + allocator_type, + strategy,0 ); + } +
imho here should be placed alignment detection for i915.
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 943
Quoted 13 lines
lib/intel_batchbuffer.c +13
-0+ ibb->vm_id =0 ; + }else { +igt_assert (!do_relocs); + +if (!ctx) + ctx =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + + ibb->uses_full_ppgtt =1 ; + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, start, end, + allocator_type, + strategy, +xe_get_default_alignment (fd));
------------------------------------------------- ^ Later on you set:
ibb->alignment = xe_get_default_alignment(fd);
so maybe move it here and use it ?
Quoted 20 lines
lib/intel_batchbuffer.c +3
-11+ ibb->vm_id = ctx; + ibb->last_engine = ~0U ; + } -/* if relocs are set we won't use an allocator */ -if (do_relocs) - allocator_type =INTEL_ALLOCATOR_NONE ; -else - ibb->allocator_handle =intel_allocator_open_full (fd, ctx, - start, end, - allocator_type, - strategy,0 ); ibb->allocator_type = allocator_type; ibb->allocator_strategy = strategy; ibb->allocator_start = start; ibb->allocator_end = end; - - ibb->fd = fd; ibb->enforce_relocs = do_relocs; - ibb->handle =gem_create (fd, size);
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 962
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+ +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->handle =gem_create (fd, size); + ibb->alignment =gem_detect_safe_alignment (fd); + ibb->gtt_size =gem_aperture_size (fd); + }else { + ibb->alignment =xe_get_default_alignment (fd); + size =ALIGN (size, ibb->alignment); + ibb->handle = xe_bo_create_flags(fd, 0, size, + xe_has_vram(fd) ?
------------------------------------------------ ^
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 964
Quoted 2 lines
lib/intel_batchbuffer.c +2
-0+ vram_memory(fd, 0) : + system_memory(fd));
xe_vram_if_possible ? btw this may interfere when one wants to create ibb object in system memory, so maybe we should add one more option (in future).
Quoted 21 lines
lib/intel_batchbuffer.c +3
-4+ ibb->gtt_size =1ull <<xe_va_bits (fd); + } + ibb->size = size; - ibb->alignment =gem_detect_safe_alignment (fd); - ibb->ctx = ctx; - ibb->vm_id =0 ; ibb->batch =calloc (1 , size);igt_assert (ibb->batch); ibb->ptr = ibb->batch;@@ -937,7 +978,6 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,memcpy (ibb->cfg, cfg,sizeof (*cfg)); } - ibb->gtt_size =gem_aperture_size (fd);if ((ibb->gtt_size -1 ) >>32 ) ibb->supports_48b_address = true;@@ -961,13 +1001,13 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,/**
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 1010
Quoted 10 lines
lib/intel_batchbuffer.c +2
-2* intel_bb_create_full: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer * @start: allocator vm start address * @end: allocator vm start address -* @allocator_type: allocator type, SIMPLE, RANDOM, ... +* @allocator_type: allocator type, SIMPLE, RELOC, ...
Looks like unrelated fix.
Quoted 85 lines
lib/intel_batchbuffer.c +9
-9* @strategy: allocation strategy * * Creates bb with context passed in @ctx, size in @size and allocator type @@ -992,7 +1032,7 @@ struct intel_bb *intel_bb_create_full(int fd, uint32_t ctx,/** * intel_bb_create_with_allocator: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1027,7 +1067,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)/** * intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @size: size of the batchbuffer * * Creates bb with default context. @@ -1047,7 +1087,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)*/ struct intel_bb *intel_bb_create (int fd,uint32_t size) { -bool relocs =gem_has_relocations (fd); +bool relocs =is_i915_device (fd) &&gem_has_relocations (fd); return __intel_bb_create(fd, 0, NULL, size, relocs && !aux_needs_softpin(fd), 0, 0,@@ -1057,7 +1097,7 @@ struct intel_bb *intel_bb_create(int fd, uint32_t size)/** * intel_bb_create_with_context: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1073,7 +1113,7 @@ struct intel_bb * intel_bb_create_with_context(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, uint32_t size) { - bool relocs = gem_has_relocations(fd); + bool relocs = is_i915_device(fd) && gem_has_relocations(fd); return __intel_bb_create(fd, ctx, cfg, size, relocs && !aux_needs_softpin(fd), 0, 0,@@ -1083,7 +1123,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,/** * intel_bb_create_with_relocs: -* @fd: drm fd +* @fd: drm fd - i915 * @size: size of the batchbuffer * * Creates bb which will disable passing addresses. @@ -1095,7 +1135,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,*/ struct intel_bb *intel_bb_create_with_relocs (int fd,uint32_t size) { -igt_require (gem_has_relocations (fd)); +igt_require (is_i915_device (fd) &&gem_has_relocations (fd));return __intel_bb_create (fd,0 ,NULL , size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );@@ -1103,7 +1143,7 @@ struct intel_bb *intel_bb_create_with_relocs(int fd, uint32_t size)/** * intel_bb_create_with_relocs_and_context: -* @fd: drm fd +* @fd: drm fd - i915 * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1120,7 +1160,7 @@ intel_bb_create_with_relocs_and_context(int fd, uint32_t ctx,const intel_ctx_cfg_t *cfg, uint32_t size) { -igt_require (gem_has_relocations (fd )); + igt_require(is_i915_device(fd) && gem_has_relocations(fd));return __intel_bb_create (fd, ctx, cfg, size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );
lib/intel_batchbuffer.c void intel_bb_destroy(struct intel_bb *ibb) · line 1266
Quoted 6 lines
lib/intel_batchbuffer.c +3
-0@@ -1221,12 +1261,76 @@ void intel_bb_destroy(struct intel_bb *ibb)if (ibb->fence >=0 )close (ibb->fence); +if (ibb->engine_syncobj) +syncobj_destroy (ibb->fd, ibb->engine_syncobj); +if (ibb->vm_id && !ibb->ctx)
Why not use here ibb->driver == INTEL_DRIVER_XE check ?
lib/intel_batchbuffer.c void intel_bb_destroy(struct intel_bb *ibb) · line 1275
Quoted 9 lines
lib/intel_batchbuffer.c +3
-0+xe_vm_destroy (ibb->fd, ibb->vm_id);free (ibb->batch);free (ibb->cfg);free (ibb); } +static struct drm_xe_vm_bind_op *xe_alloc_bind_ops (struct intel_bb *ibb, +uint32_t op,uint32_t region)
--------------------------------------------------------------- ^ Here uint64_t as you are adding new function so let make it correct from the start.
Quoted 62 lines
lib/intel_batchbuffer.c +58
-0+{ +struct drm_i915_gem_exec_object2 **objects = ibb->objects; +struct drm_xe_vm_bind_op *bind_ops, *ops; +bool set_obj = (op &0xffff ) ==XE_VM_BIND_OP_MAP ; + + bind_ops =calloc (ibb->num_objects,sizeof (*bind_ops)); +igt_assert (bind_ops); + +igt_debug ("bind_ops: %s\n" , set_obj ?"MAP" :"UNMAP" ); +for (int i =0 ; i < ibb->num_objects; i++) { + ops = &bind_ops[i]; + +if (set_obj) + ops->obj = objects[i]->handle; + + ops->op = op; + ops->obj_offset =0 ; + ops->addr = objects[i]->offset; + ops->range = objects[i]->rsvd1; + ops->region = region; + +igt_debug (" [%d]: handle: %u, offset: %llx, size: %llx\n" , + i, ops->obj, (long long )ops->addr, (long long )ops->range); + } + +return bind_ops; +} + +static void __unbind_xe_objects (struct intel_bb *ibb) +{ +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +int ret; + + syncs[0 ].handle = ibb->engine_syncobj; + syncs[1 ].handle =syncobj_create (ibb->fd,0 ); + +if (ibb->num_objects >1 ) { +struct drm_xe_vm_bind_op *bind_ops; +uint32_t op =XE_VM_BIND_OP_UNMAP |XE_VM_BIND_FLAG_ASYNC ; + + bind_ops =xe_alloc_bind_ops (ibb, op,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,2 ); +free (bind_ops); + }else { +xe_vm_unbind_async (ibb->fd, ibb->vm_id,0 ,0 , + ibb->batch_offset, ibb->size, syncs,2 ); + } + ret =syncobj_wait_err (ibb->fd, &syncs[1 ].handle,1 ,INT64_MAX ,0 ); +igt_assert_eq (ret,0 ); +syncobj_destroy (ibb->fd, syncs[1 ].handle); + + ibb->xe_bound = false; +} +/* * intel_bb_reset: * @ibb: pointer to intel_bb
lib/intel_batchbuffer.c void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) · line 1365
Quoted 4 lines
lib/intel_batchbuffer.c +1
-0@@ -1258,6 +1362,9 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)for (i =0 ; i < ibb->num_objects; i++) ibb->objects[i]->flags &=EXEC_OBJECT_SUPPORTS_48B_ADDRESS ; +if (is_xe_device (ibb->fd) && ibb->xe_bound)
----------- ^
Use ibb->driver ? Or just drop and use only:
if (ibb->xe_bound)
lib/intel_batchbuffer.c void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) · line 1388
Quoted 11 lines
lib/intel_batchbuffer.c +3
-1+__unbind_xe_objects (ibb); +__intel_bb_destroy_relocations (ibb);__intel_bb_destroy_objects (ibb);__reallocate_objects (ibb);@@ -1278,10 +1385,15 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) ibb->size);gem_close (ibb->fd, ibb->handle); - ibb->handle =gem_create (ibb->fd, ibb->size); +if (is_i915_device (ibb->fd))
----------- ^
Use ibb->driver
lib/intel_batchbuffer.c void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) · line 1396
Quoted 10 lines
lib/intel_batchbuffer.c +7
-2+ ibb->handle =gem_create (ibb->fd, ibb->size); + else + ibb->handle = xe_bo_create_flags(ibb->fd, 0, ibb->size, +vram_if_possible (ibb->fd,0 )); -/* Keep address for bb in reloc mode and RANDOM allocator */ -if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE ) +/* Reacquire offset for RELOC and SIMPLE */ +if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE || + ibb->allocator_type ==INTEL_ALLOCATOR_RELOC )
This hunk looks like part of non-related fix.
Quoted 93 lines
lib/intel_batchbuffer.c +38
-10ibb->batch_offset = __intel_bb_get_offset(ibb, ibb->handle, ibb->size,@@ -1304,13 +1416,19 @@ int intel_bb_sync(struct intel_bb *ibb) {int ret; -if (ibb->fence <0 ) +if (ibb->fence <0 && !ibb->engine_syncobj)return 0 ; - ret =sync_fence_wait (ibb->fence,-1 ); -if (ret ==0 ) { -close (ibb->fence); - ibb->fence =-1 ; +if (ibb->fence >=0 ) { + ret =sync_fence_wait (ibb->fence,-1 ); +if (ret ==0 ) { +close (ibb->fence); + ibb->fence =-1 ; + } + }else { +igt_assert_neq (ibb->engine_syncobj,0 ); + ret =syncobj_wait_err (ibb->fd, &ibb->engine_syncobj, +1 ,INT64_MAX ,0 ); }return ret;@@ -1501,7 +1619,7 @@ static void __remove_from_objects(struct intel_bb *ibb, }/** -* intel_bb_add_object: +* __intel_bb_add_object: * @ibb: pointer to intel_bb * @handle: which handle to add to objects array * @size: object size @@ -1513,9 +1631,9 @@ static void __remove_from_objects(struct intel_bb *ibb,* in the object tree. When object is a render target it has to * be marked with EXEC_OBJECT_WRITE flag. */ -struct drm_i915_gem_exec_object2 * -intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, -uint64_t offset,uint64_t alignment,bool write) +static struct drm_i915_gem_exec_object2 * +__intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) {struct drm_i915_gem_exec_object2 *object;@@ -1523,8 +1641,12 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size, || ALIGN(offset, alignment) == offset);igt_assert (is_power_of_two (alignment)); +if (ibb->driver ==INTEL_DRIVER_I915 ) + alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd)); +else + alignment =max_t (uint64_t, ibb->alignment, alignment); + object =__add_to_cache (ibb, handle); - alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd));__add_to_objects (ibb, object);/* @@ -1584,9 +1706,27 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,if (ibb->allows_obj_alignment) object->alignment = alignment; +if (ibb->driver ==INTEL_DRIVER_XE ) { + object->alignment = alignment; + object->rsvd1 = size; + } +return object; } +struct drm_i915_gem_exec_object2 * +intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) +{ +struct drm_i915_gem_exec_object2 *obj =NULL ; + + obj =__intel_bb_add_object (ibb, handle, size, offset, + alignment, write); +igt_assert (obj); + +return obj; +} +bool intel_bb_remove_object (struct intel_bb *ibb,uint32_t handle,uint64_t offset,uint64_t size) {
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2280
Quoted 6 lines
lib/intel_batchbuffer.c +3
-0@@ -2135,6 +2275,82 @@ static void update_offsets(struct intel_bb *ibb, }#define LINELEN 76 + +static int +__xe_bb_exec (struct intel_bb *ibb,uint64_t flags,bool sync)
----------------------------------------------------- ^ You use this function only once with 0 (=false), so maybe drop this param ?
Quoted 23 lines
lib/intel_batchbuffer.c +23
-0+{ +uint32_t engine = flags & (I915_EXEC_BSD_MASK |I915_EXEC_RING_MASK ); +uint32_t engine_id; +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +struct drm_xe_vm_bind_op *bind_ops; +void *map; + +igt_assert_eq (ibb->num_relocs,0 ); +igt_assert_eq (ibb->xe_bound, false); + +if (ibb->last_engine != engine) { +struct drm_xe_engine_class_instance inst = { }; + + inst.engine_instance = + (flags &I915_EXEC_BSD_MASK ) >>I915_EXEC_BSD_SHIFT ; + +switch (flags &I915_EXEC_RING_MASK ) { +case I915_EXEC_DEFAULT : +case I915_EXEC_BLT : + inst.engine_class =DRM_XE_ENGINE_CLASS_COPY ;
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2313
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+break ; +case I915_EXEC_BSD : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_DECODE ; +break ; +case I915_EXEC_RENDER : + inst.engine_class =DRM_XE_ENGINE_CLASS_RENDER ; +break ; +case I915_EXEC_VEBOX : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE ; +break ;
What about compute ? It is not unknown.
Quoted 11 lines
lib/intel_batchbuffer.c +11
-0+default : +igt_assert_f (false,"Unknown engine: %x" , (uint32_t ) flags); + } +igt_debug ("Run on %s\n" ,xe_engine_class_string (inst.engine_class)); + + ibb->engine_id = engine_id = +xe_engine_create (ibb->fd, ibb->vm_id, &inst,0 ); + }else { + engine_id = ibb->engine_id; + } + ibb->last_engine = engine;
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2334
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+ + map =xe_bo_map (ibb->fd, ibb->handle, ibb->size); +memcpy (map, ibb->batch, ibb->size); +gem_munmap (map, ibb->size); + + syncs[0 ].handle =syncobj_create (ibb->fd,0 ); +if (ibb->num_objects >1 ) { + bind_ops =xe_alloc_bind_ops (ibb,XE_VM_BIND_OP_MAP |XE_VM_BIND_FLAG_ASYNC ,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,1 );
--------------------------------------------------------- ^
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2339
Quoted 5 lines
lib/intel_batchbuffer.c +5
-0+ ibb->xe_bound = true; +free (bind_ops); + }else { +xe_vm_bind_async (ibb->fd, ibb->vm_id,0 , ibb->handle,0 , + ibb->batch_offset, ibb->size, syncs,1 );
--------------------------------------------------------------------- ^
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2342
Quoted 3 lines
lib/intel_batchbuffer.c +3
-0+ } + + syncs[0 ].flags &= ~DRM_XE_SYNC_SIGNAL ;
------------- ^
Why not create it already without this flag and in above places use "&syncs[1]" ? Or use two vars sync_bind[1] and syncs_exec[2] ?
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2349
Quoted 7 lines
lib/intel_batchbuffer.c +7
-0+ ibb->engine_syncobj =syncobj_create (ibb->fd,0 ); + syncs[1 ].handle = ibb->engine_syncobj; + +xe_exec_sync (ibb->fd, engine_id, ibb->batch_offset, syncs,2 ); + +if (sync) +intel_bb_sync (ibb);
--------------- ^
Not used.
Regards,
Kamil
Quoted 80 lines
lib/intel_batchbuffer.c +19
-3+ +return 0 ; +} +/* * __intel_bb_exec: * @ibb: pointer to intel_bb @@ -2220,7 +2436,7 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,/** * intel_bb_exec: * @ibb: pointer to intel_bb -* @end_offset: offset of the last instruction in the bb +* @end_offset: offset of the last instruction in the bb (for i915) * @flags: flags passed directly to execbuf * @sync: if true wait for execbuf completion, otherwise caller is responsible * to wait for completion @@ -2230,7 +2446,13 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,void intel_bb_exec (struct intel_bb *ibb,uint32_t end_offset,uint64_t flags,bool sync) { -igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +if (ibb->dump_base64) +intel_bb_dump_base64 (ibb,LINELEN ); + +if (ibb->driver ==INTEL_DRIVER_I915 ) +igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +else +igt_assert_eq (__xe_bb_exec (ibb, flags, sync),0 ); }/** @@ -2628,14 +2850,20 @@ void intel_bb_track(bool do_tracking)static void __intel_bb_reinit_alloc (struct intel_bb *ibb) { +uint64_t alignment =0 ; +if (ibb->allocator_type ==INTEL_ALLOCATOR_NONE )return ; +if (ibb->driver ==INTEL_DRIVER_XE ) + alignment =xe_get_default_alignment (ibb->fd); + ibb->allocator_handle =intel_allocator_open_full (ibb->fd, ibb->ctx, ibb->allocator_start, ibb->allocator_end, ibb->allocator_type, ibb->allocator_strategy, -0 ); + alignment); +intel_bb_reset (ibb, true); }lib/intel_batchbuffer.h +6
-0@@ -246,6 +246,7 @@ struct intel_bb {uint8_t allocator_type;enum allocator_strategy allocator_strategy; +enum intel_driver driver;int fd;unsigned int gen;bool debug;@@ -268,6 +269,11 @@ struct intel_bb {uint32_t ctx;uint32_t vm_id; +bool xe_bound; +uint32_t engine_syncobj; +uint32_t engine_id; +uint32_t last_engine; +/* Context configuration */ intel_ctx_cfg_t *cfg;Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 08/15] lib/intel_batchbuffer: Add Xe support in intel-bb
Hi Kamil,
Quoted 542 lines · Kamil Konieczny
Hi Zbigniew,
Quoted 8 lines · Zbigniew Kempczyński
Intention of creating intel-bb was to replace libdrm for i915. Due to many code relies on it (kms for example) most rational way is to extend and add Xe path to it.
Signed-off-by Zbigniew Kempczyński <[email protected]>--- lib/intel_batchbuffer.c | 350 +++++++++++++++++++++++++++++++++------- lib/intel_batchbuffer.h | 6 +Thank you for separating i195 -> fd rename, now it is easier to review.
lib/intel_batchbuffer.c line 33
Quoted 12 lines
2 files changed, 295 insertions(+), 61 deletions(-)lib/intel_batchbuffer.c +2
-0@@ -29,6 +29,8 @@#include <glib.h> #include "i915/gem_create.h" +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h" Please sort it alphabetically.
lib/intel_batchbuffer.c line 44
Quoted 9 lines
lib/intel_batchbuffer.c +2
-0#include "intel_batchbuffer.h" #include "intel_bufops.h" #include "intel_chipset.h" @@ -38,6 +40,8 @@#include "veboxcopy.h" #include "sw_sync.h" #include "gpgpu_fill.h" +#include "igt_aux.h" +#include "igt_syncobj.h" Same here, please put in in alphabetical order.
Quoted 10 lines
lib/intel_batchbuffer.c +1
-1#include "huc_copy.h" #include "i915/i915_blt.h" @@ -828,21 +832,22 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,/** * __intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id lib/intel_batchbuffer.c static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb, · line 844
Quoted 10 lines
lib/intel_batchbuffer.c +3
-2-* @cfg: intel_ctx configuration, NULL for default context or legacy mode +* @cfg: for i915 intel_ctx configuration, NULL for default context or legacy mode, +* unused for xe * @size: size of the batchbuffer * @do_relocs: use relocations or allocator * @allocator_type: allocator type, must be INTEL_ALLOCATOR_NONE for relocations * * intel-bb assumes it will work in one of two modes - with relocations or -* with using allocator (currently RANDOM and SIMPLE are implemented). +* with using allocator (currently RELOC and SIMPLE are implemented). These should be done in separate patch ? Or at least write about it in patch description. Also you can write about relocations can not be used in xe and that RELOC allocator can.
Quoted 74 lines
lib/intel_batchbuffer.c +25
-16* Some description is required to describe how they maintain the addresses. * * Before entering into each scenarios generic rule is intel-bb keeps objects * and their offsets in the internal cache and reuses in subsequent execs. * -* 1. intel-bb with relocations +* 1. intel-bb with relocations (i915 only) * * Creating new intel-bb adds handle to cache implicitly and sets its address * to 0. Objects added to intel-bb later also have address 0 set for first run. @@ -850,14 +855,15 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,* works in reloc mode addresses are only suggestion to the driver and we * cannot be sure they won't change at next exec. * -* 2. with allocator +* 2. with allocator (i915 or xe) * * This mode is valid only for ppgtt. Addresses are acquired from allocator -* and softpinned. intel-bb cache must be then coherent with allocator -* (simple is coherent, random is not due to fact we don't keep its state). +* and softpinned (i915) or vm-binded (xe). intel-bb cache must be then +* coherent with allocator (simple is coherent, reloc partially [doesn't +* support address reservation]). * When we do intel-bb reset with purging cache it has to reacquire addresses * from allocator (allocator should return same address - what is true for -* simple allocator and false for random as mentioned before). +* simple and reloc allocators). * * If we do reset without purging caches we use addresses from intel-bb cache * during execbuf objects construction. @@ -883,48 +889,83 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,igt_assert (ibb); - ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); ibb->devid =intel_get_drm_devid (fd); ibb->gen =intel_gen (ibb->devid); + ibb->ctx = ctx; + + ibb->fd = fd; + ibb->driver =is_i915_device (fd) ?INTEL_DRIVER_I915 : +is_xe_device (fd) ?INTEL_DRIVER_XE :0 ; +igt_assert (ibb->driver);/* * If we don't have full ppgtt driver can change our addresses * so allocator is useless in this case. Just enforce relocations * for such gens and don't use allocator at all. */ -if (!ibb->uses_full_ppgtt) - do_relocs = true; +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); -/* -* For softpin mode allocator has full control over offsets allocation -* so we want kernel to not interfere with this. -*/ -if (do_relocs) - ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); +if (!ibb->uses_full_ppgtt) + do_relocs = true; -/* Use safe start offset instead assuming 0x0 is safe */ - start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd)); +/* +* For softpin mode allocator has full control over offsets allocation +* so we want kernel to not interfere with this. +*/ +if (do_relocs) { + ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); + allocator_type =INTEL_ALLOCATOR_NONE ; + }else { +/* Use safe start offset instead assuming 0x0 is safe */ lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 930
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+ start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd)); + +/* if relocs are set we won't use an allocator */ + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, + start, end, + allocator_type, + strategy,0 ); + } +imho here should be placed alignment detection for i915.
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 943
Quoted 13 lines
lib/intel_batchbuffer.c +13
-0+ ibb->vm_id =0 ; + }else { +igt_assert (!do_relocs); + +if (!ctx) + ctx =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + + ibb->uses_full_ppgtt =1 ; + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, start, end, + allocator_type, + strategy, +xe_get_default_alignment (fd));------------------------------------------------- ^ Later on you set:
ibb->alignment = xe_get_default_alignment(fd);so maybe move it here and use it ?
Quoted 20 lines
lib/intel_batchbuffer.c +3
-11+ ibb->vm_id = ctx; + ibb->last_engine = ~0U ; + } -/* if relocs are set we won't use an allocator */ -if (do_relocs) - allocator_type =INTEL_ALLOCATOR_NONE ; -else - ibb->allocator_handle =intel_allocator_open_full (fd, ctx, - start, end, - allocator_type, - strategy,0 ); ibb->allocator_type = allocator_type; ibb->allocator_strategy = strategy; ibb->allocator_start = start; ibb->allocator_end = end; - - ibb->fd = fd; ibb->enforce_relocs = do_relocs; - ibb->handle =gem_create (fd, size);lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 962
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+ +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->handle =gem_create (fd, size); + ibb->alignment =gem_detect_safe_alignment (fd); + ibb->gtt_size =gem_aperture_size (fd); + }else { + ibb->alignment =xe_get_default_alignment (fd); + size =ALIGN (size, ibb->alignment); + ibb->handle = xe_bo_create_flags(fd, 0, size, + xe_has_vram(fd) ?------------------------------------------------ ^
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 964
Quoted 2 lines
lib/intel_batchbuffer.c +2
-0+ vram_memory(fd, 0) : + system_memory(fd));
xe_vram_if_possible? btw this may interfere when one wants to create ibb object in system memory, so maybe we should add one more option (in future).Quoted 21 lines
lib/intel_batchbuffer.c +3
-4+ ibb->gtt_size =1ull <<xe_va_bits (fd); + } + ibb->size = size; - ibb->alignment =gem_detect_safe_alignment (fd); - ibb->ctx = ctx; - ibb->vm_id =0 ; ibb->batch =calloc (1 , size);igt_assert (ibb->batch); ibb->ptr = ibb->batch;@@ -937,7 +978,6 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,memcpy (ibb->cfg, cfg,sizeof (*cfg)); } - ibb->gtt_size =gem_aperture_size (fd);if ((ibb->gtt_size -1 ) >>32 ) ibb->supports_48b_address = true;@@ -961,13 +1001,13 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,/** lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 1010
Quoted 10 lines
lib/intel_batchbuffer.c +2
-2* intel_bb_create_full: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer * @start: allocator vm start address * @end: allocator vm start address -* @allocator_type: allocator type, SIMPLE, RANDOM, ... +* @allocator_type: allocator type, SIMPLE, RELOC, ... Looks like unrelated fix.
Quoted 85 lines
lib/intel_batchbuffer.c +9
-9* @strategy: allocation strategy * * Creates bb with context passed in @ctx, size in @size and allocator type @@ -992,7 +1032,7 @@ struct intel_bb *intel_bb_create_full(int fd, uint32_t ctx,/** * intel_bb_create_with_allocator: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1027,7 +1067,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)/** * intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @size: size of the batchbuffer * * Creates bb with default context. @@ -1047,7 +1087,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)*/ struct intel_bb *intel_bb_create (int fd,uint32_t size) { -bool relocs =gem_has_relocations (fd); +bool relocs =is_i915_device (fd) &&gem_has_relocations (fd); return __intel_bb_create(fd, 0, NULL, size, relocs && !aux_needs_softpin(fd), 0, 0,@@ -1057,7 +1097,7 @@ struct intel_bb *intel_bb_create(int fd, uint32_t size)/** * intel_bb_create_with_context: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1073,7 +1113,7 @@ struct intel_bb * intel_bb_create_with_context(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, uint32_t size) { - bool relocs = gem_has_relocations(fd); + bool relocs = is_i915_device(fd) && gem_has_relocations(fd); return __intel_bb_create(fd, ctx, cfg, size, relocs && !aux_needs_softpin(fd), 0, 0,@@ -1083,7 +1123,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,/** * intel_bb_create_with_relocs: -* @fd: drm fd +* @fd: drm fd - i915 * @size: size of the batchbuffer * * Creates bb which will disable passing addresses. @@ -1095,7 +1135,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,*/ struct intel_bb *intel_bb_create_with_relocs (int fd,uint32_t size) { -igt_require (gem_has_relocations (fd)); +igt_require (is_i915_device (fd) &&gem_has_relocations (fd));return __intel_bb_create (fd,0 ,NULL , size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );@@ -1103,7 +1143,7 @@ struct intel_bb *intel_bb_create_with_relocs(int fd, uint32_t size)/** * intel_bb_create_with_relocs_and_context: -* @fd: drm fd +* @fd: drm fd - i915 * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1120,7 +1160,7 @@ intel_bb_create_with_relocs_and_context(int fd, uint32_t ctx,const intel_ctx_cfg_t *cfg, uint32_t size) { -igt_require (gem_has_relocations (fd )); + igt_require(is_i915_device(fd) && gem_has_relocations(fd));return __intel_bb_create (fd, ctx, cfg, size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );lib/intel_batchbuffer.c void intel_bb_destroy(struct intel_bb *ibb) · line 1266
Quoted 6 lines
lib/intel_batchbuffer.c +3
-0@@ -1221,12 +1261,76 @@ void intel_bb_destroy(struct intel_bb *ibb)if (ibb->fence >=0 )close (ibb->fence); +if (ibb->engine_syncobj) +syncobj_destroy (ibb->fd, ibb->engine_syncobj); +if (ibb->vm_id && !ibb->ctx)Why not use here
ibb->driver==INTEL_DRIVER_XEcheck ?lib/intel_batchbuffer.c void intel_bb_destroy(struct intel_bb *ibb) · line 1275
Quoted 9 lines
lib/intel_batchbuffer.c +3
-0+xe_vm_destroy (ibb->fd, ibb->vm_id);free (ibb->batch);free (ibb->cfg);free (ibb); } +static struct drm_xe_vm_bind_op *xe_alloc_bind_ops (struct intel_bb *ibb, +uint32_t op,uint32_t region)--------------------------------------------------------------- ^ Here
uint64_tas you are adding new function so let make it correct from the start.Quoted 62 lines
lib/intel_batchbuffer.c +58
-0+{ +struct drm_i915_gem_exec_object2 **objects = ibb->objects; +struct drm_xe_vm_bind_op *bind_ops, *ops; +bool set_obj = (op &0xffff ) ==XE_VM_BIND_OP_MAP ; + + bind_ops =calloc (ibb->num_objects,sizeof (*bind_ops)); +igt_assert (bind_ops); + +igt_debug ("bind_ops: %s\n" , set_obj ?"MAP" :"UNMAP" ); +for (int i =0 ; i < ibb->num_objects; i++) { + ops = &bind_ops[i]; + +if (set_obj) + ops->obj = objects[i]->handle; + + ops->op = op; + ops->obj_offset =0 ; + ops->addr = objects[i]->offset; + ops->range = objects[i]->rsvd1; + ops->region = region; + +igt_debug (" [%d]: handle: %u, offset: %llx, size: %llx\n" , + i, ops->obj, (long long )ops->addr, (long long )ops->range); + } + +return bind_ops; +} + +static void __unbind_xe_objects (struct intel_bb *ibb) +{ +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +int ret; + + syncs[0 ].handle = ibb->engine_syncobj; + syncs[1 ].handle =syncobj_create (ibb->fd,0 ); + +if (ibb->num_objects >1 ) { +struct drm_xe_vm_bind_op *bind_ops; +uint32_t op =XE_VM_BIND_OP_UNMAP |XE_VM_BIND_FLAG_ASYNC ; + + bind_ops =xe_alloc_bind_ops (ibb, op,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,2 ); +free (bind_ops); + }else { +xe_vm_unbind_async (ibb->fd, ibb->vm_id,0 ,0 , + ibb->batch_offset, ibb->size, syncs,2 ); + } + ret =syncobj_wait_err (ibb->fd, &syncs[1 ].handle,1 ,INT64_MAX ,0 ); +igt_assert_eq (ret,0 ); +syncobj_destroy (ibb->fd, syncs[1 ].handle); + + ibb->xe_bound = false; +} +/* * intel_bb_reset: * @ibb: pointer to intel_bb lib/intel_batchbuffer.c void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) · line 1365
Quoted 4 lines
lib/intel_batchbuffer.c +1
-0@@ -1258,6 +1362,9 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)for (i =0 ; i < ibb->num_objects; i++) ibb->objects[i]->flags &=EXEC_OBJECT_SUPPORTS_48B_ADDRESS ; +if (is_xe_device (ibb->fd) && ibb->xe_bound)----------- ^
Useibb->driver? Or just drop and use only:if (ibb->xe_bound)lib/intel_batchbuffer.c void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) · line 1388
Quoted 11 lines
lib/intel_batchbuffer.c +3
-1+__unbind_xe_objects (ibb); +__intel_bb_destroy_relocations (ibb);__intel_bb_destroy_objects (ibb);__reallocate_objects (ibb);@@ -1278,10 +1385,15 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) ibb->size);gem_close (ibb->fd, ibb->handle); - ibb->handle =gem_create (ibb->fd, ibb->size); +if (is_i915_device (ibb->fd))----------- ^
Useibb->driverlib/intel_batchbuffer.c void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) · line 1396
Quoted 10 lines
lib/intel_batchbuffer.c +7
-2+ ibb->handle =gem_create (ibb->fd, ibb->size); + else + ibb->handle = xe_bo_create_flags(ibb->fd, 0, ibb->size, +vram_if_possible (ibb->fd,0 )); -/* Keep address for bb in reloc mode and RANDOM allocator */ -if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE ) +/* Reacquire offset for RELOC and SIMPLE */ +if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE || + ibb->allocator_type ==INTEL_ALLOCATOR_RELOC )This hunk looks like part of non-related fix.
Quoted 95 lines
lib/intel_batchbuffer.c +38
-10ibb->batch_offset = __intel_bb_get_offset(ibb, ibb->handle, ibb->size,@@ -1304,13 +1416,19 @@ int intel_bb_sync(struct intel_bb *ibb) {int ret; -if (ibb->fence <0 ) +if (ibb->fence <0 && !ibb->engine_syncobj)return 0 ; - ret =sync_fence_wait (ibb->fence,-1 ); -if (ret ==0 ) { -close (ibb->fence); - ibb->fence =-1 ; +if (ibb->fence >=0 ) { + ret =sync_fence_wait (ibb->fence,-1 ); +if (ret ==0 ) { +close (ibb->fence); + ibb->fence =-1 ; + } + }else { +igt_assert_neq (ibb->engine_syncobj,0 ); + ret =syncobj_wait_err (ibb->fd, &ibb->engine_syncobj, +1 ,INT64_MAX ,0 ); }return ret;@@ -1501,7 +1619,7 @@ static void __remove_from_objects(struct intel_bb *ibb, }/** -* intel_bb_add_object: +* __intel_bb_add_object: * @ibb: pointer to intel_bb * @handle: which handle to add to objects array * @size: object size @@ -1513,9 +1631,9 @@ static void __remove_from_objects(struct intel_bb *ibb,* in the object tree. When object is a render target it has to * be marked with EXEC_OBJECT_WRITE flag. */ -struct drm_i915_gem_exec_object2 * -intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, -uint64_t offset,uint64_t alignment,bool write) +static struct drm_i915_gem_exec_object2 * +__intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) {struct drm_i915_gem_exec_object2 *object;@@ -1523,8 +1641,12 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size, || ALIGN(offset, alignment) == offset);igt_assert (is_power_of_two (alignment)); +if (ibb->driver ==INTEL_DRIVER_I915 ) + alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd)); +else + alignment =max_t (uint64_t, ibb->alignment, alignment); + object =__add_to_cache (ibb, handle); - alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd));__add_to_objects (ibb, object);/* @@ -1584,9 +1706,27 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,if (ibb->allows_obj_alignment) object->alignment = alignment; +if (ibb->driver ==INTEL_DRIVER_XE ) { + object->alignment = alignment; + object->rsvd1 = size; + } +return object; } +struct drm_i915_gem_exec_object2 * +intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) +{ +struct drm_i915_gem_exec_object2 *obj =NULL ; + + obj =__intel_bb_add_object (ibb, handle, size, offset, + alignment, write); +igt_assert (obj); + +return obj; +} +bool intel_bb_remove_object (struct intel_bb *ibb,uint32_t handle,uint64_t offset,uint64_t size) {@@ -2135,6 +2275,82 @@ static void update_offsets(struct intel_bb *ibb, }
Quoted 7 lines
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2280
Quoted 4 lines
lib/intel_batchbuffer.c +3
-0#define LINELEN 76 + +static int +__xe_bb_exec (struct intel_bb *ibb,uint64_t flags,bool sync)----------------------------------------------------- ^ You use this function only once with 0 (=false), so maybe drop this param ?
The only usage I found passes the 'sync' flag from intel_bb_exec:
Quoted 4 lines
Quoted 4 lines
lib/intel_batchbuffer.c +0
-0@@ -2230,7 +2446,13 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,void intel_bb_exec (struct intel_bb *ibb,uint32_t end_offset,uint64_t flags,bool sync) {
Quoted 8 lines
lib/intel_batchbuffer.c int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset, · line 2455
Quoted 8 lines
lib/intel_batchbuffer.c +7
-1-igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +if (ibb->dump_base64) +intel_bb_dump_base64 (ibb,LINELEN ); + +if (ibb->driver ==INTEL_DRIVER_I915 ) +igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +else +igt_assert_eq (__xe_bb_exec (ibb, flags, sync),0 );
-------------------------------------------------------^^^^
Quoted 68 lines
Quoted 27 lines
lib/intel_batchbuffer.c +23
-0} +{ +uint32_t engine = flags & (I915_EXEC_BSD_MASK |I915_EXEC_RING_MASK ); +uint32_t engine_id; +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +struct drm_xe_vm_bind_op *bind_ops; +void *map; + +igt_assert_eq (ibb->num_relocs,0 ); +igt_assert_eq (ibb->xe_bound, false); + +if (ibb->last_engine != engine) { +struct drm_xe_engine_class_instance inst = { }; + + inst.engine_instance = + (flags &I915_EXEC_BSD_MASK ) >>I915_EXEC_BSD_SHIFT ; + +switch (flags &I915_EXEC_RING_MASK ) { +case I915_EXEC_DEFAULT : +case I915_EXEC_BLT : + inst.engine_class =DRM_XE_ENGINE_CLASS_COPY ;lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2313
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+break ; +case I915_EXEC_BSD : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_DECODE ; +break ; +case I915_EXEC_RENDER : + inst.engine_class =DRM_XE_ENGINE_CLASS_RENDER ; +break ; +case I915_EXEC_VEBOX : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE ; +break ;What about compute ? It is not unknown.
Quoted 11 lines
lib/intel_batchbuffer.c +11
-0+default : +igt_assert_f (false,"Unknown engine: %x" , (uint32_t ) flags); + } +igt_debug ("Run on %s\n" ,xe_engine_class_string (inst.engine_class)); + + ibb->engine_id = engine_id = +xe_engine_create (ibb->fd, ibb->vm_id, &inst,0 ); + }else { + engine_id = ibb->engine_id; + } + ibb->last_engine = engine;lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2334
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+ + map =xe_bo_map (ibb->fd, ibb->handle, ibb->size); +memcpy (map, ibb->batch, ibb->size); +gem_munmap (map, ibb->size); + + syncs[0 ].handle =syncobj_create (ibb->fd,0 ); +if (ibb->num_objects >1 ) { + bind_ops =xe_alloc_bind_ops (ibb,XE_VM_BIND_OP_MAP |XE_VM_BIND_FLAG_ASYNC ,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,1 );--------------------------------------------------------- ^
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2339
Quoted 5 lines
lib/intel_batchbuffer.c +5
-0+ ibb->xe_bound = true; +free (bind_ops); + }else { +xe_vm_bind_async (ibb->fd, ibb->vm_id,0 , ibb->handle,0 , + ibb->batch_offset, ibb->size, syncs,1 );--------------------------------------------------------------------- ^
Quoted 6 lines
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2342
Quoted 3 lines
lib/intel_batchbuffer.c +3
-0+ } + + syncs[0 ].flags &= ~DRM_XE_SYNC_SIGNAL ;------------- ^
Why not create it already without this flag and in above places use "&syncs[1]" ? Or use two vars sync_bind[1] and syncs_exec[2] ?
If I understand correctly, the point of having sync[0] in the bind operation and xe_exec, is to synchronize between these operations using this object. If we use syncs[1] and set the syncs[0] flags like you suggest we would have to swap the handles which doesn't makes sense to me.
I guess we could use separate variables, but essentially, they are supposed to represent the same object so I am not sure whether having two variables here is neccessary.
Quoted 10 lines
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2349
Quoted 8 lines
lib/intel_batchbuffer.c +7
-0+ ibb->engine_syncobj =syncobj_create (ibb->fd,0 ); + syncs[1 ].handle = ibb->engine_syncobj; + +xe_exec_sync (ibb->fd, engine_id, ibb->batch_offset, syncs,2 ); + +if (sync) +intel_bb_sync (ibb);--------------- ^
Not used.
So according to the above - it is used, unless I am missing something.
Christoph
Quoted 84 lines
Regards,
KamilQuoted 80 lines
lib/intel_batchbuffer.c +19
-3+ +return 0 ; +} +/* * __intel_bb_exec: * @ibb: pointer to intel_bb @@ -2220,7 +2436,7 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,/** * intel_bb_exec: * @ibb: pointer to intel_bb -* @end_offset: offset of the last instruction in the bb +* @end_offset: offset of the last instruction in the bb (for i915) * @flags: flags passed directly to execbuf * @sync: if true wait for execbuf completion, otherwise caller is responsible * to wait for completion @@ -2230,7 +2446,13 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,void intel_bb_exec (struct intel_bb *ibb,uint32_t end_offset,uint64_t flags,bool sync) { -igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +if (ibb->dump_base64) +intel_bb_dump_base64 (ibb,LINELEN ); + +if (ibb->driver ==INTEL_DRIVER_I915 ) +igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +else +igt_assert_eq (__xe_bb_exec (ibb, flags, sync),0 ); }/** @@ -2628,14 +2850,20 @@ void intel_bb_track(bool do_tracking)static void __intel_bb_reinit_alloc (struct intel_bb *ibb) { +uint64_t alignment =0 ; +if (ibb->allocator_type ==INTEL_ALLOCATOR_NONE )return ; +if (ibb->driver ==INTEL_DRIVER_XE ) + alignment =xe_get_default_alignment (ibb->fd); + ibb->allocator_handle =intel_allocator_open_full (ibb->fd, ibb->ctx, ibb->allocator_start, ibb->allocator_end, ibb->allocator_type, ibb->allocator_strategy, -0 ); + alignment); +intel_bb_reset (ibb, true); }lib/intel_batchbuffer.h +6
-0@@ -246,6 +246,7 @@ struct intel_bb {uint8_t allocator_type;enum allocator_strategy allocator_strategy; +enum intel_driver driver;int fd;unsigned int gen;bool debug;@@ -268,6 +269,11 @@ struct intel_bb {uint32_t ctx;uint32_t vm_id; +bool xe_bound; +uint32_t engine_syncobj; +uint32_t engine_id; +uint32_t last_engine; +/* Context configuration */ intel_ctx_cfg_t *cfg;Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 08/15] lib/intel_batchbuffer: Add Xe support in intel-bb
In reply to Kamil KoniecznyQuoted 23 lines · Kamil Konieczny
Hi Zbigniew,
Quoted 8 lines · Zbigniew Kempczyński
Intention of creating intel-bb was to replace libdrm for i915. Due to many code relies on it (kms for example) most rational way is to extend and add Xe path to it.
Signed-off-by Zbigniew Kempczyński <[email protected]>--- lib/intel_batchbuffer.c | 350 +++++++++++++++++++++++++++++++++------- lib/intel_batchbuffer.h | 6 +Thank you for separating i195 -> fd rename, now it is easier to review.
Quoted 9 lines
2 files changed, 295 insertions(+), 61 deletions(-)lib/intel_batchbuffer.c +0
-0@@ -29,6 +29,8 @@#include <glib.h>
Quoted 6 lines
lib/intel_batchbuffer.c line 33
Quoted 3 lines
lib/intel_batchbuffer.c +2
-0#include "i915/gem_create.h" +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h" Please sort it alphabetically.
Ack.
Quoted 12 lines
lib/intel_batchbuffer.c line 44
Quoted 9 lines
lib/intel_batchbuffer.c +2
-0#include "intel_batchbuffer.h" #include "intel_bufops.h" #include "intel_chipset.h" @@ -38,6 +40,8 @@#include "veboxcopy.h" #include "sw_sync.h" #include "gpgpu_fill.h" +#include "igt_aux.h" +#include "igt_syncobj.h" Same here, please put in in alphabetical order.
Will do.
Quoted 16 lines
Quoted 16 lines
lib/intel_batchbuffer.c +3
-2#include "huc_copy.h" #include "i915/i915_blt.h" @@ -828,21 +832,22 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,/** * __intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id -* @cfg: intel_ctx configuration, NULL for default context or legacy mode +* @cfg: for i915 intel_ctx configuration, NULL for default context or legacy mode, +* unused for xe * @size: size of the batchbuffer * @do_relocs: use relocations or allocator * @allocator_type: allocator type, must be INTEL_ALLOCATOR_NONE for relocations
Quoted 9 lines
lib/intel_batchbuffer.c static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb, · line 844
Quoted 4 lines
lib/intel_batchbuffer.c +1
-1* * intel-bb assumes it will work in one of two modes - with relocations or -* with using allocator (currently RANDOM and SIMPLE are implemented). +* with using allocator (currently RELOC and SIMPLE are implemented). These should be done in separate patch ? Or at least write about it in patch description. Also you can write about relocations can not be used in xe and that RELOC allocator can.
Ok, I'll extract this to separate patch. During removing random documentation was intact so I need to clean this during this series.
Quoted 78 lines
Quoted 78 lines
lib/intel_batchbuffer.c +29
-16* Some description is required to describe how they maintain the addresses. * * Before entering into each scenarios generic rule is intel-bb keeps objects * and their offsets in the internal cache and reuses in subsequent execs. * -* 1. intel-bb with relocations +* 1. intel-bb with relocations (i915 only) * * Creating new intel-bb adds handle to cache implicitly and sets its address * to 0. Objects added to intel-bb later also have address 0 set for first run. @@ -850,14 +855,15 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,* works in reloc mode addresses are only suggestion to the driver and we * cannot be sure they won't change at next exec. * -* 2. with allocator +* 2. with allocator (i915 or xe) * * This mode is valid only for ppgtt. Addresses are acquired from allocator -* and softpinned. intel-bb cache must be then coherent with allocator -* (simple is coherent, random is not due to fact we don't keep its state). +* and softpinned (i915) or vm-binded (xe). intel-bb cache must be then +* coherent with allocator (simple is coherent, reloc partially [doesn't +* support address reservation]). * When we do intel-bb reset with purging cache it has to reacquire addresses * from allocator (allocator should return same address - what is true for -* simple allocator and false for random as mentioned before). +* simple and reloc allocators). * * If we do reset without purging caches we use addresses from intel-bb cache * during execbuf objects construction. @@ -883,48 +889,83 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,igt_assert (ibb); - ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); ibb->devid =intel_get_drm_devid (fd); ibb->gen =intel_gen (ibb->devid); + ibb->ctx = ctx; + + ibb->fd = fd; + ibb->driver =is_i915_device (fd) ?INTEL_DRIVER_I915 : +is_xe_device (fd) ?INTEL_DRIVER_XE :0 ; +igt_assert (ibb->driver);/* * If we don't have full ppgtt driver can change our addresses * so allocator is useless in this case. Just enforce relocations * for such gens and don't use allocator at all. */ -if (!ibb->uses_full_ppgtt) - do_relocs = true; +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->uses_full_ppgtt =gem_uses_full_ppgtt (fd); -/* -* For softpin mode allocator has full control over offsets allocation -* so we want kernel to not interfere with this. -*/ -if (do_relocs) - ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); +if (!ibb->uses_full_ppgtt) + do_relocs = true; -/* Use safe start offset instead assuming 0x0 is safe */ - start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd)); +/* +* For softpin mode allocator has full control over offsets allocation +* so we want kernel to not interfere with this. +*/ +if (do_relocs) { + ibb->allows_obj_alignment =gem_allows_obj_alignment (fd); + allocator_type =INTEL_ALLOCATOR_NONE ; + }else { +/* Use safe start offset instead assuming 0x0 is safe */ + start =max_t (uint64_t, start,gem_detect_safe_start_offset (fd)); + +/* if relocs are set we won't use an allocator */ + ibb->allocator_handle =
Quoted 9 lines
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 930
Quoted 6 lines
lib/intel_batchbuffer.c +6
-0+intel_allocator_open_full (fd, ctx, + start, end, + allocator_type, + strategy,0 ); + } +imho here should be placed alignment detection for i915.
Agree, there're unnecessary two if (driver == ...) blocks which might be narrowed to single one.
Quoted 15 lines
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 943
Quoted 13 lines
lib/intel_batchbuffer.c +13
-0+ ibb->vm_id =0 ; + }else { +igt_assert (!do_relocs); + +if (!ctx) + ctx =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + + ibb->uses_full_ppgtt =1 ; + ibb->allocator_handle = +intel_allocator_open_full (fd, ctx, start, end, + allocator_type, + strategy, +xe_get_default_alignment (fd));------------------------------------------------- ^ Later on you set:
Quoted 2 lines
ibb->alignment = xe_get_default_alignment(fd);so maybe move it here and use it ?
Agree.
Quoted 32 lines
Quoted 21 lines
lib/intel_batchbuffer.c +3
-11+ ibb->vm_id = ctx; + ibb->last_engine = ~0U ; + } -/* if relocs are set we won't use an allocator */ -if (do_relocs) - allocator_type =INTEL_ALLOCATOR_NONE ; -else - ibb->allocator_handle =intel_allocator_open_full (fd, ctx, - start, end, - allocator_type, - strategy,0 ); ibb->allocator_type = allocator_type; ibb->allocator_strategy = strategy; ibb->allocator_start = start; ibb->allocator_end = end; - - ibb->fd = fd; ibb->enforce_relocs = do_relocs; - ibb->handle =gem_create (fd, size);lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 962
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+ +if (ibb->driver ==INTEL_DRIVER_I915 ) { + ibb->handle =gem_create (fd, size); + ibb->alignment =gem_detect_safe_alignment (fd); + ibb->gtt_size =gem_aperture_size (fd); + }else { + ibb->alignment =xe_get_default_alignment (fd); + size =ALIGN (size, ibb->alignment); + ibb->handle = xe_bo_create_flags(fd, 0, size, + xe_has_vram(fd) ?------------------------------------------------ ^
Quoted 7 lines
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 964
Quoted 2 lines
lib/intel_batchbuffer.c +2
-0+ vram_memory(fd, 0) : + system_memory(fd));
xe_vram_if_possible? btw this may interfere when one wants to create ibb object in system memory, so maybe we should add one more option (in future).
Same issue we got on i915 (see above, bb is created in system memory). For cases we're using imo region of bb doesn't matter much.
Quoted 20 lines
Quoted 20 lines
lib/intel_batchbuffer.c +3
-4+ ibb->gtt_size =1ull <<xe_va_bits (fd); + } + ibb->size = size; - ibb->alignment =gem_detect_safe_alignment (fd); - ibb->ctx = ctx; - ibb->vm_id =0 ; ibb->batch =calloc (1 , size);igt_assert (ibb->batch); ibb->ptr = ibb->batch;@@ -937,7 +978,6 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,memcpy (ibb->cfg, cfg,sizeof (*cfg)); } - ibb->gtt_size =gem_aperture_size (fd);if ((ibb->gtt_size -1 ) >>32 ) ibb->supports_48b_address = true;@@ -961,13 +1001,13 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg,
Quoted 14 lines
lib/intel_batchbuffer.c __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, · line 1010
Quoted 11 lines
lib/intel_batchbuffer.c +2
-2/** * intel_bb_create_full: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer * @start: allocator vm start address * @end: allocator vm start address -* @allocator_type: allocator type, SIMPLE, RANDOM, ... +* @allocator_type: allocator type, SIMPLE, RELOC, ... Looks like unrelated fix.
Ok, will be part of additional patch in the series.
Quoted 86 lines
Quoted 86 lines
lib/intel_batchbuffer.c +9
-9* @strategy: allocation strategy * * Creates bb with context passed in @ctx, size in @size and allocator type @@ -992,7 +1032,7 @@ struct intel_bb *intel_bb_create_full(int fd, uint32_t ctx,/** * intel_bb_create_with_allocator: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1027,7 +1067,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)/** * intel_bb_create: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @size: size of the batchbuffer * * Creates bb with default context. @@ -1047,7 +1087,7 @@ static bool has_ctx_cfg(struct intel_bb *ibb)*/ struct intel_bb *intel_bb_create (int fd,uint32_t size) { -bool relocs =gem_has_relocations (fd); +bool relocs =is_i915_device (fd) &&gem_has_relocations (fd); return __intel_bb_create(fd, 0, NULL, size, relocs && !aux_needs_softpin(fd), 0, 0,@@ -1057,7 +1097,7 @@ struct intel_bb *intel_bb_create(int fd, uint32_t size)/** * intel_bb_create_with_context: -* @fd: drm fd +* @fd: drm fd - i915 or xe * @ctx: context id * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1073,7 +1113,7 @@ struct intel_bb * intel_bb_create_with_context(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, uint32_t size) { - bool relocs = gem_has_relocations(fd); + bool relocs = is_i915_device(fd) && gem_has_relocations(fd); return __intel_bb_create(fd, ctx, cfg, size, relocs && !aux_needs_softpin(fd), 0, 0,@@ -1083,7 +1123,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,/** * intel_bb_create_with_relocs: -* @fd: drm fd +* @fd: drm fd - i915 * @size: size of the batchbuffer * * Creates bb which will disable passing addresses. @@ -1095,7 +1135,7 @@ intel_bb_create_with_context(int fd, uint32_t ctx,*/ struct intel_bb *intel_bb_create_with_relocs (int fd,uint32_t size) { -igt_require (gem_has_relocations (fd)); +igt_require (is_i915_device (fd) &&gem_has_relocations (fd));return __intel_bb_create (fd,0 ,NULL , size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );@@ -1103,7 +1143,7 @@ struct intel_bb *intel_bb_create_with_relocs(int fd, uint32_t size)/** * intel_bb_create_with_relocs_and_context: -* @fd: drm fd +* @fd: drm fd - i915 * @ctx: context * @cfg: intel_ctx configuration, NULL for default context or legacy mode * @size: size of the batchbuffer @@ -1120,7 +1160,7 @@ intel_bb_create_with_relocs_and_context(int fd, uint32_t ctx,const intel_ctx_cfg_t *cfg, uint32_t size) { -igt_require (gem_has_relocations (fd )); + igt_require(is_i915_device(fd) && gem_has_relocations(fd));return __intel_bb_create (fd, ctx, cfg, size, true,0 ,0 ,INTEL_ALLOCATOR_NONE ,ALLOC_STRATEGY_NONE );@@ -1221,12 +1261,76 @@ void intel_bb_destroy(struct intel_bb *ibb)
Quoted 8 lines
lib/intel_batchbuffer.c void intel_bb_destroy(struct intel_bb *ibb) · line 1266
Quoted 5 lines
lib/intel_batchbuffer.c +3
-0if (ibb->fence >=0 )close (ibb->fence); +if (ibb->engine_syncobj) +syncobj_destroy (ibb->fd, ibb->engine_syncobj); +if (ibb->vm_id && !ibb->ctx)Why not use here
ibb->driver==INTEL_DRIVER_XEcheck ?
ibb->driver may be additional check but decision about destroying vm depends on who created it (above check says about it).
Quoted 7 lines
Quoted 7 lines
lib/intel_batchbuffer.c +1
-0+xe_vm_destroy (ibb->fd, ibb->vm_id);free (ibb->batch);free (ibb->cfg);free (ibb); }
Quoted 6 lines
lib/intel_batchbuffer.c void intel_bb_destroy(struct intel_bb *ibb) · line 1275
Quoted 2 lines
lib/intel_batchbuffer.c +2
-0+static struct drm_xe_vm_bind_op *xe_alloc_bind_ops (struct intel_bb *ibb, +uint32_t op,uint32_t region)--------------------------------------------------------------- ^ Here
uint64_tas you are adding new function so let make it correct from the start.
This is correct, see struct drm_xe_vm_bind_op.
Quoted 65 lines
Quoted 65 lines
lib/intel_batchbuffer.c +58
-0+{ +struct drm_i915_gem_exec_object2 **objects = ibb->objects; +struct drm_xe_vm_bind_op *bind_ops, *ops; +bool set_obj = (op &0xffff ) ==XE_VM_BIND_OP_MAP ; + + bind_ops =calloc (ibb->num_objects,sizeof (*bind_ops)); +igt_assert (bind_ops); + +igt_debug ("bind_ops: %s\n" , set_obj ?"MAP" :"UNMAP" ); +for (int i =0 ; i < ibb->num_objects; i++) { + ops = &bind_ops[i]; + +if (set_obj) + ops->obj = objects[i]->handle; + + ops->op = op; + ops->obj_offset =0 ; + ops->addr = objects[i]->offset; + ops->range = objects[i]->rsvd1; + ops->region = region; + +igt_debug (" [%d]: handle: %u, offset: %llx, size: %llx\n" , + i, ops->obj, (long long )ops->addr, (long long )ops->range); + } + +return bind_ops; +} + +static void __unbind_xe_objects (struct intel_bb *ibb) +{ +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +int ret; + + syncs[0 ].handle = ibb->engine_syncobj; + syncs[1 ].handle =syncobj_create (ibb->fd,0 ); + +if (ibb->num_objects >1 ) { +struct drm_xe_vm_bind_op *bind_ops; +uint32_t op =XE_VM_BIND_OP_UNMAP |XE_VM_BIND_FLAG_ASYNC ; + + bind_ops =xe_alloc_bind_ops (ibb, op,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,2 ); +free (bind_ops); + }else { +xe_vm_unbind_async (ibb->fd, ibb->vm_id,0 ,0 , + ibb->batch_offset, ibb->size, syncs,2 ); + } + ret =syncobj_wait_err (ibb->fd, &syncs[1 ].handle,1 ,INT64_MAX ,0 ); +igt_assert_eq (ret,0 ); +syncobj_destroy (ibb->fd, syncs[1 ].handle); + + ibb->xe_bound = false; +} +/* * intel_bb_reset: * @ibb: pointer to intel_bb @@ -1258,6 +1362,9 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)for (i =0 ; i < ibb->num_objects; i++) ibb->objects[i]->flags &=EXEC_OBJECT_SUPPORTS_48B_ADDRESS ;
Quoted 5 lines
lib/intel_batchbuffer.c void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) · line 1365
Quoted 1 line
lib/intel_batchbuffer.c +1
-0+if (is_xe_device (ibb->fd) && ibb->xe_bound)----------- ^
Useibb->driver? Or just drop and use only:if (ibb->xe_bound)
if (ibb->xe_bound) is enough, driver check isn't necessary. But I've just noticed bug in ibb->xe_bound = true assignment, it is currently done on num_objects > 1. I'll fix this.
Quoted 8 lines
Quoted 8 lines
lib/intel_batchbuffer.c +2
-0+__unbind_xe_objects (ibb); +__intel_bb_destroy_relocations (ibb);__intel_bb_destroy_objects (ibb);__reallocate_objects (ibb);@@ -1278,10 +1385,15 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) ibb->size);
Quoted 6 lines
lib/intel_batchbuffer.c void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) · line 1388
Quoted 3 lines
lib/intel_batchbuffer.c +1
-1gem_close (ibb->fd, ibb->handle); - ibb->handle =gem_create (ibb->fd, ibb->size); +if (is_i915_device (ibb->fd))----------- ^
Useibb->driver
Ack.
Quoted 5 lines
Quoted 5 lines
lib/intel_batchbuffer.c +4
-0+ ibb->handle =gem_create (ibb->fd, ibb->size); + else + ibb->handle = xe_bo_create_flags(ibb->fd, 0, ibb->size, +vram_if_possible (ibb->fd,0 ));
Quoted 8 lines
lib/intel_batchbuffer.c void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) · line 1396
Quoted 5 lines
lib/intel_batchbuffer.c +3
-2-/* Keep address for bb in reloc mode and RANDOM allocator */ -if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE ) +/* Reacquire offset for RELOC and SIMPLE */ +if (ibb->allocator_type ==INTEL_ALLOCATOR_SIMPLE || + ibb->allocator_type ==INTEL_ALLOCATOR_RELOC )This hunk looks like part of non-related fix.
Ok, will extract to separate patch.
Quoted 95 lines
Quoted 95 lines
lib/intel_batchbuffer.c +38
-10ibb->batch_offset = __intel_bb_get_offset(ibb, ibb->handle, ibb->size,@@ -1304,13 +1416,19 @@ int intel_bb_sync(struct intel_bb *ibb) {int ret; -if (ibb->fence <0 ) +if (ibb->fence <0 && !ibb->engine_syncobj)return 0 ; - ret =sync_fence_wait (ibb->fence,-1 ); -if (ret ==0 ) { -close (ibb->fence); - ibb->fence =-1 ; +if (ibb->fence >=0 ) { + ret =sync_fence_wait (ibb->fence,-1 ); +if (ret ==0 ) { +close (ibb->fence); + ibb->fence =-1 ; + } + }else { +igt_assert_neq (ibb->engine_syncobj,0 ); + ret =syncobj_wait_err (ibb->fd, &ibb->engine_syncobj, +1 ,INT64_MAX ,0 ); }return ret;@@ -1501,7 +1619,7 @@ static void __remove_from_objects(struct intel_bb *ibb, }/** -* intel_bb_add_object: +* __intel_bb_add_object: * @ibb: pointer to intel_bb * @handle: which handle to add to objects array * @size: object size @@ -1513,9 +1631,9 @@ static void __remove_from_objects(struct intel_bb *ibb,* in the object tree. When object is a render target it has to * be marked with EXEC_OBJECT_WRITE flag. */ -struct drm_i915_gem_exec_object2 * -intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, -uint64_t offset,uint64_t alignment,bool write) +static struct drm_i915_gem_exec_object2 * +__intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) {struct drm_i915_gem_exec_object2 *object;@@ -1523,8 +1641,12 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size, || ALIGN(offset, alignment) == offset);igt_assert (is_power_of_two (alignment)); +if (ibb->driver ==INTEL_DRIVER_I915 ) + alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd)); +else + alignment =max_t (uint64_t, ibb->alignment, alignment); + object =__add_to_cache (ibb, handle); - alignment =max_t (uint64_t, alignment,gem_detect_safe_alignment (ibb->fd));__add_to_objects (ibb, object);/* @@ -1584,9 +1706,27 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,if (ibb->allows_obj_alignment) object->alignment = alignment; +if (ibb->driver ==INTEL_DRIVER_XE ) { + object->alignment = alignment; + object->rsvd1 = size; + } +return object; } +struct drm_i915_gem_exec_object2 * +intel_bb_add_object (struct intel_bb *ibb,uint32_t handle,uint64_t size, +uint64_t offset,uint64_t alignment,bool write) +{ +struct drm_i915_gem_exec_object2 *obj =NULL ; + + obj =__intel_bb_add_object (ibb, handle, size, offset, + alignment, write); +igt_assert (obj); + +return obj; +} +bool intel_bb_remove_object (struct intel_bb *ibb,uint32_t handle,uint64_t offset,uint64_t size) {@@ -2135,6 +2275,82 @@ static void update_offsets(struct intel_bb *ibb, }
Quoted 8 lines
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2280
Quoted 4 lines
lib/intel_batchbuffer.c +3
-0#define LINELEN 76 + +static int +__xe_bb_exec (struct intel_bb *ibb,uint64_t flags,bool sync)----------------------------------------------------- ^ You use this function only once with 0 (=false), so maybe drop this param ?
No, this flag comes from intel_bb_exec() what might be executed with true or false depending on user needs.
Quoted 27 lines
Quoted 27 lines
lib/intel_batchbuffer.c +27
-0+{ +uint32_t engine = flags & (I915_EXEC_BSD_MASK |I915_EXEC_RING_MASK ); +uint32_t engine_id; +struct drm_xe_sync syncs[2 ] = { + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + { .flags =DRM_XE_SYNC_SYNCOBJ |DRM_XE_SYNC_SIGNAL , }, + }; +struct drm_xe_vm_bind_op *bind_ops; +void *map; + +igt_assert_eq (ibb->num_relocs,0 ); +igt_assert_eq (ibb->xe_bound, false); + +if (ibb->last_engine != engine) { +struct drm_xe_engine_class_instance inst = { }; + + inst.engine_instance = + (flags &I915_EXEC_BSD_MASK ) >>I915_EXEC_BSD_SHIFT ; + +switch (flags &I915_EXEC_RING_MASK ) { +case I915_EXEC_DEFAULT : +case I915_EXEC_BLT : + inst.engine_class =DRM_XE_ENGINE_CLASS_COPY ; +break ; +case I915_EXEC_BSD : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_DECODE ; +break ;
Quoted 9 lines
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2313
Quoted 6 lines
lib/intel_batchbuffer.c +6
-0+case I915_EXEC_RENDER : + inst.engine_class =DRM_XE_ENGINE_CLASS_RENDER ; +break ; +case I915_EXEC_VEBOX : + inst.engine_class =DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE ; +break ;What about compute ? It is not unknown.
There's no such legacy flag what we're addressing here.
Quoted 28 lines
Quoted 11 lines
lib/intel_batchbuffer.c +11
-0+default : +igt_assert_f (false,"Unknown engine: %x" , (uint32_t ) flags); + } +igt_debug ("Run on %s\n" ,xe_engine_class_string (inst.engine_class)); + + ibb->engine_id = engine_id = +xe_engine_create (ibb->fd, ibb->vm_id, &inst,0 ); + }else { + engine_id = ibb->engine_id; + } + ibb->last_engine = engine;lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2334
Quoted 10 lines
lib/intel_batchbuffer.c +10
-0+ + map =xe_bo_map (ibb->fd, ibb->handle, ibb->size); +memcpy (map, ibb->batch, ibb->size); +gem_munmap (map, ibb->size); + + syncs[0 ].handle =syncobj_create (ibb->fd,0 ); +if (ibb->num_objects >1 ) { + bind_ops =xe_alloc_bind_ops (ibb,XE_VM_BIND_OP_MAP |XE_VM_BIND_FLAG_ASYNC ,0 ); +xe_vm_bind_array (ibb->fd, ibb->vm_id,0 , bind_ops, + ibb->num_objects, syncs,1 );--------------------------------------------------------- ^
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2339
Quoted 5 lines
lib/intel_batchbuffer.c +5
-0+ ibb->xe_bound = true; +free (bind_ops); + }else { +xe_vm_bind_async (ibb->fd, ibb->vm_id,0 , ibb->handle,0 , + ibb->batch_offset, ibb->size, syncs,1 );--------------------------------------------------------------------- ^
Quoted 6 lines
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2342
Quoted 3 lines
lib/intel_batchbuffer.c +3
-0+ } + + syncs[0 ].flags &= ~DRM_XE_SYNC_SIGNAL ;------------- ^
Why not create it already without this flag and in above places use "&syncs[1]" ? Or use two vars sync_bind[1] and syncs_exec[2] ?
syncs[0] for vm_bind is created with SIGNAL flag and used during binding. Then it is used as wait syncobj (flag zeroed). But we need two sync objects for xe_exec (wait syncobj [vm-bind] and signal syncobj [exec]).
Quoted 10 lines
lib/intel_batchbuffer.c static void update_offsets(struct intel_bb *ibb, · line 2349
Quoted 8 lines
lib/intel_batchbuffer.c +7
-0+ ibb->engine_syncobj =syncobj_create (ibb->fd,0 ); + syncs[1 ].handle = ibb->engine_syncobj; + +xe_exec_sync (ibb->fd, engine_id, ibb->batch_offset, syncs,2 ); + +if (sync) +intel_bb_sync (ibb);--------------- ^
Not used.
I don't agree, sync comes from the caller so you never know will it be true or false.
Thank you for the review
--
Zbigniew
Quoted 84 lines
Regards,
KamilQuoted 80 lines
lib/intel_batchbuffer.c +19
-3+ +return 0 ; +} +/* * __intel_bb_exec: * @ibb: pointer to intel_bb @@ -2220,7 +2436,7 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,/** * intel_bb_exec: * @ibb: pointer to intel_bb -* @end_offset: offset of the last instruction in the bb +* @end_offset: offset of the last instruction in the bb (for i915) * @flags: flags passed directly to execbuf * @sync: if true wait for execbuf completion, otherwise caller is responsible * to wait for completion @@ -2230,7 +2446,13 @@ int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,void intel_bb_exec (struct intel_bb *ibb,uint32_t end_offset,uint64_t flags,bool sync) { -igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +if (ibb->dump_base64) +intel_bb_dump_base64 (ibb,LINELEN ); + +if (ibb->driver ==INTEL_DRIVER_I915 ) +igt_assert_eq (__intel_bb_exec (ibb, end_offset, flags, sync),0 ); +else +igt_assert_eq (__xe_bb_exec (ibb, flags, sync),0 ); }/** @@ -2628,14 +2850,20 @@ void intel_bb_track(bool do_tracking)static void __intel_bb_reinit_alloc (struct intel_bb *ibb) { +uint64_t alignment =0 ; +if (ibb->allocator_type ==INTEL_ALLOCATOR_NONE )return ; +if (ibb->driver ==INTEL_DRIVER_XE ) + alignment =xe_get_default_alignment (ibb->fd); + ibb->allocator_handle =intel_allocator_open_full (ibb->fd, ibb->ctx, ibb->allocator_start, ibb->allocator_end, ibb->allocator_type, ibb->allocator_strategy, -0 ); + alignment); +intel_bb_reset (ibb, true); }lib/intel_batchbuffer.h +6
-0@@ -246,6 +246,7 @@ struct intel_bb {uint8_t allocator_type;enum allocator_strategy allocator_strategy; +enum intel_driver driver;int fd;unsigned int gen;bool debug;@@ -268,6 +269,11 @@ struct intel_bb {uint32_t ctx;uint32_t vm_id; +bool xe_bound; +uint32_t engine_syncobj; +uint32_t engine_id; +uint32_t last_engine; +/* Context configuration */ intel_ctx_cfg_t *cfg;Signature · 1 line
2.34.1
PATCH v6 9/15 tests/xe_intel_bb: Check if intel-bb Xe support correctness
In reply to Zbigniew KempczyńskiAs we're reusing intel-bb for Xe we need to check it behaves correctly for buffer handling and submission.
---
v5: to run test quick use system memory instead of vram (mapping
on system is wb)
--- tests/meson.build | 1 + tests/xe/xe_intel_bb.c | 1185 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1186 insertions(+) create mode 100644 tests/xe/xe_intel_bb.c
tests/meson.build +1 -0
@@ -255,6 +255,7 @@ xe_progs = [ 'xe_exec_threads', 'xe_guc_pc', 'xe_huc_copy', + 'xe_intel_bb', 'xe_mmap', 'xe_mmio', 'xe_module_load',
tests/xe/xe_intel_bb.c new file +1185 -0
1,185 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v6 10/15 tests/xe-fast-feedback: Add xe_intel_bb test to BAT
In reply to Zbigniew KempczyńskiVerifies intel-bb integration with xe.
--- tests/intel-ci/xe-fast-feedback.testlist | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
tests/intel-ci/xe-fast-feedback.testlist +18 -0
@@ -106,6 +106,24 @@ igt@xe_guc_pc@freq_range_idle igt@xe_guc_pc@rc6_on_idle igt@xe_guc_pc@rc0_on_exec igt@xe_huc_copy@huc_copy +igt@xe_intel_bb@add-remove-objects +igt@xe_intel_bb@bb-with-allocator +igt@xe_intel_bb@blit-reloc +igt@xe_intel_bb@blit-simple +igt@xe_intel_bb@create-in-region +igt@xe_intel_bb@delta-check +igt@xe_intel_bb@destroy-bb +igt@xe_intel_bb@full-batch +igt@xe_intel_bb@intel-bb-blit-none +igt@xe_intel_bb@intel-bb-blit-x +igt@xe_intel_bb@intel-bb-blit-y +igt@xe_intel_bb@lot-of-buffers +igt@xe_intel_bb@offset-control +igt@xe_intel_bb@purge-bb +igt@xe_intel_bb@render +igt@xe_intel_bb@reset-bb +igt@xe_intel_bb@simple-bb +igt@xe_intel_bb@simple-bb-ctx igt@xe_mmap@system igt@xe_mmap@vram igt@xe_mmap@vram-system
Signature · 1 line
2.34.1
PATCH v6 11/15 lib/gpgpu_fill: Use RENDER engine flag to work on Xe
In reply to Zbigniew KempczyńskiUsing I915_EXEC_DEFAULT works fine for i915 selecting appropriate command streamer. Unfortunately this cannot be used on Xe as it requires explicit engine selection. Submitting gpgpu work on render is fine so change to I915_EXEC_RENDER doesn't break i915 and allows run on valid engine on Xe.
--- lib/gpgpu_fill.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/gpgpu_fill.c +2 -2
@@ -288,7 +288,7 @@ __gen9_gpgpu_fillfunc(int i915,intel_bb_ptr_align (ibb,32 );intel_bb_exec (ibb,intel_bb_offset (ibb), -I915_EXEC_DEFAULT |I915_EXEC_NO_RELOC , true); +I915_EXEC_RENDER |I915_EXEC_NO_RELOC , true);intel_bb_destroy (ibb); }
@@ -329,7 +329,7 @@ __xehp_gpgpu_fillfunc(int i915,intel_bb_ptr_align (ibb,32 );intel_bb_exec (ibb,intel_bb_offset (ibb), -I915_EXEC_DEFAULT |I915_EXEC_NO_RELOC , true); +I915_EXEC_RENDER |I915_EXEC_NO_RELOC , true);intel_bb_destroy (ibb); }
Signature · 1 line
2.34.1
PATCH v6 12/15 tests/xe_gpgpu_fill: Exercise gpgpu fill on Xe
In reply to Zbigniew KempczyńskiReuse gpgpu fill already exercised on i915 on Xe.
--- tests/intel-ci/xe-fast-feedback.testlist | 1 + tests/meson.build | 1 + tests/xe/xe_gpgpu_fill.c | 135 +++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 tests/xe/xe_gpgpu_fill.c
tests/intel-ci/xe-fast-feedback.testlist +1 -0
@@ -100,6 +100,7 @@ igt@xe_exec_threads@threads-mixed-fd-basic igt@xe_exec_threads@threads-bal-mixed-basic igt@xe_exec_threads@threads-bal-mixed-shared-vm-basic igt@xe_exec_threads@threads-bal-mixed-fd-basic +igt@xe_gpgpu_fill@basic igt@xe_guc_pc@freq_basic_api igt@xe_guc_pc@freq_fixed_idle igt@xe_guc_pc@freq_range_idle
tests/meson.build +1 -0
@@ -253,6 +253,7 @@ xe_progs = [ 'xe_exec_fault_mode', 'xe_exec_reset', 'xe_exec_threads', + 'xe_gpgpu_fill', 'xe_guc_pc', 'xe_huc_copy', 'xe_intel_bb',
tests/xe/xe_gpgpu_fill.c new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v6 13/15 lib/igt_fb: For xe assume vram is used on discrete
In reply to Zbigniew KempczyńskiAssume fb bo's were created on vram on discrete, otherwise use system memory.
--- lib/igt_fb.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
lib/igt_fb.c +11 -6
@@ -2545,6 +2545,7 @@ igt_fb_create_intel_buf(int fd, struct buf_ops *bops, {struct intel_buf *buf;uint32_t bo_name, handle, compression; +uint64_t region;int num_surfaces;int i;
@@ -2571,12 +2572,16 @@ igt_fb_create_intel_buf(int fd, struct buf_ops *bops, bo_name =gem_flink (fd, fb->gem_handle); handle =gem_open (fd, bo_name); - buf =intel_buf_create_using_handle_and_size (bops, handle, - fb->width, fb->height, - fb->plane_bpp[0 ],0 , -igt_fb_mod_to_tiling (fb->modifier), - compression, fb->size, - fb->strides[0 ]); +/* For i915 region doesn't matter, for xe does */ + region =buf_ops_get_driver (bops) ==INTEL_DRIVER_XE ? +vram_if_possible (fd,0 ) :0 ; + buf =intel_buf_create_full (bops, handle, + fb->width, fb->height, + fb->plane_bpp[0 ],0 , +igt_fb_mod_to_tiling (fb->modifier), + compression, fb->size, + fb->strides[0 ], + region);intel_buf_set_name (buf, name);/* Make sure we close handle on destroy path */
Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 13/15] lib/igt_fb: For xe assume vram is used on discrete
Quoted 23 lines · Zbigniew Kempczyński
Assume fb bo's were created on vram on discrete, otherwise use system memory.
Signed-off-by Zbigniew Kempczyński <[email protected]>--- lib/igt_fb.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)lib/igt_fb.c +1
-0@@ -2545,6 +2545,7 @@ igt_fb_create_intel_buf(int fd, struct buf_ops *bops, {struct intel_buf *buf;uint32_t bo_name, handle, compression; +uint64_t region;int num_surfaces;int i;@@ -2571,12 +2572,16 @@ igt_fb_create_intel_buf(int fd, struct buf_ops *bops, bo_name =gem_flink (fd, fb->gem_handle); handle =gem_open (fd, bo_name);
lib/igt_fb.c igt_fb_create_intel_buf(int fd, struct buf_ops *bops, · line 2577
Quoted 10 lines
lib/igt_fb.c +3
-6- buf =intel_buf_create_using_handle_and_size (bops, handle, - fb->width, fb->height, - fb->plane_bpp[0 ],0 , -igt_fb_mod_to_tiling (fb->modifier), - compression, fb->size, - fb->strides[0 ]); +/* For i915 region doesn't matter, for xe does */ + region =buf_ops_get_driver (bops) ==INTEL_DRIVER_XE ? +vram_if_possible (fd,0 ) :0 ;
----------------------------------------------------------^ For i915, region must be -1 right?
- Bhanu
Quoted 10 lines
lib/igt_fb.c +7
-0+ buf =intel_buf_create_full (bops, handle, + fb->width, fb->height, + fb->plane_bpp[0 ],0 , +igt_fb_mod_to_tiling (fb->modifier), + compression, fb->size, + fb->strides[0 ], + region);intel_buf_set_name (buf, name);/* Make sure we close handle on destroy path */
Re: [igt-dev] [PATCH i-g-t v6 13/15] lib/igt_fb: For xe assume vram is used on discrete
Quoted 27 lines · Bhanuprakash
Quoted 25 lines · Zbigniew Kempczyński
Assume fb bo's were created on vram on discrete, otherwise use system memory.
Signed-off-by Zbigniew Kempczyński <[email protected]>--- lib/igt_fb.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)lib/igt_fb.c +1
-3@@ -2545,6 +2545,7 @@ igt_fb_create_intel_buf(int fd, struct buf_ops *bops, {struct intel_buf *buf;uint32_t bo_name, handle, compression; +uint64_t region;int num_surfaces;int i;@@ -2571,12 +2572,16 @@ igt_fb_create_intel_buf(int fd, struct buf_ops *bops, bo_name =gem_flink (fd, fb->gem_handle); handle =gem_open (fd, bo_name); - buf = intel_buf_create_using_handle_and_size(bops, handle, - fb->width, fb->height, - fb->plane_bpp[0], 0,
Quoted 8 lines
lib/igt_fb.c igt_fb_create_intel_buf(int fd, struct buf_ops *bops, · line 2577
Quoted 6 lines
lib/igt_fb.c +3
-3-igt_fb_mod_to_tiling (fb->modifier), - compression, fb->size, - fb->strides[0]); +/* For i915 region doesn't matter, for xe does */ + region =buf_ops_get_driver (bops) ==INTEL_DRIVER_XE ? +vram_if_possible (fd,0 ) :0 ;----------------------------------------------------------^ For i915, region must be -1 right?
Not must but it will be consistent to current design. Thank you for the review and spotting this.
--
Zbigniew
Quoted 12 lines
- Bhanu
Quoted 9 lines
lib/igt_fb.c +7
-0+ buf =intel_buf_create_full (bops, handle, + fb->width, fb->height, + fb->plane_bpp[0 ],0 , +igt_fb_mod_to_tiling (fb->modifier), + compression, fb->size, + fb->strides[0 ], + region);intel_buf_set_name (buf, name);/* Make sure we close handle on destroy path */
PATCH v6 14/15 lib/igt_draw: Pass region while building intel_buf from flink
In reply to Zbigniew KempczyńskiFor i915 region doesn't matter but for xe we need to be more strict and region aware. This is related to size and alignment constraints. As we don't have information about flink buffer origin let's assume region is vram if possible, otherwise choose system region.
--- lib/igt_draw.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
lib/igt_draw.c +11 -3
@@ -37,6 +37,7 @@#include "i915/gem_create.h" #include "i915/gem_mman.h" #include "i915/intel_mocs.h" +#include "xe/xe_query.h" #ifndef PAGE_ALIGN #ifndef PAGE_SIZE
@@ -634,17 +635,24 @@ static struct intel_buf *create_buf(int fd, struct buf_ops *bops, struct buf_data *from, uint32_t tiling) {struct intel_buf *buf; +enum intel_driver driver =buf_ops_get_driver (bops);uint32_t handle, name, width, height; +uint64_t region = driver ==INTEL_DRIVER_XE ?vram_if_possible (fd,0 ) :-1 ; +uint64_t size = from->size; width = from->stride / (from->bpp /8 ); height = from->size / from->stride; +if (driver ==INTEL_DRIVER_XE ) + size =ALIGN (size,xe_get_default_alignment (fd)); name =gem_flink (fd, from->handle); handle =gem_open (fd, name); - buf =intel_buf_create_using_handle (bops, handle, - width, height, from->bpp,0 , - tiling,0 ); + buf =intel_buf_create_full (bops, handle, + width, height, from->bpp,0 , + tiling,0 , + size,0 , + region);/* Make sure we close handle on destroy path */ intel_buf_set_ownership (buf, true);
Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 14/15] lib/igt_draw: Pass region while building intel_buf from flink
Quoted 6 lines · Zbigniew Kempczyński
For i915 region doesn't matter but for xe we need to be more strict and region aware. This is related to size and alignment constraints. As we don't have information about flink buffer origin let's assume region is vram if possible, otherwise choose system region.
Signed-off-by Zbigniew Kempczyński <[email protected]>
LGTM
Quoted 44 lines
--- lib/igt_draw.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)lib/igt_draw.c +11
-3@@ -37,6 +37,7 @@#include "i915/gem_create.h" #include "i915/gem_mman.h" #include "i915/intel_mocs.h" +#include "xe/xe_query.h" #ifndef PAGE_ALIGN #ifndef PAGE_SIZE @@ -634,17 +635,24 @@ static struct intel_buf *create_buf(int fd, struct buf_ops *bops, struct buf_data *from, uint32_t tiling) {struct intel_buf *buf; +enum intel_driver driver =buf_ops_get_driver (bops);uint32_t handle, name, width, height; +uint64_t region = driver ==INTEL_DRIVER_XE ?vram_if_possible (fd,0 ) :-1 ; +uint64_t size = from->size; width = from->stride / (from->bpp /8 ); height = from->size / from->stride; +if (driver ==INTEL_DRIVER_XE ) + size =ALIGN (size,xe_get_default_alignment (fd)); name =gem_flink (fd, from->handle); handle =gem_open (fd, name); - buf =intel_buf_create_using_handle (bops, handle, - width, height, from->bpp,0 , - tiling,0 ); + buf =intel_buf_create_full (bops, handle, + width, height, from->bpp,0 , + tiling,0 , + size,0 , + region);/* Make sure we close handle on destroy path */ intel_buf_set_ownership (buf, true);
PATCH v6 15/15 tests/kms_big_fb: Deduce region for xe framebuffer
In reply to Zbigniew KempczyńskiFor discrete framebuffer reside on vram/device memory and for integrated on system memory. Due to xe requirement regarding size and alignment on different memory regions during intel_buf creation pass deduced memory region.
--- tests/i915/kms_big_fb.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
tests/i915/kms_big_fb.c +8 -2
@@ -28,6 +28,7 @@#include <string.h> #include "i915/gem_create.h" +#include "xe/xe_query.h" IGT_TEST_DESCRIPTION ("Test big framebuffers" );
@@ -62,7 +63,10 @@ static struct intel_buf *init_buf(data_t *data, const char *buf_name) {struct intel_buf *buf; +enum intel_driver driver =buf_ops_get_driver (data->bops);uint32_t name, handle, tiling, stride, width, height, bpp, size; +uint64_t region = driver ==INTEL_DRIVER_XE ? +vram_if_possible (data->drm_fd,0 ) :-1 ;igt_assert_eq (fb->offsets[0 ],0 );
@@ -75,8 +79,10 @@ static struct intel_buf *init_buf(data_t *data, name =gem_flink (data->drm_fd, fb->gem_handle); handle =gem_open (data->drm_fd, name); - buf =intel_buf_create_using_handle (data->bops, handle, width, height, - bpp,0 , tiling,0 ); + buf =intel_buf_create_full (data->bops, handle, width, height, + bpp,0 , tiling,0 , size,0 , + region); +intel_buf_set_name (buf, buf_name);intel_buf_set_ownership (buf, true);
Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH i-g-t v6 15/15] tests/kms_big_fb: Deduce region for xe framebuffer
Quoted 5 lines · Zbigniew Kempczyński
For discrete framebuffer reside on vram/device memory and for integrated on system memory. Due to xe requirement regarding size and alignment on different memory regions during
intel_bufcreation pass deduced memory region.
LGTM
Quoted 41 lines
Signed-off-by Zbigniew Kempczyński <[email protected]>--- tests/i915/kms_big_fb.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)tests/i915/kms_big_fb.c +8
-2@@ -28,6 +28,7 @@#include <string.h> #include "i915/gem_create.h" +#include "xe/xe_query.h" IGT_TEST_DESCRIPTION ("Test big framebuffers" );@@ -62,7 +63,10 @@ static struct intel_buf *init_buf(data_t *data, const char *buf_name) {struct intel_buf *buf; +enum intel_driver driver =buf_ops_get_driver (data->bops);uint32_t name, handle, tiling, stride, width, height, bpp, size; +uint64_t region = driver ==INTEL_DRIVER_XE ? +vram_if_possible (data->drm_fd,0 ) :-1 ;igt_assert_eq (fb->offsets[0 ],0 );@@ -75,8 +79,10 @@ static struct intel_buf *init_buf(data_t *data, name =gem_flink (data->drm_fd, fb->gem_handle); handle =gem_open (data->drm_fd, name); - buf =intel_buf_create_using_handle (data->bops, handle, width, height, - bpp,0 , tiling,0 ); + buf =intel_buf_create_full (data->bops, handle, width, height, + bpp,0 , tiling,0 , size,0 , + region); +intel_buf_set_name (buf, buf_name);intel_buf_set_ownership (buf, true);
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for Integrate intel-bb with Xe (rev7)
In reply to Zbigniew Kempczyński== Series Details ==
== Series Details ==
Series: Integrate intel-bb with Xe (rev7)
URL : https://patchwork.freedesktop.org/series/116578/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_13062 -> IGTPW_8856
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_8856 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_8856, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8856/index.html
Participating hosts (39 -> 38)
------------------------------
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_8856:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@slpc:
- bat-rpls-1: NOTRUN -> [FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8856/bat-rpls-1/igt@i915_selftest@[email protected]
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@i915_selftest@live@hugepages:
- {bat-mtlp-8}: NOTRUN -> [FAIL][2] +1 similar issue
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8856/bat-mtlp-8/igt@i915_selftest@[email protected]
Known issues
------------
Here are the changes found in IGTPW_8856 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-rpls-1: NOTRUN -> [SKIP][3] ([i915#7828])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8856/bat-rpls-1/igt@[email protected]
* igt@kms_pipe_crc_basic@suspend-read-crc:
- bat-rpls-1: NOTRUN -> [SKIP][4] ([i915#1845])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8856/bat-rpls-1/igt@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live@requests:
- {bat-mtlp-8}: [ABORT][5] -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13062/bat-mtlp-8/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8856/bat-mtlp-8/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@reset:
- bat-rpls-1: [ABORT][7] ([i915#8384]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13062/bat-rpls-1/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8856/bat-rpls-1/igt@i915_selftest@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#8384]: https://gitlab.freedesktop.org/drm/intel/issues/8384
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7270 -> IGTPW_8856
CI-20190529: 20190529
CI_DRM_13062: 5a0333cf630a335d7e8f60fd2b8526ed0895900c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8856: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8856/index.html
IGT_7270: 3bd8bf9bca97bbfb7b4b408f9fccd0cf6f742d4c @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Testlist changes
----------------
+igt@xe_gpgpu_fill@basic
+igt@xe_intel_bb@add-remove-objects
+igt@xe_intel_bb@bb-with-allocator
+igt@xe_intel_bb@blit-reloc
+igt@xe_intel_bb@blit-simple
+igt@xe_intel_bb@create-in-region
+igt@xe_intel_bb@delta-check
+igt@xe_intel_bb@destroy-bb
+igt@xe_intel_bb@full-batch
+igt@xe_intel_bb@intel-bb-blit-none
+igt@xe_intel_bb@intel-bb-blit-x
+igt@xe_intel_bb@intel-bb-blit-y
+igt@xe_intel_bb@lot-of-buffers
+igt@xe_intel_bb@offset-control
+igt@xe_intel_bb@purge-bb
+igt@xe_intel_bb@render
+igt@xe_intel_bb@reset-bb
+igt@xe_intel_bb@simple-bb
+igt@xe_intel_bb@simple-bb-ctx
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8856/index.html
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for Integrate intel-bb with Xe (rev8)
In reply to Zbigniew Kempczyński== Series Details ==
== Series Details ==
Series: Integrate intel-bb with Xe (rev8)
URL : https://patchwork.freedesktop.org/series/116578/
State : failure
== Summary ==
CI Bug Log - changes from IGT_7271 -> IGTPW_8861
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_8861 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_8861, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8861/index.html
Participating hosts (39 -> 37)
------------------------------
Missing (2): fi-kbl-soraka fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_8861:
### IGT changes ###
#### Possible regressions ####
* igt@gem_exec_suspend@basic-s3@smem:
- bat-rpls-1: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/bat-rpls-1/igt@gem_exec_suspend@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8861/bat-rpls-1/igt@gem_exec_suspend@[email protected]
* igt@i915_selftest@live@gt_heartbeat:
- fi-apl-guc: [PASS][3] -> [FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8861/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
Known issues
------------
Here are the changes found in IGTPW_8861 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_pm_rps@basic-api:
- bat-dg2-11: [PASS][5] -> [FAIL][6] ([i915#8308])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/bat-dg2-11/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8861/bat-dg2-11/igt@[email protected]
* igt@i915_selftest@live@gt_lrc:
- bat-adln-1: [PASS][7] -> [INCOMPLETE][8] ([i915#7609])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/bat-adln-1/igt@i915_selftest@live@gt_lrc.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8861/bat-adln-1/igt@i915_selftest@live@gt_lrc.html
* igt@kms_pipe_crc_basic@nonblocking-crc@pipe-d-dp-1:
- bat-dg2-8: [PASS][9] -> [FAIL][10] ([i915#7932])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8861/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live@slpc:
- bat-rpls-1: [FAIL][11] -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/bat-rpls-1/igt@i915_selftest@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8861/bat-rpls-1/igt@i915_selftest@[email protected]
* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-d-dp-1:
- bat-dg2-8: [FAIL][13] ([i915#7932]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8861/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
[i915#7609]: https://gitlab.freedesktop.org/drm/intel/issues/7609
[i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
[i915#8308]: https://gitlab.freedesktop.org/drm/intel/issues/8308
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7271 -> IGTPW_8861
CI-20190529: 20190529
CI_DRM_13062: 5a0333cf630a335d7e8f60fd2b8526ed0895900c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8861: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8861/index.html
IGT_7271: d12d7eb92226e14745a80e6bdd95384913a43548 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Testlist changes
----------------
+igt@xe_gpgpu_fill@basic
+igt@xe_intel_bb@add-remove-objects
+igt@xe_intel_bb@bb-with-allocator
+igt@xe_intel_bb@blit-reloc
+igt@xe_intel_bb@blit-simple
+igt@xe_intel_bb@create-in-region
+igt@xe_intel_bb@delta-check
+igt@xe_intel_bb@destroy-bb
+igt@xe_intel_bb@full-batch
+igt@xe_intel_bb@intel-bb-blit-none
+igt@xe_intel_bb@intel-bb-blit-x
+igt@xe_intel_bb@intel-bb-blit-y
+igt@xe_intel_bb@lot-of-buffers
+igt@xe_intel_bb@offset-control
+igt@xe_intel_bb@purge-bb
+igt@xe_intel_bb@render
+igt@xe_intel_bb@reset-bb
+igt@xe_intel_bb@simple-bb
+igt@xe_intel_bb@simple-bb-ctx
-igt@xe_query@query-invalid-extension
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8861/index.html
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for Integrate intel-bb with Xe (rev9)
In reply to Zbigniew Kempczyński== Series Details ==
== Series Details ==
Series: Integrate intel-bb with Xe (rev9)
URL : https://patchwork.freedesktop.org/series/116578/
State : success
== Summary ==
CI Bug Log - changes from IGT_7271 -> IGTPW_8865
====================================================
Summary
-------
**WARNING**
Minor unknown changes coming with IGTPW_8865 need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_8865, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/index.html
Participating hosts (39 -> 37)
------------------------------
Missing (2): fi-kbl-soraka fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_8865:
### IGT changes ###
#### Warnings ####
* igt@core_hotunplug@unbind-rebind:
- fi-kbl-8809g: [ABORT][1] ([i915#8397]) -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/fi-kbl-8809g/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/fi-kbl-8809g/igt@[email protected]
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@i915_selftest@live@slpc:
- {bat-mtlp-8}: NOTRUN -> [FAIL][3] +2 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/bat-mtlp-8/igt@i915_selftest@[email protected]
Known issues
------------
Here are the changes found in IGTPW_8865 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live@migrate:
- bat-atsm-1: [PASS][4] -> [FAIL][5] ([i915#6268] / [i915#7913])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/bat-atsm-1/igt@i915_selftest@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/bat-atsm-1/igt@i915_selftest@[email protected]
* igt@kms_pipe_crc_basic@read-crc:
- bat-adlp-9: NOTRUN -> [SKIP][6] ([i915#3546]) +1 similar issue
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/bat-adlp-9/igt@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live@requests:
- {bat-mtlp-8}: [ABORT][7] ([i915#7920]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/bat-mtlp-8/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/bat-mtlp-8/igt@i915_selftest@[email protected]
* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-d-dp-1:
- bat-dg2-8: [FAIL][9] ([i915#7932]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7920]: https://gitlab.freedesktop.org/drm/intel/issues/7920
[i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
[i915#8397]: https://gitlab.freedesktop.org/drm/intel/issues/8397
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7271 -> IGTPW_8865
CI-20190529: 20190529
CI_DRM_13062: 5a0333cf630a335d7e8f60fd2b8526ed0895900c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8865: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/index.html
IGT_7271: d12d7eb92226e14745a80e6bdd95384913a43548 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Testlist changes
----------------
+igt@xe_gpgpu_fill@basic
+igt@xe_intel_bb@add-remove-objects
+igt@xe_intel_bb@bb-with-allocator
+igt@xe_intel_bb@blit-reloc
+igt@xe_intel_bb@blit-simple
+igt@xe_intel_bb@create-in-region
+igt@xe_intel_bb@delta-check
+igt@xe_intel_bb@destroy-bb
+igt@xe_intel_bb@full-batch
+igt@xe_intel_bb@intel-bb-blit-none
+igt@xe_intel_bb@intel-bb-blit-x
+igt@xe_intel_bb@intel-bb-blit-y
+igt@xe_intel_bb@lot-of-buffers
+igt@xe_intel_bb@offset-control
+igt@xe_intel_bb@purge-bb
+igt@xe_intel_bb@render
+igt@xe_intel_bb@reset-bb
+igt@xe_intel_bb@simple-bb
+igt@xe_intel_bb@simple-bb-ctx
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/index.html
Patchwork
CI[igt-dev] ✓ Fi.CI.IGT: success for Integrate intel-bb with Xe (rev9)
In reply to Zbigniew Kempczyński== Series Details ==
== Series Details ==
Series: Integrate intel-bb with Xe (rev9)
URL : https://patchwork.freedesktop.org/series/116578/
State : success
== Summary ==
CI Bug Log - changes from IGT_7271_full -> IGTPW_8865_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/index.html
Participating hosts (7 -> 7)
------------------------------
No changes in participating hosts
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_8865_full:
### IGT changes ###
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@api_intel_bb@blit-reloc-purge-cache:
- {shard-dg1}: [SKIP][1] ([i915#3281]) -> [SKIP][2] +3 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-dg1-16/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-dg1-18/igt@[email protected]
* igt@api_intel_bb@object-reloc-keep-cache:
- {shard-rkl}: NOTRUN -> [SKIP][3] +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-rkl-7/igt@[email protected]
* igt@gem_exec_endless@dispatch@vcs1:
- {shard-tglu}: [PASS][4] -> [TIMEOUT][5]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-tglu-9/igt@gem_exec_endless@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-tglu-8/igt@gem_exec_endless@[email protected]
* igt@gem_set_tiling_vs_blt@tiled-to-tiled:
- {shard-rkl}: [SKIP][6] ([i915#3281]) -> [SKIP][7] +4 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-rkl-2/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-rkl-6/igt@[email protected]
* igt@i915_pm_rps@reset:
- {shard-tglu}: [PASS][8] -> [FAIL][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-tglu-7/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-tglu-8/igt@[email protected]
* igt@i915_selftest@live@gt_pm:
- {shard-rkl}: [PASS][10] -> [FAIL][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-rkl-4/igt@i915_selftest@live@gt_pm.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-rkl-4/igt@i915_selftest@live@gt_pm.html
Known issues
------------
Here are the changes found in IGTPW_8865_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_barrier_race@remote-request@rcs0:
- shard-apl: [PASS][12] -> [ABORT][13] ([i915#8234])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-apl4/igt@gem_barrier_race@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-apl4/igt@gem_barrier_race@[email protected]
* igt@gem_exec_fair@basic-deadline:
- shard-glk: [PASS][14] -> [FAIL][15] ([i915#2846])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-glk2/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk5/igt@[email protected]
* igt@gem_exec_fair@basic-pace-solo@rcs0:
- shard-apl: [PASS][16] -> [FAIL][17] ([i915#2842])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-apl1/igt@gem_exec_fair@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-apl3/igt@gem_exec_fair@[email protected]
* igt@gem_huc_copy@huc-copy:
- shard-glk: NOTRUN -> [SKIP][18] ([fdo#109271] / [i915#2190])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk5/igt@[email protected]
* igt@gem_lmem_swapping@random-engines:
- shard-glk: NOTRUN -> [SKIP][19] ([fdo#109271] / [i915#4613])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk1/igt@[email protected]
* igt@gen9_exec_parse@allowed-single:
- shard-apl: [PASS][20] -> [ABORT][21] ([i915#5566])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-apl3/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-apl1/igt@[email protected]
* igt@i915_module_load@reload-no-display:
- shard-snb: [PASS][22] -> [ABORT][23] ([i915#8393])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-snb6/igt@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-snb6/igt@[email protected]
* igt@i915_pm_dc@dc9-dpms:
- shard-apl: [PASS][24] -> [SKIP][25] ([fdo#109271])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-apl2/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-apl1/igt@[email protected]
* igt@kms_ccs@pipe-b-ccs-on-another-bo-y_tiled_gen12_rc_ccs_cc:
- shard-glk: NOTRUN -> [SKIP][26] ([fdo#109271] / [i915#3886]) +3 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk4/igt@kms_ccs@pipe-b-ccs-on-another-bo-y_tiled_gen12_rc_ccs_cc.html
* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-apl: [PASS][27] -> [FAIL][28] ([i915#2346])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-apl1/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-apl1/igt@[email protected]
* igt@kms_flip@flip-vs-expired-vblank@b-hdmi-a1:
- shard-glk: [PASS][29] -> [FAIL][30] ([i915#79])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-glk3/igt@kms_flip@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk5/igt@kms_flip@[email protected]
* igt@kms_plane_scaling@planes-downscale-factor-0-5-unity-scaling@pipe-b-vga-1:
- shard-snb: NOTRUN -> [SKIP][31] ([fdo#109271]) +33 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-snb2/igt@kms_plane_scaling@[email protected]
* igt@kms_plane_scaling@planes-upscale-factor-0-25-downscale-factor-0-5@pipe-c-hdmi-a-1:
- shard-glk: NOTRUN -> [SKIP][32] ([fdo#109271]) +68 similar issues
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk5/igt@kms_plane_scaling@planes-upscale-factor-0-25-downscale-factor-0-5@pipe-c-hdmi-a-1.html
* igt@kms_psr2_sf@cursor-plane-move-continuous-exceed-sf:
- shard-glk: NOTRUN -> [SKIP][33] ([fdo#109271] / [i915#658]) +1 similar issue
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk8/igt@[email protected]
* igt@kms_setmode@basic@pipe-a-vga-1:
- shard-snb: NOTRUN -> [FAIL][34] ([i915#5465]) +1 similar issue
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-snb6/igt@kms_setmode@[email protected]
#### Possible fixes ####
* igt@gem_barrier_race@remote-request@rcs0:
- shard-glk: [ABORT][35] ([i915#7461]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-glk1/igt@gem_barrier_race@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk3/igt@gem_barrier_race@[email protected]
* igt@gem_eio@reset-stress:
- {shard-dg1}: [FAIL][37] ([i915#5784]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-dg1-18/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-dg1-13/igt@[email protected]
* igt@gem_exec_fair@basic-none@bcs0:
- {shard-rkl}: [FAIL][39] ([i915#2842]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-rkl-3/igt@gem_exec_fair@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-rkl-3/igt@gem_exec_fair@[email protected]
* igt@gem_exec_fair@basic-pace@rcs0:
- shard-glk: [FAIL][41] ([i915#2842]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-glk4/igt@gem_exec_fair@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk4/igt@gem_exec_fair@[email protected]
* igt@i915_pm_dc@dc9-dpms:
- {shard-tglu}: [SKIP][43] ([i915#4281]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-tglu-8/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-tglu-4/igt@[email protected]
* igt@i915_pm_rpm@dpms-lpsp:
- {shard-rkl}: [SKIP][45] ([i915#1397]) -> [PASS][46] +1 similar issue
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-rkl-6/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-rkl-7/igt@[email protected]
* igt@kms_cursor_legacy@single-move@pipe-b:
- {shard-rkl}: [INCOMPLETE][47] ([i915#8011]) -> [PASS][48] +1 similar issue
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-rkl-7/igt@kms_cursor_legacy@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-rkl-1/igt@kms_cursor_legacy@[email protected]
* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible@ab-hdmi-a1-hdmi-a2:
- shard-glk: [FAIL][49] ([i915#79]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-glk8/igt@kms_flip@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk3/igt@kms_flip@[email protected]
* igt@kms_flip@2x-plain-flip-fb-recreate@ac-hdmi-a1-hdmi-a2:
- shard-glk: [FAIL][51] ([i915#2122]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-glk3/igt@kms_flip@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk7/igt@kms_flip@[email protected]
* igt@kms_rotation_crc@primary-y-tiled-reflect-x-0:
- {shard-rkl}: [ABORT][53] -> [PASS][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-rkl-3/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-rkl-1/igt@[email protected]
* igt@perf@stress-open-close@0-rcs0:
- shard-glk: [ABORT][55] ([i915#7941]) -> [PASS][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7271/shard-glk4/igt@perf@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/shard-glk8/igt@perf@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1937]: https://gitlab.freedesktop.org/drm/intel/issues/1937
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2846]: https://gitlab.freedesktop.org/drm/intel/issues/2846
[i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
[i915#3023]: https://gitlab.freedesktop.org/drm/intel/issues/3023
[i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3804]: https://gitlab.freedesktop.org/drm/intel/issues/3804
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4281]: https://gitlab.freedesktop.org/drm/intel/issues/4281
[i915#4349]: https://gitlab.freedesktop.org/drm/intel/issues/4349
[i915#4525]: https://gitlab.freedesktop.org/drm/intel/issues/4525
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#5465]: https://gitlab.freedesktop.org/drm/intel/issues/5465
[i915#5566]: https://gitlab.freedesktop.org/drm/intel/issues/5566
[i915#5784]: https://gitlab.freedesktop.org/drm/intel/issues/5784
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6227]: https://gitlab.freedesktop.org/drm/intel/issues/6227
[i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
[i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
[i915#6412]: https://gitlab.freedesktop.org/drm/intel/issues/6412
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
[i915#6944]: https://gitlab.freedesktop.org/drm/intel/issues/6944
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
[i915#7461]: https://gitlab.freedesktop.org/drm/intel/issues/7461
[i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
[i915#7707]: https://gitlab.freedesktop.org/drm/intel/issues/7707
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
[i915#7742]: https://gitlab.freedesktop.org/drm/intel/issues/7742
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#7941]: https://gitlab.freedesktop.org/drm/intel/issues/7941
[i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
[i915#8234]: https://gitlab.freedesktop.org/drm/intel/issues/8234
[i915#8253]: https://gitlab.freedesktop.org/drm/intel/issues/8253
[i915#8393]: https://gitlab.freedesktop.org/drm/intel/issues/8393
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7271 -> IGTPW_8865
CI-20190529: 20190529
CI_DRM_13062: 5a0333cf630a335d7e8f60fd2b8526ed0895900c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8865: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/index.html
IGT_7271: d12d7eb92226e14745a80e6bdd95384913a43548 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8865/index.html