[igt-dev] [PATCH i-g-t v2 1/2] lib/igt_debugfs: set provision to ignore long HPDs

Kamil Konieczny kamil.konieczny at linux.intel.com
Wed Mar 8 18:36:12 UTC 2023


Hi Vinod,

On 2023-02-14 at 11:57:23 +0200, Vinod Govindapillai wrote:
> Add provision to ignore long HPDs as some displays generate
> long HPDs even while connected. For some CI systems with
> such displays it might be usefull to ignore such spurious
> HPDs while executing testcases.
> 
> Cc: Imre Deak <imre.deak at intel.com>
> Signed-off-by: Vinod Govindapillai <vinod.govindapillai at intel.com>
> ---
>  lib/igt_debugfs.c | 22 ++++++++++++++++++++++
>  lib/igt_debugfs.h |  1 +
>  2 files changed, 23 insertions(+)
> 
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index 6de178d6..8d2d3144 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -411,6 +411,28 @@ bool igt_debugfs_search(int device, const char *filename, const char *substring)
>  	return matched;
>  }
>  
> +/**
> + * igt_ignore_long_hpd:

Add also description of parameters here.

> + *
> + * Set / unset ignore long HPD events from the panels. Some panels
> + * generate long HPDs even while connected to the ports causing
> + * unexpected CI execution issues. Set this to ignore such unexpected
> + * long HPDs where we dont expect to disconnect the displays.
> + */
> +void igt_ignore_long_hpd(int drm_fd, bool enable)
-- ^
imho bool would be better.

> +{
> +	int fd = igt_debugfs_open(drm_fd, "i915_ignore_long_hpd", O_WRONLY);
> +
> +	if (fd < 0) {
> +		igt_debug("couldn't open ignore long hpd file\n");
> +		return;

Then you can
	return false;
here.

> +	}
> +
> +	igt_assert_eq(write(fd, enable ? "1" : "0", 1), 1);

Asserts in libs should be avoided, so maybe:
	ret = write(fd, enable ? "1" : "0", 1);

> +
> +	close(fd);

and then:
	return ret == 1;

Btw regarding your second patch, did you reset this to old value
before leaving subtest ?

Regards,
Kamil

> +}
> +
>  static void igt_hpd_storm_exit_handler(int sig)
>  {
>  	int fd = drm_open_driver(DRIVER_INTEL);
> diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
> index a883e2d4..fe23a5ef 100644
> --- a/lib/igt_debugfs.h
> +++ b/lib/igt_debugfs.h
> @@ -72,6 +72,7 @@ void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
>  void igt_hpd_storm_reset(int fd);
>  bool igt_hpd_storm_detected(int fd);
>  void igt_require_hpd_storm_ctl(int fd);
> +void igt_ignore_long_hpd(int fd, bool enable);
>  
>  /*
>   * Drop caches
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list