[PATCH i-g-t 7/8] lib: Enable Vebox framebuffer copying on Intel Xe2

Juha-Pekka Heikkila
2026-03-20T13:47:09Z

Choose correct gt for Vebox and use gen12 veboxcopy
functionality on Xe2

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
lib/igt_fb.c | 17 ++++++++++++++++-
lib/intel_batchbuffer.c | 2 +-
2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index d59fe133b..0f7ebc6b4 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -2560,6 +2560,7 @@ struct fb_blit_upload {
struct fb_blit_linear linear;
struct buf_ops *bops;
struct intel_bb *ibb;
+ uint32_t vm;
};

static enum blt_tiling_type fb_tile_to_blt_tile(uint64_t tile)
@@ -3364,10 +3365,24 @@ static void setup_linear_mapping(struct fb_blit_upload *blit)
int fd = blit->fd;
struct igt_fb *fb = blit->fb;
struct fb_blit_linear *linear = &blit->linear;
+ struct drm_xe_engine *engine;
+ uint16_t class;

if (!igt_vc4_is_tiled(fb->modifier) && use_enginecopy(fb)) {
blit->bops = buf_ops_create(fd);
- blit->ibb = intel_bb_create(fd, 4096);
+
+ if (is_xe_device(fd)) {
+ class = use_vebox_copy(fb, fb) ? DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE :
+ DRM_XE_ENGINE_CLASS_RENDER;
+
+ engine = xe_find_engine_by_class(fd, class);
+ blit->vm = xe_vm_create(fd, 0, 0);
+ blit->ibb = intel_bb_create_with_gt(fd, 4096,
+ blit->vm,
+ engine->instance.gt_id);
+ } else {
+ blit->ibb = intel_bb_create(fd, 4096);
+ }
}

/*
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 5c0597869..a38d6bdc0 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -699,7 +699,7 @@ igt_vebox_copyfunc_t igt_get_vebox_copyfunc(int devid)
{
igt_vebox_copyfunc_t copy = NULL;

- if (IS_GEN12(devid))
+ if (intel_gen(devid) >= 12)
copy = gen12_vebox_copyfunc;

return copy;
--
2.43.0