From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id C18AE6E3C4 for ; Tue, 14 Jan 2020 13:35:39 +0000 (UTC) From: Kunal Joshi Date: Tue, 14 Jan 2020 19:05:03 +0530 Message-Id: <1579008904-22441-2-git-send-email-kunal1.joshi@intel.com> In-Reply-To: <1579008904-22441-1-git-send-email-kunal1.joshi@intel.com> References: <1579008904-22441-1-git-send-email-kunal1.joshi@intel.com> Subject: [igt-dev] [PATCH i-g-t 1/2] lib/igt_chamelium: add function to compare two frame dumps. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: igt-dev@lists.freedesktop.org Cc: Kunal Joshi , ville.syrjala@intel.com, petri.latvala@intel.com, daniel.vetter@intel.com List-ID: Added chamelium_assert_frame_dump_eq() into lib. Function is used to compare two frame dumps. Signed-off-by: Kunal Joshi Signed-off-by: Swati Sharma Suggested-by: Uma Shankar --- lib/igt_chamelium.c | 22 ++++++++++++++++++++++ lib/igt_chamelium.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c index 9971f51..0baf5bc 100644 --- a/lib/igt_chamelium.c +++ b/lib/igt_chamelium.c @@ -1519,6 +1519,28 @@ void chamelium_assert_frame_eq(const struct chamelium *chamelium, } /** + * chamelium_assert_frame_eq: + * @chamelium: The chamelium instance the frame dump belongs to + * @dump1: The chamelium frame dump to check + * @dump2: The chamelium frame dump to check + * + * Asserts that the image contained in the chamelium frame dump is + * identical to the other chamelium frame dump. + */ +bool chamelium_assert_frame_dump_eq(const struct chamelium *chamelium, + const struct chamelium_frame_dump *dump1, + const struct chamelium_frame_dump *dump2) +{ + bool eq; + + /* Frame dump comparison */ + eq = memcmp(dump1->bgr, dump2->bgr, + dump1->size) == 0; + + return eq; +} + +/** * chamelium_assert_crc_eq_or_dump: * @chamelium: The chamelium instance the frame dump belongs to * @reference_crc: The CRC for the reference frame diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h index 08705a9..6ff2d76 100644 --- a/lib/igt_chamelium.h +++ b/lib/igt_chamelium.h @@ -195,6 +195,9 @@ int chamelium_get_frame_limit(struct chamelium *chamelium, void chamelium_assert_frame_eq(const struct chamelium *chamelium, const struct chamelium_frame_dump *dump, struct igt_fb *fb); +bool chamelium_assert_frame_dump_eq(const struct chamelium *chamelium, + const struct chamelium_frame_dump *dump1, + const struct chamelium_frame_dump *dump2); void chamelium_assert_crc_eq_or_dump(struct chamelium *chamelium, igt_crc_t *reference_crc, igt_crc_t *capture_crc, struct igt_fb *fb, -- 2.7.4 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev