From patchwork Thu Sep 4 01:29:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 4841991 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D0DEEC0338 for ; Thu, 4 Sep 2014 01:30:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E961420221 for ; Thu, 4 Sep 2014 01:30:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AF8E22020A for ; Thu, 4 Sep 2014 01:30:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 733FE6E613; Wed, 3 Sep 2014 18:30:10 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id D1E626E60D for ; Wed, 3 Sep 2014 18:30:08 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 03 Sep 2014 18:30:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,462,1406617200"; d="scan'208";a="568049921" Received: from rdvivi-bratislava.jf.intel.com ([10.7.196.74]) by orsmga001.jf.intel.com with ESMTP; 03 Sep 2014 18:30:07 -0700 From: Rodrigo Vivi To: intel-gfx@lists.freedesktop.org Date: Wed, 3 Sep 2014 21:29:55 -0400 Message-Id: <1409794206-2126-1-git-send-email-rodrigo.vivi@intel.com> X-Mailer: git-send-email 1.9.3 Cc: Rodrigo Vivi Subject: [Intel-gfx] [PATCH 01/12] tests/pm_psr: Update pm_psr for new psr debug interface. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP v2: Doesn't duplicate kernel's HAS_PSR. skip based on debugfs output. Signed-off-by: Rodrigo Vivi --- tests/pm_psr.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/tests/pm_psr.c b/tests/pm_psr.c index 3ab7e7a..16ec3fa 100644 --- a/tests/pm_psr.c +++ b/tests/pm_psr.c @@ -32,6 +32,8 @@ #include #include "drmtest.h" +#include "intel_chipset.h" +#include "igt_debugfs.h" #define SLEEP_DURATION 5000 // in milliseconds @@ -41,22 +43,34 @@ static int get_perf(const char *path) FILE *file; char str[4]; - file = fopen(path, "r"); - igt_assert(file); + file = igt_debugfs_fopen("i915_edp_psr_status", "r"); + igt_require(file); ret = fscanf(file, "Sink_Support: %s\n", str); igt_skip_on_f(ret == 0, "i915_edp_psr_status format not supported by this test case\n"); - igt_require(strcmp(str, "yes") == 0); + igt_skip_on_f(strcmp(str, "yes") != 0, + "PSR not supported on this platform\n"); + ret = fscanf(file, "Source_OK: %s\n", str); igt_assert(ret != 0); - igt_require(strcmp(str, "yes") == 0); ret = fscanf(file, "Enabled: %s\n", str); igt_assert(ret != 0); igt_assert(strcmp(str, "yes") == 0); + ret = fscanf(file, "Active: %s\n", str); + igt_skip_on_f(ret == 0, + "i915_edp_psr_status format not supported by this test case\n"); + + ret = fscanf(file, "Busy frontbuffer bits: %s\n", str); + igt_assert(ret != 0); + ret = fscanf(file, "Re-enable work scheduled: %s\n", str); + igt_assert(ret != 0); + ret = fscanf(file, "HW Enabled & Active bit: %s\n", str); + igt_assert(ret != 0); + ret = fscanf(file, "Performance_Counter: %i", &perf); igt_assert(ret != 0); @@ -68,15 +82,13 @@ static int get_perf(const char *path) igt_simple_main { - int ret, perf1, perf2; - int device = drm_get_card(); + int perf1, perf2; + int drm_fd = drm_open_any(); + uint32_t devid = intel_get_drm_devid(drm_fd); char *path; igt_skip_on_simulation(); - ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_edp_psr_status", device); - igt_assert(ret != -1); - perf1 = get_perf(path); sleep(SLEEP_DURATION / 1000); perf2 = get_perf(path);