[igt-dev] [PATCH i-g-t 4/5] lib/igt_psr: added function to check active dp pr

Joshi, Kunal1 kunal1.joshi at intel.com
Wed Oct 25 06:16:55 UTC 2023


Hello Jouni,

-----Original Message-----
From: Hogander, Jouni <jouni.hogander at intel.com> 
Sent: Friday, October 20, 2023 5:46 PM
To: Joshi, Kunal1 <kunal1.joshi at intel.com>; igt-dev at lists.freedesktop.org
Cc: Murthy, Arun R <arun.r.murthy at intel.com>; Manna, Animesh <animesh.manna at intel.com>
Subject: Re: [PATCH i-g-t 4/5] lib/igt_psr: added function to check active dp pr

On Fri, 2023-10-20 at 11:35 +0530, Kunal Joshi wrote:
> Added function to check if pr is active on a output.
> assuming SRDENT is the state to compare when pr is active
> 
> Cc: Jouni Högander <jouni.hogander at intel.com>
> Cc: Animesh Manna <animesh.manna at intel.com>
> Cc: Arun R Murthy <arun.r.murthy at intel.com>
> Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
> ---
>  lib/igt_psr.c | 23 +++++++++++++++++++++++
>  lib/igt_psr.h |  2 +-
>  2 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_psr.c b/lib/igt_psr.c index 4c912a064..683379db6 
> 100644
> --- a/lib/igt_psr.c
> +++ b/lib/igt_psr.c
> @@ -390,3 +390,26 @@ bool output_supports_pr(int debugfs_fd, 
> igt_output_t *output)
>  
>          return strstr(buf, "Panel Replay = yes");
>  }
> +
> +bool dp_pr_active_check(int debugfs_fd, igt_output_t *output) {
> +        char debugfs_file[128] = {0};
> +        char buf[PSR_STATUS_MAX_LEN];
> +        const char *state = "SRDENT";
> +        int ret;
> +
> +        if (!strstr(output->name,"DP"))
> +                return false;
> +
> +        sprintf(debugfs_file, "%s/i915_sink_status", output->name);
> +
> +        ret = igt_debugfs_simple_read(debugfs_fd, debugfs_file,
> +                                     buf, sizeof(buf));
> +        if (ret < 0) {
> +                igt_info("Could not read i915_edp_psr_status: %s\n",
> +                         strerror(-ret));
> +                return false;
> +        }
> +        igt_skip_on(strstr(buf, "PSR sink not reliable: yes"));
> +        return strstr(buf, state);
> +}

> Why did you choose to write new instead of modifying existing c ?
>
> BR
For DP pr we are using different debugfs directory to read,
so thought of creating new function for clear separation,

But can modify psr_sink_support if you think that will be better way.

Jouni Högander
> diff --git a/lib/igt_psr.h b/lib/igt_psr.h index 8e36fcf2f..dc603ffc3 
> 100644
> --- a/lib/igt_psr.h
> +++ b/lib/igt_psr.h
> @@ -56,5 +56,5 @@ bool i915_psr2_selective_fetch_check(int drm_fd);
>  bool i915_psr2_sel_fetch_to_psr1(int drm_fd);
>  void i915_psr2_sel_fetch_restore(int drm_fd);
>  bool output_supports_pr(int debugfs_fd, igt_output_t *output);
> -
> +bool dp_pr_active_check(int debugfs_fd, igt_output_t *output);
>  #endif

Thanks and Regards
Kunal Joshi



More information about the igt-dev mailing list