Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: Mohammed Thasleem <mohammed.thasleem@intel.com>,
	igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] lib/igt_kms: Add helper to turn on and off the displays
Date: Wed, 13 Sep 2023 14:02:44 +0300	[thread overview]
Message-ID: <5e7831da-46f6-25dd-411c-2e63dd020c8b@gmail.com> (raw)
In-Reply-To: <20230912081129.6809-1-mohammed.thasleem@intel.com>

On 12.9.2023 11.11, Mohammed Thasleem wrote:
> From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
> 
> This helper will turn on and off the displays with the help of
> IGT_CRTC_ACTIVE properties set to ON and OFF.
> 
> v2: Use IGT_CRTC_ACTIVE for displays On/Off.
> v3: -Update commit message and helper names.
>      -Update display on and off helpers.
> v4: Remove redundant code. (Bhanu)
> 
> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> Signed-off-by: Mohammed Thasleem <mohammed.thasleem@intel.com>
> ---
>   lib/igt_kms.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   lib/igt_kms.h |  3 +++
>   2 files changed, 57 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index c2f3728a6..b9cb6aa85 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -6083,3 +6083,57 @@ int igt_get_dp_mst_connector_id(igt_output_t *output)
>   
>   	return connector_id;
>   }
> +
> +/*
> + * igt_turn_on_display:
> + * @fd: A drm file descriptor
> + *
> + * It will Enable the all connected display.
> + */
> +void igt_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);

Why display reset? igt_display_require above already called 
igt_display_reset..probably multiple times.

> +
> +	for_each_pipe(&display, pipe) {
> +		for_each_valid_output_on_pipe(&display, pipe, output) {
> +			if (output->pending_pipe != PIPE_NONE)
> +				continue;
> +
> +			igt_output_set_pipe(output, pipe);
> +			break;
> +		}
> +	}
> +
> +	igt_display_commit2(&display, COMMIT_ATOMIC);
> +
> +	igt_display_fini(&display);

What's the use case for such function? If this is used in any test that 
does igt_display_require(..) this function will cause test to go on 
random state by doing require->reset->fini. This would leave other 
display structure changed property settings not matching to anything.

Also this function doesn't just turn on displays, it will cause modesets 
on them by setting rendering pipes active.

If you just want displays to be lit why not use dpms?

> +}
> +
> +/*
> + * igt_turn_off_display:
> + * @fd: A drm file descriptor
> + *
> + * It will disable  the all connected display.
> + */
> +void igt_turn_off_display(int drm_fd)
> +{
> +	igt_display_t display;
> +
> +	if (!drmModeGetResources(drm_fd))
> +		return;
> +
> +	igt_display_require(&display, drm_fd);
> +	igt_display_reset(&display);
> +
> +	igt_display_commit2(&display, COMMIT_ATOMIC);
> +
> +	igt_display_fini(&display);

this is same as above, this will mess up any kms test.

> +}
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index f2c3741fc..526477e4d 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -1016,4 +1016,7 @@ bool i915_pipe_output_combo_valid(igt_display_t *display);
>   bool igt_check_output_is_dp_mst(igt_output_t *output);
>   int igt_get_dp_mst_connector_id(igt_output_t *output);
>   
> +void igt_turn_on_display(int drm_fd);
> +void igt_turn_off_display(int drm_fd);
> +
>   #endif /* __IGT_KMS_H__ */

  reply	other threads:[~2023-09-13 11:02 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 11:08 [igt-dev] [PATCH i-g-t v3 0/3] vram d3cold threshold test Anshuman Gupta
2023-07-18 11:08 ` [igt-dev] [PATCH i-g-t v3 1/3] lib/igt_kms: Add helper with DPMS to turn on and off the displays Anshuman Gupta
2023-07-18 19:03   ` Rodrigo Vivi
2023-08-07  9:32   ` [igt-dev] [PATCH v4 3/3] " Mohammed Thasleem
2023-08-07 15:13     ` Rodrigo Vivi
2023-08-07 17:04     ` Modem, Bhanuprakash
2023-09-07 19:22     ` [igt-dev] [PATCH i-g-t] lib/igt_kms: Add helper " Mohammed Thasleem
2023-09-08  5:14       ` Modem, Bhanuprakash
2023-09-08  5:17       ` Modem, Bhanuprakash
2023-09-12  8:11       ` Mohammed Thasleem
2023-09-13 11:02         ` Juha-Pekka Heikkila [this message]
2023-11-28 21:31         ` [igt-dev] [PATCH v4 2/2] tests/intel/xe_pm: " Mohammed Thasleem
2023-11-29 15:04           ` Kamil Konieczny
2023-07-18 11:08 ` [igt-dev] [PATCH i-g-t v3 2/3] tests/xe_pm : Add support to disable all crtc Anshuman Gupta
2023-07-18 19:04   ` Rodrigo Vivi
2023-11-28 21:30   ` [igt-dev] [PATCH v4 1/2] tests/intel/xe_pm " Mohammed Thasleem
2023-07-18 11:08 ` [igt-dev] [PATCH i-g-t v3 3/3] test/xe_pm: Add vram_d3cold_threshold subtest Anshuman Gupta
2023-07-20 21:07   ` Rodrigo Vivi
2023-07-21  7:22     ` Gupta, Anshuman
2023-07-21 15:06       ` Vivi, Rodrigo
2023-07-21  4:04   ` Nilawar, Badal
2023-07-21  7:17     ` Gupta, Anshuman
2023-07-18 12:42 ` [igt-dev] ○ CI.xeBAT: info for vram d3cold threshold test (rev3) Patchwork
2023-07-18 12:55 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-07-18 16:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-08-07 12:41 ` [igt-dev] ○ CI.xeBAT: info for vram d3cold threshold test (rev4) Patchwork
2023-08-07 12:49 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-08-07 17:25 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-09-07 19:38 ` [igt-dev] ✗ Fi.CI.BUILD: failure for vram d3cold threshold test (rev5) Patchwork
2023-09-12 11:30 ` [igt-dev] ✗ Fi.CI.BUILD: failure for vram d3cold threshold test (rev6) Patchwork
2023-11-28 21:59 ` [igt-dev] ✗ Fi.CI.BUILD: failure for vram d3cold threshold test (rev8) 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=5e7831da-46f6-25dd-411c-2e63dd020c8b@gmail.com \
    --to=juhapekka.heikkila@gmail.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mohammed.thasleem@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