From patchwork Thu Feb 26 15:59:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 5894521 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8926A9F37F for ; Thu, 26 Feb 2015 16:01:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4007201CD for ; Thu, 26 Feb 2015 16:01:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE945203AC for ; Thu, 26 Feb 2015 16:01:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754458AbbBZQAl (ORCPT ); Thu, 26 Feb 2015 11:00:41 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:36500 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754259AbbBZQAi (ORCPT ); Thu, 26 Feb 2015 11:00:38 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NKD00MCJZ51RPC0@mailout4.samsung.com> for linux-media@vger.kernel.org; Fri, 27 Feb 2015 01:00:37 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-14-54ef43257adc Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 66.05.09430.5234FE45; Fri, 27 Feb 2015 01:00:37 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NKD00448Z32VO60@mmp2.samsung.com>; Fri, 27 Feb 2015 01:00:36 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com, gjasny@googlemail.com, hdegoede@redhat.com, kyungmin.park@samsung.com, Jacek Anaszewski Subject: [v4l-utils PATCH/RFC v5 09/14] mediactl: libv4l2subdev: add support for comparing mbus formats Date: Thu, 26 Feb 2015 16:59:19 +0100 Message-id: <1424966364-3647-10-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1424966364-3647-1-git-send-email-j.anaszewski@samsung.com> References: <1424966364-3647-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBLMWRmVeSWpSXmKPExsVy+t9jQV1V5/chBjM+sVtMnzKL0eLN8elM Fr1XnzNanG16w27ROXEJu0XPhq2sFp+2fGNyYPd4OmEyu8fsjpmsHvNOBnq833eVzaNvyypG j8+b5ALYorhsUlJzMstSi/TtErgyPkyewVbwUbDiwNMH7A2Mx/m6GDk5JARMJI4+7mKFsMUk Ltxbz9bFyMUhJDCdUaL75C8WCKedSeJY03wWkCo2AUOJny9eM4HYIgLyEk96b4B1MAvsZpR4 tnwP2ChhgUyJhlsvmUFsFgFViSV/VrKD2LwCHhIzP54GquEAWqcgMWeSDUiYEyg89csnRhBb SMBd4uu75WwTGHkXMDKsYhRNLUguKE5KzzXSK07MLS7NS9dLzs/dxAgOr2fSOxhXNVgcYhTg YFTi4Z1p9D5EiDWxrLgy9xCjBAezkgivvjVQiDclsbIqtSg/vqg0J7X4EKM0B4uSOK+SfVuI kEB6YklqdmpqQWoRTJaJg1OqgVHxS0tzgWXcz3Tze+8ULztzSv3wnc6xM8mF4fz/OfO6r7Nv DbTZfGxKmY1Cjc6J9LYbvqI+l0+++bhlYewe15Xz7ulbyL98t/6I8My1u5eecGr+rfr74MLr dx/uPNl8YOt9h332k644+dpfKcurjn19+1drwplkZ+WlpulXeDoW6G+dumiFnmu4EktxRqKh FnNRcSIAUo7ptCsCAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a function for checking whether two mbus formats are compatible. Signed-off-by: Jacek Anaszewski Acked-by: Kyungmin Park --- utils/media-ctl/libv4l2subdev.c | 34 ++++++++++++++++++++++++++++++++++ utils/media-ctl/v4l2subdev.h | 12 ++++++++++++ 2 files changed, 46 insertions(+) diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c index dfd3bd5..b9a924c 100644 --- a/utils/media-ctl/libv4l2subdev.c +++ b/utils/media-ctl/libv4l2subdev.c @@ -835,6 +835,40 @@ int v4l2_subdev_validate_v4l2_ctrl(struct media_device *media, return 0; } +int v4l2_subdev_format_compare(struct v4l2_mbus_framefmt *fmt1, + struct v4l2_mbus_framefmt *fmt2) +{ + if (fmt1 == NULL || fmt2 == NULL) + return 0; + + if (fmt1->width != fmt2->width) { + printf("width mismatch\n"); + return 0; + } + + if (fmt1->height != fmt2->height) { + printf("height mismatch\n"); + return 0; + } + + if (fmt1->code != fmt2->code) { + printf("mbus code mismatch\n"); + return 0; + } + + if (fmt1->field != fmt2->field) { + printf("field mismatch\n"); + return 0; + } + + if (fmt1->colorspace != fmt2->colorspace) { + printf("colorspace mismatch\n"); + return 0; + } + + return 1; +} + bool v4l2_subdev_has_v4l2_control_redir(struct media_device *media, struct media_entity *entity, int ctrl_id) diff --git a/utils/media-ctl/v4l2subdev.h b/utils/media-ctl/v4l2subdev.h index 07f9697..2f74975 100644 --- a/utils/media-ctl/v4l2subdev.h +++ b/utils/media-ctl/v4l2subdev.h @@ -314,6 +314,18 @@ int v4l2_subdev_validate_v4l2_ctrl(struct media_device *media, __u32 ctrl_id); /** + * @brief Compare mbus formats + * @param fmt1 - 1st mbus format to compare. + * @param fmt2 - 2nd mbus format to compare. + * + * Check whether two mbus formats are compatible. + * + * @return 1 if formats are compatible, 0 otherwise. + */ +int v4l2_subdev_format_compare(struct v4l2_mbus_framefmt *fmt1, + struct v4l2_mbus_framefmt *fmt2); + +/** * @brief Check if there was a v4l2_control redirection defined for the entity * @param media - media device. * @param entity - subdev-device media entity.