From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 6/6] igt_kms: add igt_unset_all_crtcs()
Date: Thu, 7 Aug 2014 10:09:07 -0300 [thread overview]
Message-ID: <1407416947-2282-6-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1407416947-2282-1-git-send-email-przanoni@gmail.com>
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
Both pm_rpm.c and pm_lpsp.c call it "disable_all_screens", but let's
give it a name that better describes what the implementation does.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
lib/igt_kms.c | 18 ++++++++++++++++++
lib/igt_kms.h | 1 +
tests/pm_lpsp.c | 17 +++--------------
tests/pm_rpm.c | 8 +-------
4 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 6cca7e8..678b3cd 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1560,3 +1560,21 @@ void igt_reset_connectors(void)
close(drm_fd);
}
+
+/**
+ * igt_unset_all_crtcs:
+ * @drm_fd: the DRM fd
+ * @resources: libdrm resources pointer
+ *
+ * Disables all the screens.
+ */
+void igt_unset_all_crtcs(int drm_fd, drmModeResPtr resources)
+{
+ int i, rc;
+
+ for (i = 0; i < resources->count_crtcs; i++) {
+ rc = drmModeSetCrtc(drm_fd, resources->crtcs[i], -1, 0, 0, NULL,
+ 0, NULL);
+ igt_assert(rc == 0);
+ }
+}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index f8c500e..43e84f6 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -258,6 +258,7 @@ void igt_reset_connectors(void);
bool igt_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
const char *name, uint32_t *prop_id, uint64_t *value,
drmModePropertyPtr *prop);
+void igt_unset_all_crtcs(int drm_fd, drmModeResPtr resources);
#endif /* __IGT_KMS_H__ */
diff --git a/tests/pm_lpsp.c b/tests/pm_lpsp.c
index 9d3884c..b3a21ea 100644
--- a/tests/pm_lpsp.c
+++ b/tests/pm_lpsp.c
@@ -70,22 +70,11 @@ static bool lpsp_is_enabled(int drm_fd)
return !(val & HSW_PWR_WELL_STATE_ENABLED);
}
-static void disable_all_screens(int drm_fd, drmModeResPtr drm_resources)
-{
- int i, rc;
-
- for (i = 0; i < drm_resources->count_crtcs; i++) {
- rc = drmModeSetCrtc(drm_fd, drm_resources->crtcs[i], -1, 0, 0,
- NULL, 0, NULL);
- igt_assert(rc == 0);
- }
-}
-
/* The LPSP mode is all about an enabled pipe, but we expect to also be in the
* low power mode when no pipes are enabled, so do this check anyway. */
static void screens_disabled_subtest(int drm_fd, drmModeResPtr drm_res)
{
- disable_all_screens(drm_fd, drm_res);
+ igt_unset_all_crtcs(drm_fd, drm_res);
igt_assert(lpsp_is_enabled(drm_fd));
}
@@ -131,7 +120,7 @@ static void edp_subtest(int drm_fd, drmModeResPtr drm_res,
.name = "Custom 1024x768",
};
- disable_all_screens(drm_fd, drm_res);
+ igt_unset_all_crtcs(drm_fd, drm_res);
for (i = 0; i < drm_res->count_connectors; i++) {
drmModeConnectorPtr c = drm_connectors[i];
@@ -193,7 +182,7 @@ static void non_edp_subtest(int drm_fd, drmModeResPtr drm_res,
uint32_t connector_id = 0, crtc_id = 0, buffer_id = 0;
drmModeModeInfoPtr mode = NULL;
- disable_all_screens(drm_fd, drm_res);
+ igt_unset_all_crtcs(drm_fd, drm_res);
for (i = 0; i < drm_res->count_connectors; i++) {
drmModeConnectorPtr c = drm_connectors[i];
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 800ab4b..84c71bd 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -232,13 +232,7 @@ static void disable_all_screens_dpms(struct mode_set_data *data)
static void disable_all_screens(struct mode_set_data *data)
{
- int i, rc;
-
- for (i = 0; i < data->res->count_crtcs; i++) {
- rc = drmModeSetCrtc(drm_fd, data->res->crtcs[i], -1, 0, 0,
- NULL, 0, NULL);
- igt_assert(rc == 0);
- }
+ igt_unset_all_crtcs(drm_fd, data->res);
}
static struct scanout_fb *create_fb(struct mode_set_data *data, int width,
--
2.0.1
next prev parent reply other threads:[~2014-08-07 13:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-07 13:09 [PATCH 1/6] igt_kms: don't get drmModeRes just to free it later Paulo Zanoni
2014-08-07 13:09 ` [PATCH 2/6] igt_kms: pass drm_fd instead of igt_display_t on some functions Paulo Zanoni
2014-08-07 13:09 ` [PATCH 3/6] igt_kms: optionally return the property from get_property Paulo Zanoni
2014-08-07 13:09 ` [PATCH 4/6] igt_kms: document and export igt_get_property() Paulo Zanoni
2014-08-07 14:43 ` Daniel Vetter
2014-08-07 13:09 ` [PATCH 5/6] tests/pm_rpm: use igt_get_property() Paulo Zanoni
2014-08-07 13:09 ` Paulo Zanoni [this message]
2014-08-07 14:45 ` [PATCH 6/6] igt_kms: add igt_unset_all_crtcs() Daniel Vetter
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=1407416947-2282-6-git-send-email-przanoni@gmail.com \
--to=przanoni@gmail.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=paulo.r.zanoni@intel.com \
/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