Skip to contentSkip to conversation

add new subtests for dark screen detection

PATCH In review Kunal Joshi 3 participants 5 messages Nov 17, 2023 – Nov 22, 2023 Library code

lore
Share & tools
lore
#0 lore raw

cover add new subtests for dark screen detection

dark screen detection feature when enable will monitor frames and if black frame is detcted it will raise drm_error, added two tests for positive (black frame) and negative case (white frame)

Kunal Joshi (2):
lib/igt_debugfs: added helper to enable/disable dark screen detection tests/kms_pipe_crc_basic: added new subtest for darkscreen detection

 lib/igt_debugfs.c          | 24 +++++++++++++++++
 lib/igt_debugfs.h          |  2 ++
 tests/kms_pipe_crc_basic.c | 55 +++++++++++++++++++++++++++++++++-----
 3 files changed, 74 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 lib/igt_debugfs: added helper to enable/disable dark screen detection

added helper function for dark screen detection

v2: Fix indentation (JP)
Reduce complexity and redundancy (JP)

v3: Close fd (JP)
Use ternary operator (JP)

Cc Juha-Pekka Heikkila <[email protected]>
Cc Nemesa Garg <[email protected]>
Cc Arun R Murthy <[email protected]>
Cc Bhanuprakash Modem <[email protected]>
---
 lib/igt_debugfs.c | 24 ++++++++++++++++++++++++
 lib/igt_debugfs.h |  2 ++
 2 files changed, 26 insertions(+)
lib/igt_debugfs.c +24 -0
index a7b54bae5..a39405710 100644
@@ -743,3 +743,27 @@ void __igt_debugfs_dump(int device, const char *filename, int level)
 	igt_log(IGT_LOG_DOMAIN, level, "%s:\n%s\n", filename, contents);
 	free(contents);
 }
+
+bool igt_is_dark_screen_supported(int drm_fd, enum pipe pipe)
+{
+	char buf[256];
+	int dir;
+
+	dir = igt_debugfs_pipe_dir(drm_fd, pipe, O_DIRECTORY);
+	igt_require_fd(dir);
+	igt_debugfs_simple_read(dir, "i915_darkscreen_status", buf, sizeof(buf));
+	close(dir);
+	return (*buf == '0' || *buf == '1');
+}
+
+ssize_t igt_set_dark_screen_detection(int drm_fd, enum pipe pipe, bool enable)
+{
+	int dir;
+	int size;
+
+	dir = igt_debugfs_pipe_dir(drm_fd, pipe, O_DIRECTORY);
+	igt_require_fd(dir);
+	size = igt_sysfs_write(dir, "i915_darkscreen_status", enable ? "1" : "0", 1);
+	close(dir);
+	return size;
+}
lib/igt_debugfs.h +2 -0
index 3e6194ade..68f25be59 100644
@@ -77,6 +77,8 @@ void igt_hpd_storm_reset(int fd);
 bool igt_hpd_storm_detected(int fd);
 void igt_require_hpd_storm_ctl(int fd);
 bool igt_ignore_long_hpd(int fd, bool enable);
+bool igt_is_dark_screen_supported(int drm_fd, enum pipe pipe);
+ssize_t igt_set_dark_screen_detection(int drm_fd, enum pipe pipe, bool enable);
 
 /*
  * Drop caches
Signature · 1 line
2.25.1
#2 lore raw

Re: [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable dark screen detection

The code look all ok to me, those new functions just need the comment block above them as they're in lib and not static functions.

/Juha-Pekka

Quoted 63 lines · Kunal Joshi

added helper function for dark screen detection

v2: Fix indentation (JP)
Reduce complexity and redundancy (JP)

v3: Close fd (JP)
Use ternary operator (JP)

Cc Juha-Pekka Heikkila <[email protected]>
Cc Nemesa Garg <[email protected]>
Cc Arun R Murthy <[email protected]>
Cc Bhanuprakash Modem <[email protected]>
---
  lib/igt_debugfs.c | 24 ++++++++++++++++++++++++
  lib/igt_debugfs.h |  2 ++
  2 files changed, 26 insertions(+)
lib/igt_debugfs.c +24 -0
index a7b54bae5..a39405710 100644
@@ -743,3 +743,27 @@ void __igt_debugfs_dump(int device, const char *filename, int level)
  	igt_log(IGT_LOG_DOMAIN, level, "%s:\n%s\n", filename, contents);
  	free(contents);
  }
+
+bool igt_is_dark_screen_supported(int drm_fd, enum pipe pipe)
+{
+	char buf[256];
+	int dir;
+
+	dir = igt_debugfs_pipe_dir(drm_fd, pipe, O_DIRECTORY);
+	igt_require_fd(dir);
+	igt_debugfs_simple_read(dir, "i915_darkscreen_status", buf, sizeof(buf));
+	close(dir);
+	return (*buf == '0' || *buf == '1');
+}
+
+ssize_t igt_set_dark_screen_detection(int drm_fd, enum pipe pipe, bool enable)
+{
+	int dir;
+	int size;
+
+	dir = igt_debugfs_pipe_dir(drm_fd, pipe, O_DIRECTORY);
+	igt_require_fd(dir);
+	size = igt_sysfs_write(dir, "i915_darkscreen_status", enable ? "1" : "0", 1);
+	close(dir);
+	return size;
+}
lib/igt_debugfs.h +2 -0
index 3e6194ade..68f25be59 100644
@@ -77,6 +77,8 @@ void igt_hpd_storm_reset(int fd);
  bool igt_hpd_storm_detected(int fd);
  void igt_require_hpd_storm_ctl(int fd);
  bool igt_ignore_long_hpd(int fd, bool enable);
+bool igt_is_dark_screen_supported(int drm_fd, enum pipe pipe);
+ssize_t igt_set_dark_screen_detection(int drm_fd, enum pipe pipe, bool enable);
 
  /*
   * Drop caches
#3 lore raw

PATCH 2/2 tests/kms_pipe_crc_basic: added new subtest for darkscreen detection

In reply to Kunal Joshi

dark screen detection feature when enable will monitor frames and if black frame is detcted it will raise drm_error, added two tests for positive (black frame) and negative case (white frame)

Cc Nemesa Garg <[email protected]>
Cc Arun R Murthy <[email protected]>
Cc Bhanuprakash Modem <[email protected]>
---
 tests/kms_pipe_crc_basic.c | 55 +++++++++++++++++++++++++++++++++-----
 1 file changed, 48 insertions(+), 7 deletions(-)
tests/kms_pipe_crc_basic.c +48 -7
index 94252415b..3c1ad3097 100644
@@ -47,13 +47,10 @@ typedef struct {
 	struct igt_fb fb;
 } data_t;
 
-static struct {
+typedef struct {
 	double r, g, b;
 	igt_crc_t crc;
-} colors[2] = {
-	{ .r = 0.0, .g = 1.0, .b = 0.0 },
-	{ .r = 0.0, .g = 1.0, .b = 1.0 },
-};
+} color;
 
 static bool simulation_constraint(enum pipe pipe)
 {
@@ -92,6 +89,8 @@ enum {
 	TEST_NONBLOCK = 1 << 1,
 	TEST_SUSPEND = 1 << 2,
 	TEST_HANG = 1 << 3,
+	TEST_DARK_SCREEN = 1 << 4,
+	TEST_DARK_SCREEN_NEGATIVE = 1 << 5,
 };
 
 /**
@@ -136,6 +135,21 @@ enum {
  * Test category: functionality test
  * Functionality: crc, hang
  * Mega feature: General Display Features
+ *
+ * SUBTEST: darkscreen-read-crc
+ * Description: Test dark screen detection works
+ * Driver requirement: i915, xe
+ * Test category: functionality test
+ * Functionality: crc, hang, darkscreen
+ * Mega feature: General Display Features
+ *
+ * SUBTEST: negative-darkscreen-read-crc
+ * Description: Test false positives aren't reported by dark screen detection
+ * Driver requirement: i915, xe
+ * Test category: functionality test
+ * Functionality: crc, hang, darkscreen
+ * Mega feature: General Display Features
+ *
  */
 static void test_read_crc(data_t *data, enum pipe pipe,
 			  igt_output_t *output, unsigned flags)
@@ -144,7 +158,8 @@ static void test_read_crc(data_t *data, enum pipe pipe,
 	igt_plane_t *primary;
 	drmModeModeInfo *mode;
 	igt_crc_t *crcs = NULL;
-	int c, j;
+	color *colors;
+	int c, j, no_of_colors;
 
 	igt_display_reset(display);
 
@@ -153,7 +168,22 @@ static void test_read_crc(data_t *data, enum pipe pipe,
 
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
-	for (c = 0; c < ARRAY_SIZE(colors); c++) {
+	if (flags & TEST_DARK_SCREEN) {
+		no_of_colors = 1;
+		colors = (color *)malloc(no_of_colors * sizeof(color));
+		colors[0] = (color){ .r = 0.0, .g = 0.0, .b = 0.0 };
+	} else if (flags & TEST_DARK_SCREEN_NEGATIVE) {
+		no_of_colors = 1;
+		colors = (color *)malloc(no_of_colors * sizeof(color));
+		colors[0] = (color){ .r = 1.0, .g = 1.0, .b = 1.0 };
+	} else {
+		no_of_colors = 2;
+		colors = (color *)malloc(no_of_colors * sizeof(color));
+		colors[0] = (color){ .r = 0.0, .g = 1.0, .b = 0.0 };
+		colors[1] = (color){ .r = 0.0, .g = 1.0, .b = 1.0 };
+	}
+
+	for (c = 0; c < no_of_colors; c++) {
 		char *crc_str;
 		int n_crcs;
 
@@ -229,6 +259,7 @@ static void test_read_crc(data_t *data, enum pipe pipe,
 	}
 
 	/* Clean-up */
+	free(colors);
 	igt_output_set_pipe(output, PIPE_NONE);
 	igt_plane_set_fb(primary, NULL);
 	igt_display_commit(display);
@@ -422,6 +453,10 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL)
 			"Suspend test for pipe CRC reads." },
 		{ "hang-read-crc", TEST_HANG,
 			"Hang test for pipe CRC read." },
+		{"darkscreen-read-crc", TEST_DARK_SCREEN,
+			"Test dark screen detection works."},
+		{"negative-darkscreen-read-crc", TEST_DARK_SCREEN_NEGATIVE,
+			"Test false positives aren't reported by dark screen detection."},
 	};
 	int i;
 	last_pipe = 0;
@@ -475,6 +510,12 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL)
 						test_read_crc(&data, pipe, output, 0);
 
 						igt_disallow_hang(data.drm_fd, hang);
+					} else if (tests[i].flags & TEST_DARK_SCREEN || tests[i].flags & TEST_DARK_SCREEN_NEGATIVE) {
+						igt_require_f(igt_is_dark_screen_supported(data.drm_fd, pipe),
+							     "Dark Screen Detection not supported\n");
+						igt_set_dark_screen_detection(data.drm_fd, pipe, true);
+						test_read_crc(&data, pipe, output, tests[i].flags);
+						igt_set_dark_screen_detection(data.drm_fd, pipe, false);
 					} else {
 						test_read_crc(&data, pipe, output, tests[i].flags);
 					}
Signature · 1 line
2.25.1
#4 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for add new subtests for dark screen detection (rev3)

In reply to Kunal Joshi
== Series Details ==

== Series Details ==

Series: add new subtests for dark screen detection (rev3)
URL : https://patchwork.freedesktop.org/series/125880/
State : failure

== Summary ==

CI Bug Log - changes from IGT_7592 -> IGTPW_10207
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_10207 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in IGTPW_10207, please notify your bug team ([email protected]) 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_10207/index.html

Participating hosts (38 -> 36)
------------------------------

Additional (1): fi-pnv-d510
Missing (3): bat-mtlp-8 bat-dg2-9 fi-snb-2520m

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_10207:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@migrate:
- fi-hsw-4770: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/fi-hsw-4770/igt@i915_selftest@[email protected]

Known issues
------------

Here are the changes found in IGTPW_10207 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_lmem_swapping@basic:
- fi-pnv-d510: NOTRUN -> [SKIP][2] ([fdo#109271]) +25 other tests skip
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/fi-pnv-d510/igt@[email protected]

* igt@gem_lmem_swapping@verify-random:
- fi-hsw-4770: NOTRUN -> [SKIP][3] ([fdo#109271]) +3 other tests skip
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/fi-hsw-4770/igt@[email protected]

* igt@i915_selftest@live@mman:
- bat-rpls-1: [PASS][4] -> [TIMEOUT][5] ([i915#6794] / [i915#7392])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7592/bat-rpls-1/igt@i915_selftest@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-rpls-1/igt@i915_selftest@[email protected]

* igt@i915_suspend@basic-s2idle-without-i915:
- bat-rpls-1: [PASS][6] -> [WARN][7] ([i915#8747])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7592/bat-rpls-1/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-rpls-1/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-adlp-6: NOTRUN -> [SKIP][8] ([fdo#109285])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-adlp-6/igt@[email protected]

* igt@kms_hdmi_inject@inject-audio:
- fi-kbl-guc: [PASS][9] -> [FAIL][10] ([IGT#3])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7592/fi-kbl-guc/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/fi-kbl-guc/igt@[email protected]

* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
- bat-adlp-9: NOTRUN -> [SKIP][11] ([i915#1845] / [i915#3546]) +2 other tests skip
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-adlp-9/igt@[email protected]
- bat-dg2-11: NOTRUN -> [SKIP][12] ([i915#1845] / [i915#9197]) +3 other tests skip
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-dg2-11/igt@[email protected]

#### Possible fixes ####

* igt@i915_suspend@basic-s3-without-i915:
- bat-adlp-9: [INCOMPLETE][13] ([i915#7443]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7592/bat-adlp-9/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-adlp-9/igt@[email protected]

* igt@kms_flip@basic-flip-vs-modeset@a-edp1:
- bat-adlp-6: [INCOMPLETE][15] -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7592/bat-adlp-6/igt@kms_flip@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-adlp-6/igt@kms_flip@[email protected]

* igt@vgem_basic@unload:
- fi-hsw-4770: [INCOMPLETE][17] -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7592/fi-hsw-4770/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/fi-hsw-4770/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[IGT#3]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/3
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#6794]: https://gitlab.freedesktop.org/drm/intel/issues/6794
[i915#7359]: https://gitlab.freedesktop.org/drm/intel/issues/7359
[i915#7392]: https://gitlab.freedesktop.org/drm/intel/issues/7392
[i915#7443]: https://gitlab.freedesktop.org/drm/intel/issues/7443
[i915#8668]: https://gitlab.freedesktop.org/drm/intel/issues/8668
[i915#8747]: https://gitlab.freedesktop.org/drm/intel/issues/8747
[i915#8981]: https://gitlab.freedesktop.org/drm/intel/issues/8981
[i915#9197]: https://gitlab.freedesktop.org/drm/intel/issues/9197
[i915#9648]: https://gitlab.freedesktop.org/drm/intel/issues/9648

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_7592 -> IGTPW_10207

CI-20190529: 20190529
CI_DRM_13885: 346f47e69d27a4b3177c2939b1f6f26d093ad8c4 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_10207: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/index.html
IGT_7592: 7a525cfbc2a9a1dac2ae4e1d180a31d95b374c3d @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

Testlist changes
----------------

+igt@kms_pipe_crc_basic@darkscreen-read-crc +igt@kms_pipe_crc_basic@negative-darkscreen-read-crc

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/index.html