All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [RFC, i-g-t] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight
@ 2022-09-21  8:58 Nidhi Gupta
  2022-09-21 11:35 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight (rev2) Patchwork
  2022-09-22  9:31 ` [igt-dev] [RFC, i-g-t] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight Hogander, Jouni
  0 siblings, 2 replies; 5+ messages in thread
From: Nidhi Gupta @ 2022-09-21  8:58 UTC (permalink / raw)
  To: igt-dev; +Cc: Nidhi Gupta

-Since driver can now support multiple eDPs and Debugfs structure for
backlight changed per connector the test should then iterate through
all eDP connectors.
-backlight with dpms cycle of on and off with all the eDP connected.

Signed-off-by: Nidhi Gupta <nidhi1.gupta@intel.com>
---
 tests/i915/i915_pm_backlight.c | 204 +++++++++++++++++++++++++--------
 1 file changed, 156 insertions(+), 48 deletions(-)

diff --git a/tests/i915/i915_pm_backlight.c b/tests/i915/i915_pm_backlight.c
index cafae7f7..951ee048 100644
--- a/tests/i915/i915_pm_backlight.c
+++ b/tests/i915/i915_pm_backlight.c
@@ -36,19 +36,77 @@
 #include <time.h>
 
 struct context {
+	int drm_fd;
+	igt_display_t display;
 	int max;
 };
 
+//typedef struct data {
+//	igt_display_t display;
+//	int drm_fd;
+//} data_t;
+
 
 #define TOLERANCE 5 /* percent */
 #define BACKLIGHT_PATH "/sys/class/backlight/intel_backlight"
-
+#define BACKLIGHT_BRIGHTNESS "brightness"
+#define BACKLIGHT_ACTUAL_BRIGHTNESS "actual_brightness"
 #define FADESTEPS 10
 #define FADESPEED 100 /* milliseconds between steps */
 
 IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
 
-static int backlight_read(int *result, const char *fname)
+static int backlight_read(int *result, int drm_fd, char *connector_name)
+{
+	char buf[20];
+	int fd, e, r;
+
+	fd = igt_debugfs_connector_dir(drm_fd, connector_name, O_RDONLY);
+
+	if (fd < 0) {
+		igt_info("Couldn't open connector %s debugfs directory\n",
+			 connector_name);
+		return false;
+	}
+
+	r = igt_debugfs_simple_read(fd, BACKLIGHT_BRIGHTNESS, buf, sizeof(buf));
+	e = errno;
+	close(fd);
+
+	if (r < 0)
+		return -e;
+
+	errno = 0;
+	*result = strtol(buf, NULL, 0);
+	return errno = 0;
+}
+
+static int read_actual_backlight(int *result, int drm_fd, char *connector_name)
+{
+	char buf[20];
+	int fd, e, r;
+
+	fd = igt_debugfs_connector_dir(drm_fd, connector_name, O_RDONLY);
+
+	if (fd < 0) {
+		igt_info("Couldn't open connector %s debugfs directory\n",
+			 connector_name);
+		return false;
+	}
+
+	r = igt_debugfs_simple_read(fd, BACKLIGHT_ACTUAL_BRIGHTNESS, buf, sizeof(buf));
+	e = errno;
+	close(fd);
+
+	if (r < 0)
+		return -e;
+
+	errno = 0;
+	*result = strtol(buf, NULL, 0);
+	return errno;
+}
+
+/*static int backlight_read(int *result, const char *fname)
 {
 	int fd;
 	char full[PATH_MAX];
@@ -72,6 +130,7 @@ static int backlight_read(int *result, const char *fname)
 	*result = strtol(dst, NULL, 10);
 	return errno;
 }
+*/
 
 static int backlight_write(int value, const char *fname)
 {
@@ -99,18 +158,25 @@ static void test_and_verify(struct context *context, int val)
 {
 	const int tolerance = val * TOLERANCE / 100;
 	int result;
-
-	igt_assert_eq(backlight_write(val, "brightness"), 0);
-	igt_assert_eq(backlight_read(&result, "brightness"), 0);
-	/* Check that the exact value sticks */
-	igt_assert_eq(result, val);
-
-	igt_assert_eq(backlight_read(&result, "actual_brightness"), 0);
-	/* Some rounding may happen depending on hw */
-	igt_assert_f(result >= max(0, val - tolerance) &&
-		     result <= min(context->max, val + tolerance),
-		     "actual_brightness [%d] did not match expected brightness [%d +- %d]\n",
-		     result, val, tolerance);
+	igt_output_t *output;
+	enum pipe pipe;
+
+	for_each_pipe_with_valid_output(&context->display, pipe, output) {
+		if (output->config.connector->connector_type != DRM_MODE_CONNECTOR_eDP)
+			continue;
+
+		igt_assert_eq(backlight_write(val, "brightness"), 0);
+		igt_assert_eq(backlight_read(&result, context->drm_fd, output->name), 0);
+		/* Check that the exact value sticks */
+		igt_assert_eq(result, val);
+
+		igt_assert_eq(read_actual_backlight(&result, context->drm_fd, output->name), 0);
+		/* Some rounding may happen depending on hw */
+		igt_assert_f(result >= max(0, val - tolerance) &&
+			     result <= min(context->max, val + tolerance),
+			     "actual_brightness [%d] did not match expected brightness [%d +- %d]\n",
+			      result, val, tolerance);
+	}
 }
 
 static void test_brightness(struct context *context)
@@ -123,52 +189,68 @@ static void test_brightness(struct context *context)
 static void test_bad_brightness(struct context *context)
 {
 	int val;
-	/* First write some sane value */
-	backlight_write(context->max / 2, "brightness");
-	/* Writing invalid values should fail and not change the value */
-	igt_assert_lt(backlight_write(-1, "brightness"), 0);
-	backlight_read(&val, "brightness");
-	igt_assert_eq(val, context->max / 2);
-	igt_assert_lt(backlight_write(context->max + 1, "brightness"), 0);
-	backlight_read(&val, "brightness");
-	igt_assert_eq(val, context->max / 2);
-	igt_assert_lt(backlight_write(INT_MAX, "brightness"), 0);
-	backlight_read(&val, "brightness");
-	igt_assert_eq(val, context->max / 2);
+	igt_output_t *output;
+	enum pipe pipe;
+
+	for_each_pipe_with_valid_output(&context->display, pipe, output) {
+		if (output->config.connector->connector_type != DRM_MODE_CONNECTOR_eDP)
+			continue;
+		/* First write some sane value */
+		backlight_write(context->max / 2, "brightness");
+		/* Writing invalid values should fail and not change the value */
+		igt_assert_lt(backlight_write(-1, "brightness"), 0);
+		backlight_read(&val, context->drm_fd, output->name);
+		igt_assert_eq(val, context->max / 2);
+		igt_assert_lt(backlight_write(context->max + 1, "brightness"), 0);
+		backlight_read(&val, context->drm_fd, output->name);
+		igt_assert_eq(val, context->max / 2);
+		igt_assert_lt(backlight_write(INT_MAX, "brightness"), 0);
+		backlight_read(&val, context->drm_fd, output->name);
+		igt_assert_eq(val, context->max / 2);
+	}
 }
 
 static void test_fade(struct context *context)
 {
 	int i;
 	static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 };
+	igt_output_t *output;
+	enum pipe pipe;
 
-	/* Fade out, then in */
-	for (i = context->max; i > 0; i -= context->max / FADESTEPS) {
-		test_and_verify(context, i);
-		nanosleep(&ts, NULL);
-	}
-	for (i = 0; i <= context->max; i += context->max / FADESTEPS) {
-		test_and_verify(context, i);
-		nanosleep(&ts, NULL);
+	for_each_pipe_with_valid_output(&context->display, pipe, output) {
+		if (output->config.connector->connector_type != DRM_MODE_CONNECTOR_eDP)
+			continue;
+
+		/* Fade out, then in */
+		for (i = context->max; i > 0; i -= context->max / FADESTEPS) {
+			test_and_verify(context, i);
+			nanosleep(&ts, NULL);
+		}
+		for (i = 0; i <= context->max; i += context->max / FADESTEPS) {
+			test_and_verify(context, i);
+			nanosleep(&ts, NULL);
+		}
 	}
 }
 
 static void
 test_fade_with_dpms(struct context *context, igt_output_t *output)
 {
-	igt_require(igt_setup_runtime_pm(output->display->drm_fd));
 
-	kmstest_set_connector_dpms(output->display->drm_fd,
-				   output->config.connector,
-				   DRM_MODE_DPMS_OFF);
-	igt_require(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+		igt_require(igt_setup_runtime_pm(output->display->drm_fd));
 
-	kmstest_set_connector_dpms(output->display->drm_fd,
-				   output->config.connector,
-				   DRM_MODE_DPMS_ON);
-	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE));
+		kmstest_set_connector_dpms(output->display->drm_fd,
+					   output->config.connector,
+					   DRM_MODE_DPMS_OFF);
+		igt_require(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+
+		kmstest_set_connector_dpms(output->display->drm_fd,
+					   output->config.connector,
+					   DRM_MODE_DPMS_ON);
+		igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE));
+
+		test_fade(context);
 
-	test_fade(context);
 }
 
 static void
@@ -179,9 +261,32 @@ test_fade_with_suspend(struct context *context, igt_output_t *output)
 	test_fade(context);
 }
 
+static void test_backlight_dpms_cycle(struct context *context, igt_output_t *output)
+{
+	int result;
+	enum pipe pipe;
+
+	for_each_pipe_with_valid_output(output->display, pipe, output) {
+		if (output->config.connector->connector_type != DRM_MODE_CONNECTOR_eDP)
+			continue;
+
+		igt_info("Testing backlight dpms on %s\n", output->name);
+
+		backlight_write(context->max / 2, "brightness");
+		usleep(100000);
+		backlight_read(&result, context->drm_fd, output->name);
+
+		kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
+		kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_ON);
+		usleep(100000);
+
+		igt_assert_eq(read_actual_backlight(&result, context->drm_fd, output->name), 0);
+	}
+}
+
 igt_main
 {
-	struct context context = {0};
+	struct context context;
 	int old;
 	igt_display_t display;
 	igt_output_t *output;
@@ -200,11 +305,12 @@ igt_main
 		 * try to enable all.
 		 */
 		kmstest_set_vt_graphics_mode();
-		igt_display_require(&display, drm_open_driver(DRIVER_INTEL));
+		//igt_display_require(&display, drm_open_driver(DRIVER_INTEL));
+		igt_display_require(&context.display, context.drm_fd);
 
 		/* Get the max value and skip the whole test if sysfs interface not available */
-		igt_skip_on(backlight_read(&old, "brightness"));
-		igt_assert(backlight_read(&context.max, "max_brightness") > -1);
+		igt_skip_on(backlight_read(&old, context.drm_fd, output->name));
+		igt_assert(backlight_read(&context.max, context.drm_fd, output->name) > -1);
 
 		/* should be ../../cardX-$output */
 		igt_assert_lt(12, readlink(BACKLIGHT_PATH "/device", full_name, sizeof(full_name) - 1));
@@ -245,6 +351,8 @@ igt_main
 		test_fade_with_dpms(&context, output);
 	igt_subtest("fade_with_suspend")
 		test_fade_with_suspend(&context, output);
+	igt_subtest("backlight_dpms_cycle")
+		test_backlight_dpms_cycle(&context, output);
 
 	igt_fixture {
 		/* Restore old brightness */
-- 
2.36.0

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

* [igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight (rev2)
  2022-09-21  8:58 [igt-dev] [RFC, i-g-t] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight Nidhi Gupta
@ 2022-09-21 11:35 ` Patchwork
  2022-09-22  9:31 ` [igt-dev] [RFC, i-g-t] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight Hogander, Jouni
  1 sibling, 0 replies; 5+ messages in thread
From: Patchwork @ 2022-09-21 11:35 UTC (permalink / raw)
  To: Nidhi Gupta; +Cc: igt-dev

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

== Series Details ==

Series: tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight (rev2)
URL   : https://patchwork.freedesktop.org/series/108246/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12164 -> IGTPW_7810
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_7810 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_7810, 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_7810/index.html

Participating hosts (34 -> 44)
------------------------------

  Additional (11): fi-rkl-11600 bat-dg1-5 bat-dg2-8 bat-adlm-1 fi-icl-u2 bat-dg2-9 bat-adlp-6 bat-adln-1 bat-jsl-3 bat-rpls-1 bat-dg2-11 
  Missing    (1): fi-bdw-samus 

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@i915_pm_backlight@basic-brightness:
    - fi-icl-u2:          NOTRUN -> [SKIP][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-icl-u2/igt@i915_pm_backlight@basic-brightness.html
    - fi-tgl-u2:          [PASS][2] -> [SKIP][3]
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-tgl-u2/igt@i915_pm_backlight@basic-brightness.html
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-tgl-u2/igt@i915_pm_backlight@basic-brightness.html
    - fi-rkl-11600:       NOTRUN -> [SKIP][4]
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@i915_pm_backlight@basic-brightness.html
    - bat-dg1-5:          NOTRUN -> [SKIP][5]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@i915_pm_backlight@basic-brightness.html

  
#### Warnings ####

  * igt@i915_pm_backlight@basic-brightness:
    - fi-adl-ddr5:        [SKIP][6] ([i915#1155]) -> [SKIP][7]
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-adl-ddr5/igt@i915_pm_backlight@basic-brightness.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-adl-ddr5/igt@i915_pm_backlight@basic-brightness.html
    - fi-rkl-guc:         [SKIP][8] ([i915#3012]) -> [SKIP][9]
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-rkl-guc/igt@i915_pm_backlight@basic-brightness.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-guc/igt@i915_pm_backlight@basic-brightness.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * igt@i915_pm_backlight@basic-brightness:
    - {bat-adln-1}:       NOTRUN -> [SKIP][10]
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-adln-1/igt@i915_pm_backlight@basic-brightness.html
    - {fi-ehl-2}:         [PASS][11] -> [SKIP][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-ehl-2/igt@i915_pm_backlight@basic-brightness.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-ehl-2/igt@i915_pm_backlight@basic-brightness.html
    - {fi-tgl-mst}:       [SKIP][13] ([i915#1155]) -> [SKIP][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-tgl-mst/igt@i915_pm_backlight@basic-brightness.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-tgl-mst/igt@i915_pm_backlight@basic-brightness.html
    - {bat-adlp-6}:       NOTRUN -> [SKIP][15]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-adlp-6/igt@i915_pm_backlight@basic-brightness.html
    - {bat-jsl-3}:        NOTRUN -> [SKIP][16]
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-jsl-3/igt@i915_pm_backlight@basic-brightness.html
    - {bat-dg2-11}:       NOTRUN -> [SKIP][17]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg2-11/igt@i915_pm_backlight@basic-brightness.html
    - {bat-dg2-8}:        NOTRUN -> [SKIP][18]
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg2-8/igt@i915_pm_backlight@basic-brightness.html
    - {bat-adlm-1}:       NOTRUN -> [SKIP][19]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-adlm-1/igt@i915_pm_backlight@basic-brightness.html
    - {fi-jsl-1}:         [PASS][20] -> [SKIP][21]
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-jsl-1/igt@i915_pm_backlight@basic-brightness.html
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-jsl-1/igt@i915_pm_backlight@basic-brightness.html
    - {bat-rpls-1}:       NOTRUN -> [SKIP][22]
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-rpls-1/igt@i915_pm_backlight@basic-brightness.html
    - {bat-dg2-9}:        NOTRUN -> [SKIP][23]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg2-9/igt@i915_pm_backlight@basic-brightness.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@fbdev@nullptr:
    - bat-dg1-5:          NOTRUN -> [SKIP][24] ([i915#2582]) +4 similar issues
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@fbdev@nullptr.html

  * igt@gem_huc_copy@huc-copy:
    - fi-icl-u2:          NOTRUN -> [SKIP][25] ([i915#2190])
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-icl-u2/igt@gem_huc_copy@huc-copy.html
    - fi-rkl-11600:       NOTRUN -> [SKIP][26] ([i915#2190])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@gem_huc_copy@huc-copy.html

  * igt@gem_lmem_swapping@basic:
    - fi-rkl-11600:       NOTRUN -> [SKIP][27] ([i915#4613]) +3 similar issues
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@gem_lmem_swapping@basic.html

  * igt@gem_lmem_swapping@random-engines:
    - fi-icl-u2:          NOTRUN -> [SKIP][28] ([i915#4613]) +3 similar issues
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-icl-u2/igt@gem_lmem_swapping@random-engines.html

  * igt@gem_mmap@basic:
    - bat-dg1-5:          NOTRUN -> [SKIP][29] ([i915#4083])
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@gem_mmap@basic.html

  * igt@gem_tiled_blits@basic:
    - bat-dg1-5:          NOTRUN -> [SKIP][30] ([i915#4077]) +2 similar issues
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@gem_tiled_blits@basic.html

  * igt@gem_tiled_pread_basic:
    - fi-rkl-11600:       NOTRUN -> [SKIP][31] ([i915#3282])
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@gem_tiled_pread_basic.html
    - bat-dg1-5:          NOTRUN -> [SKIP][32] ([i915#4079]) +1 similar issue
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@gem_tiled_pread_basic.html

  * igt@i915_pm_backlight@basic-brightness:
    - fi-skl-6600u:       [PASS][33] -> [SKIP][34] ([fdo#109271])
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-skl-6600u/igt@i915_pm_backlight@basic-brightness.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-skl-6600u/igt@i915_pm_backlight@basic-brightness.html
    - fi-snb-2520m:       [PASS][35] -> [SKIP][36] ([fdo#109271])
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-snb-2520m/igt@i915_pm_backlight@basic-brightness.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-snb-2520m/igt@i915_pm_backlight@basic-brightness.html
    - fi-bxt-dsi:         [PASS][37] -> [SKIP][38] ([fdo#109271])
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-bxt-dsi/igt@i915_pm_backlight@basic-brightness.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-bxt-dsi/igt@i915_pm_backlight@basic-brightness.html
    - fi-glk-dsi:         [PASS][39] -> [SKIP][40] ([fdo#109271])
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-glk-dsi/igt@i915_pm_backlight@basic-brightness.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-glk-dsi/igt@i915_pm_backlight@basic-brightness.html

  * igt@i915_pm_rps@basic-api:
    - bat-dg1-5:          NOTRUN -> [SKIP][41] ([i915#6621])
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@i915_pm_rps@basic-api.html

  * igt@i915_suspend@basic-s3-without-i915:
    - fi-rkl-11600:       NOTRUN -> [INCOMPLETE][42] ([i915#5982])
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@i915_suspend@basic-s3-without-i915.html

  * igt@kms_addfb_basic@basic-x-tiled-legacy:
    - bat-dg1-5:          NOTRUN -> [SKIP][43] ([i915#4212]) +7 similar issues
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@kms_addfb_basic@basic-x-tiled-legacy.html

  * igt@kms_addfb_basic@basic-y-tiled-legacy:
    - bat-dg1-5:          NOTRUN -> [SKIP][44] ([i915#4215])
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@kms_addfb_basic@basic-y-tiled-legacy.html

  * igt@kms_busy@basic:
    - bat-dg1-5:          NOTRUN -> [SKIP][45] ([i915#1845] / [i915#4303])
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@kms_busy@basic.html

  * igt@kms_chamelium@dp-crc-fast:
    - bat-dg1-5:          NOTRUN -> [SKIP][46] ([fdo#111827]) +8 similar issues
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@kms_chamelium@dp-crc-fast.html

  * igt@kms_chamelium@hdmi-edid-read:
    - fi-rkl-11600:       NOTRUN -> [SKIP][47] ([fdo#111827]) +7 similar issues
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@kms_chamelium@hdmi-edid-read.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-icl-u2:          NOTRUN -> [SKIP][48] ([fdo#111827]) +8 similar issues
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-icl-u2/igt@kms_chamelium@hdmi-hpd-fast.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor:
    - fi-rkl-11600:       NOTRUN -> [SKIP][49] ([i915#4103])
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@kms_cursor_legacy@basic-busy-flip-before-cursor.html
    - fi-icl-u2:          NOTRUN -> [SKIP][50] ([i915#4103])
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-icl-u2/igt@kms_cursor_legacy@basic-busy-flip-before-cursor.html

  * igt@kms_force_connector_basic@force-connector-state:
    - fi-icl-u2:          NOTRUN -> [WARN][51] ([i915#6008])
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-icl-u2/igt@kms_force_connector_basic@force-connector-state.html

  * igt@kms_force_connector_basic@force-load-detect:
    - bat-dg1-5:          NOTRUN -> [SKIP][52] ([fdo#109285])
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@kms_force_connector_basic@force-load-detect.html
    - fi-rkl-11600:       NOTRUN -> [SKIP][53] ([fdo#109285] / [i915#4098])
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@kms_force_connector_basic@force-load-detect.html
    - fi-icl-u2:          NOTRUN -> [SKIP][54] ([fdo#109285])
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-icl-u2/igt@kms_force_connector_basic@force-load-detect.html

  * igt@kms_pipe_crc_basic@nonblocking-crc:
    - bat-dg1-5:          NOTRUN -> [SKIP][55] ([i915#4078]) +14 similar issues
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@kms_pipe_crc_basic@nonblocking-crc.html

  * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-2:
    - fi-icl-u2:          NOTRUN -> [DMESG-WARN][56] ([i915#2867])
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-icl-u2/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-2.html

  * igt@kms_psr@primary_page_flip:
    - fi-rkl-11600:       NOTRUN -> [SKIP][57] ([i915#1072]) +3 similar issues
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@kms_psr@primary_page_flip.html
    - bat-dg1-5:          NOTRUN -> [SKIP][58] ([i915#1072] / [i915#4078]) +3 similar issues
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@kms_psr@primary_page_flip.html

  * igt@kms_setmode@basic-clone-single-crtc:
    - fi-rkl-11600:       NOTRUN -> [SKIP][59] ([i915#3555] / [i915#4098])
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@kms_setmode@basic-clone-single-crtc.html
    - bat-dg1-5:          NOTRUN -> [SKIP][60] ([i915#3555])
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@kms_setmode@basic-clone-single-crtc.html
    - fi-icl-u2:          NOTRUN -> [SKIP][61] ([i915#3555])
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-icl-u2/igt@kms_setmode@basic-clone-single-crtc.html

  * igt@prime_vgem@basic-fence-flip:
    - bat-dg1-5:          NOTRUN -> [SKIP][62] ([i915#1845] / [i915#3708])
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@prime_vgem@basic-fence-flip.html

  * igt@prime_vgem@basic-fence-read:
    - bat-dg1-5:          NOTRUN -> [SKIP][63] ([i915#3708]) +2 similar issues
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@prime_vgem@basic-fence-read.html

  * igt@prime_vgem@basic-gtt:
    - bat-dg1-5:          NOTRUN -> [SKIP][64] ([i915#3708] / [i915#4077]) +1 similar issue
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@prime_vgem@basic-gtt.html

  * igt@prime_vgem@basic-read:
    - fi-rkl-11600:       NOTRUN -> [SKIP][65] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@prime_vgem@basic-read.html

  * igt@prime_vgem@basic-userptr:
    - fi-icl-u2:          NOTRUN -> [SKIP][66] ([fdo#109295] / [i915#3301])
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-icl-u2/igt@prime_vgem@basic-userptr.html
    - bat-dg1-5:          NOTRUN -> [SKIP][67] ([i915#3708] / [i915#4873])
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/bat-dg1-5/igt@prime_vgem@basic-userptr.html
    - fi-rkl-11600:       NOTRUN -> [SKIP][68] ([fdo#109295] / [i915#3301] / [i915#3708])
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-rkl-11600/igt@prime_vgem@basic-userptr.html

  
#### Warnings ####

  * igt@i915_pm_backlight@basic-brightness:
    - fi-hsw-4770:        [SKIP][69] ([fdo#109271] / [i915#3012]) -> [SKIP][70] ([fdo#109271])
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-hsw-4770/igt@i915_pm_backlight@basic-brightness.html
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-hsw-4770/igt@i915_pm_backlight@basic-brightness.html
    - fi-hsw-g3258:       [SKIP][71] ([fdo#109271] / [i915#3012]) -> [SKIP][72] ([fdo#109271])
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-hsw-g3258/igt@i915_pm_backlight@basic-brightness.html
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-hsw-g3258/igt@i915_pm_backlight@basic-brightness.html

  * igt@runner@aborted:
    - fi-kbl-guc:         [FAIL][73] ([i915#6219] / [i915#6884]) -> [FAIL][74] ([i915#6884])
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-kbl-guc/igt@runner@aborted.html
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-kbl-guc/igt@runner@aborted.html
    - fi-kbl-8809g:       [FAIL][75] ([i915#6219] / [i915#6884]) -> [FAIL][76] ([i915#6884])
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-kbl-8809g/igt@runner@aborted.html
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-kbl-8809g/igt@runner@aborted.html
    - fi-kbl-soraka:      [FAIL][77] ([i915#6219] / [i915#6884]) -> [FAIL][78] ([i915#6884])
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12164/fi-kbl-soraka/igt@runner@aborted.html
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/fi-kbl-soraka/igt@runner@aborted.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#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#1155]: https://gitlab.freedesktop.org/drm/intel/issues/1155
  [i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
  [i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
  [i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
  [i915#3003]: https://gitlab.freedesktop.org/drm/intel/issues/3003
  [i915#3012]: https://gitlab.freedesktop.org/drm/intel/issues/3012
  [i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
  [i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
  [i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
  [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
  [i915#3595]: https://gitlab.freedesktop.org/drm/intel/issues/3595
  [i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
  [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
  [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#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
  [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#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
  [i915#4303]: https://gitlab.freedesktop.org/drm/intel/issues/4303
  [i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
  [i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
  [i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
  [i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
  [i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
  [i915#5982]: https://gitlab.freedesktop.org/drm/intel/issues/5982
  [i915#6008]: https://gitlab.freedesktop.org/drm/intel/issues/6008
  [i915#6219]: https://gitlab.freedesktop.org/drm/intel/issues/6219
  [i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
  [i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
  [i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
  [i915#6816]: https://gitlab.freedesktop.org/drm/intel/issues/6816
  [i915#6884]: https://gitlab.freedesktop.org/drm/intel/issues/6884


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

  * CI: CI-20190529 -> None
  * IGT: IGT_6659 -> IGTPW_7810

  CI-20190529: 20190529
  CI_DRM_12164: a1f63e144e545f0ce8f41f41005f2dfc552eb836 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_7810: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7810/index.html
  IGT_6659: 1becf700a737a7a98555a0cfbe8566355377afb2 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git


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

+igt@i915_pm_backlight@backlight_dpms_cycle

== Logs ==

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

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

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

* Re: [igt-dev] [RFC, i-g-t] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight
  2022-09-21  8:58 [igt-dev] [RFC, i-g-t] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight Nidhi Gupta
  2022-09-21 11:35 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight (rev2) Patchwork
@ 2022-09-22  9:31 ` Hogander, Jouni
  1 sibling, 0 replies; 5+ messages in thread
From: Hogander, Jouni @ 2022-09-22  9:31 UTC (permalink / raw)
  To: igt-dev, Gupta, Nidhi1

On Wed, 2022-09-21 at 14:28 +0530, Nidhi Gupta wrote:
> -Since driver can now support multiple eDPs and Debugfs structure for
> backlight changed per connector the test should then iterate through
> all eDP connectors.
> -backlight with dpms cycle of on and off with all the eDP connected.

These are clearly two separate patches. I would suggest splitting.


> Signed-off-by: Nidhi Gupta <nidhi1.gupta@intel.com>
> ---
>  tests/i915/i915_pm_backlight.c | 204 +++++++++++++++++++++++++------
> --
>  1 file changed, 156 insertions(+), 48 deletions(-)
> 
> diff --git a/tests/i915/i915_pm_backlight.c
> b/tests/i915/i915_pm_backlight.c
> index cafae7f7..951ee048 100644
> --- a/tests/i915/i915_pm_backlight.c
> +++ b/tests/i915/i915_pm_backlight.c
> @@ -36,19 +36,77 @@
>  #include <time.h>
>  
>  struct context {
> +       int drm_fd;
> +       igt_display_t display;
>         int max;
>  };
>  
> +//typedef struct data {
> +//     igt_display_t display;
> +//     int drm_fd;
> +//} data_t;
> +
>  

Just remove if not used.

>  #define TOLERANCE 5 /* percent */
>  #define BACKLIGHT_PATH "/sys/class/backlight/intel_backlight"
> -
> +#define BACKLIGHT_BRIGHTNESS "brightness"
> +#define BACKLIGHT_ACTUAL_BRIGHTNESS "actual_brightness"
>  #define FADESTEPS 10
>  #define FADESPEED 100 /* milliseconds between steps */
>  
>  IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
>  
> -static int backlight_read(int *result, const char *fname)
> +static int backlight_read(int *result, int drm_fd, char
> *connector_name)
> +{
> +       char buf[20];
> +       int fd, e, r;
> +
> +       fd = igt_debugfs_connector_dir(drm_fd, connector_name,
> O_RDONLY);

Why you are using debugfs? Isn't it sysfs interface you want to use?

> +
> +       if (fd < 0) {
> +               igt_info("Couldn't open connector %s debugfs
> directory\n",
> +                        connector_name);
> +               return false;

On error you return "< 0". Maybe fd as it is?
 
> +       }
> +
> +       r = igt_debugfs_simple_read(fd, BACKLIGHT_BRIGHTNESS, buf,
> sizeof(buf));
> +       e = errno;
> +       close(fd);
> +
> +       if (r < 0)
> +               return -e;
> +
> +       errno = 0;

I don't see a reason to set errno here as you are already setting it
below? Honestly: I do not understand why errno is used in this testcase
at all as it's value is not really used. Maybe igt is using it for some
reporting? I'm fine if you want to keep it though.

> +       *result = strtol(buf, NULL, 0);
> +       return errno = 0;
> +}
> +
> +static int read_actual_backlight(int *result, int drm_fd, char
> *connector_name)

You should combine read_actual_backlight, backlight_read and
> +{
> +       char buf[20];
> +       int fd, e, r;
> +
> +       fd = igt_debugfs_connector_dir(drm_fd, connector_name,
> O_RDONLY);
> +
> +       if (fd < 0) {
> +               igt_info("Couldn't open connector %s debugfs
> directory\n",
> +                        connector_name);
> +               return false;
> +       }
> +
> +       r = igt_debugfs_simple_read(fd, BACKLIGHT_ACTUAL_BRIGHTNESS,
> buf, sizeof(buf));
> +       e = errno;
> +       close(fd);
> +
> +       if (r < 0)
> +               return -e;
> +
> +       errno = 0;
> +       *result = strtol(buf, NULL, 0);
> +       return errno;
> +}
> +
> +/*static int backlight_read(int *result, const char *fname)
>  {
>         int fd;
>         char full[PATH_MAX];
> @@ -72,6 +130,7 @@ static int backlight_read(int *result, const char
> *fname)
>         *result = strtol(dst, NULL, 10);
>         return errno;
>  }
> +*/

Again just remove.

>  
>  static int backlight_write(int value, const char *fname)
>  {
> @@ -99,18 +158,25 @@ static void test_and_verify(struct context
> *context, int val)
>  {
>         const int tolerance = val * TOLERANCE / 100;
>         int result;
> -
> -       igt_assert_eq(backlight_write(val, "brightness"), 0);
> -       igt_assert_eq(backlight_read(&result, "brightness"), 0);
> -       /* Check that the exact value sticks */
> -       igt_assert_eq(result, val);
> -
> -       igt_assert_eq(backlight_read(&result, "actual_brightness"),
> 0);
> -       /* Some rounding may happen depending on hw */
> -       igt_assert_f(result >= max(0, val - tolerance) &&
> -                    result <= min(context->max, val + tolerance),
> -                    "actual_brightness [%d] did not match expected
> brightness [%d +- %d]\n",
> -                    result, val, tolerance);
> +       igt_output_t *output;
> +       enum pipe pipe;
> +
> +       for_each_pipe_with_valid_output(&context->display, pipe,
> output) {

 for_each_pipe_with_single_output

> +               if (output->config.connector->connector_type !=
> DRM_MODE_CONNECTOR_eDP)
> +                       continue;
> +
> +               igt_assert_eq(backlight_write(val, "brightness"), 0);

Shouldn't you write both panels separately?

> +               igt_assert_eq(backlight_read(&result, context-
> >drm_fd, output->name), 0);
> +               /* Check that the exact value sticks */
> +               igt_assert_eq(result, val);
> +
> +               igt_assert_eq(read_actual_backlight(&result, context-
> >drm_fd, output->name), 0);
> +               /* Some rounding may happen depending on hw */
> +               igt_assert_f(result >= max(0, val - tolerance) &&
> +                            result <= min(context->max, val +
> tolerance),
> +                            "actual_brightness [%d] did not match
> expected brightness [%d +- %d]\n",
> +                             result, val, tolerance);
> +       }
>  }
>  
>  static void test_brightness(struct context *context)
> @@ -123,52 +189,68 @@ static void test_brightness(struct context
> *context)
>  static void test_bad_brightness(struct context *context)
>  {
>         int val;
> -       /* First write some sane value */
> -       backlight_write(context->max / 2, "brightness");
> -       /* Writing invalid values should fail and not change the
> value */
> -       igt_assert_lt(backlight_write(-1, "brightness"), 0);
> -       backlight_read(&val, "brightness");
> -       igt_assert_eq(val, context->max / 2);
> -       igt_assert_lt(backlight_write(context->max + 1,
> "brightness"), 0);
> -       backlight_read(&val, "brightness");
> -       igt_assert_eq(val, context->max / 2);
> -       igt_assert_lt(backlight_write(INT_MAX, "brightness"), 0);
> -       backlight_read(&val, "brightness");
> -       igt_assert_eq(val, context->max / 2);
> +       igt_output_t *output;
> +       enum pipe pipe;
> +
> +       for_each_pipe_with_valid_output(&context->display, pipe,
> output) {

for_each_pipe_with_single_output

> +               if (output->config.connector->connector_type !=
> DRM_MODE_CONNECTOR_eDP)
> +                       continue;
> +               /* First write some sane value */
> +               backlight_write(context->max / 2, "brightness");
> +               /* Writing invalid values should fail and not change
> the value */
> +               igt_assert_lt(backlight_write(-1, "brightness"), 0);
> +               backlight_read(&val, context->drm_fd, output->name);
> +               igt_assert_eq(val, context->max / 2);
> +               igt_assert_lt(backlight_write(context->max + 1,
> "brightness"), 0);
> +               backlight_read(&val, context->drm_fd, output->name);
> +               igt_assert_eq(val, context->max / 2);
> +               igt_assert_lt(backlight_write(INT_MAX, "brightness"),
> 0);
> +               backlight_read(&val, context->drm_fd, output->name);
> +               igt_assert_eq(val, context->max / 2);
> +       }
>  }
>  
>  static void test_fade(struct context *context)
>  {
>         int i;
>         static const struct timespec ts = { .tv_sec = 0, .tv_nsec =
> FADESPEED*1000000 };
> +       igt_output_t *output;
> +       enum pipe pipe;
>  
> -       /* Fade out, then in */
> -       for (i = context->max; i > 0; i -= context->max / FADESTEPS)
> {
> -               test_and_verify(context, i);
> -               nanosleep(&ts, NULL);
> -       }
> -       for (i = 0; i <= context->max; i += context->max / FADESTEPS)
> {
> -               test_and_verify(context, i);
> -               nanosleep(&ts, NULL);
> +       for_each_pipe_with_valid_output(&context->display, pipe,
> output) {
> +               if (output->config.connector->connector_type !=
> DRM_MODE_CONNECTOR_eDP)
> +                       continue;
> +
> +               /* Fade out, then in */
> +               for (i = context->max; i > 0; i -= context->max /
> FADESTEPS) {
> +                       test_and_verify(context, i);
> +                       nanosleep(&ts, NULL);
> +               }
> +               for (i = 0; i <= context->max; i += context->max /
> FADESTEPS) {
> +                       test_and_verify(context, i);
> +                       nanosleep(&ts, NULL);
> +               }
>         }
>  }
>  
>  static void
>  test_fade_with_dpms(struct context *context, igt_output_t *output)
>  {
> -       igt_require(igt_setup_runtime_pm(output->display->drm_fd));
>  
> -       kmstest_set_connector_dpms(output->display->drm_fd,
> -                                  output->config.connector,
> -                                  DRM_MODE_DPMS_OFF);
> -
>        igt_require(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPEN
> DED));
> +               igt_require(igt_setup_runtime_pm(output->display-
> >drm_fd));
>  
> -       kmstest_set_connector_dpms(output->display->drm_fd,
> -                                  output->config.connector,
> -                                  DRM_MODE_DPMS_ON);
> -
>        igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE)
> );
> +               kmstest_set_connector_dpms(output->display->drm_fd,
> +                                          output->config.connector,
> +                                          DRM_MODE_DPMS_OFF);
> +               igt_require(igt_wait_for_pm_status(IGT_RUNTIME_PM_STA
> TUS_SUSPENDED));
> +
> +               kmstest_set_connector_dpms(output->display->drm_fd,
> +                                          output->config.connector,
> +                                          DRM_MODE_DPMS_ON);
> +               igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STAT
> US_ACTIVE));
> +
> +               test_fade(context);
>  
> -       test_fade(context);
>  }
>  
>  static void
> @@ -179,9 +261,32 @@ test_fade_with_suspend(struct context *context,
> igt_output_t *output)
>         test_fade(context);
>  }
>  
> +static void test_backlight_dpms_cycle(struct context *context,
> igt_output_t *output)
> +{
> +       int result;
> +       enum pipe pipe;
> +
> +       for_each_pipe_with_valid_output(output->display, pipe,
> output) {
> +               if (output->config.connector->connector_type !=
> DRM_MODE_CONNECTOR_eDP)
> +                       continue;
> +
> +               igt_info("Testing backlight dpms on %s\n", output-
> >name);
> +
> +               backlight_write(context->max / 2, "brightness");
> +               usleep(100000);
> +               backlight_read(&result, context->drm_fd, output-
> >name);
> +
> +               kmstest_set_connector_dpms(output->display->drm_fd,
> output->config.connector, DRM_MODE_DPMS_OFF);
> +               kmstest_set_connector_dpms(output->display->drm_fd,
> output->config.connector, DRM_MODE_DPMS_ON);
> +               usleep(100000);
> +
> +               igt_assert_eq(read_actual_backlight(&result, context-
> >drm_fd, output->name), 0);
> +       }
> +}
> +
>  igt_main
>  {
> -       struct context context = {0};
> +       struct context context;
>         int old;
>         igt_display_t display;
>         igt_output_t *output;
> @@ -200,11 +305,12 @@ igt_main
>                  * try to enable all.
>                  */
>                 kmstest_set_vt_graphics_mode();
> -               igt_display_require(&display,
> drm_open_driver(DRIVER_INTEL));
> +               //igt_display_require(&display,
> drm_open_driver(DRIVER_INTEL));
> +               igt_display_require(&context.display,
> context.drm_fd);
>  
>                 /* Get the max value and skip the whole test if sysfs
> interface not available */
> -               igt_skip_on(backlight_read(&old, "brightness"));
> -               igt_assert(backlight_read(&context.max,
> "max_brightness") > -1);
> +               igt_skip_on(backlight_read(&old, context.drm_fd,
> output->name));
> +               igt_assert(backlight_read(&context.max,
> context.drm_fd, output->name) > -1);
>  
>                 /* should be ../../cardX-$output */
>                 igt_assert_lt(12, readlink(BACKLIGHT_PATH "/device",
> full_name, sizeof(full_name) - 1));
> @@ -245,6 +351,8 @@ igt_main
>                 test_fade_with_dpms(&context, output);
>         igt_subtest("fade_with_suspend")
>                 test_fade_with_suspend(&context, output);
> +       igt_subtest("backlight_dpms_cycle")
> +               test_backlight_dpms_cycle(&context, output);
>  
>         igt_fixture {
>                 /* Restore old brightness */


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

* Re: [igt-dev] [RFC, i-g-t] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight
  2022-09-07 13:15 Nidhi Gupta
@ 2022-09-07 13:57 ` Hogander, Jouni
  0 siblings, 0 replies; 5+ messages in thread
From: Hogander, Jouni @ 2022-09-07 13:57 UTC (permalink / raw)
  To: igt-dev, Gupta, Nidhi1

On Wed, 2022-09-07 at 18:45 +0530, Nidhi Gupta wrote:
> Added a new subtest as a part of i915_pm_backlight to validate
> dual panel support.
> 
> Signed-off-by: Nidhi Gupta <nidhi1.gupta@intel.com>
> ---
>  tests/i915/i915_pm_backlight.c | 74
> +++++++++++++++++++++++++++++++++-
>  1 file changed, 73 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/i915/i915_pm_backlight.c
> b/tests/i915/i915_pm_backlight.c
> index cafae7f7..d4b25f3f 100644
> --- a/tests/i915/i915_pm_backlight.c
> +++ b/tests/i915/i915_pm_backlight.c
> @@ -42,6 +42,7 @@ struct context {
>  
>  #define TOLERANCE 5 /* percent */
>  #define BACKLIGHT_PATH "/sys/class/backlight/intel_backlight"
> +#define BACKLIGHT_PATH_DUAL "/sys/class/backlight/card0-eDP-2-
> backlight"
>  
>  #define FADESTEPS 10
>  #define FADESPEED 100 /* milliseconds between steps */
> @@ -94,7 +95,52 @@ static int backlight_write(int value, const char
> *fname)
>  
>         return 0;
>  }
> +static int backlight_read_dual(int *result, const char *fname)
> +{
> +        int fd;
> +        char full[PATH_MAX];
> +        char dst[64];
> +        int r, e;
> +
> +        igt_assert(snprintf(full, PATH_MAX, "%s/%s",
> BACKLIGHT_PATH_DUAL, fname) < PATH_MAX);
> +
> +        fd = open(full, O_RDONLY);
> +        if (fd == -1)
> +                return -errno;
> +
> +        r = read(fd, dst, sizeof(dst));
> +        e = errno;
> +        close(fd);
> +
> +        if (r < 0)
> +                return -e;
> +
> +        errno = 0;
> +        *result = strtol(dst, NULL, 10);
> +        return errno;
> +}
> +
> +static int backlight_write_dual(int value, const char *fname)
> +{
> +        int fd;
> +        char full[PATH_MAX];
> +        char src[64];
> +        int len;
> +
> +        igt_assert(snprintf(full, PATH_MAX, "%s/%s",
> BACKLIGHT_PATH_DUAL, fname) < PATH_MAX);/sys/class/backlight/card0-
> eDP-2-backlight
> +        fd = open(full, O_WRONLY);
> +        if (fd == -1)
> +                return -errno;
>  
> +        len = snprintf(src, sizeof(src), "%i", value);
> +        len = write(fd, src, len);
> +        close(fd);
> +
> +        if (len < 0)
> +                return len;
> +
> +        return 0;
> +}

Instead of duplicating these functions maybe you could have path as a
parameter i.e. int backlight_write/read_dual(int value, const char
*path, const char *fname)

>  static void test_and_verify(struct context *context, int val)
>  {
>         const int tolerance = val * TOLERANCE / 100;
> @@ -112,7 +158,6 @@ static void test_and_verify(struct context
> *context, int val)
>                      "actual_brightness [%d] did not match expected
> brightness [%d +- %d]\n",
>                      result, val, tolerance);
>  }
> -
>  static void test_brightness(struct context *context)
>  {
>         test_and_verify(context, 0);
> @@ -120,6 +165,31 @@ static void test_brightness(struct context
> *context)
>         test_and_verify(context, context->max / 2);
>  }
>  
> +static void test_and_verify_dual(struct context *context, int val)
> +{
> +        const int tolerance = val * TOLERANCE / 100;
> +        int result;
> +
> +        igt_assert_eq(backlight_write_dual(val, "brightness"), 0);
> +        igt_assert_eq(backlight_read_dual(&result, "brightness"),
> 0);
> +        /* Check that the exact value sticks */
> +        igt_assert_eq(result, val);
> +
> +        igt_assert_eq(backlight_read_dual(&result,
> "actual_brightness"), 0);
> +        /* Some rounding may happen depending on hw */
> +        igt_assert_f(result >= max(0, val - tolerance) &&
> +                     result <= min(context->max, val + tolerance),
> +                     "actual_brightness [%d] did not match expected
> brightness [%d +- %d]\n",
> +                     result, val, tolerance);
> +}

You could consider adding path (/sys/class/backlight/intel_backlight
and /sys/class/backlight/card0-eDP-2-backlight) into context. That way
you can drop this function completely and just slightly modify existing
test_and_verify.

> +
> +static void test_brightness_dual(struct context *context)
> +{
> +        test_and_verify_dual(context, 0);
> +        test_and_verify_dual(context, context->max);
> +        test_and_verify_dual(context, context->max / 2);
> +}
> +
>  static void test_bad_brightness(struct context *context)
>  {
>         int val;
> @@ -237,6 +307,8 @@ igt_main
>  
>         igt_subtest("basic-brightness")
>                 test_brightness(&context);
> +       igt_subtest("basic-brightness-dual")
> +               test_brightness_dual(&context);
>         igt_subtest("bad-brightness")
>                 test_bad_brightness(&context);
>         igt_subtest("fade")

You could consider adding like:

static const char *paths[] = {
	"/sys/class/backlight/intel_backlight",
	"/sys/class/backlight/card0-eDP-2-backlight"
};

Then iterate that array and add subtests:

 context.path = path;
 igt_subtest_f("basic-brightness%s", edp_name(path))
	test_brightness(&context);

where edp is returning either "-edp1" or "-edp2" or alternatively
<empty> for edp1 and "-dual" for edp2 if you prefer that one.

BR,

Jouni Högander

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

* [igt-dev] [RFC, i-g-t] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight
@ 2022-09-07 13:15 Nidhi Gupta
  2022-09-07 13:57 ` Hogander, Jouni
  0 siblings, 1 reply; 5+ messages in thread
From: Nidhi Gupta @ 2022-09-07 13:15 UTC (permalink / raw)
  To: igt-dev; +Cc: Nidhi Gupta

Added a new subtest as a part of i915_pm_backlight to validate
dual panel support.

Signed-off-by: Nidhi Gupta <nidhi1.gupta@intel.com>
---
 tests/i915/i915_pm_backlight.c | 74 +++++++++++++++++++++++++++++++++-
 1 file changed, 73 insertions(+), 1 deletion(-)

diff --git a/tests/i915/i915_pm_backlight.c b/tests/i915/i915_pm_backlight.c
index cafae7f7..d4b25f3f 100644
--- a/tests/i915/i915_pm_backlight.c
+++ b/tests/i915/i915_pm_backlight.c
@@ -42,6 +42,7 @@ struct context {
 
 #define TOLERANCE 5 /* percent */
 #define BACKLIGHT_PATH "/sys/class/backlight/intel_backlight"
+#define BACKLIGHT_PATH_DUAL "/sys/class/backlight/card0-eDP-2-backlight"
 
 #define FADESTEPS 10
 #define FADESPEED 100 /* milliseconds between steps */
@@ -94,7 +95,52 @@ static int backlight_write(int value, const char *fname)
 
 	return 0;
 }
+static int backlight_read_dual(int *result, const char *fname)
+{
+        int fd;
+        char full[PATH_MAX];
+        char dst[64];
+        int r, e;
+
+        igt_assert(snprintf(full, PATH_MAX, "%s/%s", BACKLIGHT_PATH_DUAL, fname) < PATH_MAX);
+
+        fd = open(full, O_RDONLY);
+        if (fd == -1)
+                return -errno;
+
+        r = read(fd, dst, sizeof(dst));
+        e = errno;
+        close(fd);
+
+        if (r < 0)
+                return -e;
+
+        errno = 0;
+        *result = strtol(dst, NULL, 10);
+        return errno;
+}
+
+static int backlight_write_dual(int value, const char *fname)
+{
+        int fd;
+        char full[PATH_MAX];
+        char src[64];
+        int len;
+
+        igt_assert(snprintf(full, PATH_MAX, "%s/%s", BACKLIGHT_PATH_DUAL, fname) < PATH_MAX);
+        fd = open(full, O_WRONLY);
+        if (fd == -1)
+                return -errno;
 
+        len = snprintf(src, sizeof(src), "%i", value);
+        len = write(fd, src, len);
+        close(fd);
+
+        if (len < 0)
+                return len;
+
+        return 0;
+}
 static void test_and_verify(struct context *context, int val)
 {
 	const int tolerance = val * TOLERANCE / 100;
@@ -112,7 +158,6 @@ static void test_and_verify(struct context *context, int val)
 		     "actual_brightness [%d] did not match expected brightness [%d +- %d]\n",
 		     result, val, tolerance);
 }
-
 static void test_brightness(struct context *context)
 {
 	test_and_verify(context, 0);
@@ -120,6 +165,31 @@ static void test_brightness(struct context *context)
 	test_and_verify(context, context->max / 2);
 }
 
+static void test_and_verify_dual(struct context *context, int val)
+{
+        const int tolerance = val * TOLERANCE / 100;
+        int result;
+
+        igt_assert_eq(backlight_write_dual(val, "brightness"), 0);
+        igt_assert_eq(backlight_read_dual(&result, "brightness"), 0);
+        /* Check that the exact value sticks */
+        igt_assert_eq(result, val);
+
+        igt_assert_eq(backlight_read_dual(&result, "actual_brightness"), 0);
+        /* Some rounding may happen depending on hw */
+        igt_assert_f(result >= max(0, val - tolerance) &&
+                     result <= min(context->max, val + tolerance),
+                     "actual_brightness [%d] did not match expected brightness [%d +- %d]\n",
+                     result, val, tolerance);
+}
+
+static void test_brightness_dual(struct context *context)
+{
+        test_and_verify_dual(context, 0);
+        test_and_verify_dual(context, context->max);
+        test_and_verify_dual(context, context->max / 2);
+}
+
 static void test_bad_brightness(struct context *context)
 {
 	int val;
@@ -237,6 +307,8 @@ igt_main
 
 	igt_subtest("basic-brightness")
 		test_brightness(&context);
+	igt_subtest("basic-brightness-dual")
+		test_brightness_dual(&context);
 	igt_subtest("bad-brightness")
 		test_bad_brightness(&context);
 	igt_subtest("fade")
-- 
2.36.0

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

end of thread, other threads:[~2022-09-22  9:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21  8:58 [igt-dev] [RFC, i-g-t] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight Nidhi Gupta
2022-09-21 11:35 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight (rev2) Patchwork
2022-09-22  9:31 ` [igt-dev] [RFC, i-g-t] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight Hogander, Jouni
  -- strict thread matches above, loose matches on Subject: below --
2022-09-07 13:15 Nidhi Gupta
2022-09-07 13:57 ` Hogander, Jouni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.