public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: "José Roberto de Souza" <jose.souza@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 1/2] tests/kms_fbcon_fbt: Make FBC wait_until_update() more reliable
Date: Wed, 29 Apr 2020 18:00:40 +0300	[thread overview]
Message-ID: <20200429150040.GD5618@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <20200408201925.31566-1-jose.souza@intel.com>

On Wed, Apr 08, 2020 at 01:19:24PM -0700, José Roberto de Souza wrote:
> We can't depend onto debugfs reads of the FBC status as compression
> takes one idle frame to recompress and we could easily miss that.
> 
> Instead lets use the pipe CRC as it keeps the CRC of each frame so we
> can compare each other until a blink in the FBCON causes it do change.
> 
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> ---
>  lib/igt_debugfs.c     | 13 +++++++++++--
>  lib/igt_debugfs.h     |  1 +
>  tests/kms_fbcon_fbt.c | 39 ++++++++++++++++++++++++++++++---------
>  3 files changed, 42 insertions(+), 11 deletions(-)
> 
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index bf6be552..9e6c5c99 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -368,8 +368,17 @@ bool igt_debugfs_search(int device, const char *filename, const char *substring)
>   * Pipe CRC
>   */
>  
> -static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
> -				  int *index)
> +/**
> + * igt_find_crc_mismatch:
> + * @a: first pipe CRC value
> + * @b: second pipe CRC value
> + * @index: index of the first value that mismatched
> + *
> + * Check if CRC a and CRC b mismatch.
> + *
> + * Returns true if CRC values mismatch, false otherwise;
> + */
> +bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b, int *index)
>  {
>  	int nwords = min(a->n_words, b->n_words);
>  	int i;
> diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
> index 7d1a6175..722c5cc3 100644
> --- a/lib/igt_debugfs.h
> +++ b/lib/igt_debugfs.h
> @@ -85,6 +85,7 @@ typedef struct {
>  #define INTEL_PIPE_CRC_SOURCE_AUTO "auto"
>  #define AMDGPU_PIPE_CRC_SOURCE_DPRX "dprx"
>  
> +bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b, int *index);
>  void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b);
>  bool igt_check_crc_equal(const igt_crc_t *a, const igt_crc_t *b);
>  char *igt_crc_to_string_extended(igt_crc_t *crc, char delimiter, int crc_size);
> diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c
> index c2361730..546dff99 100644
> --- a/tests/kms_fbcon_fbt.c
> +++ b/tests/kms_fbcon_fbt.c
> @@ -142,13 +142,31 @@ static bool fbc_wait_until_disabled(int debugfs_fd)
>  	return r;
>  }
>  
> -static bool fbc_not_compressing_enabled(int debugfs_fd)
> +static bool fbc_check_cursor_blinking(struct drm_info *drm)
>  {
> -	char buf[128];
> +	igt_pipe_crc_t *pipe_crc;
> +	igt_crc_t crc[2];
> +	bool ret;
> +	int i;
>  
> -	igt_debugfs_simple_read(debugfs_fd, "i915_fbc_status", buf,
> -				sizeof(buf));
> -	return strstr(buf, "FBC enabled\nCompressing: no");
> +	pipe_crc = igt_pipe_crc_new(drm->fd, PIPE_A, INTEL_PIPE_CRC_SOURCE_AUTO);

There doesn't seem to be a way to find the actual pipe for fbcon, but
since nothing else is enabled here, it's a reasonable assumption:

Reviewed-by: Imre Deak <imre.deak@intel.com>

> +
> +	igt_pipe_crc_start(pipe_crc);
> +	igt_pipe_crc_drain(pipe_crc);
> +
> +	for (i = 0; i < 60; i++) {
> +		igt_pipe_crc_get_single(pipe_crc, &crc[i % 2]);
> +
> +		if (i > 0) {
> +			ret = igt_find_crc_mismatch(&crc[0], &crc[1], NULL);
> +			if (ret)
> +				break;
> +		}
> +	}
> +	igt_pipe_crc_stop(pipe_crc);
> +	igt_pipe_crc_free(pipe_crc);
> +
> +	return ret;
>  }
>  
>  static bool fbc_wait_until_update(struct drm_info *drm)
> @@ -161,11 +179,14 @@ static bool fbc_wait_until_update(struct drm_info *drm)
>  	 * For older GENs FBC is still expected to be disabled as it still
>  	 * relies on a tiled and fenceable framebuffer to track modifications.
>  	 */
> -	if (AT_LEAST_GEN(drm->devid, 9))
> -		return igt_wait(fbc_not_compressing_enabled(drm->debugfs_fd),
> -				2500, 1);
> -	else
> +	if (AT_LEAST_GEN(drm->devid, 9)) {
> +		if (!fbc_wait_until_enabled(drm->debugfs_fd))
> +			return false;
> +
> +		return fbc_check_cursor_blinking(drm);
> +	} else {
>  		return fbc_wait_until_disabled(drm->debugfs_fd);
> +	}
>  }
>  
>  typedef bool (*connector_possible_fn)(drmModeConnectorPtr connector);
> -- 
> 2.26.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

      parent reply	other threads:[~2020-04-29 15:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 20:19 [igt-dev] [PATCH i-g-t 1/2] tests/kms_fbcon_fbt: Make FBC wait_until_update() more reliable José Roberto de Souza
2020-04-08 20:19 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_fbcon_fbt: Reduce execution time by not calling wait_until_enabled() José Roberto de Souza
2020-04-29 15:01   ` Imre Deak
2020-04-30  6:43   ` Mun, Gwan-gyeong
2020-04-08 22:13 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] tests/kms_fbcon_fbt: Make FBC wait_until_update() more reliable Patchwork
2020-04-09  0:42 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_fbcon_fbt: Make FBC wait_until_update() more reliable (rev2) Patchwork
2020-04-09 12:41 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-04-11  3:42 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_fbcon_fbt: Make FBC wait_until_update() more reliable (rev3) Patchwork
2020-04-11 10:30 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-04-29 15:00 ` Imre Deak [this message]

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=20200429150040.GD5618@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jose.souza@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