Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: Kunal Joshi <kunal1.joshi@intel.com>, igt-dev@lists.freedesktop.org
Cc: Nemesa Garg <nemesa.garg@intel.com>,
	Arun R Murthy <arun.r.murthy@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable dark screen detection
Date: Tue, 14 Nov 2023 19:37:23 +0200	[thread overview]
Message-ID: <1ca0b43f-27b8-4654-9855-bae69722fbd6@gmail.com> (raw)
In-Reply-To: <20231102062304.1204625-2-kunal1.joshi@intel.com>

On 2.11.2023 8.23, Kunal Joshi wrote:
> added helper function for dark screen detection
> 
> Cc: Nemesa Garg <nemesa.garg@intel.com>
> Cc: Arun R Murthy <arun.r.murthy@intel.com>
> Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
> Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
> ---
>   lib/igt_debugfs.c | 41 +++++++++++++++++++++++++++++++++++++++++
>   lib/igt_debugfs.h |  3 +++
>   2 files changed, 44 insertions(+)
> 
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index a7b54bae5..e2a4b17ea 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -743,3 +743,44 @@ void __igt_debugfs_dump(int device, const char *filename, int level)
>   	igt_log(IGT_LOG_DOMAIN, level, "%s:\n%s\n", filename, contents);
>   	free(contents);
>   }
> +
> +bool igt_is_dark_screen_supported(int drm_fd, enum pipe pipe)
> +{
> +        char buf[256];
> +        int dir;
> +
> +        dir = igt_debugfs_pipe_dir(drm_fd, pipe, O_DIRECTORY);
> +        igt_require_fd(dir);
> +        igt_debugfs_simple_read(dir, "i915_darkscreen_status", buf, sizeof(buf));
> +        close(dir);
> +        if (*buf == '\0')
> +                return false;
> +
> +        return strcasestr(buf, "0") || strcasestr(buf, "1");
> +}
> +
> +ssize_t igt_enable_dark_screen_detection(int drm_fd, enum pipe pipe)
> +{
> +        char buf[2];
> +        int dir;
> +	int enable_dark_screen_detection;
> +
> +	enable_dark_screen_detection = 1;
> +        snprintf(buf, sizeof(buf), "%d", enable_dark_screen_detection);

This feels bit excessive handling just to get char buf that says "1"

> +        dir = igt_debugfs_pipe_dir(drm_fd, pipe, O_DIRECTORY);
> +        igt_require_fd(dir);
> +        return igt_sysfs_write(dir, "i915_darkscreen_status", buf, sizeof(buf) - 1);
> +}
> +
> +ssize_t igt_disable_dark_screen_detection(int drm_fd, enum pipe pipe)
> +{
> +        char buf[2];
> +        int dir;
> +	int disable_dark_screen_detection;
> +
> +	disable_dark_screen_detection = 0;
> +        snprintf(buf, sizeof(buf), "%d", disable_dark_screen_detection);

Here same as above. Also this patch has some indentations done with 
spaces instead of tab. Patch generally seems ok, just these small detail.

/Juha-Pekka

> +        dir = igt_debugfs_pipe_dir(drm_fd, pipe, O_DIRECTORY);
> +        igt_require_fd(dir);
> +        return igt_sysfs_write(dir, "i915_darkscreen_status", buf, sizeof(buf) - 1);
> +}
> diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
> index 3e6194ade..bd539f54d 100644
> --- a/lib/igt_debugfs.h
> +++ b/lib/igt_debugfs.h
> @@ -77,6 +77,9 @@ void igt_hpd_storm_reset(int fd);
>   bool igt_hpd_storm_detected(int fd);
>   void igt_require_hpd_storm_ctl(int fd);
>   bool igt_ignore_long_hpd(int fd, bool enable);
> +bool igt_is_dark_screen_supported(int drm_fd, enum pipe pipe);
> +ssize_t igt_enable_dark_screen_detection(int drm_fd, enum pipe pipe);
> +ssize_t igt_disable_dark_screen_detection(int drm_fd, enum pipe pipe);
>   
>   /*
>    * Drop caches

  reply	other threads:[~2023-11-14 17:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02  6:23 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection Kunal Joshi
2023-11-02  6:23 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable " Kunal Joshi
2023-11-14 17:37   ` Juha-Pekka Heikkila [this message]
2023-11-02  6:23 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
2023-11-14 17:37   ` Juha-Pekka Heikkila
2023-11-02  7:47 ` [igt-dev] ✓ CI.xeBAT: success for add new subtests for dark screen detection Patchwork
2023-11-02  7:52 ` [igt-dev] ✓ Fi.CI.BAT: " Patchwork
2023-11-03  8:13 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-11-15  6:42 [igt-dev] [PATCH i-g-t 0/2] " Kunal Joshi
2023-11-15  6:42 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable " Kunal Joshi
2023-11-16 11:40   ` Juha-Pekka Heikkila
2023-11-17  7:03 [igt-dev] [PATCH i-g-t 0/2] add new subtests for " Kunal Joshi
2023-11-17  7:03 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable " Kunal Joshi
2023-11-22 21:01   ` Juha-Pekka Heikkila
2023-11-23  6:29 [igt-dev] [PATCH i-g-t 0/2] add new subtests for " Kunal Joshi
2023-11-23  6:29 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: added helper to enable/disable " Kunal Joshi
2023-11-28 16:12   ` Juha-Pekka Heikkila

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=1ca0b43f-27b8-4654-9855-bae69722fbd6@gmail.com \
    --to=juhapekka.heikkila@gmail.com \
    --cc=arun.r.murthy@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kunal1.joshi@intel.com \
    --cc=nemesa.garg@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