From: Mohammed Thasleem <mohammed.thasleem@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH v4 2/2] tests/intel/xe_pm: Add helper to turn on and off the displays
Date: Wed, 29 Nov 2023 03:01:35 +0530 [thread overview]
Message-ID: <20231128213135.29062-1-mohammed.thasleem@intel.com> (raw)
In-Reply-To: <20230912081129.6809-1-mohammed.thasleem@intel.com>
v2: Use IGT_CRTC_ACTIVE for displays On/Off.
v3: -Update commit message and helper names.
-Update display on and off helpers.
v4: Remove redundant code. (Bhanu)
v5: Move helper calls to test file.
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
Signed-off-by: Mohammed Thasleem <mohammed.thasleem@intel.com>
---
tests/intel/xe_pm.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
index 54f9c0f5e..377884112 100644
--- a/tests/intel/xe_pm.c
+++ b/tests/intel/xe_pm.c
@@ -37,10 +37,30 @@ typedef struct {
struct pci_device *pci_xe;
struct pci_device *pci_root;
char pci_slot_name[NAME_MAX];
+ drmModeResPtr res;
} device_t;
uint64_t orig_threshold;
+static void update_display(drmModeResPtr res, int fd_xe, int mode)
+{
+ int i;
+
+ for (i = 0; i < res->count_connectors; i++) {
+ drmModeConnector *connector = drmModeGetConnectorCurrent(fd_xe, res->connectors[i]);
+
+ if (!connector)
+ continue;
+
+ if (connector->connection != DRM_MODE_CONNECTED)
+ continue;
+
+ kmstest_set_connector_dpms(fd_xe, connector, mode);
+
+ drmModeFreeConnector(connector);
+ }
+}
+
/* runtime_usage is only available if kernel build CONFIG_PM_ADVANCED_DEBUG */
static bool runtime_usage_available(struct pci_device *pci)
{
@@ -95,7 +115,8 @@ static void vram_d3cold_threshold_restore(int sig)
static bool setup_d3(device_t device, enum igt_acpi_d_state state)
{
- update_display(device.fd_xe);
+ if (device.res)
+ update_display(device.res, device.fd_xe, DRM_MODE_DPMS_OFF);
switch (state) {
case IGT_ACPI_D3Cold:
@@ -115,7 +136,10 @@ static bool setup_d3(device_t device, enum igt_acpi_d_state state)
static void cleanup_d3(device_t device)
{
- update_display(device.fd_xe);
+ if (device.res) {
+ update_display(device.res, device.fd_xe, DRM_MODE_DPMS_ON);
+ drmModeFreeResources(device.res);
+ }
}
static bool in_d3(device_t device, enum igt_acpi_d_state state)
@@ -484,6 +508,7 @@ igt_main
igt_pm_get_d3cold_allowed(device.pci_slot_name, &d3cold_allowed);
igt_assert(igt_setup_runtime_pm(device.fd_xe));
sysfs_fd = igt_sysfs_open(device.fd_xe);
+ device.res = drmModeGetResources(device.fd_xe);
}
for (const struct s_state *s = s_states; s->name; s++) {
--
2.25.1
next prev parent reply other threads:[~2023-11-28 21:42 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 11:08 [igt-dev] [PATCH i-g-t v3 0/3] vram d3cold threshold test Anshuman Gupta
2023-07-18 11:08 ` [igt-dev] [PATCH i-g-t v3 1/3] lib/igt_kms: Add helper with DPMS to turn on and off the displays Anshuman Gupta
2023-07-18 19:03 ` Rodrigo Vivi
2023-08-07 9:32 ` [igt-dev] [PATCH v4 3/3] " Mohammed Thasleem
2023-08-07 15:13 ` Rodrigo Vivi
2023-08-07 17:04 ` Modem, Bhanuprakash
2023-09-07 19:22 ` [igt-dev] [PATCH i-g-t] lib/igt_kms: Add helper " Mohammed Thasleem
2023-09-08 5:14 ` Modem, Bhanuprakash
2023-09-08 5:17 ` Modem, Bhanuprakash
2023-09-12 8:11 ` Mohammed Thasleem
2023-09-13 11:02 ` Juha-Pekka Heikkila
2023-11-28 21:31 ` Mohammed Thasleem [this message]
2023-11-29 15:04 ` [igt-dev] [PATCH v4 2/2] tests/intel/xe_pm: " Kamil Konieczny
2023-07-18 11:08 ` [igt-dev] [PATCH i-g-t v3 2/3] tests/xe_pm : Add support to disable all crtc Anshuman Gupta
2023-07-18 19:04 ` Rodrigo Vivi
2023-11-28 21:30 ` [igt-dev] [PATCH v4 1/2] tests/intel/xe_pm " Mohammed Thasleem
2023-07-18 11:08 ` [igt-dev] [PATCH i-g-t v3 3/3] test/xe_pm: Add vram_d3cold_threshold subtest Anshuman Gupta
2023-07-20 21:07 ` Rodrigo Vivi
2023-07-21 7:22 ` Gupta, Anshuman
2023-07-21 15:06 ` Vivi, Rodrigo
2023-07-21 4:04 ` Nilawar, Badal
2023-07-21 7:17 ` Gupta, Anshuman
2023-07-18 12:42 ` [igt-dev] ○ CI.xeBAT: info for vram d3cold threshold test (rev3) Patchwork
2023-07-18 12:55 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-07-18 16:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-08-07 12:41 ` [igt-dev] ○ CI.xeBAT: info for vram d3cold threshold test (rev4) Patchwork
2023-08-07 12:49 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-08-07 17:25 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-09-07 19:38 ` [igt-dev] ✗ Fi.CI.BUILD: failure for vram d3cold threshold test (rev5) Patchwork
2023-09-12 11:30 ` [igt-dev] ✗ Fi.CI.BUILD: failure for vram d3cold threshold test (rev6) Patchwork
2023-11-28 21:59 ` [igt-dev] ✗ Fi.CI.BUILD: failure for vram d3cold threshold test (rev8) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231128213135.29062-1-mohammed.thasleem@intel.com \
--to=mohammed.thasleem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox