From patchwork Thu Aug 23 12:16:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yadav, Jyoti R" X-Patchwork-Id: 10573781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C0FD109C for ; Thu, 23 Aug 2018 12:16:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B7742A406 for ; Thu, 23 Aug 2018 12:16:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F27D2B5AF; Thu, 23 Aug 2018 12:16:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 04BF42B59F for ; Thu, 23 Aug 2018 12:16:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E3776E0AA; Thu, 23 Aug 2018 12:16:45 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3617A6E0AA; Thu, 23 Aug 2018 12:16:44 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2018 05:16:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,278,1531810800"; d="scan'208";a="68507123" Received: from unknown (HELO localhost.localdomain) ([10.109.67.16]) by orsmga006.jf.intel.com with ESMTP; 23 Aug 2018 05:16:41 -0700 From: Jyoti Yadav To: igt-dev@lists.freedesktop.org Date: Thu, 23 Aug 2018 08:16:28 -0400 Message-Id: <1535026588-12495-1-git-send-email-jyoti.r.yadav@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [Intel-gfx] [PATCH] [intel-gfx][igt-dev] [PATCH i-g-t] tests/pm_backlight.c : Brightness test with DPMS and System suspend. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, vandita.kulkarni@intel.com, rodrigo.vivi@intel.com MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Jyoti BIOS programs few of PWM related registers during initial boot. But during System suspend those registers are cleared. This test aim to check whether display programs those registers properly after system resume. Also checks brightness programming during DPMS ON/OFF cycle to check backlight programming is done properly from display side. Signed-off-by: Jyoti Yadav --- tests/pm_backlight.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c index a695f90..6f6d727 100644 --- a/tests/pm_backlight.c +++ b/tests/pm_backlight.c @@ -47,6 +47,7 @@ struct context { #define FADESPEED 100 /* milliseconds between steps */ IGT_TEST_DESCRIPTION("Basic backlight sysfs test"); +static int8_t *pm_data = NULL; static int backlight_read(int *result, const char *fname) { @@ -150,19 +151,60 @@ static void test_fade(struct context *context) nanosleep(&ts, NULL); } } +static void test_fade_with_dpms(struct context *context, igt_output_t *output) +{ + int i; + static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 }; + bool has_runtime_pm; + has_runtime_pm = igt_setup_runtime_pm(); + igt_info("Runtime PM support: %d\n", has_runtime_pm); + igt_assert(has_runtime_pm); + kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF); + igt_assert(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)); + + /* 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_suspend(struct context *context, igt_output_t *output) +{ + int i; + static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 }; + kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF); + igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED)); + igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); + + /* 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); + } +} igt_main { struct context context = {0}; int old; igt_display_t display; + igt_output_t *output; struct igt_fb fb; igt_skip_on_simulation(); igt_fixture { enum pipe pipe; - igt_output_t *output; bool found = false; char full_name[32] = {}; char *name; @@ -187,7 +229,6 @@ igt_main for_each_pipe_with_valid_output(&display, pipe, output) { if (strcmp(name + 6, output->name)) continue; - found = true; break; } @@ -205,6 +246,7 @@ igt_main igt_plane_set_fb(primary, &fb); igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY); + pm_data = igt_pm_enable_sata_link_power_management(); } igt_subtest("basic-brightness") @@ -213,6 +255,10 @@ igt_main test_bad_brightness(&context); igt_subtest("fade") test_fade(&context); + igt_subtest("fade_with_dpms") + test_fade_with_dpms(&context, output); + igt_subtest("fade_with_suspend") + test_fade_with_suspend(&context, output); igt_fixture { /* Restore old brightness */ @@ -220,6 +266,8 @@ igt_main igt_display_fini(&display); igt_remove_fb(display.drm_fd, &fb); + igt_pm_restore_sata_link_power_management(pm_data); + free(pm_data); close(display.drm_fd); } }