[PATCH i-g-t,v2 1/3] lib/igt_chamelium: Add chamelium_frame_match_or_dump_frame_pair()
Borah, Chaitanya Kumar
chaitanya.kumar.borah at intel.com
Tue Apr 1 10:04:02 UTC 2025
> -----Original Message-----
> From: Sharma, Swati2 <swati2.sharma at intel.com>
> Sent: Friday, March 28, 2025 11:41 PM
> To: igt-dev at lists.freedesktop.org
> Cc: ville.syrjala at linux.intel.com; Shankar, Uma <uma.shankar at intel.com>;
> Borah, Chaitanya Kumar <chaitanya.kumar.borah at intel.com>; Sharma,
> Swati2 <swati2.sharma at intel.com>
> Subject: [PATCH i-g-t,v2 1/3] lib/igt_chamelium: Add
> chamelium_frame_match_or_dump_frame_pair()
>
> Add chamelium_frame_match_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.
>
> v2: -let crc be computed from compared_frames_dump() (Chaitanya)
> -remove passing of reference_crc (Chaitanya)
>
LGTM
Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah at intel.com>
> Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
> ---
> lib/igt_chamelium.c | 46
> +++++++++++++++++++++++++++++++++++++++++++++
> lib/igt_chamelium.h | 5 +++++
> 2 files changed, 51 insertions(+)
>
> diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c index
> 620fbbf7d..c86773898 100644
> --- a/lib/igt_chamelium.c
> +++ b/lib/igt_chamelium.c
> @@ -2070,6 +2070,52 @@ bool chamelium_frame_match_or_dump(struct
> chamelium *chamelium,
> return match;
> }
>
> +/**
> + * chamelium_frame_match_or_dump_frame_pair:
> + * @chamelium: The chamelium instance the frame dump belongs to
> + * @frame0: The chamelium reference frame dump to match
> + * @frame1: The chamelium capture frame dump to match
> + * @check: the type of frame matching check to use
> + *
> + * Returns bool that the provided captured frames matches.
> + * If they do not, this saves the frames to a png file.
> + */
> +bool chamelium_frame_match_or_dump_frame_pair(struct chamelium
> *chamelium,
> + struct chamelium_port *port,
> + const struct
> chamelium_frame_dump *frame0,
> + const struct
> chamelium_frame_dump *frame1,
> + enum chamelium_check check)
> +{
> + cairo_surface_t *reference;
> + cairo_surface_t *capture;
> + bool match;
> +
> + /* 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);
> +
> + switch (check) {
> + case CHAMELIUM_CHECK_ANALOG:
> + match = igt_check_analog_frame_match(reference, capture);
> + break;
> + case CHAMELIUM_CHECK_CHECKERBOARD:
> + match = igt_check_checkerboard_frame_match(reference,
> capture);
> + break;
> + default:
> + igt_assert(false);
> + }
> +
> + if (!match && igt_frame_dump_is_enabled())
> + compared_frames_dump(reference, capture, 0, 0);
> +
> + cairo_surface_destroy(reference);
> + cairo_surface_destroy(capture);
> +
> + return match;
> +}
> +
> /**
> * chamelium_analog_frame_crop:
> * @chamelium: The Chamelium instance to use diff --git
> a/lib/igt_chamelium.h b/lib/igt_chamelium.h index d979de4a2..8882e13fb
> 100644
> --- a/lib/igt_chamelium.h
> +++ b/lib/igt_chamelium.h
> @@ -257,6 +257,11 @@ bool chamelium_frame_match_or_dump(struct
> chamelium *chamelium,
> const struct chamelium_frame_dump
> *frame,
> struct igt_fb *fb,
> enum chamelium_check check);
> +bool chamelium_frame_match_or_dump_frame_pair(struct chamelium
> *chamelium,
> + struct chamelium_port *port,
> + const struct
> chamelium_frame_dump *frame0,
> + const struct
> chamelium_frame_dump *frame1,
> + enum chamelium_check check);
> void chamelium_crop_analog_frame(struct chamelium_frame_dump *dump,
> int width,
> int height);
> void chamelium_destroy_frame_dump(struct chamelium_frame_dump
> *dump);
> --
> 2.25.1
More information about the igt-dev
mailing list