[igt-dev] [PATCH v4 3/3] lib/igt_kms: Add helper with DPMS to turn on and off the displays

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Aug 7 15:13:28 UTC 2023


On Mon, Aug 07, 2023 at 03:02:01PM +0530, Mohammed Thasleem wrote:
> From: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
> 
> This helper will turn on and off the displays with the help of DPMS
> properties set to ON and OFF.
> 
> v2: Use IGT_CRTC_ACTIVE for displays On/Off.

yeap, I believe that also works. you can keep my rv-b.

> 
> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta at intel.com>
> Signed-off-by: Thasleem, Mohammed <mohammed.thasleem at intel.com>
> ---
>  lib/igt_kms.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_kms.h |  3 +++
>  2 files changed, 53 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index f2b0eed57..97283d55e 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -6029,3 +6029,53 @@ 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;
> +	enum pipe pipe;
> +
> +	if (!drmModeGetResources(drm_fd))
> +		return;
> +
> +	igt_display_require(&display, drm_fd);
> +	igt_display_reset(&display);
> +
> +	for_each_connected_output(&display, output) {
> +		for_each_pipe(&display, pipe) {
> +			igt_display_reset(&display);
> +			igt_output_set_pipe(output, pipe);
> +			igt_pipe_set_prop_value(&display, pipe, IGT_CRTC_ACTIVE, 1);
> +		}
> +	}
> +
> +	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;
> +	enum pipe pipe;
> +
> +	if (!drmModeGetResources(drm_fd))
> +		return;
> +
> +	igt_display_require(&display, drm_fd);
> +	igt_display_reset(&display);
> +
> +	for_each_connected_output(&display, output) {
> +		for_each_pipe(&display, pipe) {
> +			igt_display_reset(&display);
> +			igt_output_set_pipe(output, pipe);
> +			igt_pipe_set_prop_value(&display, pipe, IGT_CRTC_ACTIVE, 0);
> +		}
> +	}
> +
> +	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
> 


More information about the igt-dev mailing list