[PATCH i-g-t 06/14] lib/igt_kms: add function to check if retrain disabled
Samala, Pranay
pranay.samala at intel.com
Wed Sep 4 05:13:19 UTC 2024
> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Kunal Joshi
> Sent: Sunday, August 25, 2024 11:44 PM
> To: igt-dev at lists.freedesktop.org
> Cc: Joshi, Kunal1 <kunal1.joshi at intel.com>
> Subject: [PATCH i-g-t 06/14] lib/igt_kms: add function to check if retrain disabled
>
> add helper to check if retraining is disabled, retraining will be disable if we are at
> the lowest link parameters or the lowest mode supported on a panel
>
> Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
> ---
> lib/igt_kms.c | 24 ++++++++++++++++++++++++ lib/igt_kms.h | 1 +
> 2 files changed, 25 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 683989e84..2720095d4 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -6869,3 +6869,27 @@ void igt_force_lt_failure(int drm_fd, igt_output_t
> *output, int failure_count)
> value, sizeof(value));
> close(dir);
> }
> +
> +/**
> + * igt_get_dp_link_retrain_disabled:
> + * @drm_fd: A drm file descriptor
> + * @output: Target output
> + *
> + * Returns: True if link retrain disabled, false otherwise */ bool
> +igt_get_dp_link_retrain_disabled(int drm_fd, igt_output_t *output) {
> + int dir, res;
> + char buf[512];
> +
> + igt_require_f(output->name, "Invalid output");
> + dir = igt_debugfs_connector_dir(drm_fd, output->name, O_RDONLY);
> + igt_assert_f(dir >= 0, "Failed to open debugfs dir for connector %s\n",
> + igt_output_name(output));
Alignment should match open parenthesis.
Otherwise, code looks good to me.
Regards,
Pranay Samala
> + res = igt_debugfs_simple_read(dir,
> + "i915_dp_link_retrain_disabled",
> + buf, sizeof(buf));
> + close(dir);
> + igt_require(res > 0);
> + return strstr(buf, "yes");
> +}
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 57829416a..2d69d794a 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -1253,5 +1253,6 @@ enum dp_link_rate igt_get_dp_max_link_rate(int
> drm_fd, igt_output_t *output); enum dp_lane_count
> igt_get_dp_max_lane_count(int drm_fd, igt_output_t *output); void
> igt_force_link_retrain(int drm_fd, igt_output_t *output, int retrain_count); void
> igt_force_lt_failure(int drm_fd, igt_output_t *output, int failure_count);
> +bool igt_get_dp_link_retrain_disabled(int drm_fd, igt_output_t
> +*output);
>
> #endif /* __IGT_KMS_H__ */
> --
> 2.43.0
More information about the igt-dev
mailing list