From patchwork Mon Feb 13 23:43:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jim.bride@linux.intel.com X-Patchwork-Id: 9570885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D1CA60572 for ; Mon, 13 Feb 2017 23:45:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6310227F85 for ; Mon, 13 Feb 2017 23:45:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5802E2833B; Mon, 13 Feb 2017 23:45:15 +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=-4.2 required=2.0 tests=BAYES_00, 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 E549527F85 for ; Mon, 13 Feb 2017 23:45:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B0906E592; Mon, 13 Feb 2017 23:45:13 +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 4E81F6E58C for ; Mon, 13 Feb 2017 23:45:10 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 13 Feb 2017 15:45:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,158,1484035200"; d="scan'208";a="933496866" Received: from shiv.jf.intel.com ([10.7.198.83]) by orsmga003.jf.intel.com with ESMTP; 13 Feb 2017 15:45:09 -0800 From: Jim Bride To: intel-gfx@lists.freedesktop.org Date: Mon, 13 Feb 2017 15:43:26 -0800 Message-Id: <1487029408-28483-2-git-send-email-jim.bride@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487029408-28483-1-git-send-email-jim.bride@linux.intel.com> References: <1487029408-28483-1-git-send-email-jim.bride@linux.intel.com> Cc: Rodrigo Vivi Subject: [Intel-gfx] [PATCH I-G-T 2/4] tests/kms_psr_sink_crc: Refactor to use new PSR library primitives X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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 Cc: Rodrigo Vivi Signed-off-by: Jim Bride --- tests/kms_psr_sink_crc.c | 53 ++++++++++-------------------------------------- 1 file changed, 11 insertions(+), 42 deletions(-) diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index 8f6bdc0..1d9eb11 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -191,37 +191,6 @@ static void fill_render(data_t *data, uint32_t handle, unsigned char color) gem_bo_busy(data->drm_fd, handle); } -static bool psr_possible(data_t *data) -{ - char buf[512]; - - igt_debugfs_read("i915_edp_psr_status", buf); - - return running_with_psr_disabled || - strstr(buf, "Sink_Support: yes\n"); -} - -static bool psr_active(data_t *data) -{ - char buf[512]; - - igt_debugfs_read("i915_edp_psr_status", buf); - - return running_with_psr_disabled || - strstr(buf, "HW Enabled & Active bit: yes\n"); -} - -static bool wait_psr_entry(data_t *data) -{ - int timeout = 5; - while (timeout--) { - if (psr_active(data)) - return true; - sleep(1); - } - return false; -} - static void get_sink_crc(data_t *data, char *crc) { int ret; FILE *file; @@ -301,7 +270,7 @@ static void run_test(data_t *data) assert_or_manual(is_green(ref_crc), "screen GREEN"); /* Confirm screen stays Green after PSR got active */ - igt_assert(wait_psr_entry(data)); + igt_assert(igt_psr_await_status(true)); get_sink_crc(data, ref_crc); assert_or_manual(is_green(ref_crc), "screen GREEN"); @@ -315,7 +284,7 @@ static void run_test(data_t *data) igt_display_commit(&data->display); /* Confirm it is not Green anymore */ - igt_assert(wait_psr_entry(data)); + igt_assert(igt_psr_await_status(true)); get_sink_crc(data, ref_crc); if (data->test_plane == DRM_PLANE_TYPE_PRIMARY) assert_or_manual(!is_green(ref_crc), "screen WHITE"); @@ -513,7 +482,7 @@ int main(int argc, char *argv[]) igt_set_module_param_int("enable_psr", running_with_psr_disabled ? 0 : 1); - igt_skip_on(!psr_possible(&data)); + igt_skip_on(!igt_psr_possible()); data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096); igt_assert(data.bufmgr); @@ -524,7 +493,7 @@ int main(int argc, char *argv[]) igt_subtest("psr_basic") { setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); } for (op = PAGE_FLIP; op <= RENDER; op++) { @@ -532,7 +501,7 @@ int main(int argc, char *argv[]) data.test_plane = DRM_PLANE_TYPE_PRIMARY; data.op = op; setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); run_test(&data); test_cleanup(&data); } @@ -543,7 +512,7 @@ int main(int argc, char *argv[]) data.test_plane = DRM_PLANE_TYPE_OVERLAY; data.op = op; setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); run_test(&data); test_cleanup(&data); } @@ -554,7 +523,7 @@ int main(int argc, char *argv[]) data.test_plane = DRM_PLANE_TYPE_CURSOR; data.op = op; setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); run_test(&data); test_cleanup(&data); } @@ -564,7 +533,7 @@ int main(int argc, char *argv[]) data.test_plane = DRM_PLANE_TYPE_PRIMARY; data.op = RENDER; setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); dpms_off_on(data); @@ -579,7 +548,7 @@ int main(int argc, char *argv[]) dpms_off_on(data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); run_test(&data); test_cleanup(&data); } @@ -588,7 +557,7 @@ int main(int argc, char *argv[]) data.test_plane = DRM_PLANE_TYPE_PRIMARY; data.op = PAGE_FLIP; setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); @@ -605,7 +574,7 @@ int main(int argc, char *argv[]) igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); run_test(&data); test_cleanup(&data); }