From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0AE6EB64DE for ; Tue, 10 Sep 2024 13:13:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7003510E7C4; Tue, 10 Sep 2024 13:13:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="fVgBgjV3"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9EC0B10E7C3 for ; Tue, 10 Sep 2024 13:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725973991; x=1757509991; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z1sBc8+czXYDi5fOeiycnECyv+/IbMIwoGifTfpK5dw=; b=fVgBgjV3etmyZz2UjbjiVG/eLyUEvSXSrZX/rYRVSdB3aWU0vNDqGJLn KZuNnJx11XvAL2qkX/JUsdXnCwAxYiiu9fEJ10xCRVAuHzUL6IAqKeom6 n/5f1y8AYRr1LWBpQfCq39XhrYdhuw3VnUCJlp4RJ7jh4rqRqbbH0mE2r yF9qqJVRB7T3L8yLzs38kjVde04LL6df3keXeSmV51KPGZzP1hgYWHDfy LE7hvJGb5G3NvL80Htr+RwpYS5u2+K6EwqLiurDjHNk715JobWyVcLCtC 6nxCNOTUDbMk+p1VnOg1CfID2LFzaGZYCYv9yt6CRkKppgqZHlIRRlKsD g==; X-CSE-ConnectionGUID: MUOyVh1DSgSOTyA5e6OiDg== X-CSE-MsgGUID: RLQ8TnlvSz2LLYEAZByM1Q== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="24823261" X-IronPort-AV: E=Sophos;i="6.10,217,1719903600"; d="scan'208";a="24823261" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2024 06:13:11 -0700 X-CSE-ConnectionGUID: mlnN1AR8QUq/JW5FMexr7g== X-CSE-MsgGUID: hnqIYISXQfqJlUGMhjlkfw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,217,1719903600"; d="scan'208";a="66820841" Received: from pgcooper-mobl3.ger.corp.intel.com (HELO jhogande-mobl1..) ([10.245.245.145]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2024 06:13:11 -0700 From: =?UTF-8?q?Jouni=20H=C3=B6gander?= To: igt-dev@lists.freedesktop.org Cc: ramanaidu.naladala@intel.com, =?UTF-8?q?Jouni=20H=C3=B6gander?= Subject: [PATCH i-g-t v2 3/4] lib/igt_psr: Add mechanism to check sink status as well Date: Tue, 10 Sep 2024 16:12:47 +0300 Message-Id: <20240910131248.334521-4-jouni.hogander@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240910131248.334521-1-jouni.hogander@intel.com> References: <20240910131248.334521-1-jouni.hogander@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" We have seen passing PSR testcases even though panel is not even aware of PSR being used. This can happen because we currently not checking sink PSR statuses at all. Also sink might have detected errors but our testcase currently don't care about that. Help the gap described above by adding new interface to check sink error statuses. Also add sink status check to be part of psr_is_active check. Signed-off-by: Jouni Högander Reviewed-by: Naladala Ramanaidu --- lib/igt_psr.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++- lib/igt_psr.h | 1 + 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/lib/igt_psr.c b/lib/igt_psr.c index e3e7577eb..47517b5dc 100644 --- a/lib/igt_psr.c +++ b/lib/igt_psr.c @@ -52,6 +52,19 @@ bool selective_fetch_check(int debugfs_fd, igt_output_t *output) return strstr(buf, "PSR2 selective fetch: enabled"); } +static bool psr_active_sink_check(int debugfs_fd, igt_output_t *output) +{ + char debugfs_file[128] = {0}; + char buf[PSR_STATUS_MAX_LEN]; + int ret; + + sprintf(debugfs_file, "%s/i915_psr_sink_status", output->name); + ret = igt_debugfs_simple_read(debugfs_fd, debugfs_file, buf, + sizeof(buf)); + igt_assert_f(ret >= 1, "Failed to read sink status\n"); + + return strstr(buf, "0x2 [active, display from RFB]"); +} /* * Checks if Early Transport is enabled in PSR status by reading the debugfs. @@ -72,6 +85,7 @@ static bool psr_active_check(int debugfs_fd, enum psr_mode mode, igt_output_t *o char buf[PSR_STATUS_MAX_LEN]; drmModeConnector *c; const char *state; + bool active; int ret; if (mode == PR_MODE || mode == PR_MODE_SEL_FETCH) { @@ -100,7 +114,11 @@ static bool psr_active_check(int debugfs_fd, enum psr_mode mode, igt_output_t *o igt_skip_on(strstr(buf, "PSR sink not reliable: yes")); - return strstr(buf, state); + active = strstr(buf, state); + if (active && output) + active = psr_active_sink_check(debugfs_fd, output); + + return active; } /* @@ -297,6 +315,38 @@ bool psr_sink_support(int device, int debugfs_fd, enum psr_mode mode, igt_output } } +/** + * psr_sink_error_check + * Check and assert on PSR errors detected by panel + * + * Returns: + * None + */ +void psr_sink_error_check(int debugfs_fd, enum psr_mode mode, igt_output_t *output) +{ + char *line; + char debugfs_file[128] = {0}; + char buf[PSR_STATUS_MAX_LEN]; + int ret; + + sprintf(debugfs_file, "%s/i915_psr_sink_status", output->name); + ret = igt_debugfs_simple_read(debugfs_fd, debugfs_file, buf, + sizeof(buf)); + igt_assert_f(ret >= 1, "Failed to read sink status\n"); + + line = strstr(buf, "error status: 0x0"); + + /* + * On certain PSR1 panels we are seeing "PSR VSC SDP + * uncorrectable error" bit set even it is applicable for PSR1 + * only + */ + if (!line && mode == PSR_MODE_1) + line = strstr(buf, "Sink PSR error status: 0x4"); + + igt_assert_f(line, "Sink detected PSR error(s):\n%s\n", buf); +} + #define PSR2_SU_BLOCK_STR_LOOKUP "PSR2 SU blocks:\n0\t" /* Return the the last or last but one su blocks */ diff --git a/lib/igt_psr.h b/lib/igt_psr.h index a7ebd0739..7639f8d46 100644 --- a/lib/igt_psr.h +++ b/lib/igt_psr.h @@ -56,6 +56,7 @@ bool psr_long_wait_update(int debugfs_fd, enum psr_mode mode, igt_output_t *outp bool psr_enable(int device, int debugfs_fd, enum psr_mode, igt_output_t *output); bool psr_disable(int device, int debugfs_fd, igt_output_t *output); bool psr_sink_support(int device, int debugfs_fd, enum psr_mode mode, igt_output_t *output); +void psr_sink_error_check(int debugfs_fd, enum psr_mode mode, igt_output_t *output); bool psr2_wait_su(int debugfs_fd, uint16_t *num_su_blocks); void psr_print_debugfs(int debugfs_fd); enum psr_mode psr_get_mode(int debugfs_fd, igt_output_t *output); -- 2.34.1