From: "Thasleem, Mohammed" <mohammed.thasleem@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Thasleem@freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] lib/igt_kms: Add helper with DPMS to turn on and off the displays
Date: Wed, 5 Jul 2023 14:16:58 +0530 [thread overview]
Message-ID: <20230705084658.246195-1-mohammed.thasleem@intel.com> (raw)
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
This helper will turn on and off the displays with the help of DPMS
properties set to ON and OFF.
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Thasleem, Mohammed <mohammed.thasleem@intel.com>
---
lib/igt_kms.c | 36 ++++++++++++++++++++++++++++++++++++
lib/igt_kms.h | 3 +++
2 files changed, 39 insertions(+)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f2b0eed57..3afa0cee0 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6029,3 +6029,39 @@ bool i915_pipe_output_combo_valid(igt_display_t *display)
*/
return igt_check_bigjoiner_support(display);
}
+
+void igt_dpms_turn_on_display(int drm_fd)
+{
+ igt_display_t display;
+ igt_output_t *output;
+
+ if (!drmModeGetResources(drm_fd))
+ return;
+
+ igt_display_require(&display, drm_fd);
+
+ for_each_connected_output(&display, output)
+ igt_output_set_prop_value(output, IGT_CONNECTOR_DPMS, DRM_MODE_DPMS_ON);
+
+ igt_display_commit2(&display, COMMIT_ATOMIC);
+
+ igt_display_fini(&display);
+}
+
+void igt_dpms_turn_off_display(int drm_fd)
+{
+ igt_display_t display;
+ igt_output_t *output;
+
+ if (!drmModeGetResources(drm_fd))
+ return;
+
+ igt_display_require(&display, drm_fd);
+
+ for_each_connected_output(&display, output)
+ igt_output_set_prop_value(output, IGT_CONNECTOR_DPMS, DRM_MODE_DPMS_OFF);
+
+ igt_display_commit2(&display, COMMIT_ATOMIC);
+
+ igt_display_fini(&display);
+}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 1b6988c17..32d20d683 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1005,4 +1005,7 @@ bool igt_check_bigjoiner_support(igt_display_t *display);
bool igt_parse_mode_string(const char *mode_string, drmModeModeInfo *mode);
bool i915_pipe_output_combo_valid(igt_display_t *display);
+void igt_dpms_turn_on_display(int drm_fd);
+void igt_dpms_turn_off_display(int drm_fd);
+
#endif /* __IGT_KMS_H__ */
--
2.25.1
next reply other threads:[~2023-07-05 8:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 8:46 Thasleem, Mohammed [this message]
2023-07-05 9:45 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_kms: Add helper with DPMS to turn on and off the displays Patchwork
2023-07-05 11:05 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20230705084658.246195-1-mohammed.thasleem@intel.com \
--to=mohammed.thasleem@intel.com \
--cc=Thasleem@freedesktop.org \
--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