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, 28 Nov 2023 18:12:36 +0200 [thread overview]
Message-ID: <1564f013-7cb4-408e-944f-c8430f9db4b7@gmail.com> (raw)
In-Reply-To: <20231123062944.1889520-2-kunal1.joshi@intel.com>
Hi,
On 23.11.2023 8.29, Kunal Joshi wrote:
> added helper function for dark screen detection
>
> v2: Fix indentation (JP)
> Reduce complexity and redundancy (JP)
>
> v3: Close fd (JP)
> Use ternary operator (JP)
>
> v4: Added comments for functions (JP)
>
> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> 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 | 39 +++++++++++++++++++++++++++++++++++++++
> lib/igt_debugfs.h | 2 ++
> 2 files changed, 41 insertions(+)
>
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index a7b54bae5..323030b19 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -743,3 +743,42 @@ 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);
> }
> +
> +/**
> + * igt_is_dark_screen_supported:
> + * @drm_fd: fd of the device
> + * @pipe: display pipe
> + *
> + * Returns true if dark screen detection supported on platform
> + */
> +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);
> + return (*buf == '0' || *buf == '1');
> +}
> +
> +/**
> + * igt_set_dark_screen_detection:
> + * @drm_fd: fd of the device
> + * @pipe: display pipe
> + * @enable: bool to enable/disable dark screen detection
> + *
> + * Enable/Disable dark screen detection for given @pipe
please include here also comment for the meaning of return value. With that
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> + */
> +ssize_t igt_set_dark_screen_detection(int drm_fd, enum pipe pipe, bool enable)
> +{
> + int dir;
> + int size;
> +
> + dir = igt_debugfs_pipe_dir(drm_fd, pipe, O_DIRECTORY);
> + igt_require_fd(dir);
> + size = igt_sysfs_write(dir, "i915_darkscreen_status", enable ? "1" : "0", 1);
> + close(dir);
> + return size;
> +}
> diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
> index 3e6194ade..68f25be59 100644
> --- a/lib/igt_debugfs.h
> +++ b/lib/igt_debugfs.h
> @@ -77,6 +77,8 @@ 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_set_dark_screen_detection(int drm_fd, enum pipe pipe, bool enable);
>
> /*
> * Drop caches
next prev parent reply other threads:[~2023-11-28 16:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-23 6:29 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection 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 [this message]
2023-11-23 6:29 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
2023-11-23 7:05 ` [igt-dev] ✓ CI.xeBAT: success for add new subtests for dark screen detection (rev4) Patchwork
2023-11-23 7:08 ` [igt-dev] ✓ Fi.CI.BAT: " Patchwork
2023-11-24 15:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2023-11-17 7:03 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection 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-15 6:42 [igt-dev] [PATCH i-g-t 0/2] add new subtests for " 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-02 6:23 [igt-dev] [PATCH i-g-t 0/2] add new subtests for " 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
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=1564f013-7cb4-408e-944f-c8430f9db4b7@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