Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection
  2023-11-02  6:23 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
@ 2023-11-02  6:23 ` Kunal Joshi
  2023-11-14 17:37   ` Juha-Pekka Heikkila
  0 siblings, 1 reply; 9+ messages in thread
From: Kunal Joshi @ 2023-11-02  6:23 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi, Nemesa Garg, Arun R Murthy

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 <nemesa.garg@intel.com>
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 tests/kms_pipe_crc_basic.c | 60 +++++++++++++++++++++++++++++++++-----
 1 file changed, 52 insertions(+), 8 deletions(-)

diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index d980c3786..479241e79 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -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,24 @@ 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 +261,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 +455,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,7 +512,14 @@ 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 {
+					} 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_enable_dark_screen_detection(data.drm_fd, pipe);
+						test_read_crc(&data, pipe, output, tests[i].flags);
+						igt_disable_dark_screen_detection(data.drm_fd, pipe);
+					}
+					else {
 						test_read_crc(&data, pipe, output, tests[i].flags);
 					}
 				}
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection
  2023-11-02  6:23 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
@ 2023-11-14 17:37   ` Juha-Pekka Heikkila
  0 siblings, 0 replies; 9+ messages in thread
From: Juha-Pekka Heikkila @ 2023-11-14 17:37 UTC (permalink / raw)
  To: Kunal Joshi, igt-dev; +Cc: Nemesa Garg, Arun R Murthy

This patch has some indentations with spaces. With those fixed you can add

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>


On 2.11.2023 8.23, Kunal Joshi wrote:
> 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 <nemesa.garg@intel.com>
> Cc: Arun R Murthy <arun.r.murthy@intel.com>
> Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
> Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
> ---
>   tests/kms_pipe_crc_basic.c | 60 +++++++++++++++++++++++++++++++++-----
>   1 file changed, 52 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
> index d980c3786..479241e79 100644
> --- a/tests/kms_pipe_crc_basic.c
> +++ b/tests/kms_pipe_crc_basic.c
> @@ -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,24 @@ 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 +261,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 +455,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,7 +512,14 @@ 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 {
> +					} 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_enable_dark_screen_detection(data.drm_fd, pipe);
> +						test_read_crc(&data, pipe, output, tests[i].flags);
> +						igt_disable_dark_screen_detection(data.drm_fd, pipe);
> +					}
> +					else {
>   						test_read_crc(&data, pipe, output, tests[i].flags);
>   					}
>   				}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection
  2023-11-15  6:42 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
@ 2023-11-15  6:42 ` Kunal Joshi
  0 siblings, 0 replies; 9+ messages in thread
From: Kunal Joshi @ 2023-11-15  6:42 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi, Nemesa Garg, Arun R Murthy

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)

v2: Fix indentation (JP)

Cc: Nemesa Garg <nemesa.garg@intel.com>
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 tests/kms_pipe_crc_basic.c | 55 +++++++++++++++++++++++++++++++++-----
 1 file changed, 48 insertions(+), 7 deletions(-)

diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 94252415b..3c1ad3097 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -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);
 					}
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection
@ 2023-11-17  7:03 Kunal Joshi
  2023-11-17  7:03 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable " Kunal Joshi
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Kunal Joshi @ 2023-11-17  7:03 UTC (permalink / raw)
  To: igt-dev; +Cc: 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)

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(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable dark screen detection
  2023-11-17  7:03 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
@ 2023-11-17  7:03 ` Kunal Joshi
  2023-11-22 21:01   ` Juha-Pekka Heikkila
  2023-11-17  7:03 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
  2023-11-17  7:58 ` [igt-dev] ✗ Fi.CI.BAT: failure for add new subtests for dark screen detection (rev3) Patchwork
  2 siblings, 1 reply; 9+ messages in thread
From: Kunal Joshi @ 2023-11-17  7:03 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi, Nemesa Garg, Arun R Murthy

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 <juhapekka.heikkila@gmail.com>
Cc: Nemesa Garg <nemesa.garg@intel.com>
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 lib/igt_debugfs.c | 24 ++++++++++++++++++++++++
 lib/igt_debugfs.h |  2 ++
 2 files changed, 26 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index a7b54bae5..a39405710 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -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;
+}
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 3e6194ade..68f25be59 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -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
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection
  2023-11-17  7:03 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
  2023-11-17  7:03 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable " Kunal Joshi
@ 2023-11-17  7:03 ` Kunal Joshi
  2023-11-17  7:58 ` [igt-dev] ✗ Fi.CI.BAT: failure for add new subtests for dark screen detection (rev3) Patchwork
  2 siblings, 0 replies; 9+ messages in thread
From: Kunal Joshi @ 2023-11-17  7:03 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi, Nemesa Garg, Arun R Murthy

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 <nemesa.garg@intel.com>
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 tests/kms_pipe_crc_basic.c | 55 +++++++++++++++++++++++++++++++++-----
 1 file changed, 48 insertions(+), 7 deletions(-)

diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 94252415b..3c1ad3097 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -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);
 					}
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] ✗ Fi.CI.BAT: failure for add new subtests for dark screen detection (rev3)
  2023-11-17  7:03 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
  2023-11-17  7:03 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable " Kunal Joshi
  2023-11-17  7:03 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
@ 2023-11-17  7:58 ` Patchwork
  2 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2023-11-17  7:58 UTC (permalink / raw)
  To: Kunal Joshi; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 6344 bytes --]

== 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 (lgci.bug.filing@intel.com) 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@live@migrate.html

  
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@gem_lmem_swapping@basic.html

  * 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@gem_lmem_swapping@verify-random.html

  * 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@live@mman.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-rpls-1/igt@i915_selftest@live@mman.html

  * 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@i915_suspend@basic-s2idle-without-i915.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-rpls-1/igt@i915_suspend@basic-s2idle-without-i915.html

  * 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@kms_force_connector_basic@force-load-detect.html

  * 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@kms_hdmi_inject@inject-audio.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/fi-kbl-guc/igt@kms_hdmi_inject@inject-audio.html

  * 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@kms_pipe_crc_basic@nonblocking-crc-frame-sequence.html
    - 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@kms_pipe_crc_basic@nonblocking-crc-frame-sequence.html

  
#### 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@i915_suspend@basic-s3-without-i915.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-adlp-9/igt@i915_suspend@basic-s3-without-i915.html

  * 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@basic-flip-vs-modeset@a-edp1.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/bat-adlp-6/igt@kms_flip@basic-flip-vs-modeset@a-edp1.html

  * 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@vgem_basic@unload.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10207/fi-hsw-4770/igt@vgem_basic@unload.html

  
  {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

[-- Attachment #2: Type: text/html, Size: 7127 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable dark screen detection
  2023-11-17  7:03 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable " Kunal Joshi
@ 2023-11-22 21:01   ` Juha-Pekka Heikkila
  0 siblings, 0 replies; 9+ messages in thread
From: Juha-Pekka Heikkila @ 2023-11-22 21:01 UTC (permalink / raw)
  To: Kunal Joshi, igt-dev; +Cc: Nemesa Garg, Arun R Murthy

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

On 17.11.2023 9.03, Kunal Joshi wrote:
> 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 <juhapekka.heikkila@gmail.com>
> Cc: Nemesa Garg <nemesa.garg@intel.com>
> Cc: Arun R Murthy <arun.r.murthy@intel.com>
> Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
> Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
> ---
>   lib/igt_debugfs.c | 24 ++++++++++++++++++++++++
>   lib/igt_debugfs.h |  2 ++
>   2 files changed, 26 insertions(+)
> 
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index a7b54bae5..a39405710 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -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;
> +}
> diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
> index 3e6194ade..68f25be59 100644
> --- a/lib/igt_debugfs.h
> +++ b/lib/igt_debugfs.h
> @@ -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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection
  2023-11-23  6:29 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
@ 2023-11-23  6:29 ` Kunal Joshi
  0 siblings, 0 replies; 9+ messages in thread
From: Kunal Joshi @ 2023-11-23  6:29 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi, Nemesa Garg, Arun R Murthy

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 <nemesa.garg@intel.com>
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 tests/kms_pipe_crc_basic.c | 55 +++++++++++++++++++++++++++++++++-----
 1 file changed, 48 insertions(+), 7 deletions(-)

diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 94252415b..3c1ad3097 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -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);
 					}
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-11-23  6:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-17  7:03 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
2023-11-17  7:03 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable " Kunal Joshi
2023-11-22 21:01   ` Juha-Pekka Heikkila
2023-11-17  7:03 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
2023-11-17  7:58 ` [igt-dev] ✗ Fi.CI.BAT: failure for add new subtests for dark screen detection (rev3) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-11-23  6:29 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
2023-11-23  6:29 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
2023-11-15  6:42 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
2023-11-15  6:42 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
2023-11-02  6:23 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
2023-11-02  6:23 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
2023-11-14 17:37   ` Juha-Pekka Heikkila

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox