[igt-dev] [PATCH i-g-t] tests/i915/i915_pm_backlight: Brightness test during DPMS on and off
Mohammed Thasleem
mohammed.thasleem at intel.com
Sat Mar 25 18:34:05 UTC 2023
Set brightness by deviding max brightness, store and read it back.
The actual brightness should be same during DPMS on and off cycle.
Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
---
tests/i915/i915_pm_backlight.c | 37 ++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/tests/i915/i915_pm_backlight.c b/tests/i915/i915_pm_backlight.c
index 82960662..3961f4fc 100644
--- a/tests/i915/i915_pm_backlight.c
+++ b/tests/i915/i915_pm_backlight.c
@@ -188,6 +188,32 @@ check_suspend(igt_output_t *output)
igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
}
+static void check_dpms_cycle(igt_display_t *display, igt_output_t *output, 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);
+
+ 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));
+
+ 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));
+
+ backlight_read(&val_2, "actual_brightness", context);
+ igt_assert_eq(val_1, val_2);
+}
+
static void test_cleanup(igt_display_t *display, igt_output_t *output)
{
igt_output_set_pipe(output, PIPE_NONE);
@@ -325,6 +351,17 @@ igt_main
}
}
+ igt_describe("test brightness with dpms on and off cycle");
+ igt_subtest_with_dynamic("brightness-with-dpms") {
+ for (int j = 0; j < (dual_edp ? 2 : 1); j++) {
+ test_setup(display, &contexts->output[j]);
+ igt_dynamic_f("%s", igt_output_name(contexts[j].output)) {
+ check_dpms_cycle(&display, &contexts->output[j], &contexts[j]);
+ test_cleanup(&display, &contexts->output[j]);
+ }
+ }
+ }
+
igt_fixture {
/* Restore old brightness */
for (i = 0; i < (dual_edp ? 2 : 1); i++)
--
2.25.1
More information about the igt-dev
mailing list