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: Thu, 16 Nov 2023 13:40:04 +0200 [thread overview]
Message-ID: <51f014ca-fd5f-431b-87e8-876421e8ac9f@gmail.com> (raw)
In-Reply-To: <20231115064253.1680913-2-kunal1.joshi@intel.com>
On 15.11.2023 8.42, Kunal Joshi wrote:
> added helper function for dark screen detection
>
> v2: Fix indentation (JP)
> Reduce complexity and redundancy (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>
> Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
> ---
> lib/igt_debugfs.c | 23 +++++++++++++++++++++++
> lib/igt_debugfs.h | 2 ++
> 2 files changed, 25 insertions(+)
>
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index a7b54bae5..c4a8b532d 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -743,3 +743,26 @@ 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);
> + return (*buf == '0' || *buf == '1');
> +}
> +
> +ssize_t igt_set_dark_screen_detection(int drm_fd, enum pipe pipe, bool enable)
> +{
> + char buf[2];
> + int dir;
> +
> + snprintf(buf, sizeof(buf), "%d", enable ? 1 : 0);
> + 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);
Would something like
igt_sysfs_write(dir, "i915_darkscreen_status", enable ? "1" : "0", 1);
work?
Also I think you'll need to close dir before return
/Juha-Pekka
> +}
> 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-16 11:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-15 6:42 [igt-dev] [PATCH i-g-t 0/2] add new subtests for dark screen detection 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 [this message]
2023-11-15 6:42 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
2023-11-15 7:36 ` [igt-dev] ✗ Fi.CI.BAT: failure for add new subtests for dark screen detection (rev2) Patchwork
2023-11-15 8:16 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
-- strict thread matches above, loose matches on Subject: below --
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
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-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=51f014ca-fd5f-431b-87e8-876421e8ac9f@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