From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paulo Zanoni Subject: [PATCH 6/6] igt_kms: add igt_unset_all_crtcs() Date: Thu, 7 Aug 2014 10:09:07 -0300 Message-ID: <1407416947-2282-6-git-send-email-przanoni@gmail.com> References: <1407416947-2282-1-git-send-email-przanoni@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-yk0-f174.google.com (mail-yk0-f174.google.com [209.85.160.174]) by gabe.freedesktop.org (Postfix) with ESMTP id C8AB389FD1 for ; Thu, 7 Aug 2014 06:09:32 -0700 (PDT) Received: by mail-yk0-f174.google.com with SMTP id q9so2741301ykb.19 for ; Thu, 07 Aug 2014 06:09:32 -0700 (PDT) In-Reply-To: <1407416947-2282-1-git-send-email-przanoni@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org Cc: Paulo Zanoni List-Id: intel-gfx@lists.freedesktop.org From: Paulo Zanoni 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 --- 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