Skip to contentSkip to conversation

DC states igt tests patch series v10

PATCH Superseded Anshuman Gupta 3 participants 8 messages Apr 16, 2019 1 message not in the archive Library code

v10 of 14 Superseded Latest is v14 →

lore
Share & tools
lore
#0 lore raw

v10 cover DC states igt tests patch series v10

This patch series adds new tests to validate Display C states.
DC states like DC5 and DC6 are validated during PSR entry/exit and during DPMS on/off cycle.

Sending new revision of patch series after addressing review comments and other relevant changes.

1. Changing the name of test from "pm_dc" to "i915_pm_dc" alinged to other PM tests.
2. Changing the DC5/6 counter check timeout from 1 sec to 3 sec,
as in case of PSR it requires more than 2 second to disable DC
power wells after vblank event.
3. Changed the test name from tests/pm_dc to tests tests/i915/i915_pm_dc in name of individual patch.
4. Addressed the review comment by saving POWER_DIR values in igt_disable_runtime_pm().
5. CI fixures for dc5-dpms failure.
Checking DC5 counter value after DPMS off, broke the dpms_on_off function to dpms_on and dpms_off.
6. Used igt_pm_enable_sata_link_power_management() function in order to use min_power policy for SATA.

Jyoti Yadav (5):
lib/igt_pm: igt lib helper routines to support DC5/6 tests tests/i915/i915_pm_dc: Added new test to verify Display C States tests/i915/i915_pm_dc: Added test for DC6 during PSR tests/i915/i915_pm_dc: Added test for DC5 during DPMS tests/i915/i915_pm_dc: Added test for DC6 during DPMS

 lib/igt_pm.c             |  83 ++++++++++++++
 lib/igt_pm.h             |   2 +
 tests/Makefile.sources   |   3 +
 tests/i915/i915_pm_dc.c  | 288 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/i915/i915_pm_rpm.c |  17 +--
 tests/meson.build        |   1 +
 6 files changed, 378 insertions(+), 16 deletions(-)
 create mode 100644 tests/i915/i915_pm_dc.c
Signature · 6 lines
2.7.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

PATCH v10 1/5 lib/igt_pm: igt lib helper routines to support DC5/6 tests

From: Jyoti Yadav <[email protected]>

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() in order 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(). [Imre]

---
 lib/igt_pm.c             | 83 ++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_pm.h             |  2 ++
 tests/i915/i915_pm_rpm.c | 17 +---------
 3 files changed, 86 insertions(+), 16 deletions(-)
lib/igt_pm.c +83 -0
index fd22273..6539428 100644
@@ -38,6 +38,7 @@
 #include "drmtest.h"
 #include "igt_pm.h"
 #include "igt_aux.h"
+#include "igt_sysfs.h"
 
 /**
  * SECTION:igt_pm
@@ -585,6 +586,61 @@ 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:
  *
@@ -628,3 +684,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");
+}
lib/igt_pm.h +2 -0
index 10cc679..6c4617a 100644
@@ -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 */
tests/i915/i915_pm_rpm.c +1 -16
index a2c9d0e..0c3b4e5 100644
@@ -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;
@@ -759,7 +744,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);
Signature · 6 lines
2.7.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#2 lore raw

PATCH v10 3/5 tests/i915/i915_pm_dc: Added test for DC6 during PSR

In reply to Anshuman Gupta

From: Jyoti Yadav <[email protected]>

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.

---
 tests/i915/i915_pm_dc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
tests/i915/i915_pm_dc.c +8 -0
index b86f2fc..e33610c 100644
@@ -203,6 +203,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 {
 		igt_pm_restore_sata_link_power_management(pm_data);
 		close(data.debugfs_fd);
Signature · 6 lines
2.7.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw

PATCH v10 4/5 tests/i915/i915_pm_dc: Added test for DC5 during DPMS

In reply to Anshuman Gupta

From: Jyoti Yadav <[email protected]>

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 platform 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.
v9: Check DC5 counter value after DPMS off, broke the dpms_on_off
function to dpms_on and dpms_off. [Imre]

---
 tests/i915/i915_pm_dc.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
tests/i915/i915_pm_dc.c +62 -0
index e33610c..fe82f0e 100644
@@ -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);
@@ -173,6 +174,62 @@ 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(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));
+}
+
+static void dpms_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_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(data);
+	check_dc_counter(data->drm_fd, dc_flag, dc_counter);
+	dpms_on(data);
+
+	/* 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;
@@ -211,6 +268,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 {
 		igt_pm_restore_sata_link_power_management(pm_data);
 		close(data.debugfs_fd);
Signature · 6 lines
2.7.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#4 lore raw

PATCH v10 5/5 tests/i915/i915_pm_dc: Added test for DC6 during DPMS

In reply to Anshuman Gupta

From: Jyoti Yadav <[email protected]>

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.

---
 tests/i915/i915_pm_dc.c | 5 +++++
 1 file changed, 5 insertions(+)
tests/i915/i915_pm_dc.c +5 -0
index fe82f0e..59dddf1 100644
@@ -273,6 +273,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 {
 		igt_pm_restore_sata_link_power_management(pm_data);
 		close(data.debugfs_fd);
Signature · 6 lines
2.7.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#5 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for DC states igt tests patch series (rev9)

In reply to Anshuman Gupta
== Series Details ==

== Series Details ==

Series: DC states igt tests patch series (rev9)
URL : https://patchwork.freedesktop.org/series/56713/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5939 -> IGTPW_2869
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/56713/revisions/9/mbox/

Known issues
------------

Here are the changes found in IGTPW_2869 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_create@basic-files:
- fi-gdg-551: NOTRUN -> SKIP [fdo#109271] +101

* igt@gem_exec_suspend@basic-s4-devices:
- fi-blb-e6850: PASS -> INCOMPLETE [fdo#107718]

* igt@i915_pm_rpm@module-reload:
- fi-skl-6770hq: PASS -> FAIL [fdo#108511]

* igt@i915_selftest@live_execlists:
- fi-apl-guc: PASS -> INCOMPLETE [fdo#103927] / [fdo#109720]

* igt@kms_busy@basic-flip-c:
- fi-byt-j1900: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
- fi-gdg-551: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

* igt@kms_chamelium@hdmi-crc-fast:
- fi-byt-j1900: NOTRUN -> SKIP [fdo#109271] +47

* igt@kms_frontbuffer_tracking@basic:
- fi-byt-clapper: PASS -> FAIL [fdo#103167]

* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
- fi-byt-clapper: PASS -> FAIL [fdo#103191]

* igt@runner@aborted:
- fi-apl-guc: NOTRUN -> FAIL [fdo#108622] / [fdo#109720]

#### Possible fixes ####

* igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
- fi-byt-clapper: FAIL [fdo#103191] -> PASS
- fi-glk-dsi: FAIL [fdo#103191] -> PASS

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108511]: https://bugs.freedesktop.org/show_bug.cgi?id=108511
[fdo#108622]: https://bugs.freedesktop.org/show_bug.cgi?id=108622
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720

Participating hosts (48 -> 43)
------------------------------

Additional (2): fi-byt-j1900 fi-gdg-551
Missing (7): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-icl-y fi-bdw-samus

Build changes
-------------

* IGT: IGT_4951 -> IGTPW_2869

CI_DRM_5939: 757f5370dc4baed0475b6e28efd67ecc267e8745 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2869: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2869/
IGT_4951: cc9a60c029432b5843724e4f2c57f9f815f7adbb @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Testlist changes ==

+igt@i915_pm_dc@dc5-dpms
+igt@i915_pm_dc@dc5-psr
+igt@i915_pm_dc@dc6-dpms
+igt@i915_pm_dc@dc6-psr

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2869/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Re: [igt-dev] [PATCH i-g-t v10 2/5] tests/i915/i915_pm_dc: Added new test to verify Display C States

Quoted 238 lines · Anshuman Gupta

From: Jyoti Yadav <[email protected]>

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.
v8: On few platform SATA i/p is blocking deeper package C states.
used igt_pm_enable_sata_link_power_management() function in order to use min_power policy.

---
 tests/Makefile.sources  |   3 +
 tests/i915/i915_pm_dc.c | 213 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/meson.build       |   1 +
 3 files changed, 217 insertions(+)
 create mode 100644 tests/i915/i915_pm_dc.c
tests/Makefile.sources +3 -0
index 214698d..21feb73 100644
@@ -489,6 +489,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
 
tests/i915/i915_pm_dc.c new file +180 -0
new file mode 100644
index 0000000..b86f2fc
@@ -0,0 +1,213 @@
+/*
+ * 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 <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#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, "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 = {};
+	int8_t *pm_data = NULL;

tests/i915/i915_pm_dc.c line 190

Quoted 10 lines
tests/i915/i915_pm_dc.c new file +10 -0
+
+	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);
+		pm_data = igt_pm_enable_sata_link_power_management();

I think eventually this should be moved to igt_setup_runtime_pm() (akin to igt_pm_enable_audio_runtime_pm()), but for now this is ok.

However I'd like that we fix now igt_pm_enable_sata_link_power_management() to restore the original state if things fail. Please look at igt_pm_enable_audio_runtime_pm() on how to do this. Basically make pm_data internal to lib/igt_pm.c instead of returning it and install an exit handler from igt_pm_enable_audio_runtime_pm() to restore things using pm_data. Make sure we can enable/restore the setting multiple times (needed for instance by i915_pm_rpm.c).

Quoted 38 lines
tests/i915/i915_pm_dc.c new file +23 -0
+		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 {
+		igt_pm_restore_sata_link_power_management(pm_data);
+		close(data.debugfs_fd);
+		display_fini(&data);
+	}
+
+	igt_exit();
+}
tests/meson.build +1 -0
index 5167a6c..f307cfb 100644
@@ -220,6 +220,7 @@ i915_progs = [
 	'i915_pm_lpsp',
 	'i915_pm_rc6_residency',
 	'i915_pm_rpm',
+	'i915_pm_dc',
 	'i915_pm_rps',
 	'i915_pm_sseu',
 	'i915_query',
Signature · 1 line
2.7.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#8 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for DC states igt tests patch series (rev9)

In reply to Anshuman Gupta
== Series Details ==

== Series Details ==

Series: DC states igt tests patch series (rev9)
URL : https://patchwork.freedesktop.org/series/56713/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5939_full -> IGTPW_2869_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/56713/revisions/9/mbox/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_2869_full:

### IGT changes ###

#### Possible regressions ####

* {igt@i915_pm_dc@dc6-dpms} (NEW):
- shard-iclb: NOTRUN -> FAIL +1
- shard-kbl: NOTRUN -> FAIL

New tests
---------

New tests have been introduced between CI_DRM_5939_full and IGTPW_2869_full:

### New IGT tests (4) ###

* igt@i915_pm_dc@dc5-dpms:
- Statuses : 4 pass(s) 2 skip(s)
- Exec time: [0.0, 2.21] s

* igt@i915_pm_dc@dc5-psr:
- Statuses : 1 pass(s) 5 skip(s)
- Exec time: [0.0, 3.38] s

* igt@i915_pm_dc@dc6-dpms:
- Statuses : 2 fail(s) 4 skip(s)
- Exec time: [0.0, 3.51] s

* igt@i915_pm_dc@dc6-psr:
- Statuses : 1 fail(s) 5 skip(s)
- Exec time: [0.0, 3.64] s

Known issues
------------

Here are the changes found in IGTPW_2869_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* {igt@i915_pm_dc@dc5-dpms} (NEW):
- shard-hsw: NOTRUN -> SKIP [fdo#109271] +3

* {igt@i915_pm_dc@dc6-dpms} (NEW):
- shard-apl: NOTRUN -> SKIP [fdo#109271] +2

* {igt@i915_pm_dc@dc6-psr} (NEW):
- shard-glk: NOTRUN -> SKIP [fdo#109271] +2

* igt@i915_pm_lpsp@screens-disabled:
- shard-hsw: PASS -> FAIL [fdo#110383]

* igt@kms_busy@extended-pageflip-hang-newfb-render-c:
- shard-snb: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +12

* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-d:
- shard-iclb: NOTRUN -> SKIP [fdo#109278] +2

* igt@kms_chamelium@dp-hpd-after-suspend:
- shard-iclb: NOTRUN -> SKIP [fdo#109284]

* igt@kms_fbcon_fbt@psr:
- shard-iclb: PASS -> FAIL [fdo#103833]

* igt@kms_flip@2x-flip-vs-fences:
- shard-iclb: NOTRUN -> SKIP [fdo#109274] +2

* igt@kms_frontbuffer_tracking@fbc-2p-pri-indfb-multidraw:
- shard-iclb: NOTRUN -> SKIP [fdo#109280] +9

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-shrfb-msflip-blt:
- shard-snb: NOTRUN -> SKIP [fdo#109271] +113

* igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
- shard-iclb: PASS -> FAIL [fdo#103167] +3

* igt@kms_frontbuffer_tracking@fbc-shrfb-scaledprimary:
- shard-apl: PASS -> FAIL [fdo#103167]
- shard-kbl: PASS -> FAIL [fdo#103167]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-pwrite:
- shard-iclb: PASS -> FAIL [fdo#109247] +14

* igt@kms_frontbuffer_tracking@psr-rgb101010-draw-mmap-wc:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] +33

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes:
- shard-apl: PASS -> DMESG-WARN [fdo#108566] +4

* igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: PASS -> SKIP [fdo#109441] +1

* igt@kms_psr@sprite_render:
- shard-iclb: PASS -> FAIL [fdo#107383] / [fdo#110215] +3

* igt@kms_setmode@basic:
- shard-snb: NOTRUN -> FAIL [fdo#99912]

* igt@kms_universal_plane@universal-plane-gen9-features-pipe-e:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

* igt@perf_pmu@busy-check-all-vcs1:
- shard-iclb: NOTRUN -> SKIP [fdo#109276] +3

* igt@prime_vgem@fence-flip-hang:
- shard-iclb: NOTRUN -> SKIP [fdo#109295]

* igt@tools_test@tools_test:
- shard-kbl: PASS -> SKIP [fdo#109271]

#### Possible fixes ####

* igt@gem_eio@in-flight-suspend:
- shard-kbl: INCOMPLETE [fdo#103665] -> PASS +1

* igt@gem_tiled_swapping@non-threaded:
- shard-iclb: FAIL [fdo#108686] -> PASS

* igt@i915_suspend@debugfs-reader:
- shard-apl: DMESG-WARN [fdo#108566] -> PASS +4

* igt@kms_cursor_legacy@2x-nonblocking-modeset-vs-cursor-atomic:
- shard-glk: FAIL [fdo#106509] / [fdo#107409] -> PASS

* igt@kms_flip@2x-flip-vs-expired-vblank:
- shard-glk: FAIL [fdo#105363] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-render:
- shard-iclb: FAIL [fdo#103167] -> PASS

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-pri-indfb-draw-mmap-cpu:
- shard-iclb: FAIL [fdo#109247] -> PASS +18

* igt@kms_plane@pixel-format-pipe-a-planes-source-clamping:
- shard-glk: SKIP [fdo#109271] -> PASS +1

* igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-iclb: FAIL [fdo#103166] -> PASS

* igt@kms_psr@primary_render:
- shard-iclb: FAIL [fdo#107383] / [fdo#110215] -> PASS +1

* igt@kms_psr@psr2_cursor_render:
- shard-iclb: SKIP [fdo#109441] -> PASS +2

* igt@kms_rotation_crc@multiplane-rotation-cropping-bottom:
- shard-kbl: DMESG-FAIL [fdo#105763] -> PASS

* igt@kms_setmode@basic:
- shard-kbl: FAIL [fdo#99912] -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103833]: https://bugs.freedesktop.org/show_bug.cgi?id=103833
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
[fdo#106509]: https://bugs.freedesktop.org/show_bug.cgi?id=106509
[fdo#107383]: https://bugs.freedesktop.org/show_bug.cgi?id=107383
[fdo#107409]: https://bugs.freedesktop.org/show_bug.cgi?id=107409
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109247]: https://bugs.freedesktop.org/show_bug.cgi?id=109247
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#110215]: https://bugs.freedesktop.org/show_bug.cgi?id=110215
[fdo#110383]: https://bugs.freedesktop.org/show_bug.cgi?id=110383
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (10 -> 6)
------------------------------

Missing (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005

Build changes
-------------

* IGT: IGT_4951 -> IGTPW_2869
* Piglit: piglit_4509 -> None

CI_DRM_5939: 757f5370dc4baed0475b6e28efd67ecc267e8745 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2869: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2869/
IGT_4951: cc9a60c029432b5843724e4f2c57f9f815f7adbb @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2869/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev