Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: Swati Sharma <swati2.sharma@intel.com>, <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t 09/10] lib/igt_chamelium: Add chamelium_frame_eq_or_dump_frame_pair()
Date: Wed, 23 Apr 2025 08:58:36 +0530	[thread overview]
Message-ID: <419ae9d3-d032-4a23-a756-40c408e43ab5@intel.com> (raw)
In-Reply-To: <20250414111657.794484-10-swati2.sharma@intel.com>


On 4/14/2025 4:46 PM, Swati Sharma wrote:
> Add chamelium_frame_eq_or_dump_frame_pair() to compare frame
> dumps captured from chamelium. If they do not, this saves the
> reference and captured frames to a png file. This function does
> exact comparison.
>
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
>   lib/igt_chamelium.c | 38 ++++++++++++++++++++++++++++++++++++++
>   lib/igt_chamelium.h |  3 +++
>   2 files changed, 41 insertions(+)
>
> diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
> index a96e36b5b..463ba31ed 100644
> --- a/lib/igt_chamelium.c
> +++ b/lib/igt_chamelium.c
> @@ -1893,6 +1893,44 @@ static void compared_frames_dump(cairo_surface_t *reference,
>   	free(capture_suffix);
>   }
>   
> +/**
> + * chamelium_frame_eq_or_dump_frame_pair:
> + * @chamelium: The chamelium instance the frame dump belongs to
> + * @frame0: The chamelium frame dump to check
> + * @frame1: The chamelium frame dump to check
> + *
> + * Returns bool that the provided captured frame dumps are identical.
> + * If they do not, this saves the frames to a png file.

Perhaps we can rephrase this as:

Returns true if frames are identical. If they are not, saves the frames 
to a png file and returns false.


Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>

> + */
> +bool chamelium_frame_eq_or_dump_frame_pair(const struct chamelium *chamelium,
> +			                   const struct chamelium_frame_dump *frame0,
> +			                   const struct chamelium_frame_dump *frame1)
> +{
> +	cairo_surface_t *reference;
> +	cairo_surface_t *capture;
> +	bool eq;
> +
> +	/* Grab the captured reference frame from chamelium */
> +	reference = convert_frame_dump_argb32(frame0);
> +
> +	/* Grab the captured frame from chamelium */
> +	capture = convert_frame_dump_argb32(frame1);
> +
> +	if (frame0->size != frame1->size)
> +		return false;
> +
> +	/* Now do the actual comparison */
> +	eq = memcmp(frame0->bgr, frame1->bgr, frame0->size) == 0;
> +
> +	if (!eq && igt_frame_dump_is_enabled())
> +		compared_frames_dump(reference, capture, 0, 0);
> +
> +	cairo_surface_destroy(reference);
> +	cairo_surface_destroy(capture);
> +
> +	return eq;
> +}
> +
>   /**
>    * chamelium_assert_frame_eq:
>    * @chamelium: The chamelium instance the frame dump belongs to
> diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
> index 8882e13fb..b5d13ddc8 100644
> --- a/lib/igt_chamelium.h
> +++ b/lib/igt_chamelium.h
> @@ -262,6 +262,9 @@ bool chamelium_frame_match_or_dump_frame_pair(struct chamelium *chamelium,
>   					      const struct chamelium_frame_dump *frame0,
>   					      const struct chamelium_frame_dump *frame1,
>   					      enum chamelium_check check);
> +bool chamelium_frame_eq_or_dump_frame_pair(const struct chamelium *chamelium,
> +			                   const struct chamelium_frame_dump *frame0,
> +			                   const struct chamelium_frame_dump *frame1);
>   void chamelium_crop_analog_frame(struct chamelium_frame_dump *dump, int width,
>   				 int height);
>   void chamelium_destroy_frame_dump(struct chamelium_frame_dump *dump);

  reply	other threads:[~2025-04-23  3:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 11:16 [PATCH i-g-t 00/10] Add new test to validate adaptive sharpness filter Swati Sharma
2025-04-14 11:16 ` [PATCH i-g-t, v5 01/10] lib/igt_kms: Add "sharpness strength" as crtc property Swati Sharma
2025-04-14 11:16 ` [PATCH i-g-t, v2 02/10] lib/igt_kms: Add func() to return scaling mode name string Swati Sharma
2025-04-14 11:16 ` [PATCH i-g-t, v10 03/10] tests/kms_sharpness_filter: Add adaptive sharpness basic filter tests Swati Sharma
2025-04-14 11:16 ` [PATCH i-g-t, v2 04/10] tests/kms_sharpness_filter: Add toggle subtest Swati Sharma
2025-04-14 11:16 ` [PATCH i-g-t, v2 05/10] tests/kms_sharpness_filter: Add filter-tap subtest Swati Sharma
2025-04-14 11:16 ` [PATCH i-g-t, v2 06/10] tests/kms_sharpness_filter: Add dpms/suspend subtests Swati Sharma
2025-04-14 11:16 ` [PATCH i-g-t, v2 07/10] tests/kms_sharpness_filter: Add scaler subtests Swati Sharma
2025-04-14 11:16 ` [PATCH i-g-t 08/10] tests/kms_sharpness_filter: Add invalid subtests Swati Sharma
2025-04-14 11:16 ` [PATCH i-g-t 09/10] lib/igt_chamelium: Add chamelium_frame_eq_or_dump_frame_pair() Swati Sharma
2025-04-23  3:28   ` Nautiyal, Ankit K [this message]
2025-04-14 11:16 ` [PATCH i-g-t, v5 10/10] tests/chamelium/kms_chamelium_sharpness_filter: Add basic test Swati Sharma
2025-04-23  3:51   ` [PATCH i-g-t,v5 " Nautiyal, Ankit K
2025-04-14 21:30 ` ✗ i915.CI.BAT: failure for Add new test to validate adaptive sharpness filter (rev14) Patchwork
2025-04-14 22:14 ` ✓ Xe.CI.BAT: success " Patchwork
2025-04-15  5:08 ` ✗ Xe.CI.Full: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-04-11 12:12 [PATCH i-g-t 00/10] Add new test to validate adaptive sharpness filter Swati Sharma
2025-04-11 12:12 ` [PATCH i-g-t 09/10] lib/igt_chamelium: Add chamelium_frame_eq_or_dump_frame_pair() Swati Sharma

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=419ae9d3-d032-4a23-a756-40c408e43ab5@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=swati2.sharma@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