* [igt-dev] [PATCH i-g-t 0/3] Testcases for dirtyfb ioctl
@ 2023-04-05 5:34 Jouni Högander
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 1/3] tests/i915/kms_frontbuffer_tracking: Split fbc into separate helper Jouni Högander
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Jouni Högander @ 2023-04-05 5:34 UTC (permalink / raw)
To: igt-dev
This patchset is adding new testcases for dirtyfb ioctl with features
like FBC, PSR and DRRS.
Also some helpers are split from kms_frontbuffer_tracking to be shared
with a new testcases.
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Jouni Högander (3):
tests/i915/kms_frontbuffer_tracking: Split fbc into separate helper
tests/i915/kms_frontbuffer_tracking: Split drrs
tests/kms_dirtyfb: Add new test for dirtyfb ioctl
tests/i915/kms_dirtyfb.c | 309 ++++++++++++++++++++++++++
tests/i915/kms_drrs_helper.c | 83 +++++++
tests/i915/kms_drrs_helper.h | 15 ++
tests/i915/kms_fbc_helper.c | 57 +++++
tests/i915/kms_fbc_helper.h | 19 ++
tests/i915/kms_frontbuffer_tracking.c | 140 ++----------
tests/meson.build | 17 +-
7 files changed, 516 insertions(+), 124 deletions(-)
create mode 100644 tests/i915/kms_dirtyfb.c
create mode 100644 tests/i915/kms_drrs_helper.c
create mode 100644 tests/i915/kms_drrs_helper.h
create mode 100644 tests/i915/kms_fbc_helper.c
create mode 100644 tests/i915/kms_fbc_helper.h
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t 1/3] tests/i915/kms_frontbuffer_tracking: Split fbc into separate helper
2023-04-05 5:34 [igt-dev] [PATCH i-g-t 0/3] Testcases for dirtyfb ioctl Jouni Högander
@ 2023-04-05 5:34 ` Jouni Högander
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 2/3] tests/i915/kms_frontbuffer_tracking: Split drrs Jouni Högander
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Jouni Högander @ 2023-04-05 5:34 UTC (permalink / raw)
To: igt-dev
Split fbc handling into separate helper to be used by other tests
as well.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
tests/i915/kms_fbc_helper.c | 57 ++++++++++++++++++++++++++
tests/i915/kms_fbc_helper.h | 19 +++++++++
tests/i915/kms_frontbuffer_tracking.c | 58 +++++----------------------
tests/meson.build | 9 ++++-
4 files changed, 95 insertions(+), 48 deletions(-)
create mode 100644 tests/i915/kms_fbc_helper.c
create mode 100644 tests/i915/kms_fbc_helper.h
diff --git a/tests/i915/kms_fbc_helper.c b/tests/i915/kms_fbc_helper.c
new file mode 100644
index 00000000..935679d3
--- /dev/null
+++ b/tests/i915/kms_fbc_helper.c
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#include <fcntl.h>
+
+#include "igt.h"
+
+#include "kms_fbc_helper.h"
+
+bool fbc_supported_on_chipset(int device, enum pipe pipe)
+{
+ char buf[128];
+ int dir;
+
+ dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+ igt_require_fd(dir);
+ igt_debugfs_simple_read(dir, "i915_fbc_status", buf, sizeof(buf));
+ close(dir);
+ if (*buf == '\0')
+ return false;
+
+ return !strstr(buf, "FBC unsupported on this chipset\n");
+}
+
+static char last_fbc_buf[128];
+
+bool fbc_is_enabled(int device, enum pipe pipe, int log_level)
+{
+ char buf[128];
+ bool print = true;
+ int dir;
+
+ dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+ igt_require_fd(dir);
+ igt_debugfs_simple_read(dir, "i915_fbc_status", buf, sizeof(buf));
+ close(dir);
+ if (log_level != IGT_LOG_DEBUG)
+ last_fbc_buf[0] = '\0';
+ else if (strcmp(last_fbc_buf, buf))
+ strcpy(last_fbc_buf, buf);
+ else
+ print = false;
+
+ if (print)
+ igt_log(IGT_LOG_DOMAIN, log_level, "fbc_is_enabled()?\n%s", buf);
+
+ return strstr(buf, "FBC enabled\n");
+}
+
+bool fbc_wait_until_enabled(int device, enum pipe pipe)
+{
+ last_fbc_buf[0] = '\0';
+
+ return igt_wait(fbc_is_enabled(device, pipe, IGT_LOG_DEBUG), 2000, 1);
+}
diff --git a/tests/i915/kms_fbc_helper.h b/tests/i915/kms_fbc_helper.h
new file mode 100644
index 00000000..c8a30602
--- /dev/null
+++ b/tests/i915/kms_fbc_helper.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef IGT_KMS_FBC_HELPER_H
+#define IGT_KMS_FBC_HELPER_H
+
+#include "igt.h"
+
+#define fbc_enable(device) igt_set_module_param_int(device, "enable_fbc", 1)
+#define fbc_disable(device) igt_set_module_param_int(device, "enable_fbc", 0)
+
+bool fbc_supported_on_chipset(int device, enum pipe pipe);
+bool fbc_wait_until_enabled(int device, enum pipe pipe);
+bool fbc_is_enabled(int device, enum pipe pipe, int log_level);
+
+#endif
+
diff --git a/tests/i915/kms_frontbuffer_tracking.c b/tests/i915/kms_frontbuffer_tracking.c
index 650e14a7..63fcb0fd 100644
--- a/tests/i915/kms_frontbuffer_tracking.c
+++ b/tests/i915/kms_frontbuffer_tracking.c
@@ -36,6 +36,8 @@
#include "igt_sysfs.h"
#include "igt_psr.h"
+#include "kms_fbc_helper.h"
+
#define TIME SLOW_QUICK(1000, 10000)
IGT_TEST_DESCRIPTION("Test the Kernel's frontbuffer tracking mechanism and "
@@ -775,27 +777,6 @@ static void __debugfs_read_connector(const char *param, char *buf, int len)
#define debugfs_write_crtc(p, arr) __debugfs_write_crtc(p, arr, sizeof(arr))
#define debugfs_read_connector(p, arr) __debugfs_read_connector(p, arr, sizeof(arr))
-static char last_fbc_buf[128];
-
-static bool fbc_is_enabled(int lvl)
-{
- char buf[128];
- bool print = true;
-
- debugfs_read_crtc("i915_fbc_status", buf);
- if (lvl != IGT_LOG_DEBUG)
- last_fbc_buf[0] = '\0';
- else if (strcmp(last_fbc_buf, buf))
- strcpy(last_fbc_buf, buf);
- else
- print = false;
-
- if (print)
- igt_log(IGT_LOG_DOMAIN, lvl, "fbc_is_enabled()?\n%s", buf);
-
- return strstr(buf, "FBC enabled\n");
-}
-
static void drrs_set(unsigned int val)
{
char buf[2];
@@ -970,20 +951,11 @@ static bool fbc_mode_too_large(void)
return strstr(buf, "FBC disabled: mode too large for compression\n");
}
-static bool fbc_wait_until_enabled(void)
-{
- last_fbc_buf[0] = '\0';
-
- return igt_wait(fbc_is_enabled(IGT_LOG_DEBUG), 2000, 1);
-}
-
static bool drrs_wait_until_rr_switch_to_low(void)
{
return igt_wait(is_drrs_low(), 5000, 1);
}
-#define fbc_enable() igt_set_module_param_int(drm.fd, "enable_fbc", 1)
-#define fbc_disable() igt_set_module_param_int(drm.fd, "enable_fbc", 0)
#define drrs_enable() drrs_set(1)
#define drrs_disable() drrs_set(0)
@@ -1188,8 +1160,8 @@ static bool disable_features(const struct test_mode *t)
if (t->feature == FEATURE_DEFAULT)
return false;
- fbc_disable();
drrs_disable();
+ fbc_disable(drm.fd);
return psr.can_test ? psr_disable(drm.fd, drm.debugfs) : false;
}
@@ -1429,20 +1401,9 @@ static void teardown_crcs(void)
igt_pipe_crc_free(pipe_crc);
}
-static bool fbc_supported_on_chipset(void)
-{
- char buf[128];
-
- debugfs_read_crtc("i915_fbc_status", buf);
- if (*buf == '\0')
- return false;
-
- return !strstr(buf, "FBC unsupported on this chipset\n");
-}
-
static void setup_fbc(void)
{
- if (!fbc_supported_on_chipset()) {
+ if (!fbc_supported_on_chipset(drm.fd, prim_mode_params.pipe)) {
igt_info("Can't test FBC: not supported on this chipset\n");
return;
}
@@ -1649,15 +1610,18 @@ static void do_status_assertions(int flags)
igt_require(!fbc_not_enough_stolen());
igt_require(!fbc_stride_not_supported());
igt_require(!fbc_mode_too_large());
- if (!fbc_wait_until_enabled()) {
- igt_assert_f(fbc_is_enabled(IGT_LOG_WARN),
+ if (!fbc_wait_until_enabled(drm.fd, prim_mode_params.pipe)) {
+ igt_assert_f(fbc_is_enabled(drm.fd,
+ prim_mode_params.pipe,
+ IGT_LOG_WARN),
"FBC disabled\n");
}
if (opt.fbc_check_compression)
igt_assert(fbc_wait_for_compression());
} else if (flags & ASSERT_FBC_DISABLED) {
- igt_assert(!fbc_wait_until_enabled());
+ igt_assert(!fbc_wait_until_enabled(drm.fd,
+ prim_mode_params.pipe));
}
if (flags & ASSERT_PSR_ENABLED)
@@ -1797,7 +1761,7 @@ static bool enable_features_for_test(const struct test_mode *t)
return false;
if (t->feature & FEATURE_FBC)
- fbc_enable();
+ fbc_enable(drm.fd);
if (t->feature & FEATURE_PSR)
ret = psr_enable(drm.fd, drm.debugfs, PSR_MODE_1);
if (t->feature & FEATURE_DRRS)
diff --git a/tests/meson.build b/tests/meson.build
index da31e782..27459938 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -227,7 +227,6 @@ i915_progs = [
'kms_fence_pin_leak',
'kms_flip_scaled_crc',
'kms_flip_tiling',
- 'kms_frontbuffer_tracking',
'kms_legacy_colorkey',
'kms_mmap_write_crc',
'kms_pipe_b_c_ivb',
@@ -487,6 +486,14 @@ test_executables += executable('kms_psr2_sf',
install : true)
test_list += 'kms_psr2_sf'
+test_executables += executable('kms_frontbuffer_tracking',
+ [ join_paths('i915', 'kms_frontbuffer_tracking.c'), join_paths ('i915', 'kms_fbc_helper.c')],
+ dependencies : test_deps,
+ install_dir : libexecdir,
+ install_rpath : libexecdir_rpathdir,
+ install : true)
+test_list += 'kms_frontbuffer_tracking'
+
if chamelium.found()
test_executables += executable('kms_chamelium_color',
[ 'chamelium/kms_chamelium_color.c', 'kms_color_helper.c' ],
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t 2/3] tests/i915/kms_frontbuffer_tracking: Split drrs
2023-04-05 5:34 [igt-dev] [PATCH i-g-t 0/3] Testcases for dirtyfb ioctl Jouni Högander
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 1/3] tests/i915/kms_frontbuffer_tracking: Split fbc into separate helper Jouni Högander
@ 2023-04-05 5:34 ` Jouni Högander
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_dirtyfb: Add new test for dirtyfb ioctl Jouni Högander
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Jouni Högander @ 2023-04-05 5:34 UTC (permalink / raw)
To: igt-dev
Split drrs handling into separate helper to be used by other testcases
as well.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
tests/i915/kms_drrs_helper.c | 83 +++++++++++++++++++++++++++
tests/i915/kms_drrs_helper.h | 15 +++++
tests/i915/kms_frontbuffer_tracking.c | 82 ++------------------------
tests/meson.build | 2 +-
4 files changed, 105 insertions(+), 77 deletions(-)
create mode 100644 tests/i915/kms_drrs_helper.c
create mode 100644 tests/i915/kms_drrs_helper.h
diff --git a/tests/i915/kms_drrs_helper.c b/tests/i915/kms_drrs_helper.c
new file mode 100644
index 00000000..67443e9e
--- /dev/null
+++ b/tests/i915/kms_drrs_helper.c
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#include <fcntl.h>
+
+#include "igt.h"
+#include "igt_sysfs.h"
+
+#include "kms_drrs_helper.h"
+
+bool is_drrs_supported(int device, enum pipe pipe)
+{
+ char buf[256];
+ int dir;
+
+ dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+ igt_require_fd(dir);
+ igt_debugfs_simple_read(dir, "i915_drrs_status", buf, sizeof(buf));
+ close(dir);
+ if (*buf == '\0')
+ return false;
+
+ return !strcasestr(buf, "DRRS enabled:");
+}
+
+bool output_has_drrs(int device, igt_output_t *output)
+{
+ char buf[256];
+ int dir;
+
+ dir = igt_debugfs_connector_dir(device, output->name, O_DIRECTORY);
+ igt_require_fd(dir);
+ igt_debugfs_simple_read(dir, "i915_drrs_type", buf, sizeof(buf));
+ close(dir);
+
+ return strstr(buf, "seamless");
+}
+
+static void drrs_set(int device, enum pipe pipe, unsigned int val)
+{
+ char buf[2];
+ int dir, ret;
+
+ igt_debug("Manually %sabling DRRS. %u\n", val ? "en" : "dis", val);
+ snprintf(buf, sizeof(buf), "%d", val);
+
+ dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+ igt_require_fd(dir);
+ ret = igt_sysfs_write(dir, "i915_drrs_ctl", buf, sizeof(buf) - 1);
+
+ /*
+ * drrs_enable() is called on DRRS capable platform only,
+ * whereas drrs_disable() is called on all platforms.
+ * So handle the failure of debugfs_write only for drrs_enable().
+ */
+ if (val)
+ igt_assert_f(ret == (sizeof(buf) - 1), "debugfs_write failed");
+}
+
+void drrs_enable(int device, enum pipe pipe)
+{
+ drrs_set(device, pipe, 1);
+}
+
+void drrs_disable(int device, enum pipe pipe)
+{
+ drrs_set(device, pipe, 0);
+}
+
+bool is_drrs_inactive(int device, enum pipe pipe)
+{
+ char buf[256];
+ int dir;
+
+ dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+ igt_require_fd(dir);
+ igt_debugfs_simple_read(dir, "i915_drrs_status", buf, sizeof(buf));
+ close(dir);
+
+ return strstr(buf, "DRRS active: no");
+}
diff --git a/tests/i915/kms_drrs_helper.h b/tests/i915/kms_drrs_helper.h
new file mode 100644
index 00000000..ca037ca5
--- /dev/null
+++ b/tests/i915/kms_drrs_helper.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef IGT_KMS_DRRS_HELPER_H
+#define IGT_KMS_DRRS_HELPER_H
+
+bool is_drrs_supported(int device, enum pipe pipe);
+bool output_has_drrs(int device, igt_output_t *output);
+void drrs_enable(int device, enum pipe pipe);
+void drrs_disable(int device, enum pipe pipe);
+bool is_drrs_inactive(int device, enum pipe pipe);
+
+#endif
diff --git a/tests/i915/kms_frontbuffer_tracking.c b/tests/i915/kms_frontbuffer_tracking.c
index 63fcb0fd..64b35880 100644
--- a/tests/i915/kms_frontbuffer_tracking.c
+++ b/tests/i915/kms_frontbuffer_tracking.c
@@ -36,6 +36,7 @@
#include "igt_sysfs.h"
#include "igt_psr.h"
+#include "kms_drrs_helper.h"
#include "kms_fbc_helper.h"
#define TIME SLOW_QUICK(1000, 10000)
@@ -747,54 +748,10 @@ static void __debugfs_read_crtc(const char *param, char *buf, int len)
close(dir);
}
-static int __debugfs_write_crtc(const char *param, const char *buf, int len)
-{
- int dir, ret;
- enum pipe pipe;
-
- pipe = prim_mode_params.pipe;
- dir = igt_debugfs_pipe_dir(drm.fd, pipe, O_DIRECTORY);
- igt_require_fd(dir);
- ret = igt_sysfs_write(dir, param, buf, len - 1);
- close(dir);
-
- return ret;
-}
-
-static void __debugfs_read_connector(const char *param, char *buf, int len)
-{
- int dir;
- igt_output_t *output;
-
- output = prim_mode_params.output;
- dir = igt_debugfs_connector_dir(drm.fd, output->name, O_DIRECTORY);
- igt_require_fd(dir);
- igt_debugfs_simple_read(dir, param, buf, len);
- close(dir);
-}
-
#define debugfs_read_crtc(p, arr) __debugfs_read_crtc(p, arr, sizeof(arr))
#define debugfs_write_crtc(p, arr) __debugfs_write_crtc(p, arr, sizeof(arr))
#define debugfs_read_connector(p, arr) __debugfs_read_connector(p, arr, sizeof(arr))
-static void drrs_set(unsigned int val)
-{
- char buf[2];
- int ret;
-
- igt_debug("Manually %sabling DRRS. %u\n", val ? "en" : "dis", val);
- snprintf(buf, sizeof(buf), "%d", val);
- ret = debugfs_write_crtc("i915_drrs_ctl", buf);
-
- /*
- * drrs_enable() is called on DRRS capable platform only,
- * whereas drrs_disable() is called on all platforms.
- * So handle the failure of debugfs_write only for drrs_enable().
- */
- if (val)
- igt_assert_f(ret == (sizeof(buf) - 1), "debugfs_write failed");
-}
-
static bool is_drrs_high(void)
{
char buf[MAX_DRRS_STATUS_BUF_LEN];
@@ -811,22 +768,6 @@ static bool is_drrs_low(void)
return strstr(buf, "DRRS refresh rate: low");
}
-static bool is_drrs_supported(void)
-{
- char buf[MAX_DRRS_STATUS_BUF_LEN];
-
- debugfs_read_crtc("i915_drrs_status", buf);
- return strcasestr(buf, "DRRS enabled:");
-}
-
-static bool is_drrs_inactive(void)
-{
- char buf[MAX_DRRS_STATUS_BUF_LEN];
-
- debugfs_read_crtc("i915_drrs_status", buf);
- return strstr(buf, "DRRS active: no");
-}
-
static void drrs_print_status(void)
{
char buf[MAX_DRRS_STATUS_BUF_LEN];
@@ -835,14 +776,6 @@ static void drrs_print_status(void)
igt_info("DRRS STATUS :\n%s\n", buf);
}
-static bool output_has_drrs(void)
-{
- char buf[MAX_DRRS_STATUS_BUF_LEN];
-
- debugfs_read_connector("i915_drrs_type", buf);
- return strstr(buf, "seamless");
-}
-
static struct timespec fbc_get_last_action(void)
{
struct timespec ret = { 0, 0 };
@@ -956,9 +889,6 @@ static bool drrs_wait_until_rr_switch_to_low(void)
return igt_wait(is_drrs_low(), 5000, 1);
}
-#define drrs_enable() drrs_set(1)
-#define drrs_disable() drrs_set(0)
-
static struct rect pat1_get_rect(struct fb_region *fb, int r)
{
struct rect rect;
@@ -1160,8 +1090,8 @@ static bool disable_features(const struct test_mode *t)
if (t->feature == FEATURE_DEFAULT)
return false;
- drrs_disable();
fbc_disable(drm.fd);
+ drrs_disable(drm.fd, prim_mode_params.pipe);
return psr.can_test ? psr_disable(drm.fd, drm.debugfs) : false;
}
@@ -1438,12 +1368,12 @@ static void teardown_psr(void)
static void setup_drrs(void)
{
- if (!output_has_drrs()) {
+ if (!output_has_drrs(drm.fd, prim_mode_params.output)) {
igt_info("Can't test DRRS: no usable screen.\n");
return;
}
- if (!is_drrs_supported()) {
+ if (!is_drrs_supported(drm.fd, prim_mode_params.pipe)) {
igt_info("Can't test DRRS: Not supported.\n");
return;
}
@@ -1600,7 +1530,7 @@ static void do_status_assertions(int flags)
igt_assert_f(false, "DRRS LOW\n");
}
} else if (flags & ASSERT_DRRS_INACTIVE) {
- if (!is_drrs_inactive()) {
+ if (!is_drrs_inactive(drm.fd, prim_mode_params.pipe)) {
drrs_print_status();
igt_assert_f(false, "DRRS INACTIVE\n");
}
@@ -1765,7 +1695,7 @@ static bool enable_features_for_test(const struct test_mode *t)
if (t->feature & FEATURE_PSR)
ret = psr_enable(drm.fd, drm.debugfs, PSR_MODE_1);
if (t->feature & FEATURE_DRRS)
- drrs_enable();
+ drrs_enable(drm.fd, prim_mode_params.pipe);
return ret;
}
diff --git a/tests/meson.build b/tests/meson.build
index 27459938..8fa69af3 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -487,7 +487,7 @@ test_executables += executable('kms_psr2_sf',
test_list += 'kms_psr2_sf'
test_executables += executable('kms_frontbuffer_tracking',
- [ join_paths('i915', 'kms_frontbuffer_tracking.c'), join_paths ('i915', 'kms_fbc_helper.c')],
+ [ join_paths('i915', 'kms_frontbuffer_tracking.c'), join_paths ('i915', 'kms_fbc_helper.c'), join_paths ('i915', 'kms_drrs_helper.c')],
dependencies : test_deps,
install_dir : libexecdir,
install_rpath : libexecdir_rpathdir,
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t 3/3] tests/kms_dirtyfb: Add new test for dirtyfb ioctl
2023-04-05 5:34 [igt-dev] [PATCH i-g-t 0/3] Testcases for dirtyfb ioctl Jouni Högander
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 1/3] tests/i915/kms_frontbuffer_tracking: Split fbc into separate helper Jouni Högander
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 2/3] tests/i915/kms_frontbuffer_tracking: Split drrs Jouni Högander
@ 2023-04-05 5:34 ` Jouni Högander
2023-04-05 12:59 ` Maarten Lankhorst
2023-04-06 7:20 ` Kamil Konieczny
2023-04-05 6:16 ` [igt-dev] ✗ Fi.CI.BAT: failure for Testcases " Patchwork
` (2 subsequent siblings)
5 siblings, 2 replies; 11+ messages in thread
From: Jouni Högander @ 2023-04-05 5:34 UTC (permalink / raw)
To: igt-dev
Add new test to validate dirtyfb ioctl is working properly with GPU
frontbuffer rendering.
Create big framebuffer and use only lower right corner for the
plane. Initiate GPU drawing for a rectangle over the whole
framebuffer and perform dirtyfb ioctl. Then wait for the drawing to
complete and collect crc and check that it matches with expected.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
tests/i915/kms_dirtyfb.c | 309 +++++++++++++++++++++++++++++++++++++++
tests/meson.build | 8 +
2 files changed, 317 insertions(+)
create mode 100644 tests/i915/kms_dirtyfb.c
diff --git a/tests/i915/kms_dirtyfb.c b/tests/i915/kms_dirtyfb.c
new file mode 100644
index 00000000..99d4231d
--- /dev/null
+++ b/tests/i915/kms_dirtyfb.c
@@ -0,0 +1,309 @@
+/*
+ * Copyright © 2023 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include <sys/types.h>
+
+#include "igt.h"
+#include "igt_psr.h"
+
+#include "kms_fbc_helper.h"
+#include "kms_drrs_helper.h"
+
+IGT_TEST_DESCRIPTION("Test the DIRTYFB ioctl is working properly with "
+ "its related features: FBC, PSR and DRRS");
+
+#ifndef PAGE_ALIGN
+#ifndef PAGE_SIZE
+#define PAGE_SIZE 4096
+#endif
+#define PAGE_ALIGN(x) ALIGN(x, PAGE_SIZE)
+#endif
+
+typedef struct {
+ int drm_fd;
+ int debugfs_fd;
+ igt_display_t display;
+ drmModeModeInfo *mode;
+ igt_output_t *output;
+ igt_pipe_crc_t *pipe_crc;
+ enum pipe pipe;
+
+ struct igt_fb fbs[3];
+
+ igt_crc_t ref_crc;
+
+ struct buf_ops *bops;
+ enum {
+ FEATURE_NONE = 0,
+ FEATURE_PSR = 1,
+ FEATURE_FBC = 2,
+ FEATURE_DRRS = 4,
+ FEATURE_COUNT = 8,
+ FEATURE_DEFAULT = 8,
+ } feature;
+} data_t;
+
+static const char *feature_str(int feature)
+{
+ switch (feature) {
+ case FEATURE_NONE:
+ return "nop";
+ case FEATURE_FBC:
+ return "fbc";
+ case FEATURE_PSR:
+ return "psr";
+ case FEATURE_DRRS:
+ return "drrs";
+ case FEATURE_DEFAULT:
+ return "default";
+ default:
+ igt_assert(false);
+ }
+}
+
+static bool check_support(data_t *data)
+{
+ switch (data->feature) {
+ case FEATURE_NONE:
+ return true;
+ case FEATURE_FBC:
+ return fbc_supported_on_chipset(data->drm_fd, data->pipe);
+ case FEATURE_PSR:
+ return psr_sink_support(data->drm_fd, data->debugfs_fd,
+ PSR_MODE_1);
+ case FEATURE_DRRS:
+ return is_drrs_supported(data->drm_fd, data->pipe) &&
+ output_has_drrs(data->drm_fd, data->output);
+ case FEATURE_DEFAULT:
+ return true;
+ default:
+ igt_assert(false);
+ }
+}
+
+static void enable_feature(data_t *data)
+{
+ switch (data->feature) {
+ case FEATURE_NONE:
+ break;
+ case FEATURE_FBC:
+ fbc_enable(data->drm_fd);
+ break;
+ case FEATURE_PSR:
+ psr_enable(data->drm_fd, data->debugfs_fd, PSR_MODE_1);
+ break;
+ case FEATURE_DRRS:
+ drrs_enable(data->drm_fd, data->pipe);
+ break;
+ case FEATURE_DEFAULT:
+ break;
+ default:
+ igt_assert(false);
+ }
+}
+
+static void check_feature(data_t *data)
+{
+ switch (data->feature) {
+ case FEATURE_NONE:
+ break;
+ case FEATURE_FBC:
+ igt_assert_f(fbc_wait_until_enabled(data->drm_fd, data->pipe),
+ "FBC still disabled");
+ break;
+ case FEATURE_PSR:
+ igt_assert_f(psr_wait_entry(data->debugfs_fd, PSR_MODE_1),
+ "PSR still disabled\n");
+ break;
+ case FEATURE_DRRS:
+ igt_assert_f(is_drrs_inactive(data->drm_fd, data->pipe),
+ "DRRS INACTIVE\n");
+ break;
+ case FEATURE_DEFAULT:
+ break;
+ default:
+ igt_assert(false);
+ }
+}
+
+static void disable_features(data_t *data)
+{
+ fbc_disable(data->drm_fd);
+ psr_disable(data->drm_fd, data->debugfs_fd);
+ drrs_disable(data->drm_fd, data->pipe);
+}
+
+static void prepare(data_t *data)
+{
+ igt_plane_t *primary;
+ drmModeResPtr res;
+
+ igt_skip_on(!check_support(data));
+
+ data->mode = igt_output_get_mode(data->output);
+
+ igt_output_set_pipe(data->output, data->pipe);
+
+ data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
+ IGT_PIPE_CRC_SOURCE_AUTO);
+
+ igt_create_color_fb(data->drm_fd, data->mode->hdisplay,
+ data->mode->hdisplay, DRM_FORMAT_XRGB8888,
+ DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
+ &data->fbs[0]);
+ igt_draw_rect_fb(data->drm_fd, data->bops, 0, &data->fbs[0],
+ IGT_DRAW_RENDER, 0, 0, data->fbs[0].width,
+ data->fbs[0].height, 0xFF);
+
+ primary = igt_output_get_plane_type(data->output,
+ DRM_PLANE_TYPE_PRIMARY);
+
+ igt_plane_set_fb(primary, &data->fbs[0]);
+
+ igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+ igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
+
+ res = drmModeGetResources(data->drm_fd);
+
+ igt_create_color_fb(data->drm_fd, res->max_width,
+ res->max_height, DRM_FORMAT_XRGB8888,
+ DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
+ &data->fbs[1]);
+ igt_draw_rect_fb(data->drm_fd, data->bops, 0, &data->fbs[1],
+ IGT_DRAW_MMAP_CPU, 0, 0, data->fbs[1].width,
+ data->fbs[1].height, 0xFF);
+
+ igt_create_color_fb(data->drm_fd, res->max_width,
+ res->max_height, DRM_FORMAT_XRGB8888,
+ DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
+ &data->fbs[2]);
+
+ igt_plane_set_fb(primary, &data->fbs[2]);
+ igt_fb_set_position(&data->fbs[2], primary,
+ data->fbs[2].width - data->fbs[0].width,
+ data->fbs[2].height - data->fbs[0].height);
+ igt_fb_set_size(&data->fbs[2], primary, data->fbs[0].width,
+ data->fbs[0].height);
+
+ enable_feature(data);
+
+ igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+ check_feature(data);
+}
+
+static void cleanup(data_t *data)
+{
+ igt_remove_fb(data->drm_fd, &data->fbs[0]);
+ igt_remove_fb(data->drm_fd, &data->fbs[1]);
+
+ igt_pipe_crc_free(data->pipe_crc);
+
+ disable_features(data);
+
+ igt_output_set_pipe(data->output, PIPE_NONE);
+
+ igt_display_commit2(&data->display, COMMIT_ATOMIC);
+}
+
+static void run_test(data_t *data)
+{
+ igt_crc_t crc;
+ struct intel_buf *src, *dst;
+ struct intel_bb *ibb;
+ uint32_t devid = intel_get_drm_devid(data->drm_fd);
+ igt_render_copyfunc_t rendercopy = igt_get_render_copyfunc(devid);
+ int r;
+
+ igt_skip_on(!rendercopy);
+
+ src = intel_buf_create_using_handle(data->bops, data->fbs[1].gem_handle,
+ data->fbs[1].width,
+ data->fbs[1].height,
+ igt_drm_format_to_bpp(data->fbs[1].drm_format),
+ 0, igt_fb_mod_to_tiling(data->fbs[1].modifier), 0);
+ dst = intel_buf_create_using_handle(data->bops, data->fbs[2].gem_handle,
+ data->fbs[2].width,
+ data->fbs[2].height,
+ igt_drm_format_to_bpp(data->fbs[2].drm_format),
+ 0, igt_fb_mod_to_tiling(data->fbs[2].modifier), 0);
+ ibb = intel_bb_create_with_context(data->drm_fd, 0, NULL, PAGE_SIZE);
+
+ rendercopy(ibb, src, 0, 0, data->fbs[2].width, data->fbs[2].height, dst, 0, 0);
+
+ /* Perfom dirtyfb right after initiating rendercopy */
+ r = drmModeDirtyFB(data->drm_fd, data->fbs[2].fb_id, NULL, 0);
+ igt_assert(r == 0 || r == -ENOSYS);
+
+ /* Ensure rendercopy is complete */
+ intel_bb_sync(ibb);
+
+ intel_bb_destroy(ibb);
+ intel_buf_destroy(src);
+ intel_buf_destroy(dst);
+
+ igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
+ igt_assert_crc_equal(&crc, &data->ref_crc);
+}
+
+igt_main
+{
+ data_t data = {};
+
+ igt_fixture {
+ data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+ data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
+ kmstest_set_vt_graphics_mode();
+
+ igt_display_require(&data.display, data.drm_fd);
+
+ data.bops = buf_ops_create(data.drm_fd);
+
+ igt_display_reset(&data.display);
+ }
+
+ igt_describe("Test dirtyFB ioctl");
+ igt_subtest_with_dynamic("dirtyfb-ioctl") {
+ data.pipe = PIPE_A;
+ for_each_valid_output_on_pipe(&data.display, data.pipe,
+ data.output) {
+ for (data.feature = FEATURE_DEFAULT; data.feature > 0;
+ data.feature = data.feature >> 1) {
+ igt_dynamic_f("%s-%s", feature_str(data.feature),
+ igt_output_name(data.output)) {
+ prepare(&data);
+ run_test(&data);
+ cleanup(&data);
+ }
+ }
+ }
+ }
+
+ igt_fixture {
+ buf_ops_destroy(data.bops);
+ igt_display_fini(&data.display);
+ close(data.drm_fd);
+ }
+}
diff --git a/tests/meson.build b/tests/meson.build
index 8fa69af3..a286a9b8 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -494,6 +494,14 @@ test_executables += executable('kms_frontbuffer_tracking',
install : true)
test_list += 'kms_frontbuffer_tracking'
+test_executables += executable('kms_dirtyfb',
+ [ join_paths('i915', 'kms_dirtyfb.c'), join_paths ('i915', 'kms_fbc_helper.c'), join_paths ('i915', 'kms_drrs_helper.c')],
+ dependencies : test_deps,
+ install_dir : libexecdir,
+ install_rpath : libexecdir_rpathdir,
+ install : true)
+test_list += 'kms_frontbuffer_tracking'
+
if chamelium.found()
test_executables += executable('kms_chamelium_color',
[ 'chamelium/kms_chamelium_color.c', 'kms_color_helper.c' ],
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: failure for Testcases for dirtyfb ioctl
2023-04-05 5:34 [igt-dev] [PATCH i-g-t 0/3] Testcases for dirtyfb ioctl Jouni Högander
` (2 preceding siblings ...)
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_dirtyfb: Add new test for dirtyfb ioctl Jouni Högander
@ 2023-04-05 6:16 ` Patchwork
2023-04-05 14:35 ` [igt-dev] ✓ Fi.CI.BAT: success for Testcases for dirtyfb ioctl (rev2) Patchwork
2023-04-06 3:20 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
5 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2023-04-05 6:16 UTC (permalink / raw)
To: Jouni Högander; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 7270 bytes --]
== Series Details ==
Series: Testcases for dirtyfb ioctl
URL : https://patchwork.freedesktop.org/series/116130/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_12967 -> IGTPW_8756
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_8756 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in IGTPW_8756, 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_8756/index.html
Participating hosts (37 -> 37)
------------------------------
Additional (1): fi-kbl-soraka
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_8756:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@guc_hang:
- bat-jsl-1: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12967/bat-jsl-1/igt@i915_selftest@live@guc_hang.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-jsl-1/igt@i915_selftest@live@guc_hang.html
Known issues
------------
Here are the changes found in IGTPW_8756 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#2190])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/fi-kbl-soraka/igt@gem_huc_copy@huc-copy.html
* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#4613]) +3 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/fi-kbl-soraka/igt@gem_lmem_swapping@basic.html
* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][5] ([i915#1886])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
* igt@i915_selftest@live@slpc:
- bat-rpls-2: NOTRUN -> [DMESG-FAIL][6] ([i915#6367] / [i915#7913] / [i915#7996])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-rpls-2/igt@i915_selftest@live@slpc.html
- bat-rpls-1: [PASS][7] -> [DMESG-FAIL][8] ([i915#6367] / [i915#7996])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12967/bat-rpls-1/igt@i915_selftest@live@slpc.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-rpls-1/igt@i915_selftest@live@slpc.html
* igt@kms_chamelium_frames@hdmi-crc-fast:
- fi-kbl-soraka: NOTRUN -> [SKIP][9] ([fdo#109271]) +16 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/fi-kbl-soraka/igt@kms_chamelium_frames@hdmi-crc-fast.html
* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-rpls-2: NOTRUN -> [SKIP][10] ([i915#7828])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-rpls-2/igt@kms_chamelium_hpd@common-hpd-after-suspend.html
- fi-bsw-n3050: NOTRUN -> [SKIP][11] ([fdo#109271])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/fi-bsw-n3050/igt@kms_chamelium_hpd@common-hpd-after-suspend.html
- bat-rpls-1: NOTRUN -> [SKIP][12] ([i915#7828])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-rpls-1/igt@kms_chamelium_hpd@common-hpd-after-suspend.html
* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-c-dp-1:
- bat-dg2-8: [PASS][13] -> [FAIL][14] ([i915#7932]) +1 similar issue
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12967/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-c-dp-1.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-c-dp-1.html
* igt@kms_pipe_crc_basic@suspend-read-crc:
- bat-rpls-1: NOTRUN -> [SKIP][15] ([i915#1845])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-rpls-1/igt@kms_pipe_crc_basic@suspend-read-crc.html
- bat-rpls-2: NOTRUN -> [SKIP][16] ([i915#1845])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-rpls-2/igt@kms_pipe_crc_basic@suspend-read-crc.html
#### Possible fixes ####
* igt@gem_exec_suspend@basic-s3@smem:
- bat-rpls-1: [ABORT][17] ([i915#6687] / [i915#7978]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12967/bat-rpls-1/igt@gem_exec_suspend@basic-s3@smem.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-rpls-1/igt@gem_exec_suspend@basic-s3@smem.html
* igt@i915_selftest@live@execlists:
- fi-bsw-n3050: [ABORT][19] ([i915#7911] / [i915#7913]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12967/fi-bsw-n3050/igt@i915_selftest@live@execlists.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/fi-bsw-n3050/igt@i915_selftest@live@execlists.html
* igt@i915_selftest@live@requests:
- bat-rpls-2: [ABORT][21] ([i915#7913] / [i915#7982]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12967/bat-rpls-2/igt@i915_selftest@live@requests.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-rpls-2/igt@i915_selftest@live@requests.html
* igt@kms_pipe_crc_basic@nonblocking-crc@pipe-d-dp-1:
- bat-dg2-8: [FAIL][23] ([i915#7932]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12967/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc@pipe-d-dp-1.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc@pipe-d-dp-1.html
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7911]: https://gitlab.freedesktop.org/drm/intel/issues/7911
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
[i915#7978]: https://gitlab.freedesktop.org/drm/intel/issues/7978
[i915#7982]: https://gitlab.freedesktop.org/drm/intel/issues/7982
[i915#7996]: https://gitlab.freedesktop.org/drm/intel/issues/7996
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7236 -> IGTPW_8756
CI-20190529: 20190529
CI_DRM_12967: 28c342e55ec8081498c63f4a38825f055e294a3a @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8756: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/index.html
IGT_7236: bac5a4cc31b3212a205219a6cbc45a173d30d04b @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Testlist changes
----------------
+++ 1009 lines
--- 0 lines
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8756/index.html
[-- Attachment #2: Type: text/html, Size: 8934 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 3/3] tests/kms_dirtyfb: Add new test for dirtyfb ioctl
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_dirtyfb: Add new test for dirtyfb ioctl Jouni Högander
@ 2023-04-05 12:59 ` Maarten Lankhorst
2023-04-12 9:45 ` Hogander, Jouni
2023-04-06 7:20 ` Kamil Konieczny
1 sibling, 1 reply; 11+ messages in thread
From: Maarten Lankhorst @ 2023-04-05 12:59 UTC (permalink / raw)
To: Jouni Högander, igt-dev
Hey,
There's a gray area between i915 and Xe, and between lib and tests.
I think in this case, it makes a lot of sense to move those helpers into
lib/ instead,
it will be useful outside i915 specific tests, as they will have to run
on Xe as well.
Probably best to simply add a intel_* prefix to each function, and move
them into igt/i915/kms_*.[ch]
Personally, I feel the existing igt/igt_psr.c belongs there too.
Also I noticed debugfs_fd, because those tests don't need to be
optimized, it can be moved into the functions.
Cheers,
~Maarten
On 2023-04-05 07:34, Jouni Högander wrote:
> Add new test to validate dirtyfb ioctl is working properly with GPU
> frontbuffer rendering.
>
> Create big framebuffer and use only lower right corner for the
> plane. Initiate GPU drawing for a rectangle over the whole
> framebuffer and perform dirtyfb ioctl. Then wait for the drawing to
> complete and collect crc and check that it matches with expected.
>
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
> tests/i915/kms_dirtyfb.c | 309 +++++++++++++++++++++++++++++++++++++++
> tests/meson.build | 8 +
> 2 files changed, 317 insertions(+)
> create mode 100644 tests/i915/kms_dirtyfb.c
>
> diff --git a/tests/i915/kms_dirtyfb.c b/tests/i915/kms_dirtyfb.c
> new file mode 100644
> index 00000000..99d4231d
> --- /dev/null
> +++ b/tests/i915/kms_dirtyfb.c
> @@ -0,0 +1,309 @@
> +/*
> + * Copyright © 2023 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + */
> +
> +#include <sys/types.h>
> +
> +#include "igt.h"
> +#include "igt_psr.h"
> +
> +#include "kms_fbc_helper.h"
> +#include "kms_drrs_helper.h"
> +
> +IGT_TEST_DESCRIPTION("Test the DIRTYFB ioctl is working properly with "
> + "its related features: FBC, PSR and DRRS");
> +
> +#ifndef PAGE_ALIGN
> +#ifndef PAGE_SIZE
> +#define PAGE_SIZE 4096
> +#endif
> +#define PAGE_ALIGN(x) ALIGN(x, PAGE_SIZE)
> +#endif
> +
> +typedef struct {
> + int drm_fd;
> + int debugfs_fd;
> + igt_display_t display;
> + drmModeModeInfo *mode;
> + igt_output_t *output;
> + igt_pipe_crc_t *pipe_crc;
> + enum pipe pipe;
> +
> + struct igt_fb fbs[3];
> +
> + igt_crc_t ref_crc;
> +
> + struct buf_ops *bops;
> + enum {
> + FEATURE_NONE = 0,
> + FEATURE_PSR = 1,
> + FEATURE_FBC = 2,
> + FEATURE_DRRS = 4,
> + FEATURE_COUNT = 8,
> + FEATURE_DEFAULT = 8,
> + } feature;
> +} data_t;
> +
> +static const char *feature_str(int feature)
> +{
> + switch (feature) {
> + case FEATURE_NONE:
> + return "nop";
> + case FEATURE_FBC:
> + return "fbc";
> + case FEATURE_PSR:
> + return "psr";
> + case FEATURE_DRRS:
> + return "drrs";
> + case FEATURE_DEFAULT:
> + return "default";
> + default:
> + igt_assert(false);
> + }
> +}
> +
> +static bool check_support(data_t *data)
> +{
> + switch (data->feature) {
> + case FEATURE_NONE:
> + return true;
> + case FEATURE_FBC:
> + return fbc_supported_on_chipset(data->drm_fd, data->pipe);
> + case FEATURE_PSR:
> + return psr_sink_support(data->drm_fd, data->debugfs_fd,
> + PSR_MODE_1);
> + case FEATURE_DRRS:
> + return is_drrs_supported(data->drm_fd, data->pipe) &&
> + output_has_drrs(data->drm_fd, data->output);
> + case FEATURE_DEFAULT:
> + return true;
> + default:
> + igt_assert(false);
> + }
> +}
> +
> +static void enable_feature(data_t *data)
> +{
> + switch (data->feature) {
> + case FEATURE_NONE:
> + break;
> + case FEATURE_FBC:
> + fbc_enable(data->drm_fd);
> + break;
> + case FEATURE_PSR:
> + psr_enable(data->drm_fd, data->debugfs_fd, PSR_MODE_1);
> + break;
> + case FEATURE_DRRS:
> + drrs_enable(data->drm_fd, data->pipe);
> + break;
> + case FEATURE_DEFAULT:
> + break;
> + default:
> + igt_assert(false);
> + }
> +}
> +
> +static void check_feature(data_t *data)
> +{
> + switch (data->feature) {
> + case FEATURE_NONE:
> + break;
> + case FEATURE_FBC:
> + igt_assert_f(fbc_wait_until_enabled(data->drm_fd, data->pipe),
> + "FBC still disabled");
> + break;
> + case FEATURE_PSR:
> + igt_assert_f(psr_wait_entry(data->debugfs_fd, PSR_MODE_1),
> + "PSR still disabled\n");
> + break;
> + case FEATURE_DRRS:
> + igt_assert_f(is_drrs_inactive(data->drm_fd, data->pipe),
> + "DRRS INACTIVE\n");
> + break;
> + case FEATURE_DEFAULT:
> + break;
> + default:
> + igt_assert(false);
> + }
> +}
> +
> +static void disable_features(data_t *data)
> +{
> + fbc_disable(data->drm_fd);
> + psr_disable(data->drm_fd, data->debugfs_fd);
> + drrs_disable(data->drm_fd, data->pipe);
> +}
> +
> +static void prepare(data_t *data)
> +{
> + igt_plane_t *primary;
> + drmModeResPtr res;
> +
> + igt_skip_on(!check_support(data));
> +
> + data->mode = igt_output_get_mode(data->output);
> +
> + igt_output_set_pipe(data->output, data->pipe);
> +
> + data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
> + IGT_PIPE_CRC_SOURCE_AUTO);
> +
> + igt_create_color_fb(data->drm_fd, data->mode->hdisplay,
> + data->mode->hdisplay, DRM_FORMAT_XRGB8888,
> + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> + &data->fbs[0]);
> + igt_draw_rect_fb(data->drm_fd, data->bops, 0, &data->fbs[0],
> + IGT_DRAW_RENDER, 0, 0, data->fbs[0].width,
> + data->fbs[0].height, 0xFF);
> +
> + primary = igt_output_get_plane_type(data->output,
> + DRM_PLANE_TYPE_PRIMARY);
> +
> + igt_plane_set_fb(primary, &data->fbs[0]);
> +
> + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> + igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
> +
> + res = drmModeGetResources(data->drm_fd);
> +
> + igt_create_color_fb(data->drm_fd, res->max_width,
> + res->max_height, DRM_FORMAT_XRGB8888,
> + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> + &data->fbs[1]);
> + igt_draw_rect_fb(data->drm_fd, data->bops, 0, &data->fbs[1],
> + IGT_DRAW_MMAP_CPU, 0, 0, data->fbs[1].width,
> + data->fbs[1].height, 0xFF);
> +
> + igt_create_color_fb(data->drm_fd, res->max_width,
> + res->max_height, DRM_FORMAT_XRGB8888,
> + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> + &data->fbs[2]);
> +
> + igt_plane_set_fb(primary, &data->fbs[2]);
> + igt_fb_set_position(&data->fbs[2], primary,
> + data->fbs[2].width - data->fbs[0].width,
> + data->fbs[2].height - data->fbs[0].height);
> + igt_fb_set_size(&data->fbs[2], primary, data->fbs[0].width,
> + data->fbs[0].height);
> +
> + enable_feature(data);
> +
> + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> + check_feature(data);
> +}
> +
> +static void cleanup(data_t *data)
> +{
> + igt_remove_fb(data->drm_fd, &data->fbs[0]);
> + igt_remove_fb(data->drm_fd, &data->fbs[1]);
> +
> + igt_pipe_crc_free(data->pipe_crc);
> +
> + disable_features(data);
Should probably only do this if != FEATURE_DEFAULT
> +
> + igt_output_set_pipe(data->output, PIPE_NONE);
> +
> + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +}
> +
> +static void run_test(data_t *data)
> +{
> + igt_crc_t crc;
> + struct intel_buf *src, *dst;
> + struct intel_bb *ibb;
> + uint32_t devid = intel_get_drm_devid(data->drm_fd);
> + igt_render_copyfunc_t rendercopy = igt_get_render_copyfunc(devid);
> + int r;
> +
> + igt_skip_on(!rendercopy);
> +
> + src = intel_buf_create_using_handle(data->bops, data->fbs[1].gem_handle,
> + data->fbs[1].width,
> + data->fbs[1].height,
> + igt_drm_format_to_bpp(data->fbs[1].drm_format),
> + 0, igt_fb_mod_to_tiling(data->fbs[1].modifier), 0);
> + dst = intel_buf_create_using_handle(data->bops, data->fbs[2].gem_handle,
> + data->fbs[2].width,
> + data->fbs[2].height,
> + igt_drm_format_to_bpp(data->fbs[2].drm_format),
> + 0, igt_fb_mod_to_tiling(data->fbs[2].modifier), 0);
> + ibb = intel_bb_create_with_context(data->drm_fd, 0, NULL, PAGE_SIZE);
> +
> + rendercopy(ibb, src, 0, 0, data->fbs[2].width, data->fbs[2].height, dst, 0, 0);
> +
> + /* Perfom dirtyfb right after initiating rendercopy */
> + r = drmModeDirtyFB(data->drm_fd, data->fbs[2].fb_id, NULL, 0);
> + igt_assert(r == 0 || r == -ENOSYS);
> +
> + /* Ensure rendercopy is complete */
> + intel_bb_sync(ibb);
> +
> + intel_bb_destroy(ibb);
> + intel_buf_destroy(src);
> + intel_buf_destroy(dst);
> +
> + igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
This crc should probably be collected immediately after DirtyFB
completes, otherwise you only check that the copy worked?
> + igt_assert_crc_equal(&crc, &data->ref_crc);
> +}
> +
> +igt_main
> +{
> + data_t data = {};
> +
> + igt_fixture {
> + data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
> + data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> + kmstest_set_vt_graphics_mode();
> +
> + igt_display_require(&data.display, data.drm_fd);
> +
> + data.bops = buf_ops_create(data.drm_fd);
> +
> + igt_display_reset(&data.display);
> + }
> +
> + igt_describe("Test dirtyFB ioctl");
> + igt_subtest_with_dynamic("dirtyfb-ioctl") {
> + data.pipe = PIPE_A;
> + for_each_valid_output_on_pipe(&data.display, data.pipe,
> + data.output) {
> + for (data.feature = FEATURE_DEFAULT; data.feature > 0;
> + data.feature = data.feature >> 1) {
> + igt_dynamic_f("%s-%s", feature_str(data.feature),
> + igt_output_name(data.output)) {
Do we only care about PIPE_A here? Otherwise I would try to use each
pipe at least once, since there are 2 fbc's on MTL, and some things may
or may not work on different pipes.
In that case, I would run the default feature test separately and first
on each pipe, otherwise the defaults are only tested on pipe A.
Cheers,
~Maarten
^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for Testcases for dirtyfb ioctl (rev2)
2023-04-05 5:34 [igt-dev] [PATCH i-g-t 0/3] Testcases for dirtyfb ioctl Jouni Högander
` (3 preceding siblings ...)
2023-04-05 6:16 ` [igt-dev] ✗ Fi.CI.BAT: failure for Testcases " Patchwork
@ 2023-04-05 14:35 ` Patchwork
2023-04-06 3:20 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
5 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2023-04-05 14:35 UTC (permalink / raw)
To: Jouni Högander; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 3642 bytes --]
== Series Details ==
Series: Testcases for dirtyfb ioctl (rev2)
URL : https://patchwork.freedesktop.org/series/116130/
State : success
== Summary ==
CI Bug Log - changes from IGT_7240 -> IGTPW_8761
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/index.html
Participating hosts (36 -> 35)
------------------------------
Missing (1): fi-snb-2520m
Known issues
------------
Here are the changes found in IGTPW_8761 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live@hangcheck:
- fi-skl-guc: [PASS][1] -> [DMESG-WARN][2] ([i915#8073])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/fi-skl-guc/igt@i915_selftest@live@hangcheck.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/fi-skl-guc/igt@i915_selftest@live@hangcheck.html
* igt@i915_selftest@live@reset:
- bat-rpls-1: [PASS][3] -> [ABORT][4] ([i915#4983])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/bat-rpls-1/igt@i915_selftest@live@reset.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/bat-rpls-1/igt@i915_selftest@live@reset.html
* igt@i915_selftest@live@slpc:
- bat-rpls-2: NOTRUN -> [DMESG-FAIL][5] ([i915#6367] / [i915#7913])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/bat-rpls-2/igt@i915_selftest@live@slpc.html
* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-rpls-2: NOTRUN -> [SKIP][6] ([i915#7828])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/bat-rpls-2/igt@kms_chamelium_hpd@common-hpd-after-suspend.html
* igt@kms_pipe_crc_basic@suspend-read-crc:
- bat-rpls-2: NOTRUN -> [SKIP][7] ([i915#1845])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/bat-rpls-2/igt@kms_pipe_crc_basic@suspend-read-crc.html
#### Possible fixes ####
* igt@i915_pm_rps@basic-api:
- bat-dg1-5: [FAIL][8] ([i915#8308]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/bat-dg1-5/igt@i915_pm_rps@basic-api.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/bat-dg1-5/igt@i915_pm_rps@basic-api.html
* igt@i915_selftest@live@requests:
- bat-rpls-2: [ABORT][10] ([i915#4983] / [i915#7913]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/bat-rpls-2/igt@i915_selftest@live@requests.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/bat-rpls-2/igt@i915_selftest@live@requests.html
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#8073]: https://gitlab.freedesktop.org/drm/intel/issues/8073
[i915#8308]: https://gitlab.freedesktop.org/drm/intel/issues/8308
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7240 -> IGTPW_8761
CI-20190529: 20190529
CI_DRM_12971: 3404365be0b9c30980dde0c148fc4f89a21c29d1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8761: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/index.html
IGT_7240: ef4550e3b7d3c11ba257006bc7d4f8e421667d46 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Testlist changes
----------------
+++ 1009 lines
--- 0 lines
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/index.html
[-- Attachment #2: Type: text/html, Size: 4542 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] ✓ Fi.CI.IGT: success for Testcases for dirtyfb ioctl (rev2)
2023-04-05 5:34 [igt-dev] [PATCH i-g-t 0/3] Testcases for dirtyfb ioctl Jouni Högander
` (4 preceding siblings ...)
2023-04-05 14:35 ` [igt-dev] ✓ Fi.CI.BAT: success for Testcases for dirtyfb ioctl (rev2) Patchwork
@ 2023-04-06 3:20 ` Patchwork
5 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2023-04-06 3:20 UTC (permalink / raw)
To: Jouni Högander; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 18779 bytes --]
== Series Details ==
Series: Testcases for dirtyfb ioctl (rev2)
URL : https://patchwork.freedesktop.org/series/116130/
State : success
== Summary ==
CI Bug Log - changes from IGT_7240_full -> IGTPW_8761_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/index.html
Participating hosts (8 -> 7)
------------------------------
Missing (1): shard-rkl0
Known issues
------------
Here are the changes found in IGTPW_8761_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_fair@basic-none-vip@rcs0:
- shard-glk: NOTRUN -> [FAIL][1] ([i915#2842])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk5/igt@gem_exec_fair@basic-none-vip@rcs0.html
* igt@gem_lmem_swapping@massive:
- shard-apl: NOTRUN -> [SKIP][2] ([fdo#109271] / [i915#4613])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl3/igt@gem_lmem_swapping@massive.html
* igt@gem_lmem_swapping@parallel-random-verify-ccs:
- shard-glk: NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#4613]) +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk9/igt@gem_lmem_swapping@parallel-random-verify-ccs.html
* igt@gem_render_copy@y-tiled-ccs-to-y-tiled-mc-ccs:
- shard-glk: NOTRUN -> [SKIP][4] ([fdo#109271]) +97 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk8/igt@gem_render_copy@y-tiled-ccs-to-y-tiled-mc-ccs.html
* igt@gen9_exec_parse@basic-rejected-ctx-param:
- shard-snb: NOTRUN -> [SKIP][5] ([fdo#109271]) +5 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-snb7/igt@gen9_exec_parse@basic-rejected-ctx-param.html
* igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-hdmi-a:
- shard-glk: NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#1937])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk3/igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-hdmi-a.html
* igt@i915_pm_rps@engine-order:
- shard-apl: NOTRUN -> [FAIL][7] ([i915#6537])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl7/igt@i915_pm_rps@engine-order.html
* igt@kms_ccs@pipe-b-bad-rotation-90-y_tiled_gen12_rc_ccs_cc:
- shard-glk: NOTRUN -> [SKIP][8] ([fdo#109271] / [i915#3886]) +2 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk3/igt@kms_ccs@pipe-b-bad-rotation-90-y_tiled_gen12_rc_ccs_cc.html
* igt@kms_ccs@pipe-b-ccs-on-another-bo-y_tiled_gen12_rc_ccs_cc:
- shard-apl: NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#3886]) +2 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl7/igt@kms_ccs@pipe-b-ccs-on-another-bo-y_tiled_gen12_rc_ccs_cc.html
* igt@kms_content_protection@uevent@pipe-a-dp-1:
- shard-apl: NOTRUN -> [FAIL][10] ([i915#1339])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl3/igt@kms_content_protection@uevent@pipe-a-dp-1.html
* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-apl: [PASS][11] -> [FAIL][12] ([i915#2346])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-apl6/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl7/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions.html
* igt@kms_flip@flip-vs-expired-vblank@a-hdmi-a1:
- shard-glk: NOTRUN -> [FAIL][13] ([i915#79])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk2/igt@kms_flip@flip-vs-expired-vblank@a-hdmi-a1.html
* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-gtt:
- shard-apl: NOTRUN -> ([SKIP][14], [SKIP][15]) ([fdo#109271]) +20 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl7/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-gtt.html
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl3/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-gtt.html
* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-blt:
- shard-glk: NOTRUN -> ([SKIP][16], [SKIP][17]) ([fdo#109271]) +18 similar issues
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk3/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-blt.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk6/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-blt.html
* igt@kms_plane_scaling@planes-downscale-factor-0-5-upscale-0-25@pipe-c-dp-1:
- shard-apl: NOTRUN -> [SKIP][18] ([fdo#109271]) +44 similar issues
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl3/igt@kms_plane_scaling@planes-downscale-factor-0-5-upscale-0-25@pipe-c-dp-1.html
* igt@kms_psr2_sf@cursor-plane-update-sf:
- shard-apl: NOTRUN -> [SKIP][19] ([fdo#109271] / [i915#658]) +1 similar issue
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl1/igt@kms_psr2_sf@cursor-plane-update-sf.html
* igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area:
- shard-glk: NOTRUN -> [SKIP][20] ([fdo#109271] / [i915#658])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk2/igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area.html
* igt@kms_vblank@pipe-b-query-idle-hang:
- shard-glk: [PASS][21] -> [SKIP][22] ([fdo#109271])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-glk6/igt@kms_vblank@pipe-b-query-idle-hang.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk6/igt@kms_vblank@pipe-b-query-idle-hang.html
- shard-apl: [PASS][23] -> [SKIP][24] ([fdo#109271])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-apl7/igt@kms_vblank@pipe-b-query-idle-hang.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl6/igt@kms_vblank@pipe-b-query-idle-hang.html
#### Possible fixes ####
* igt@core_hotunplug@unbind-rebind:
- shard-snb: [ABORT][25] ([i915#4528]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-snb5/igt@core_hotunplug@unbind-rebind.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-snb4/igt@core_hotunplug@unbind-rebind.html
* igt@gem_barrier_race@remote-request@rcs0:
- shard-glk: [ABORT][27] ([i915#8211]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-glk6/igt@gem_barrier_race@remote-request@rcs0.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk3/igt@gem_barrier_race@remote-request@rcs0.html
* igt@gem_eio@in-flight-suspend:
- shard-apl: [ABORT][29] ([i915#180]) -> [PASS][30] +1 similar issue
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-apl7/igt@gem_eio@in-flight-suspend.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl3/igt@gem_eio@in-flight-suspend.html
* igt@gem_exec_fair@basic-none@vcs0:
- {shard-rkl}: [FAIL][31] ([i915#2842]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-rkl-2/igt@gem_exec_fair@basic-none@vcs0.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-rkl-7/igt@gem_exec_fair@basic-none@vcs0.html
* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk: [FAIL][33] ([i915#2842]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-glk8/igt@gem_exec_fair@basic-pace-share@rcs0.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk7/igt@gem_exec_fair@basic-pace-share@rcs0.html
* igt@gem_exec_fair@basic-pace-solo@rcs0:
- shard-apl: [FAIL][35] ([i915#2842]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-apl3/igt@gem_exec_fair@basic-pace-solo@rcs0.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-apl2/igt@gem_exec_fair@basic-pace-solo@rcs0.html
* igt@gem_exec_suspend@basic-s4-devices@smem:
- {shard-tglu}: [ABORT][37] ([i915#7975]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-tglu-10/igt@gem_exec_suspend@basic-s4-devices@smem.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-tglu-2/igt@gem_exec_suspend@basic-s4-devices@smem.html
* igt@gen9_exec_parse@allowed-single:
- shard-glk: [ABORT][39] ([i915#5566]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-glk6/igt@gen9_exec_parse@allowed-single.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk3/igt@gen9_exec_parse@allowed-single.html
* igt@i915_pm_rpm@dpms-mode-unset-lpsp:
- {shard-rkl}: [SKIP][41] ([i915#1397]) -> [PASS][42] +1 similar issue
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-rkl-3/igt@i915_pm_rpm@dpms-mode-unset-lpsp.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-rkl-7/igt@i915_pm_rpm@dpms-mode-unset-lpsp.html
* igt@perf@stress-open-close@0-rcs0:
- shard-glk: [ABORT][43] ([i915#5213]) -> [PASS][44] +1 similar issue
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-glk8/igt@perf@stress-open-close@0-rcs0.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-glk9/igt@perf@stress-open-close@0-rcs0.html
* igt@perf_pmu@idle@rcs0:
- {shard-dg1}: [FAIL][45] ([i915#4349]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7240/shard-dg1-17/igt@perf_pmu@idle@rcs0.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/shard-dg1-15/igt@perf_pmu@idle@rcs0.html
{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#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110542]: https://bugs.freedesktop.org/show_bug.cgi?id=110542
[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
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1339]: https://gitlab.freedesktop.org/drm/intel/issues/1339
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1937]: https://gitlab.freedesktop.org/drm/intel/issues/1937
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2434]: https://gitlab.freedesktop.org/drm/intel/issues/2434
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[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#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
[i915#284]: https://gitlab.freedesktop.org/drm/intel/issues/284
[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#315]: https://gitlab.freedesktop.org/drm/intel/issues/315
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3528]: https://gitlab.freedesktop.org/drm/intel/issues/3528
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[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#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
[i915#3778]: https://gitlab.freedesktop.org/drm/intel/issues/3778
[i915#3804]: https://gitlab.freedesktop.org/drm/intel/issues/3804
[i915#3840]: https://gitlab.freedesktop.org/drm/intel/issues/3840
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3989]: https://gitlab.freedesktop.org/drm/intel/issues/3989
[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#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4281]: https://gitlab.freedesktop.org/drm/intel/issues/4281
[i915#433]: https://gitlab.freedesktop.org/drm/intel/issues/433
[i915#4349]: https://gitlab.freedesktop.org/drm/intel/issues/4349
[i915#4387]: https://gitlab.freedesktop.org/drm/intel/issues/4387
[i915#4528]: https://gitlab.freedesktop.org/drm/intel/issues/4528
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4816]: https://gitlab.freedesktop.org/drm/intel/issues/4816
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#4859]: https://gitlab.freedesktop.org/drm/intel/issues/4859
[i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
[i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
[i915#4879]: https://gitlab.freedesktop.org/drm/intel/issues/4879
[i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
[i915#4881]: https://gitlab.freedesktop.org/drm/intel/issues/4881
[i915#4885]: https://gitlab.freedesktop.org/drm/intel/issues/4885
[i915#4958]: https://gitlab.freedesktop.org/drm/intel/issues/4958
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5213]: https://gitlab.freedesktop.org/drm/intel/issues/5213
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
[i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
[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#6334]: https://gitlab.freedesktop.org/drm/intel/issues/6334
[i915#6335]: https://gitlab.freedesktop.org/drm/intel/issues/6335
[i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
[i915#6537]: https://gitlab.freedesktop.org/drm/intel/issues/6537
[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#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
[i915#6953]: https://gitlab.freedesktop.org/drm/intel/issues/6953
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[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#7975]: https://gitlab.freedesktop.org/drm/intel/issues/7975
[i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
[i915#8211]: https://gitlab.freedesktop.org/drm/intel/issues/8211
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7240 -> IGTPW_8761
CI-20190529: 20190529
CI_DRM_12971: 3404365be0b9c30980dde0c148fc4f89a21c29d1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8761: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/index.html
IGT_7240: ef4550e3b7d3c11ba257006bc7d4f8e421667d46 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8761/index.html
[-- Attachment #2: Type: text/html, Size: 14335 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 3/3] tests/kms_dirtyfb: Add new test for dirtyfb ioctl
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_dirtyfb: Add new test for dirtyfb ioctl Jouni Högander
2023-04-05 12:59 ` Maarten Lankhorst
@ 2023-04-06 7:20 ` Kamil Konieczny
2023-04-12 9:46 ` Hogander, Jouni
1 sibling, 1 reply; 11+ messages in thread
From: Kamil Konieczny @ 2023-04-06 7:20 UTC (permalink / raw)
To: igt-dev
Hi,
On 2023-04-05 at 08:34:51 +0300, Jouni Högander wrote:
> Add new test to validate dirtyfb ioctl is working properly with GPU
> frontbuffer rendering.
>
> Create big framebuffer and use only lower right corner for the
> plane. Initiate GPU drawing for a rectangle over the whole
> framebuffer and perform dirtyfb ioctl. Then wait for the drawing to
> complete and collect crc and check that it matches with expected.
>
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
> tests/i915/kms_dirtyfb.c | 309 +++++++++++++++++++++++++++++++++++++++
> tests/meson.build | 8 +
> 2 files changed, 317 insertions(+)
> create mode 100644 tests/i915/kms_dirtyfb.c
>
> diff --git a/tests/i915/kms_dirtyfb.c b/tests/i915/kms_dirtyfb.c
> new file mode 100644
> index 00000000..99d4231d
> --- /dev/null
> +++ b/tests/i915/kms_dirtyfb.c
> @@ -0,0 +1,309 @@
> +/*
Please add SPDX licence here.
> + * Copyright © 2023 Intel Corporation
> + *
Delete below text as we should use SPDX instead.
Regards,
Kamil
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + */
> +
> +#include <sys/types.h>
> +
> +#include "igt.h"
> +#include "igt_psr.h"
> +
> +#include "kms_fbc_helper.h"
> +#include "kms_drrs_helper.h"
> +
> +IGT_TEST_DESCRIPTION("Test the DIRTYFB ioctl is working properly with "
> + "its related features: FBC, PSR and DRRS");
> +
> +#ifndef PAGE_ALIGN
> +#ifndef PAGE_SIZE
> +#define PAGE_SIZE 4096
> +#endif
> +#define PAGE_ALIGN(x) ALIGN(x, PAGE_SIZE)
> +#endif
> +
> +typedef struct {
> + int drm_fd;
> + int debugfs_fd;
> + igt_display_t display;
> + drmModeModeInfo *mode;
> + igt_output_t *output;
> + igt_pipe_crc_t *pipe_crc;
> + enum pipe pipe;
> +
> + struct igt_fb fbs[3];
> +
> + igt_crc_t ref_crc;
> +
> + struct buf_ops *bops;
> + enum {
> + FEATURE_NONE = 0,
> + FEATURE_PSR = 1,
> + FEATURE_FBC = 2,
> + FEATURE_DRRS = 4,
> + FEATURE_COUNT = 8,
> + FEATURE_DEFAULT = 8,
> + } feature;
> +} data_t;
> +
> +static const char *feature_str(int feature)
> +{
> + switch (feature) {
> + case FEATURE_NONE:
> + return "nop";
> + case FEATURE_FBC:
> + return "fbc";
> + case FEATURE_PSR:
> + return "psr";
> + case FEATURE_DRRS:
> + return "drrs";
> + case FEATURE_DEFAULT:
> + return "default";
> + default:
> + igt_assert(false);
> + }
> +}
> +
> +static bool check_support(data_t *data)
> +{
> + switch (data->feature) {
> + case FEATURE_NONE:
> + return true;
> + case FEATURE_FBC:
> + return fbc_supported_on_chipset(data->drm_fd, data->pipe);
> + case FEATURE_PSR:
> + return psr_sink_support(data->drm_fd, data->debugfs_fd,
> + PSR_MODE_1);
> + case FEATURE_DRRS:
> + return is_drrs_supported(data->drm_fd, data->pipe) &&
> + output_has_drrs(data->drm_fd, data->output);
> + case FEATURE_DEFAULT:
> + return true;
> + default:
> + igt_assert(false);
> + }
> +}
> +
> +static void enable_feature(data_t *data)
> +{
> + switch (data->feature) {
> + case FEATURE_NONE:
> + break;
> + case FEATURE_FBC:
> + fbc_enable(data->drm_fd);
> + break;
> + case FEATURE_PSR:
> + psr_enable(data->drm_fd, data->debugfs_fd, PSR_MODE_1);
> + break;
> + case FEATURE_DRRS:
> + drrs_enable(data->drm_fd, data->pipe);
> + break;
> + case FEATURE_DEFAULT:
> + break;
> + default:
> + igt_assert(false);
> + }
> +}
> +
> +static void check_feature(data_t *data)
> +{
> + switch (data->feature) {
> + case FEATURE_NONE:
> + break;
> + case FEATURE_FBC:
> + igt_assert_f(fbc_wait_until_enabled(data->drm_fd, data->pipe),
> + "FBC still disabled");
> + break;
> + case FEATURE_PSR:
> + igt_assert_f(psr_wait_entry(data->debugfs_fd, PSR_MODE_1),
> + "PSR still disabled\n");
> + break;
> + case FEATURE_DRRS:
> + igt_assert_f(is_drrs_inactive(data->drm_fd, data->pipe),
> + "DRRS INACTIVE\n");
> + break;
> + case FEATURE_DEFAULT:
> + break;
> + default:
> + igt_assert(false);
> + }
> +}
> +
> +static void disable_features(data_t *data)
> +{
> + fbc_disable(data->drm_fd);
> + psr_disable(data->drm_fd, data->debugfs_fd);
> + drrs_disable(data->drm_fd, data->pipe);
> +}
> +
> +static void prepare(data_t *data)
> +{
> + igt_plane_t *primary;
> + drmModeResPtr res;
> +
> + igt_skip_on(!check_support(data));
> +
> + data->mode = igt_output_get_mode(data->output);
> +
> + igt_output_set_pipe(data->output, data->pipe);
> +
> + data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
> + IGT_PIPE_CRC_SOURCE_AUTO);
> +
> + igt_create_color_fb(data->drm_fd, data->mode->hdisplay,
> + data->mode->hdisplay, DRM_FORMAT_XRGB8888,
> + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> + &data->fbs[0]);
> + igt_draw_rect_fb(data->drm_fd, data->bops, 0, &data->fbs[0],
> + IGT_DRAW_RENDER, 0, 0, data->fbs[0].width,
> + data->fbs[0].height, 0xFF);
> +
> + primary = igt_output_get_plane_type(data->output,
> + DRM_PLANE_TYPE_PRIMARY);
> +
> + igt_plane_set_fb(primary, &data->fbs[0]);
> +
> + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> + igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
> +
> + res = drmModeGetResources(data->drm_fd);
> +
> + igt_create_color_fb(data->drm_fd, res->max_width,
> + res->max_height, DRM_FORMAT_XRGB8888,
> + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> + &data->fbs[1]);
> + igt_draw_rect_fb(data->drm_fd, data->bops, 0, &data->fbs[1],
> + IGT_DRAW_MMAP_CPU, 0, 0, data->fbs[1].width,
> + data->fbs[1].height, 0xFF);
> +
> + igt_create_color_fb(data->drm_fd, res->max_width,
> + res->max_height, DRM_FORMAT_XRGB8888,
> + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> + &data->fbs[2]);
> +
> + igt_plane_set_fb(primary, &data->fbs[2]);
> + igt_fb_set_position(&data->fbs[2], primary,
> + data->fbs[2].width - data->fbs[0].width,
> + data->fbs[2].height - data->fbs[0].height);
> + igt_fb_set_size(&data->fbs[2], primary, data->fbs[0].width,
> + data->fbs[0].height);
> +
> + enable_feature(data);
> +
> + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> + check_feature(data);
> +}
> +
> +static void cleanup(data_t *data)
> +{
> + igt_remove_fb(data->drm_fd, &data->fbs[0]);
> + igt_remove_fb(data->drm_fd, &data->fbs[1]);
> +
> + igt_pipe_crc_free(data->pipe_crc);
> +
> + disable_features(data);
> +
> + igt_output_set_pipe(data->output, PIPE_NONE);
> +
> + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +}
> +
> +static void run_test(data_t *data)
> +{
> + igt_crc_t crc;
> + struct intel_buf *src, *dst;
> + struct intel_bb *ibb;
> + uint32_t devid = intel_get_drm_devid(data->drm_fd);
> + igt_render_copyfunc_t rendercopy = igt_get_render_copyfunc(devid);
> + int r;
> +
> + igt_skip_on(!rendercopy);
> +
> + src = intel_buf_create_using_handle(data->bops, data->fbs[1].gem_handle,
> + data->fbs[1].width,
> + data->fbs[1].height,
> + igt_drm_format_to_bpp(data->fbs[1].drm_format),
> + 0, igt_fb_mod_to_tiling(data->fbs[1].modifier), 0);
> + dst = intel_buf_create_using_handle(data->bops, data->fbs[2].gem_handle,
> + data->fbs[2].width,
> + data->fbs[2].height,
> + igt_drm_format_to_bpp(data->fbs[2].drm_format),
> + 0, igt_fb_mod_to_tiling(data->fbs[2].modifier), 0);
> + ibb = intel_bb_create_with_context(data->drm_fd, 0, NULL, PAGE_SIZE);
> +
> + rendercopy(ibb, src, 0, 0, data->fbs[2].width, data->fbs[2].height, dst, 0, 0);
> +
> + /* Perfom dirtyfb right after initiating rendercopy */
> + r = drmModeDirtyFB(data->drm_fd, data->fbs[2].fb_id, NULL, 0);
> + igt_assert(r == 0 || r == -ENOSYS);
> +
> + /* Ensure rendercopy is complete */
> + intel_bb_sync(ibb);
> +
> + intel_bb_destroy(ibb);
> + intel_buf_destroy(src);
> + intel_buf_destroy(dst);
> +
> + igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
> + igt_assert_crc_equal(&crc, &data->ref_crc);
> +}
> +
> +igt_main
> +{
> + data_t data = {};
> +
> + igt_fixture {
> + data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
> + data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> + kmstest_set_vt_graphics_mode();
> +
> + igt_display_require(&data.display, data.drm_fd);
> +
> + data.bops = buf_ops_create(data.drm_fd);
> +
> + igt_display_reset(&data.display);
> + }
> +
> + igt_describe("Test dirtyFB ioctl");
> + igt_subtest_with_dynamic("dirtyfb-ioctl") {
> + data.pipe = PIPE_A;
> + for_each_valid_output_on_pipe(&data.display, data.pipe,
> + data.output) {
> + for (data.feature = FEATURE_DEFAULT; data.feature > 0;
> + data.feature = data.feature >> 1) {
> + igt_dynamic_f("%s-%s", feature_str(data.feature),
> + igt_output_name(data.output)) {
> + prepare(&data);
> + run_test(&data);
> + cleanup(&data);
> + }
> + }
> + }
> + }
> +
> + igt_fixture {
> + buf_ops_destroy(data.bops);
> + igt_display_fini(&data.display);
> + close(data.drm_fd);
> + }
> +}
> diff --git a/tests/meson.build b/tests/meson.build
> index 8fa69af3..a286a9b8 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -494,6 +494,14 @@ test_executables += executable('kms_frontbuffer_tracking',
> install : true)
> test_list += 'kms_frontbuffer_tracking'
>
> +test_executables += executable('kms_dirtyfb',
> + [ join_paths('i915', 'kms_dirtyfb.c'), join_paths ('i915', 'kms_fbc_helper.c'), join_paths ('i915', 'kms_drrs_helper.c')],
> + dependencies : test_deps,
> + install_dir : libexecdir,
> + install_rpath : libexecdir_rpathdir,
> + install : true)
> +test_list += 'kms_frontbuffer_tracking'
> +
> if chamelium.found()
> test_executables += executable('kms_chamelium_color',
> [ 'chamelium/kms_chamelium_color.c', 'kms_color_helper.c' ],
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 3/3] tests/kms_dirtyfb: Add new test for dirtyfb ioctl
2023-04-05 12:59 ` Maarten Lankhorst
@ 2023-04-12 9:45 ` Hogander, Jouni
0 siblings, 0 replies; 11+ messages in thread
From: Hogander, Jouni @ 2023-04-12 9:45 UTC (permalink / raw)
To: igt-dev@lists.freedesktop.org, maarten.lankhorst@linux.intel.com
Thank you Maarten for checking my path. Please see my inline responses
below and the new patch set.
On Wed, 2023-04-05 at 14:59 +0200, Maarten Lankhorst wrote:
> Hey,
>
> There's a gray area between i915 and Xe, and between lib and tests.
>
> I think in this case, it makes a lot of sense to move those helpers
> into
> lib/ instead,
>
> it will be useful outside i915 specific tests, as they will have to
> run
> on Xe as well.
>
> Probably best to simply add a intel_* prefix to each function, and
> move
> them into igt/i915/kms_*.[ch]
>
> Personally, I feel the existing igt/igt_psr.c belongs there too.
>
> Also I noticed debugfs_fd, because those tests don't need to be
> optimized, it can be moved into the functions.
I moved fbc and drrs helpers into libigt. I didn't touch existing psr
helpers as that is somehow out of scope in this patch set.
>
>
> Cheers,
>
> ~Maarten
>
> On 2023-04-05 07:34, Jouni Högander wrote:
> > Add new test to validate dirtyfb ioctl is working properly with GPU
> > frontbuffer rendering.
> >
> > Create big framebuffer and use only lower right corner for the
> > plane. Initiate GPU drawing for a rectangle over the whole
> > framebuffer and perform dirtyfb ioctl. Then wait for the drawing to
> > complete and collect crc and check that it matches with expected.
> >
> > Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> > ---
> > tests/i915/kms_dirtyfb.c | 309
> > +++++++++++++++++++++++++++++++++++++++
> > tests/meson.build | 8 +
> > 2 files changed, 317 insertions(+)
> > create mode 100644 tests/i915/kms_dirtyfb.c
> >
> > diff --git a/tests/i915/kms_dirtyfb.c b/tests/i915/kms_dirtyfb.c
> > new file mode 100644
> > index 00000000..99d4231d
> > --- /dev/null
> > +++ b/tests/i915/kms_dirtyfb.c
> > @@ -0,0 +1,309 @@
> > +/*
> > + * Copyright © 2023 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person
> > obtaining a
> > + * copy of this software and associated documentation files (the
> > "Software"),
> > + * to deal in the Software without restriction, including without
> > limitation
> > + * the rights to use, copy, modify, merge, publish, distribute,
> > sublicense,
> > + * and/or sell copies of the Software, and to permit persons to
> > whom the
> > + * Software is furnished to do so, subject to the following
> > conditions:
> > + *
> > + * The above copyright notice and this permission notice
> > (including the next
> > + * paragraph) shall be included in all copies or substantial
> > portions of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
> > EVENT SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
> > DAMAGES OR OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > OTHER DEALINGS
> > + * IN THE SOFTWARE.
> > + *
> > + */
> > +
> > +#include <sys/types.h>
> > +
> > +#include "igt.h"
> > +#include "igt_psr.h"
> > +
> > +#include "kms_fbc_helper.h"
> > +#include "kms_drrs_helper.h"
> > +
> > +IGT_TEST_DESCRIPTION("Test the DIRTYFB ioctl is working properly
> > with "
> > + "its related features: FBC, PSR and DRRS");
> > +
> > +#ifndef PAGE_ALIGN
> > +#ifndef PAGE_SIZE
> > +#define PAGE_SIZE 4096
> > +#endif
> > +#define PAGE_ALIGN(x) ALIGN(x, PAGE_SIZE)
> > +#endif
> > +
> > +typedef struct {
> > + int drm_fd;
> > + int debugfs_fd;
> > + igt_display_t display;
> > + drmModeModeInfo *mode;
> > + igt_output_t *output;
> > + igt_pipe_crc_t *pipe_crc;
> > + enum pipe pipe;
> > +
> > + struct igt_fb fbs[3];
> > +
> > + igt_crc_t ref_crc;
> > +
> > + struct buf_ops *bops;
> > + enum {
> > + FEATURE_NONE = 0,
> > + FEATURE_PSR = 1,
> > + FEATURE_FBC = 2,
> > + FEATURE_DRRS = 4,
> > + FEATURE_COUNT = 8,
> > + FEATURE_DEFAULT = 8,
> > + } feature;
> > +} data_t;
> > +
> > +static const char *feature_str(int feature)
> > +{
> > + switch (feature) {
> > + case FEATURE_NONE:
> > + return "nop";
> > + case FEATURE_FBC:
> > + return "fbc";
> > + case FEATURE_PSR:
> > + return "psr";
> > + case FEATURE_DRRS:
> > + return "drrs";
> > + case FEATURE_DEFAULT:
> > + return "default";
> > + default:
> > + igt_assert(false);
> > + }
> > +}
> > +
> > +static bool check_support(data_t *data)
> > +{
> > + switch (data->feature) {
> > + case FEATURE_NONE:
> > + return true;
> > + case FEATURE_FBC:
> > + return fbc_supported_on_chipset(data->drm_fd, data-
> > >pipe);
> > + case FEATURE_PSR:
> > + return psr_sink_support(data->drm_fd, data-
> > >debugfs_fd,
> > + PSR_MODE_1);
> > + case FEATURE_DRRS:
> > + return is_drrs_supported(data->drm_fd, data->pipe)
> > &&
> > + output_has_drrs(data->drm_fd, data-
> > >output);
> > + case FEATURE_DEFAULT:
> > + return true;
> > + default:
> > + igt_assert(false);
> > + }
> > +}
> > +
> > +static void enable_feature(data_t *data)
> > +{
> > + switch (data->feature) {
> > + case FEATURE_NONE:
> > + break;
> > + case FEATURE_FBC:
> > + fbc_enable(data->drm_fd);
> > + break;
> > + case FEATURE_PSR:
> > + psr_enable(data->drm_fd, data->debugfs_fd,
> > PSR_MODE_1);
> > + break;
> > + case FEATURE_DRRS:
> > + drrs_enable(data->drm_fd, data->pipe);
> > + break;
> > + case FEATURE_DEFAULT:
> > + break;
> > + default:
> > + igt_assert(false);
> > + }
> > +}
> > +
> > +static void check_feature(data_t *data)
> > +{
> > + switch (data->feature) {
> > + case FEATURE_NONE:
> > + break;
> > + case FEATURE_FBC:
> > + igt_assert_f(fbc_wait_until_enabled(data->drm_fd,
> > data->pipe),
> > + "FBC still disabled");
> > + break;
> > + case FEATURE_PSR:
> > + igt_assert_f(psr_wait_entry(data->debugfs_fd,
> > PSR_MODE_1),
> > + "PSR still disabled\n");
> > + break;
> > + case FEATURE_DRRS:
> > + igt_assert_f(is_drrs_inactive(data->drm_fd, data-
> > >pipe),
> > + "DRRS INACTIVE\n");
> > + break;
> > + case FEATURE_DEFAULT:
> > + break;
> > + default:
> > + igt_assert(false);
> > + }
> > +}
> > +
> > +static void disable_features(data_t *data)
> > +{
> > + fbc_disable(data->drm_fd);
> > + psr_disable(data->drm_fd, data->debugfs_fd);
> > + drrs_disable(data->drm_fd, data->pipe);
> > +}
> > +
> > +static void prepare(data_t *data)
> > +{
> > + igt_plane_t *primary;
> > + drmModeResPtr res;
> > +
> > + igt_skip_on(!check_support(data));
> > +
> > + data->mode = igt_output_get_mode(data->output);
> > +
> > + igt_output_set_pipe(data->output, data->pipe);
> > +
> > + data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
> > + IGT_PIPE_CRC_SOURCE_AUTO);
> > +
> > + igt_create_color_fb(data->drm_fd, data->mode->hdisplay,
> > + data->mode->hdisplay,
> > DRM_FORMAT_XRGB8888,
> > + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> > + &data->fbs[0]);
> > + igt_draw_rect_fb(data->drm_fd, data->bops, 0, &data-
> > >fbs[0],
> > + IGT_DRAW_RENDER, 0, 0, data->fbs[0].width,
> > + data->fbs[0].height, 0xFF);
> > +
> > + primary = igt_output_get_plane_type(data->output,
> > +
> > DRM_PLANE_TYPE_PRIMARY);
> > +
> > + igt_plane_set_fb(primary, &data->fbs[0]);
> > +
> > + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +
> > + igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
> > +
> > + res = drmModeGetResources(data->drm_fd);
> > +
> > + igt_create_color_fb(data->drm_fd, res->max_width,
> > + res->max_height, DRM_FORMAT_XRGB8888,
> > + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> > + &data->fbs[1]);
> > + igt_draw_rect_fb(data->drm_fd, data->bops, 0, &data-
> > >fbs[1],
> > + IGT_DRAW_MMAP_CPU, 0, 0, data-
> > >fbs[1].width,
> > + data->fbs[1].height, 0xFF);
> > +
> > + igt_create_color_fb(data->drm_fd, res->max_width,
> > + res->max_height, DRM_FORMAT_XRGB8888,
> > + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> > + &data->fbs[2]);
> > +
> > + igt_plane_set_fb(primary, &data->fbs[2]);
> > + igt_fb_set_position(&data->fbs[2], primary,
> > + data->fbs[2].width - data-
> > >fbs[0].width,
> > + data->fbs[2].height - data-
> > >fbs[0].height);
> > + igt_fb_set_size(&data->fbs[2], primary, data->fbs[0].width,
> > + data->fbs[0].height);
> > +
> > + enable_feature(data);
> > +
> > + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +
> > + check_feature(data);
> > +}
> > +
> > +static void cleanup(data_t *data)
> > +{
> > + igt_remove_fb(data->drm_fd, &data->fbs[0]);
> > + igt_remove_fb(data->drm_fd, &data->fbs[1]);
> > +
> > + igt_pipe_crc_free(data->pipe_crc);
> > +
> > + disable_features(data);
> Should probably only do this if != FEATURE_DEFAULT
> > +
> > + igt_output_set_pipe(data->output, PIPE_NONE);
> > +
> > + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +}
> > +
> > +static void run_test(data_t *data)
> > +{
> > + igt_crc_t crc;
> > + struct intel_buf *src, *dst;
> > + struct intel_bb *ibb;
> > + uint32_t devid = intel_get_drm_devid(data->drm_fd);
> > + igt_render_copyfunc_t rendercopy =
> > igt_get_render_copyfunc(devid);
> > + int r;
> > +
> > + igt_skip_on(!rendercopy);
> > +
> > + src = intel_buf_create_using_handle(data->bops, data-
> > >fbs[1].gem_handle,
> > + data->fbs[1].width,
> > + data->fbs[1].height,
> > +
> > igt_drm_format_to_bpp(data->fbs[1].drm_format),
> > + 0,
> > igt_fb_mod_to_tiling(data->fbs[1].modifier), 0);
> > + dst = intel_buf_create_using_handle(data->bops, data-
> > >fbs[2].gem_handle,
> > + data->fbs[2].width,
> > + data->fbs[2].height,
> > +
> > igt_drm_format_to_bpp(data->fbs[2].drm_format),
> > + 0,
> > igt_fb_mod_to_tiling(data->fbs[2].modifier), 0);
> > + ibb = intel_bb_create_with_context(data->drm_fd, 0, NULL,
> > PAGE_SIZE);
> > +
> > + rendercopy(ibb, src, 0, 0, data->fbs[2].width, data-
> > >fbs[2].height, dst, 0, 0);
> > +
> > + /* Perfom dirtyfb right after initiating rendercopy */
> > + r = drmModeDirtyFB(data->drm_fd, data->fbs[2].fb_id, NULL,
> > 0);
> > + igt_assert(r == 0 || r == -ENOSYS);
> > +
> > + /* Ensure rendercopy is complete */
> > + intel_bb_sync(ibb);
> > +
> > + intel_bb_destroy(ibb);
> > + intel_buf_destroy(src);
> > + intel_buf_destroy(dst);
> > +
> > + igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
> This crc should probably be collected immediately after DirtyFB
> completes, otherwise you only check that the copy worked?
No, intel_bb_sync is required to ensure drawing/copying is complete.
Oterwise it will collect crc over incomplete drawing. This is also
related to reason why we can't remove those frontbuffer tracking i915
gem hooks either -> There wont be noone to flush the endresult of this
rendercopy when it completes if we remove them. I'm working on
implementing this flush into dirtyfb itself which might allow us to
remove those gem hooks.
> > + igt_assert_crc_equal(&crc, &data->ref_crc);
> > +}
> > +
> > +igt_main
> > +{
> > + data_t data = {};
> > +
> > + igt_fixture {
> > + data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
> > + data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> > + kmstest_set_vt_graphics_mode();
> > +
> > + igt_display_require(&data.display, data.drm_fd);
> > +
> > + data.bops = buf_ops_create(data.drm_fd);
> > +
> > + igt_display_reset(&data.display);
> > + }
> > +
> > + igt_describe("Test dirtyFB ioctl");
> > + igt_subtest_with_dynamic("dirtyfb-ioctl") {
> > + data.pipe = PIPE_A;
> > + for_each_valid_output_on_pipe(&data.display,
> > data.pipe,
> > + data.output) {
> > + for (data.feature = FEATURE_DEFAULT;
> > data.feature > 0;
> > + data.feature = data.feature >> 1) {
> > + igt_dynamic_f("%s-%s",
> > feature_str(data.feature),
> > +
> > igt_output_name(data.output)) {
>
> Do we only care about PIPE_A here? Otherwise I would try to use each
> pipe at least once, since there are 2 fbc's on MTL, and some things
> may
> or may not work on different pipes.
>
> In that case, I would run the default feature test separately and
> first
> on each pipe, otherwise the defaults are only tested on pipe A.
There are opposite views on this. I.e. how often something that works
on pipe A is failing on pipe B? I still adjusted the testcase a bit. It
can be easily now modified later to iterate all pipes if wanted. Please
check my changes and consider if you are fine with that.
>
> Cheers,
>
> ~Maarten
>
BR,
Jouni Högander
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 3/3] tests/kms_dirtyfb: Add new test for dirtyfb ioctl
2023-04-06 7:20 ` Kamil Konieczny
@ 2023-04-12 9:46 ` Hogander, Jouni
0 siblings, 0 replies; 11+ messages in thread
From: Hogander, Jouni @ 2023-04-12 9:46 UTC (permalink / raw)
To: igt-dev@lists.freedesktop.org, kamil.konieczny@linux.intel.com
On Thu, 2023-04-06 at 09:20 +0200, Kamil Konieczny wrote:
> Hi,
>
> On 2023-04-05 at 08:34:51 +0300, Jouni Högander wrote:
> > Add new test to validate dirtyfb ioctl is working properly with GPU
> > frontbuffer rendering.
> >
> > Create big framebuffer and use only lower right corner for the
> > plane. Initiate GPU drawing for a rectangle over the whole
> > framebuffer and perform dirtyfb ioctl. Then wait for the drawing to
> > complete and collect crc and check that it matches with expected.
> >
> > Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> > ---
> > tests/i915/kms_dirtyfb.c | 309
> > +++++++++++++++++++++++++++++++++++++++
> > tests/meson.build | 8 +
> > 2 files changed, 317 insertions(+)
> > create mode 100644 tests/i915/kms_dirtyfb.c
> >
> > diff --git a/tests/i915/kms_dirtyfb.c b/tests/i915/kms_dirtyfb.c
> > new file mode 100644
> > index 00000000..99d4231d
> > --- /dev/null
> > +++ b/tests/i915/kms_dirtyfb.c
> > @@ -0,0 +1,309 @@
> > +/*
>
> Please add SPDX licence here.
>
> > + * Copyright © 2023 Intel Corporation
> > + *
>
> Delete below text as we should use SPDX instead.
Thank you Kamil for checking my patch. Please check new version where I
have addressed you comment.
>
> Regards,
> Kamil
>
> > + * Permission is hereby granted, free of charge, to any person
> > obtaining a
> > + * copy of this software and associated documentation files (the
> > "Software"),
> > + * to deal in the Software without restriction, including without
> > limitation
> > + * the rights to use, copy, modify, merge, publish, distribute,
> > sublicense,
> > + * and/or sell copies of the Software, and to permit persons to
> > whom the
> > + * Software is furnished to do so, subject to the following
> > conditions:
> > + *
> > + * The above copyright notice and this permission notice
> > (including the next
> > + * paragraph) shall be included in all copies or substantial
> > portions of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
> > EVENT SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
> > DAMAGES OR OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > OTHER DEALINGS
> > + * IN THE SOFTWARE.
> > + *
> > + */
> > +
> > +#include <sys/types.h>
> > +
> > +#include "igt.h"
> > +#include "igt_psr.h"
> > +
> > +#include "kms_fbc_helper.h"
> > +#include "kms_drrs_helper.h"
> > +
> > +IGT_TEST_DESCRIPTION("Test the DIRTYFB ioctl is working properly
> > with "
> > + "its related features: FBC, PSR and DRRS");
> > +
> > +#ifndef PAGE_ALIGN
> > +#ifndef PAGE_SIZE
> > +#define PAGE_SIZE 4096
> > +#endif
> > +#define PAGE_ALIGN(x) ALIGN(x, PAGE_SIZE)
> > +#endif
> > +
> > +typedef struct {
> > + int drm_fd;
> > + int debugfs_fd;
> > + igt_display_t display;
> > + drmModeModeInfo *mode;
> > + igt_output_t *output;
> > + igt_pipe_crc_t *pipe_crc;
> > + enum pipe pipe;
> > +
> > + struct igt_fb fbs[3];
> > +
> > + igt_crc_t ref_crc;
> > +
> > + struct buf_ops *bops;
> > + enum {
> > + FEATURE_NONE = 0,
> > + FEATURE_PSR = 1,
> > + FEATURE_FBC = 2,
> > + FEATURE_DRRS = 4,
> > + FEATURE_COUNT = 8,
> > + FEATURE_DEFAULT = 8,
> > + } feature;
> > +} data_t;
> > +
> > +static const char *feature_str(int feature)
> > +{
> > + switch (feature) {
> > + case FEATURE_NONE:
> > + return "nop";
> > + case FEATURE_FBC:
> > + return "fbc";
> > + case FEATURE_PSR:
> > + return "psr";
> > + case FEATURE_DRRS:
> > + return "drrs";
> > + case FEATURE_DEFAULT:
> > + return "default";
> > + default:
> > + igt_assert(false);
> > + }
> > +}
> > +
> > +static bool check_support(data_t *data)
> > +{
> > + switch (data->feature) {
> > + case FEATURE_NONE:
> > + return true;
> > + case FEATURE_FBC:
> > + return fbc_supported_on_chipset(data->drm_fd, data-
> > >pipe);
> > + case FEATURE_PSR:
> > + return psr_sink_support(data->drm_fd, data-
> > >debugfs_fd,
> > + PSR_MODE_1);
> > + case FEATURE_DRRS:
> > + return is_drrs_supported(data->drm_fd, data->pipe)
> > &&
> > + output_has_drrs(data->drm_fd, data-
> > >output);
> > + case FEATURE_DEFAULT:
> > + return true;
> > + default:
> > + igt_assert(false);
> > + }
> > +}
> > +
> > +static void enable_feature(data_t *data)
> > +{
> > + switch (data->feature) {
> > + case FEATURE_NONE:
> > + break;
> > + case FEATURE_FBC:
> > + fbc_enable(data->drm_fd);
> > + break;
> > + case FEATURE_PSR:
> > + psr_enable(data->drm_fd, data->debugfs_fd,
> > PSR_MODE_1);
> > + break;
> > + case FEATURE_DRRS:
> > + drrs_enable(data->drm_fd, data->pipe);
> > + break;
> > + case FEATURE_DEFAULT:
> > + break;
> > + default:
> > + igt_assert(false);
> > + }
> > +}
> > +
> > +static void check_feature(data_t *data)
> > +{
> > + switch (data->feature) {
> > + case FEATURE_NONE:
> > + break;
> > + case FEATURE_FBC:
> > + igt_assert_f(fbc_wait_until_enabled(data->drm_fd,
> > data->pipe),
> > + "FBC still disabled");
> > + break;
> > + case FEATURE_PSR:
> > + igt_assert_f(psr_wait_entry(data->debugfs_fd,
> > PSR_MODE_1),
> > + "PSR still disabled\n");
> > + break;
> > + case FEATURE_DRRS:
> > + igt_assert_f(is_drrs_inactive(data->drm_fd, data-
> > >pipe),
> > + "DRRS INACTIVE\n");
> > + break;
> > + case FEATURE_DEFAULT:
> > + break;
> > + default:
> > + igt_assert(false);
> > + }
> > +}
> > +
> > +static void disable_features(data_t *data)
> > +{
> > + fbc_disable(data->drm_fd);
> > + psr_disable(data->drm_fd, data->debugfs_fd);
> > + drrs_disable(data->drm_fd, data->pipe);
> > +}
> > +
> > +static void prepare(data_t *data)
> > +{
> > + igt_plane_t *primary;
> > + drmModeResPtr res;
> > +
> > + igt_skip_on(!check_support(data));
> > +
> > + data->mode = igt_output_get_mode(data->output);
> > +
> > + igt_output_set_pipe(data->output, data->pipe);
> > +
> > + data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
> > + IGT_PIPE_CRC_SOURCE_AUTO);
> > +
> > + igt_create_color_fb(data->drm_fd, data->mode->hdisplay,
> > + data->mode->hdisplay,
> > DRM_FORMAT_XRGB8888,
> > + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> > + &data->fbs[0]);
> > + igt_draw_rect_fb(data->drm_fd, data->bops, 0, &data-
> > >fbs[0],
> > + IGT_DRAW_RENDER, 0, 0, data->fbs[0].width,
> > + data->fbs[0].height, 0xFF);
> > +
> > + primary = igt_output_get_plane_type(data->output,
> > +
> > DRM_PLANE_TYPE_PRIMARY);
> > +
> > + igt_plane_set_fb(primary, &data->fbs[0]);
> > +
> > + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +
> > + igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
> > +
> > + res = drmModeGetResources(data->drm_fd);
> > +
> > + igt_create_color_fb(data->drm_fd, res->max_width,
> > + res->max_height, DRM_FORMAT_XRGB8888,
> > + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> > + &data->fbs[1]);
> > + igt_draw_rect_fb(data->drm_fd, data->bops, 0, &data-
> > >fbs[1],
> > + IGT_DRAW_MMAP_CPU, 0, 0, data-
> > >fbs[1].width,
> > + data->fbs[1].height, 0xFF);
> > +
> > + igt_create_color_fb(data->drm_fd, res->max_width,
> > + res->max_height, DRM_FORMAT_XRGB8888,
> > + DRM_FORMAT_MOD_LINEAR, 0.0, 1.0, 0.0,
> > + &data->fbs[2]);
> > +
> > + igt_plane_set_fb(primary, &data->fbs[2]);
> > + igt_fb_set_position(&data->fbs[2], primary,
> > + data->fbs[2].width - data-
> > >fbs[0].width,
> > + data->fbs[2].height - data-
> > >fbs[0].height);
> > + igt_fb_set_size(&data->fbs[2], primary, data->fbs[0].width,
> > + data->fbs[0].height);
> > +
> > + enable_feature(data);
> > +
> > + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +
> > + check_feature(data);
> > +}
> > +
> > +static void cleanup(data_t *data)
> > +{
> > + igt_remove_fb(data->drm_fd, &data->fbs[0]);
> > + igt_remove_fb(data->drm_fd, &data->fbs[1]);
> > +
> > + igt_pipe_crc_free(data->pipe_crc);
> > +
> > + disable_features(data);
> > +
> > + igt_output_set_pipe(data->output, PIPE_NONE);
> > +
> > + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +}
> > +
> > +static void run_test(data_t *data)
> > +{
> > + igt_crc_t crc;
> > + struct intel_buf *src, *dst;
> > + struct intel_bb *ibb;
> > + uint32_t devid = intel_get_drm_devid(data->drm_fd);
> > + igt_render_copyfunc_t rendercopy =
> > igt_get_render_copyfunc(devid);
> > + int r;
> > +
> > + igt_skip_on(!rendercopy);
> > +
> > + src = intel_buf_create_using_handle(data->bops, data-
> > >fbs[1].gem_handle,
> > + data->fbs[1].width,
> > + data->fbs[1].height,
> > +
> > igt_drm_format_to_bpp(data->fbs[1].drm_format),
> > + 0,
> > igt_fb_mod_to_tiling(data->fbs[1].modifier), 0);
> > + dst = intel_buf_create_using_handle(data->bops, data-
> > >fbs[2].gem_handle,
> > + data->fbs[2].width,
> > + data->fbs[2].height,
> > +
> > igt_drm_format_to_bpp(data->fbs[2].drm_format),
> > + 0,
> > igt_fb_mod_to_tiling(data->fbs[2].modifier), 0);
> > + ibb = intel_bb_create_with_context(data->drm_fd, 0, NULL,
> > PAGE_SIZE);
> > +
> > + rendercopy(ibb, src, 0, 0, data->fbs[2].width, data-
> > >fbs[2].height, dst, 0, 0);
> > +
> > + /* Perfom dirtyfb right after initiating rendercopy */
> > + r = drmModeDirtyFB(data->drm_fd, data->fbs[2].fb_id, NULL,
> > 0);
> > + igt_assert(r == 0 || r == -ENOSYS);
> > +
> > + /* Ensure rendercopy is complete */
> > + intel_bb_sync(ibb);
> > +
> > + intel_bb_destroy(ibb);
> > + intel_buf_destroy(src);
> > + intel_buf_destroy(dst);
> > +
> > + igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
> > + igt_assert_crc_equal(&crc, &data->ref_crc);
> > +}
> > +
> > +igt_main
> > +{
> > + data_t data = {};
> > +
> > + igt_fixture {
> > + data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
> > + data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> > + kmstest_set_vt_graphics_mode();
> > +
> > + igt_display_require(&data.display, data.drm_fd);
> > +
> > + data.bops = buf_ops_create(data.drm_fd);
> > +
> > + igt_display_reset(&data.display);
> > + }
> > +
> > + igt_describe("Test dirtyFB ioctl");
> > + igt_subtest_with_dynamic("dirtyfb-ioctl") {
> > + data.pipe = PIPE_A;
> > + for_each_valid_output_on_pipe(&data.display,
> > data.pipe,
> > + data.output) {
> > + for (data.feature = FEATURE_DEFAULT;
> > data.feature > 0;
> > + data.feature = data.feature >> 1) {
> > + igt_dynamic_f("%s-%s",
> > feature_str(data.feature),
> > +
> > igt_output_name(data.output)) {
> > + prepare(&data);
> > + run_test(&data);
> > + cleanup(&data);
> > + }
> > + }
> > + }
> > + }
> > +
> > + igt_fixture {
> > + buf_ops_destroy(data.bops);
> > + igt_display_fini(&data.display);
> > + close(data.drm_fd);
> > + }
> > +}
> > diff --git a/tests/meson.build b/tests/meson.build
> > index 8fa69af3..a286a9b8 100644
> > --- a/tests/meson.build
> > +++ b/tests/meson.build
> > @@ -494,6 +494,14 @@ test_executables +=
> > executable('kms_frontbuffer_tracking',
> > install : true)
> > test_list += 'kms_frontbuffer_tracking'
> >
> > +test_executables += executable('kms_dirtyfb',
> > + [ join_paths('i915', 'kms_dirtyfb.c'), join_paths
> > ('i915', 'kms_fbc_helper.c'), join_paths ('i915',
> > 'kms_drrs_helper.c')],
> > + dependencies : test_deps,
> > + install_dir : libexecdir,
> > + install_rpath : libexecdir_rpathdir,
> > + install : true)
> > +test_list += 'kms_frontbuffer_tracking'
> > +
> > if chamelium.found()
> > test_executables += executable('kms_chamelium_color',
> > [ 'chamelium/kms_chamelium_color.c',
> > 'kms_color_helper.c' ],
> > --
> > 2.34.1
> >
BR,
Jouni Högander
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-04-12 9:46 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-05 5:34 [igt-dev] [PATCH i-g-t 0/3] Testcases for dirtyfb ioctl Jouni Högander
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 1/3] tests/i915/kms_frontbuffer_tracking: Split fbc into separate helper Jouni Högander
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 2/3] tests/i915/kms_frontbuffer_tracking: Split drrs Jouni Högander
2023-04-05 5:34 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_dirtyfb: Add new test for dirtyfb ioctl Jouni Högander
2023-04-05 12:59 ` Maarten Lankhorst
2023-04-12 9:45 ` Hogander, Jouni
2023-04-06 7:20 ` Kamil Konieczny
2023-04-12 9:46 ` Hogander, Jouni
2023-04-05 6:16 ` [igt-dev] ✗ Fi.CI.BAT: failure for Testcases " Patchwork
2023-04-05 14:35 ` [igt-dev] ✓ Fi.CI.BAT: success for Testcases for dirtyfb ioctl (rev2) Patchwork
2023-04-06 3:20 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox