[i-g-t V2 09/44] tests/i915/kms_big_fb: Add XE support
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Mon Mar 27 16:08:51 UTC 2023
Add XE driver support for kms tests.
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
tests/i915/kms_big_fb.c | 78 ++++++++++++++++++++++++++++++++---------
1 file changed, 62 insertions(+), 16 deletions(-)
diff --git a/tests/i915/kms_big_fb.c b/tests/i915/kms_big_fb.c
index a29a05a28..54fa4df98 100644
--- a/tests/i915/kms_big_fb.c
+++ b/tests/i915/kms_big_fb.c
@@ -28,6 +28,8 @@
#include <string.h>
#include "i915/gem_create.h"
+#include "xe/xe_ioctl.h"
+#include "xe/xe_query.h"
IGT_TEST_DESCRIPTION("Test big framebuffers");
@@ -98,10 +100,12 @@ static void copy_pattern(data_t *data,
src = init_buf(data, src_fb, "big fb src");
dst = init_buf(data, dst_fb, "big fb dst");
- gem_set_domain(data->drm_fd, dst_fb->gem_handle,
- I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
- gem_set_domain(data->drm_fd, src_fb->gem_handle,
- I915_GEM_DOMAIN_GTT, 0);
+ if (is_i915_device(data->drm_fd)) {
+ gem_set_domain(data->drm_fd, dst_fb->gem_handle,
+ I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
+ gem_set_domain(data->drm_fd, src_fb->gem_handle,
+ I915_GEM_DOMAIN_GTT, 0);
+ }
/*
* We expect the kernel to limit the max fb
@@ -641,8 +645,13 @@ test_size_overflow(data_t *data)
igt_require(data->max_fb_width >= 16383 &&
data->max_fb_height >= 16383);
- bo = gem_buffer_create_fb_obj(data->drm_fd, (1ULL << 32) - 4096);
-
+ if (is_i915_device(data->drm_fd))
+ bo = gem_buffer_create_fb_obj(data->drm_fd, (1ULL << 32) - 4096);
+ else
+ bo = xe_bo_create_flags(data->drm_fd, 0, (1ULL << 32) - 4096,
+ xe_has_vram(data->drm_fd) ?
+ vram_memory(data->drm_fd, 0) :
+ system_memory(data->drm_fd));
igt_require(bo);
ret = __kms_addfb(data->drm_fd, bo,
@@ -680,7 +689,13 @@ test_size_offset_overflow(data_t *data)
DRM_FORMAT_NV12,
data->modifier));
- bo = gem_buffer_create_fb_obj(data->drm_fd, (1ULL << 32) - 4096);
+ if (is_i915_device(data->drm_fd))
+ bo = gem_buffer_create_fb_obj(data->drm_fd, (1ULL << 32) - 4096);
+ else
+ bo = xe_bo_create_flags(data->drm_fd, 0, (1ULL << 32) - 4096,
+ xe_has_vram(data->drm_fd) ?
+ vram_memory(data->drm_fd, 0) :
+ system_memory(data->drm_fd));
igt_require(bo);
offsets[0] = 0;
@@ -739,10 +754,16 @@ test_addfb(data_t *data)
format, data->modifier,
&size, &strides[0]);
- bo = gem_buffer_create_fb_obj(data->drm_fd, size);
+ if (is_i915_device(data->drm_fd))
+ bo = gem_buffer_create_fb_obj(data->drm_fd, size);
+ else
+ bo = xe_bo_create_flags(data->drm_fd, 0, size,
+ xe_has_vram(data->drm_fd) ?
+ vram_memory(data->drm_fd, 0) :
+ system_memory(data->drm_fd));
igt_require(bo);
- if (intel_display_ver(data->devid) < 4)
+ if (is_i915_device(data->drm_fd) && intel_display_ver(data->devid) < 4)
gem_set_tiling(data->drm_fd, bo,
igt_fb_mod_to_tiling(data->modifier), strides[0]);
@@ -838,12 +859,7 @@ igt_main
igt_fixture {
drmModeResPtr res;
- data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
-
- igt_require(is_i915_device(data.drm_fd));
-
- data.devid = intel_get_drm_devid(data.drm_fd);
-
+ data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
kmstest_set_vt_graphics_mode();
igt_require_pipe_crc(data.drm_fd);
@@ -853,6 +869,7 @@ igt_main
res = drmModeGetResources(data.drm_fd);
igt_assert(res);
+ data.devid = intel_get_drm_devid(data.drm_fd);
data.max_fb_width = res->max_width;
data.max_fb_height = res->max_height;
@@ -862,7 +879,11 @@ igt_main
data.max_fb_width, data.max_fb_height);
data.ram_size = igt_get_total_ram_mb() << 20;
- data.aper_size = gem_aperture_size(data.drm_fd);
+
+ if (is_i915_device(data.drm_fd))
+ data.aper_size = gem_aperture_size(data.drm_fd);
+ else
+ data.aper_size = xe_va_bits(data.drm_fd);
data.mappable_size = gem_mappable_aperture_size(data.drm_fd);
igt_info("RAM: %"PRIu64" MiB, GPU address space: %"PRId64" MiB, GGTT mappable size: %"PRId64" MiB\n",
@@ -897,6 +918,11 @@ igt_main
*/
igt_describe("Sanity check if addfb ioctl fails correctly for given modifier with small bo");
for (int i = 1; i < ARRAY_SIZE(modifiers); i++) {
+ // No tiling support in XE.
+ if (modifiers[i].modifier != DRM_FORMAT_MOD_LINEAR &&
+ !is_i915_device(data.drm_fd))
+ continue;
+
igt_subtest_f("%s-addfb-size-overflow",
modifiers[i].name) {
data.modifier = modifiers[i].modifier;
@@ -906,6 +932,11 @@ igt_main
igt_describe("Sanity check if addfb ioctl fails correctly for given modifier and offsets with small bo");
for (int i = 1; i < ARRAY_SIZE(modifiers); i++) {
+ // No tiling support in XE.
+ if (modifiers[i].modifier != DRM_FORMAT_MOD_LINEAR &&
+ !is_i915_device(data.drm_fd))
+ continue;
+
igt_subtest_f("%s-addfb-size-offset-overflow",
modifiers[i].name) {
data.modifier = modifiers[i].modifier;
@@ -915,6 +946,11 @@ igt_main
igt_describe("Sanity check if addfb ioctl works correctly for given size and strides of fb");
for (int i = 0; i < ARRAY_SIZE(modifiers); i++) {
+ // No tiling support in XE.
+ if (modifiers[i].modifier != DRM_FORMAT_MOD_LINEAR &&
+ !is_i915_device(data.drm_fd))
+ continue;
+
igt_subtest_f("%s-addfb", modifiers[i].name) {
data.modifier = modifiers[i].modifier;
test_addfb(&data);
@@ -922,6 +958,11 @@ igt_main
}
for (int i = 0; i < ARRAY_SIZE(modifiers); i++) {
+ // No tiling support in XE.
+ if (modifiers[i].modifier != DRM_FORMAT_MOD_LINEAR &&
+ !is_i915_device(data.drm_fd))
+ continue;
+
data.modifier = modifiers[i].modifier;
for (int j = 0; j < ARRAY_SIZE(formats); j++) {
@@ -945,6 +986,11 @@ igt_main
data.max_hw_stride_test = true;
// Run max hw stride length tests on gen5 and later.
for (int i = 0; i < ARRAY_SIZE(modifiers); i++) {
+ // No tiling support in XE.
+ if (modifiers[i].modifier != DRM_FORMAT_MOD_LINEAR &&
+ !is_i915_device(data.drm_fd))
+ continue;
+
data.modifier = modifiers[i].modifier;
set_max_hw_stride(&data);
--
2.40.0
More information about the Intel-gfx-trybot
mailing list