[igt-dev] [i-g-t 22/45] tests/i915/kms_psr*: Add XE support
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Tue Apr 18 16:44:38 UTC 2023
Add XE driver support for kms tests.
V2: - Fix unknown subtest error on CI
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
tests/i915/kms_psr.c | 40 +++++++++++++++++++++++++++-----
tests/i915/kms_psr2_sf.c | 2 +-
tests/i915/kms_psr2_su.c | 2 +-
tests/i915/kms_psr_stress_test.c | 2 +-
4 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/tests/i915/kms_psr.c b/tests/i915/kms_psr.c
index 3efe1faec..4565acd8a 100644
--- a/tests/i915/kms_psr.c
+++ b/tests/i915/kms_psr.c
@@ -29,6 +29,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
+#include "xe/xe_ioctl.h"
enum operations {
PAGE_FLIP,
@@ -181,7 +182,8 @@ static void fill_blt(data_t *data, const struct igt_fb *fb, unsigned char color)
intel_bb_destroy(ibb);
intel_buf_destroy(dst);
- gem_bo_busy(data->drm_fd, fb->gem_handle);
+ if (is_i915_device(data->drm_fd))
+ gem_bo_busy(data->drm_fd, fb->gem_handle);
}
static void fill_render(data_t *data, const struct igt_fb *fb,
@@ -204,7 +206,16 @@ static void fill_render(data_t *data, const struct igt_fb *fb,
src = intel_buf_create(data->bops, width, height, fb->plane_bpp[0],
0, tiling, 0);
- gem_write(data->drm_fd, src->handle, 0, buf, 4);
+
+ if (is_i915_device(data->drm_fd)) {
+ gem_write(data->drm_fd, src->handle, 0, buf, 4);
+ } else {
+ void *map = xe_bo_mmap_ext(data->drm_fd, src->handle, 4,
+ PROT_READ | PROT_WRITE);
+
+ memcpy(map, buf, 4);
+ gem_munmap(map, 4);
+ }
rendercopy(ibb,
src, 0, 0, 0xff, 0xff,
@@ -214,7 +225,8 @@ static void fill_render(data_t *data, const struct igt_fb *fb,
intel_buf_destroy(src);
intel_buf_destroy(dst);
- gem_bo_busy(data->drm_fd, fb->gem_handle);
+ if (is_i915_device(data->drm_fd))
+ gem_bo_busy(data->drm_fd, fb->gem_handle);
}
static bool sink_support(data_t *data, enum psr_mode mode)
@@ -256,6 +268,11 @@ static bool drrs_disabled(data_t *data)
{
char buf[512];
+ /*
+ * FIXME: As of now, XE's debugfs is using i915 namespace, once Kernel
+ * changes got landed, please update this logic to use XE specific
+ * debugfs.
+ */
igt_debugfs_simple_read(data->debugfs_fd, "i915_drrs_status",
buf, sizeof(buf));
@@ -388,7 +405,8 @@ static void setup_test_plane(data_t *data, int test_plane)
igt_create_color_fb(data->drm_fd,
data->mode->hdisplay, data->mode->vdisplay,
DRM_FORMAT_XRGB8888,
- I915_FORMAT_MOD_X_TILED,
+ is_i915_device(data->drm_fd) ?
+ I915_FORMAT_MOD_X_TILED : DRM_FORMAT_MOD_LINEAR,
0.0, 1.0, 0.0,
&data->fb_green);
@@ -416,7 +434,8 @@ static void setup_test_plane(data_t *data, int test_plane)
igt_create_color_fb(data->drm_fd,
white_h, white_v,
DRM_FORMAT_XRGB8888,
- I915_FORMAT_MOD_X_TILED,
+ is_i915_device(data->drm_fd) ?
+ I915_FORMAT_MOD_X_TILED : DRM_FORMAT_MOD_LINEAR,
1.0, 1.0, 1.0,
&data->fb_white);
break;
@@ -510,7 +529,7 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
};
igt_fixture {
- data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+ data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
kmstest_set_vt_graphics_mode();
data.devid = intel_get_drm_devid(data.drm_fd);
@@ -547,6 +566,9 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
igt_subtest_f("%sprimary_%s",
append_subtest_name[data.op_psr_mode],
op_str(op)) {
+ igt_skip_on(is_xe_device(data.drm_fd) &&
+ (op == MMAP_CPU || op == MMAP_GTT));
+
data.op = op;
data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
test_setup(&data);
@@ -561,6 +583,9 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
igt_subtest_f("%ssprite_%s",
append_subtest_name[data.op_psr_mode],
op_str(op)) {
+ igt_skip_on(is_xe_device(data.drm_fd) &&
+ (op == MMAP_CPU || op == MMAP_GTT));
+
data.op = op;
data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
test_setup(&data);
@@ -573,6 +598,9 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
igt_subtest_f("%scursor_%s",
append_subtest_name[data.op_psr_mode],
op_str(op)) {
+ igt_skip_on(is_xe_device(data.drm_fd) &&
+ (op == MMAP_CPU || op == MMAP_GTT));
+
data.op = op;
data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
test_setup(&data);
diff --git a/tests/i915/kms_psr2_sf.c b/tests/i915/kms_psr2_sf.c
index ffaae68b3..4cf986440 100644
--- a/tests/i915/kms_psr2_sf.c
+++ b/tests/i915/kms_psr2_sf.c
@@ -898,7 +898,7 @@ igt_main
igt_fixture {
drmModeResPtr res;
- data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+ data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
kmstest_set_vt_graphics_mode();
diff --git a/tests/i915/kms_psr2_su.c b/tests/i915/kms_psr2_su.c
index 3e0a78f24..65e67b8c9 100644
--- a/tests/i915/kms_psr2_su.c
+++ b/tests/i915/kms_psr2_su.c
@@ -297,7 +297,7 @@ igt_main
igt_fixture {
struct itimerspec interval;
- data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+ data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
kmstest_set_vt_graphics_mode();
diff --git a/tests/i915/kms_psr_stress_test.c b/tests/i915/kms_psr_stress_test.c
index 26e222a27..a4cb3194e 100644
--- a/tests/i915/kms_psr_stress_test.c
+++ b/tests/i915/kms_psr_stress_test.c
@@ -331,7 +331,7 @@ igt_main
data_t data = {};
igt_fixture {
- data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+ data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
data.bops = buf_ops_create(data.drm_fd);
kmstest_set_vt_graphics_mode();
--
2.40.0
More information about the igt-dev
mailing list