[Intel-gfx] [PATCH 6/6] igt_kms: add igt_unset_all_crtcs()

Daniel Vetter daniel at ffwll.ch
Thu Aug 7 16:45:38 CEST 2014


On Thu, Aug 07, 2014 at 10:09:07AM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni at 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 at intel.com>

Same comment as earlier, this should have a kmstest_ prefix and needs to
be grouped together with those functions.
-Daniel

> ---
>  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
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list