All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karthik B S <karthik.b.s@intel.com>
To: Jason-JH Lin <jason-jh.lin@mediatek.com>,
	<igt-dev@lists.freedesktop.org>,
	 Swati Sharma <swati2.sharma@intel.com>,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Ville Syrjala <ville.syrjala@linux.intel.com>,
	Fei Shao <fshao@chromium.org>
Cc: Jani <jani.nikula@intel.com>,
	Paul-PL Chen <paul-pl.chen@mediatek.com>,
	Lancelot Wu <Lancelot.Wu@mediatek.com>,
	Manasi Navare <navaremanasi@google.com>,
	Gil Dekel <gildekel@google.com>, Yacoub <markyacoub@chromium.org>,
	<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: Re: [PATCH i-g-t] tests/kms_plane: Relax CRC frame sequence validation
Date: Mon, 10 Aug 2026 10:20:51 +0530	[thread overview]
Message-ID: <ee03b60f-4f8a-46aa-a6ae-04cc72bcf2a0@intel.com> (raw)
In-Reply-To: <20260608022810.48438-1-jason-jh.lin@mediatek.com>

Hi Jason-JH,

On 6/8/2026 7:57 AM, Jason-JH Lin wrote:
> The capture_crc() function validates that the CRC frame sequence
> returned by igt_pipe_crc_get_for_frame() matches the expected value.
> The current check uses exact equality (!=), however the library
> function igt_pipe_crc_get_for_frame() uses >= comparison internally:
>
>      do {
>          read_one_crc(pipe_crc, crc);
>          ...
>      } while (igt_vblank_before(crc->frame, vblank));
>
> The function loops while crc->frame < vblank, returning the first
> CRC where crc->frame >= expected, not necessarily an exact match.
>
> This strict validation can cause test failures on drivers that
> report CRC entries with frame sequences larger than expected. This
> happens when drivers use internal queuing mechanisms to ensure CRC
> values are correctly correlated with their corresponding frames.
>
> Example without internal queue (continuous CRC reporting):
>    - Driver generates CRC entries continuously every frame
>    - Frame sequence increments sequentially
>    - Test finds exact matches for all expected frames → PASS
>
> Example with internal queue (per-commit CRC reporting):
>    - Driver queues CRC and reports with current frame sequence
>    - Due to queue processing delay, reported sequence > expected
>    - For the last CRC, test adds +1 to expected (per IGT logic)
>    - Library's >= comparison returns valid CRC
>    - capture_crc's != check fails on last frame → FAIL
>
> Relax the validation to use < comparison instead of !=, which:
> 1. Aligns with igt_pipe_crc_get_for_frame() internal behavior
> 2. Accepts CRC entries with frame >= expected (valid cases)
> 3. Still catches real errors where frame < expected, indicating
>     CRC buffer overflow or stale data
>
> Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
> ---
>   tests/kms_plane.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index f21006784bfc..548506290c9b 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -766,9 +766,13 @@ static void capture_crc(data_t *data, unsigned int vblank, igt_crc_t *crc)
>   {
>   	igt_pipe_crc_get_for_frame(data->drm_fd, data->pipe_crc, vblank, crc);
>   
> +	/*
> +	 * igt_pipe_crc_get_for_frame uses >= comparison, so we check the same.
> +	 * Getting a frame < expected indicates CRC buffer overflow or timing issue.
> +	 */
>   	igt_fail_on_f(!igt_skip_crc_compare && !igt_run_in_simulation() &&
> -		      crc->has_valid_frame && crc->frame != vblank,
> -		      "Got CRC for the wrong frame (got %u, expected %u). CRC buffer overflow?\n",
> +		      crc->has_valid_frame && crc->frame < vblank,

Agree on the concept, but with that then isn't this check itself 
redundant as this has been taken care of already in the 
'igt_pipe_crc_get_for_frame'?

static inline bool igt_vblank_before(uint32_t a, uint32_t b)
{
         return igt_vblank_after(b, a);
}

Regards,
Karthik.B.S
> +		      "Got CRC for the wrong frame (got %u, expected >= %u). CRC buffer overflow?\n",
>   		      crc->frame, vblank);
>   }
>   

  parent reply	other threads:[~2026-08-10  4:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08  2:27 [PATCH i-g-t] tests/kms_plane: Relax CRC frame sequence validation Jason-JH Lin
2026-06-08  5:08 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-06-08  5:16 ` ✓ i915.CI.BAT: " Patchwork
2026-06-08 10:33 ` ✗ i915.CI.Full: failure " Patchwork
2026-06-08 12:48 ` ✓ Xe.CI.FULL: success " Patchwork
2026-06-12  6:07 ` [PATCH i-g-t] " Manasi Navare
2026-07-24 11:48   ` Jason-JH Lin (林睿祥)
2026-08-10  4:50 ` Karthik B S [this message]
2026-08-10  9:04   ` Jason-JH Lin (林睿祥)
2026-08-11 21:59     ` Manasi Navare
2026-08-12  1:36       ` Jason-JH Lin (林睿祥)

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=ee03b60f-4f8a-46aa-a6ae-04cc72bcf2a0@intel.com \
    --to=karthik.b.s@intel.com \
    --cc=Lancelot.Wu@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=fshao@chromium.org \
    --cc=gildekel@google.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=jason-jh.lin@mediatek.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=markyacoub@chromium.org \
    --cc=navaremanasi@google.com \
    --cc=paul-pl.chen@mediatek.com \
    --cc=swati2.sharma@intel.com \
    --cc=ville.syrjala@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.