From patchwork Mon Mar 18 12:27:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Anshuman" X-Patchwork-Id: 10857559 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 1FE5A1669 for ; Mon, 18 Mar 2019 12:31:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 037CF29429 for ; Mon, 18 Mar 2019 12:31:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01E9D29437; Mon, 18 Mar 2019 12:31:51 +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 F418C29429 for ; Mon, 18 Mar 2019 12:31:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 331F889803; Mon, 18 Mar 2019 12:31:50 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5279D897E3; Mon, 18 Mar 2019 12:31:48 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 05:31:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,493,1544515200"; d="scan'208";a="134985148" Received: from genxfsim-desktop.iind.intel.com ([10.223.34.158]) by orsmga003.jf.intel.com with ESMTP; 18 Mar 2019 05:31:46 -0700 From: Anshuman Gupta To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org Date: Mon, 18 Mar 2019 17:57:53 +0530 Message-Id: <1552912077-32130-2-git-send-email-anshuman.gupta@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552912077-32130-1-git-send-email-anshuman.gupta@intel.com> References: <1552912077-32130-1-git-send-email-anshuman.gupta@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 1/5] lib/igt_pm: igt lib helper routines to support DC5/6 tests 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Jyoti Yadav dmc_loaded() will be used by new test i915_pm_dc.c which will validate Display C States. So moving the same to igt_pm library. Introduced igt_disable_runtime_pm() inorder to disable runtime suspend for the function which support dc9. v2: Simplify the comment section. v3: Remove . from the subject line. v4: Rebased, resolve conflicts in pm_rpm.c Included patch set version change log. v5: Listing actual change in patch set changelog to make review easier. v6: igt's lib added support for disabling runtime suspend, change in commit log. rebased due to test name pm_rpm changed to i915_pm_rpm. v7: Addressed review comment by saving POWER_DIR values in igt_disable_runtime_pm(). Signed-off-by: Jyoti Yadav Signed-off-by: Anshuman Gupta --- lib/igt_pm.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_pm.h | 2 ++ tests/i915/i915_pm_rpm.c | 17 +--------- 3 files changed, 85 insertions(+), 16 deletions(-) diff --git a/lib/igt_pm.c b/lib/igt_pm.c index 4902723..0e999b0 100644 --- a/lib/igt_pm.c +++ b/lib/igt_pm.c @@ -38,6 +38,7 @@ #include "drmtest.h" #include "igt_pm.h" #include "igt_aux.h" +#include "igt_sysfs.h" /** * SECTION:igt_pm @@ -577,6 +578,60 @@ bool igt_setup_runtime_pm(void) return true; } +bool igt_disable_runtime_pm(void) +{ + int fd; + ssize_t size; + char buf[6]; + + if (pm_status_fd < 0) { + fd = open(POWER_DIR "/autosuspend_delay_ms", O_RDWR); + if (fd < 0) + return false; + + size = read(fd, __igt_pm_runtime_autosuspend, + sizeof(__igt_pm_runtime_autosuspend)); + + if (size <= 0) { + close(fd); + return false; + } + + strchomp(__igt_pm_runtime_autosuspend); + igt_install_exit_handler(__igt_pm_runtime_exit_handler); + close(fd); + } + + /* We know we support runtime PM, let's try to disable it now. */ + fd = open(POWER_DIR "/control", O_RDWR); + igt_assert_f(fd >= 0, "Can't open " POWER_DIR "/control\n"); + + if (pm_status_fd < 0) { + igt_assert(read(fd, __igt_pm_runtime_control, + sizeof(__igt_pm_runtime_control)) > 0); + strchomp(__igt_pm_runtime_control); + + igt_debug("Saved runtime power management as '%s' and '%s'\n", + __igt_pm_runtime_autosuspend, __igt_pm_runtime_control); + } + + size = write(fd, "on\n", 3); + igt_assert(size == 3); + lseek(fd, 0, SEEK_SET); + size = read(fd, buf, ARRAY_SIZE(buf)); + igt_assert(size == 3); + igt_assert(strncmp(buf, "on\n", 3) == 0); + close(fd); + + if (pm_status_fd < 0) { + pm_status_fd = open(POWER_DIR "/runtime_status", O_RDONLY); + igt_assert_f(pm_status_fd >= 0, + "Can't open " POWER_DIR "/runtime_status\n"); + } + + return true; +} + /** * igt_get_runtime_pm_status: * @@ -620,3 +675,30 @@ bool igt_wait_for_pm_status(enum igt_runtime_pm_status status) { return igt_wait(igt_get_runtime_pm_status() == status, 10000, 100); } + +/** + * dmc_loaded: + * @debugfs: fd to the debugfs dir. + + * Check whether DMC FW is loaded or not. DMC FW is require for few Display C + * states like DC5 and DC6. FW does the Context Save and Restore during Display + * C States entry and exit. + * + * Returns: + * True if DMC FW is loaded otherwise false. + */ +bool igt_pm_dmc_loaded(int debugfs) +{ + igt_require(debugfs != -1); + char buf[15]; + int len; + + len = igt_sysfs_read(debugfs, "i915_dmc_info", buf, sizeof(buf) - 1); + if (len < 0) + return true; /* no CSR support, no DMC requirement */ + + buf[len] = '\0'; + + igt_info("DMC: %s\n", buf); + return strstr(buf, "fw loaded: yes"); +} diff --git a/lib/igt_pm.h b/lib/igt_pm.h index 10cc679..6c4617a 100644 --- a/lib/igt_pm.h +++ b/lib/igt_pm.h @@ -47,8 +47,10 @@ enum igt_runtime_pm_status { }; bool igt_setup_runtime_pm(void); +bool igt_disable_runtime_pm(void); void igt_restore_runtime_pm(void); enum igt_runtime_pm_status igt_get_runtime_pm_status(void); bool igt_wait_for_pm_status(enum igt_runtime_pm_status status); +bool igt_pm_dmc_loaded(int debugfs); #endif /* IGT_PM_H */ diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c index be296f5..2d7cb5e 100644 --- a/tests/i915/i915_pm_rpm.c +++ b/tests/i915/i915_pm_rpm.c @@ -710,21 +710,6 @@ static void setup_pc8(void) has_pc8 = true; } -static bool dmc_loaded(void) -{ - char buf[15]; - int len; - - len = igt_sysfs_read(debugfs, "i915_dmc_info", buf, sizeof(buf) - 1); - if (len < 0) - return true; /* no CSR support, no DMC requirement */ - - buf[len] = '\0'; - - igt_info("DMC: %s\n", buf); - return strstr(buf, "fw loaded: yes"); -} - static void dump_file(int dir, const char *filename) { char *contents; @@ -761,7 +746,7 @@ static bool setup_environment(void) igt_info("Runtime PM support: %d\n", has_runtime_pm); igt_info("PC8 residency support: %d\n", has_pc8); igt_require(has_runtime_pm); - igt_require(dmc_loaded()); + igt_require(igt_pm_dmc_loaded(debugfs)); out: disable_all_screens(&ms_data); From patchwork Mon Mar 18 12:27:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gupta, Anshuman" X-Patchwork-Id: 10857561 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 F2B301709 for ; Mon, 18 Mar 2019 12:31:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0AAB2942E for ; Mon, 18 Mar 2019 12:31:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEA0629436; Mon, 18 Mar 2019 12:31:54 +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 1EDBA2942E for ; Mon, 18 Mar 2019 12:31:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 529318984E; Mon, 18 Mar 2019 12:31:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7EBEC897E8; Mon, 18 Mar 2019 12:31:51 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 05:31:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,493,1544515200"; d="scan'208";a="134985163" Received: from genxfsim-desktop.iind.intel.com ([10.223.34.158]) by orsmga003.jf.intel.com with ESMTP; 18 Mar 2019 05:31:49 -0700 From: Anshuman Gupta To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org Date: Mon, 18 Mar 2019 17:57:54 +0530 Message-Id: <1552912077-32130-3-git-send-email-anshuman.gupta@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552912077-32130-1-git-send-email-anshuman.gupta@intel.com> References: <1552912077-32130-1-git-send-email-anshuman.gupta@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 2/5] tests/i915/i915_pm_dc: Added new test to verify Display C States 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Jyoti Yadav Currently this test validates DC5 upon PSR entry for supported platforms. Added new file for compilation inside Makefile and Meson. v2: Used the debugfs entry for DC counters instead of Registers. Used shorter names for variables. Introduced timeout to read DC counters. v3: one second timeout is introduced to read DC counters. Skip the subtest if counters are not available for that platform. v4: Rebased, to fix compilation error in psr_enable(), psr_wait_entry() and replaced igt_display_init() by igt_display_require() in pm_rpm.c. Addressed the review comment by removing unused function display_init, removing redundant igt commit suggested by Imre. Fixed typo in read_dc_counter(). v5: Addressed the review comment by removing redundant read_dc_counter(), clubbed cleanup() function in test_dc_state_psr() suggested by Imre. Rearranged preprocessor directives at one place. Fixed compilation warning by adding function prototype for dc_state_wait_entry() and check_dc_counter(). Listing actual change in patch set changelog to make review easier. v6: Fixed "i915_edp_psr_status" string to "Sink support: yes". v7: Rebased since test name changed from "pm_dc" to "i915_pm_dc", this will align with other PM tests. also changed the DC5/6 counter check timeout to 3 second. Signed-off-by: Jyoti Yadav Signed-off-by: Anshuman Gupta --- tests/Makefile.sources | 3 + tests/i915/i915_pm_dc.c | 209 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 213 insertions(+) create mode 100644 tests/i915/i915_pm_dc.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 71ccf00..5d6c449 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -492,6 +492,9 @@ i915_pm_rc6_residency_SOURCES = i915/i915_pm_rc6_residency.c TESTS_progs += i915_pm_rpm i915_pm_rpm_SOURCES = i915/i915_pm_rpm.c +TESTS_progs += i915_pm_dc +i915_pm_dc_SOURCES = i915/i915_pm_dc.c + TESTS_progs += i915_pm_rps i915_pm_rps_SOURCES = i915/i915_pm_rps.c diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c new file mode 100644 index 0000000..004a5c1 --- /dev/null +++ b/tests/i915/i915_pm_dc.c @@ -0,0 +1,209 @@ +/* + * Copyright © 2018 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ + +#include "igt.h" +#include "igt_sysfs.h" +#include "igt_psr.h" +#include +#include +#include +#include +#include "intel_bufmgr.h" +#include "intel_io.h" +#include "limits.h" + +/* DC State Flags */ +#define CHECK_DC5 1 +#define CHECK_DC6 2 + +typedef struct { + int drm_fd; + int debugfs_fd; + uint32_t devid; + igt_display_t display; + struct igt_fb fb_white; + enum psr_mode op_psr_mode; + drmModeModeInfo *mode; + igt_output_t *output; +} data_t; + +bool dc_state_wait_entry(int drm_fd, int dc_flag, int prev_dc_count); +void check_dc_counter(int drm_fd, int dc_flag, uint32_t prev_dc_count); + +static void setup_output(data_t *data) +{ + igt_display_t *display = &data->display; + igt_output_t *output; + enum pipe pipe; + + for_each_pipe_with_valid_output(display, pipe, output) { + drmModeConnectorPtr c = output->config.connector; + + if (c->connector_type != DRM_MODE_CONNECTOR_eDP) + continue; + + igt_output_set_pipe(output, pipe); + data->output = output; + data->mode = igt_output_get_mode(output); + + return; + } +} + +static void display_fini(data_t *data) +{ + igt_display_fini(&data->display); +} + +static bool edp_psr_sink_support(data_t *data) +{ + char buf[512]; + + igt_debugfs_simple_read(data->debugfs_fd, "i915_edp_psr_status", + buf, sizeof(buf)); + + return strstr(buf, "Sink support: yes"); +} + +static void cleanup(data_t *data) +{ + igt_plane_t *primary; + + primary = igt_output_get_plane_type(data->output, + DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(primary, NULL); + igt_display_commit(&data->display); + igt_remove_fb(data->drm_fd, &data->fb_white); +} + +static void setup_primary(data_t *data) +{ + igt_plane_t *primary; + + primary = igt_output_get_plane_type(data->output, + DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(primary, NULL); + igt_create_color_fb(data->drm_fd, + data->mode->hdisplay, data->mode->vdisplay, + DRM_FORMAT_XRGB8888, + LOCAL_I915_FORMAT_MOD_X_TILED, + 1.0, 1.0, 1.0, + &data->fb_white); + igt_plane_set_fb(primary, &data->fb_white); + igt_display_commit(&data->display); +} + +static uint32_t get_dc_counter(char *dc_data) +{ + char *e; + long ret; + char *s = strchr(dc_data, ':'); + + assert(s); + s++; + ret = strtol(s, &e, 10); + assert(((ret != LONG_MIN && ret != LONG_MAX) || errno != ERANGE) && + e > s && *e == '\n' && ret >= 0); + return ret; +} + +static uint32_t read_dc_counter(uint32_t drm_fd, int dc_flag) +{ + char buf[4096]; + char *str; + + igt_debugfs_read(drm_fd, "i915_dmc_info", buf); + + if (dc_flag & CHECK_DC5) + str = strstr(buf, "DC3 -> DC5 count"); + else if (dc_flag & CHECK_DC6) + str = strstr(buf, "DC5 -> DC6 count"); + + /* Check DC5/DC6 counter is available for the platform. + * Skip the test if counter is not available. + */ + igt_skip_on_f(str == NULL, "DC%d counter is not available\n", + dc_flag & CHECK_DC5 ? 5 : 6); + return get_dc_counter(str); +} + +bool dc_state_wait_entry(int drm_fd, int dc_flag, int prev_dc_count) +{ + return igt_wait(read_dc_counter(drm_fd, dc_flag) > prev_dc_count, 3000, 100); +} + +void check_dc_counter(int drm_fd, int dc_flag, uint32_t prev_dc_count) +{ + igt_assert_f(dc_state_wait_entry(drm_fd, dc_flag, prev_dc_count), + "DC%d state is not achieved\n", + dc_flag & CHECK_DC5 ? 5 : 6); +} + +static void test_dc_state_psr(data_t *data, int dc_flag) +{ + uint32_t dc_counter_before_psr; + + dc_counter_before_psr = read_dc_counter(data->drm_fd, dc_flag); + setup_output(data); + setup_primary(data); + igt_assert(psr_wait_entry(data->debugfs_fd, data->op_psr_mode)); + check_dc_counter(data->drm_fd, dc_flag, dc_counter_before_psr); + cleanup(data); +} + +int main(int argc, char *argv[]) +{ + bool has_runtime_pm; + data_t data = {}; + + igt_skip_on_simulation(); + igt_subtest_init(argc, argv); + igt_fixture { + data.drm_fd = drm_open_driver_master(DRIVER_INTEL); + data.debugfs_fd = igt_debugfs_dir(data.drm_fd); + igt_require(data.debugfs_fd != -1); + kmstest_set_vt_graphics_mode(); + data.devid = intel_get_drm_devid(data.drm_fd); + has_runtime_pm = igt_setup_runtime_pm(); + igt_info("Runtime PM support: %d\n", has_runtime_pm); + igt_require(has_runtime_pm); + igt_require(igt_pm_dmc_loaded(data.debugfs_fd)); + igt_display_require(&data.display, data.drm_fd); + } + + igt_subtest("dc5-psr") { + data.op_psr_mode = PSR_MODE_1; + psr_enable(data.debugfs_fd, data.op_psr_mode); + igt_require_f(edp_psr_sink_support(&data), + "Sink does not support PSR\n"); + test_dc_state_psr(&data, CHECK_DC5); + } + + igt_fixture { + close(data.debugfs_fd); + display_fini(&data); + } + + igt_exit(); +} diff --git a/tests/meson.build b/tests/meson.build index 9015f80..9437fad 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -221,6 +221,7 @@ i915_progs = [ 'i915_pm_lpsp', 'i915_pm_rc6_residency', 'i915_pm_rpm', + 'i915_pm_dc', 'i915_pm_rps', 'i915_pm_sseu', 'i915_query', From patchwork Mon Mar 18 12:27:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Anshuman" X-Patchwork-Id: 10857563 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 07BBF1390 for ; Mon, 18 Mar 2019 12:31:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7F0D2930A for ; Mon, 18 Mar 2019 12:31:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D65C72943F; Mon, 18 Mar 2019 12:31:56 +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 6FB312936D for ; Mon, 18 Mar 2019 12:31:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E1E7C8984F; Mon, 18 Mar 2019 12:31:55 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9682F89852; Mon, 18 Mar 2019 12:31:54 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 05:31:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,493,1544515200"; d="scan'208";a="134985179" Received: from genxfsim-desktop.iind.intel.com ([10.223.34.158]) by orsmga003.jf.intel.com with ESMTP; 18 Mar 2019 05:31:52 -0700 From: Anshuman Gupta To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org Date: Mon, 18 Mar 2019 17:57:55 +0530 Message-Id: <1552912077-32130-4-git-send-email-anshuman.gupta@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552912077-32130-1-git-send-email-anshuman.gupta@intel.com> References: <1552912077-32130-1-git-send-email-anshuman.gupta@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 3/5] tests/i915/i915_pm_dc: Added test for DC6 during PSR 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Jyoti Yadav This patch add subtest to check DC6 entry on PSR for the supported platforms. v2: Rename the subtest with more meaningful name. v3: Rebased. v4: Rebased, to fix compilation error in psr_enable(). Addressed review comment by fixing typo in comment description of DC6 PSR subtest. v5: Addressed the review comment by removing redundant read_dc_counter(), clubbed cleanup() function in test_dc_state_psr() suggested by Imre. Listing actual change in patch set changelog to make review easier. v6: Rebased due to test name pm_dc changed to i915_pm_dc, aligning to other PM tests. Signed-off-by: Jyoti Yadav Signed-off-by: Anshuman Gupta --- tests/i915/i915_pm_dc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c index 004a5c1..66e3e8f 100644 --- a/tests/i915/i915_pm_dc.c +++ b/tests/i915/i915_pm_dc.c @@ -200,6 +200,14 @@ int main(int argc, char *argv[]) test_dc_state_psr(&data, CHECK_DC5); } + igt_subtest("dc6-psr") { + data.op_psr_mode = PSR_MODE_1; + psr_enable(data.debugfs_fd, data.op_psr_mode); + igt_require_f(edp_psr_sink_support(&data), + "Sink does not support PSR\n"); + test_dc_state_psr(&data, CHECK_DC6); + } + igt_fixture { close(data.debugfs_fd); display_fini(&data); From patchwork Mon Mar 18 12:27:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Anshuman" X-Patchwork-Id: 10857565 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 0546D1390 for ; Mon, 18 Mar 2019 12:32:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB2A429438 for ; Mon, 18 Mar 2019 12:32:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF81129444; Mon, 18 Mar 2019 12:32:00 +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 4A50E29437 for ; Mon, 18 Mar 2019 12:32:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1988898B7; Mon, 18 Mar 2019 12:31:59 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0314B897E7; Mon, 18 Mar 2019 12:31:58 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 05:31:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,493,1544515200"; d="scan'208";a="134985193" Received: from genxfsim-desktop.iind.intel.com ([10.223.34.158]) by orsmga003.jf.intel.com with ESMTP; 18 Mar 2019 05:31:57 -0700 From: Anshuman Gupta To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org Date: Mon, 18 Mar 2019 17:57:56 +0530 Message-Id: <1552912077-32130-5-git-send-email-anshuman.gupta@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552912077-32130-1-git-send-email-anshuman.gupta@intel.com> References: <1552912077-32130-1-git-send-email-anshuman.gupta@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 4/5] tests/i915/i915_pm_dc: Added test for DC5 during DPMS 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Jyoti Yadav Added new subtest for DC5 entry during DPMS on/off cycle. During DPMS on/off cycle DC5 counter is incremented. v2: Rename the subtest with meaningful name. v3: Rebased. v4: Addressed review comments by removing leftover code cleanup(). v5: Addressed the review comment by removing redundant read_dc_counter() suggested by Imre. Listing actual change in patch set changelog to make review easier. v6: Three way patch applied, no functional change. v7: Disabling runtime suspend for the platfrom which support, DC9. rebased due to test name pm_dc changed to i915_pm_dc, aligning to other PM tests. v8: Introduced setup_dc_dpms() in order to disable runtime pm, restoring POWER_DIR values to its original and enabling runtime pm for other followed sub-tests. Signed-off-by: Jyoti Yadav Signed-off-by: Anshuman Gupta --- tests/i915/i915_pm_dc.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c index 66e3e8f..1b14262 100644 --- a/tests/i915/i915_pm_dc.c +++ b/tests/i915/i915_pm_dc.c @@ -46,6 +46,7 @@ typedef struct { enum psr_mode op_psr_mode; drmModeModeInfo *mode; igt_output_t *output; + bool runtime_suspend_disabled; } data_t; bool dc_state_wait_entry(int drm_fd, int dc_flag, int prev_dc_count); @@ -172,6 +173,52 @@ static void test_dc_state_psr(data_t *data, int dc_flag) cleanup(data); } +static void setup_dc_dpms(data_t *data) +{ + if (IS_BROXTON(data->devid) || IS_GEMINILAKE(data->devid) || IS_ICELAKE(data->devid)) { + data->runtime_suspend_disabled = igt_disable_runtime_pm(); + igt_require_f(data->runtime_suspend_disabled, + "unable to disable runtime pm for i915\n"); + } else { + data->runtime_suspend_disabled = false; + } +} + +static void dpms_off_on(data_t *data) +{ + for (int i = 0; i < data->display.n_outputs; i++) { + kmstest_set_connector_dpms(data->drm_fd, data->display.outputs[i].config.connector, + DRM_MODE_DPMS_OFF); + } + + if (!data->runtime_suspend_disabled) + igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED)); + + for (int i = 0; i < data->display.n_outputs; i++) { + kmstest_set_connector_dpms(data->drm_fd, data->display.outputs[i].config.connector, + DRM_MODE_DPMS_ON); + } + + if (!data->runtime_suspend_disabled) + igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE)); +} + +static void test_dc_state_dpms(data_t *data, int dc_flag) +{ + uint32_t dc_counter; + + dc_counter = read_dc_counter(data->drm_fd, dc_flag); + dpms_off_on(data); + check_dc_counter(data->drm_fd, dc_flag, dc_counter); + + /* if runtime PM is disabled for i915 restore it, + * so any other sub-test can use runtime-PM. */ + if (data->runtime_suspend_disabled) { + igt_restore_runtime_pm(); + igt_setup_runtime_pm(); + } +} + int main(int argc, char *argv[]) { bool has_runtime_pm; @@ -208,6 +255,11 @@ int main(int argc, char *argv[]) test_dc_state_psr(&data, CHECK_DC6); } + igt_subtest("dc5-dpms") { + setup_dc_dpms(&data); + test_dc_state_dpms(&data, CHECK_DC5); + } + igt_fixture { close(data.debugfs_fd); display_fini(&data); From patchwork Mon Mar 18 12:27:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Anshuman" X-Patchwork-Id: 10857567 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 0A0871669 for ; Mon, 18 Mar 2019 12:32:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0E0728F84 for ; Mon, 18 Mar 2019 12:32:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DED9829429; Mon, 18 Mar 2019 12:32:05 +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 911A028F84 for ; Mon, 18 Mar 2019 12:32:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BEBC898C8; Mon, 18 Mar 2019 12:32:04 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id A78FA898ED; Mon, 18 Mar 2019 12:32:03 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 05:32:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,493,1544515200"; d="scan'208";a="134985220" Received: from genxfsim-desktop.iind.intel.com ([10.223.34.158]) by orsmga003.jf.intel.com with ESMTP; 18 Mar 2019 05:32:01 -0700 From: Anshuman Gupta To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org Date: Mon, 18 Mar 2019 17:57:57 +0530 Message-Id: <1552912077-32130-6-git-send-email-anshuman.gupta@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552912077-32130-1-git-send-email-anshuman.gupta@intel.com> References: <1552912077-32130-1-git-send-email-anshuman.gupta@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 5/5] tests/i915/i915_pm_dc: Added test for DC6 during DPMS 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Jyoti Yadav Added new subtest for DC6 entry during DPMS on/off cycle. During DPMS on/off cycle DC6 counter is incremented. v2: Renamed the subtest name. v3: Rebased. v4: Addressed review comment by replacing igt_display_init() to igt_display_require(), changes got done in patch set 2. v5: Addressed the review comment by removing redundant read_dc_counter() suggested by Imre. Listing actual change in patch set changelog to make review easier. v6: Rebased due to test name pm_dc changed to i915_pm_dc, aligning to other PM tests. v7: Introduced setup_dc_dpms() inorder to disable i915 runtime PM for the platform supports DC9. Signed-off-by: Jyoti Yadav Signed-off-by: Anshuman Gupta --- tests/i915/i915_pm_dc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c index 1b14262..8587f92 100644 --- a/tests/i915/i915_pm_dc.c +++ b/tests/i915/i915_pm_dc.c @@ -260,6 +260,11 @@ int main(int argc, char *argv[]) test_dc_state_dpms(&data, CHECK_DC5); } + igt_subtest("dc6-dpms") { + setup_dc_dpms(&data); + test_dc_state_dpms(&data, CHECK_DC6); + } + igt_fixture { close(data.debugfs_fd); display_fini(&data);