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: Wed, 22 Nov 2023 23:01:38 +0200	[thread overview]
Message-ID: <bd0bdf97-594c-4f01-8cfe-1b51d05df079@gmail.com> (raw)
In-Reply-To: <20231117070356.1727656-2-kunal1.joshi@intel.com>

The code look all ok to me, those new functions just need the comment 
block above them as they're in lib and not static functions.

/Juha-Pekka

On 17.11.2023 9.03, 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)
> 
> 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 | 24 ++++++++++++++++++++++++
>   lib/igt_debugfs.h |  2 ++
>   2 files changed, 26 insertions(+)
> 
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index a7b54bae5..a39405710 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -743,3 +743,27 @@ 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)
> +{
> +	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

  reply	other threads:[~2023-11-22 21:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-11-17  7:03 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: added new subtest for darkscreen detection Kunal Joshi
2023-11-17  7:58 ` [igt-dev] ✗ Fi.CI.BAT: failure for add new subtests for dark screen detection (rev3) 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-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=bd0bdf97-594c-4f01-8cfe-1b51d05df079@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