[PATCH i-g-t] tests/intel/kms_pm_backlight: Brightness test during DPMS on and off

Mohammed Thasleem mohammed.thasleem at intel.com
Thu Sep 26 19:38:38 UTC 2024


Set brightness by deviding max brightness, store and read it back.
The actual brightness should be same during DPMS on and off cycle.

v2: Update test path and testplan documentation.
v3: Check backlight for all internal panels. (Jani)
v4: Minor changes.

Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
---
 tests/intel/kms_pm_backlight.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tests/intel/kms_pm_backlight.c b/tests/intel/kms_pm_backlight.c
index 140a95bcc..c93e5b357 100644
--- a/tests/intel/kms_pm_backlight.c
+++ b/tests/intel/kms_pm_backlight.c
@@ -66,6 +66,10 @@
  * SUBTEST: fade-with-suspend
  * Description: Test the fade with suspend.
  * Functionality: backlight, suspend
+ *
+ * SUBTEST: brightness-with-dpms
+ * Description: test brightness with dpms on and off cycle.
+ * Functionality: backlight, backlight
  */
 
 struct context {
@@ -78,6 +82,7 @@ struct context {
 enum {
 	TEST_NONE = 0,
 	TEST_DPMS,
+	TEST_DPMS_CYCLE,
 	TEST_SUSPEND,
 };
 
@@ -213,6 +218,22 @@ check_dpms(igt_output_t *output)
 	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE));
 }
 
+static void check_dpms_cycle(struct context *context)
+{
+	int max, val_1, val_2;
+
+	backlight_read(&max, "max_brightness", context);
+	igt_assert(max);
+
+	backlight_write(max / 2, "brightness", context);
+	backlight_read(&val_1, "actual_brightness", context);
+
+	check_dpms(context->output);
+
+	backlight_read(&val_2, "actual_brightness", context);
+	igt_assert_eq(val_1, val_2);
+}
+
 static void
 check_suspend(igt_output_t *output)
 {
@@ -276,6 +297,8 @@ igt_main
 		{ "bad-brightness", "test the bad brightness.", test_bad_brightness, TEST_NONE },
 		{ "fade", "test basic fade.", test_fade, TEST_NONE },
 		{ "fade-with-dpms", "test the fade with DPMS.", test_fade, TEST_DPMS },
+		{ "brightness-with-dpms", "test brightness with dpms on and off cycle.",
+		   check_dpms_cycle, TEST_DPMS_CYCLE},
 		{ "fade-with-suspend", "test the fade with suspend.", test_fade, TEST_SUSPEND },
 	};
 
-- 
2.25.1



More information about the igt-dev mailing list