From patchwork Mon Feb 6 04:33:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randy Li X-Patchwork-Id: 52983 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2050191wrn; Sun, 5 Feb 2023 20:38:37 -0800 (PST) X-Google-Smtp-Source: AK7set/AcOEKkfQHFKLelAbP+BOGCH+xpDNTwRzJOPrut5o8p4Auhzf33YKl0Q4UHrL1KDERodby X-Received: by 2002:a17:907:7e8f:b0:8a4:e2aa:6cd9 with SMTP id qb15-20020a1709077e8f00b008a4e2aa6cd9mr1736915ejc.19.1675658317360; Sun, 05 Feb 2023 20:38:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675658317; cv=none; d=google.com; s=arc-20160816; b=MB4NABu3s2WbtbN6TbAKSEQ3EC6qA56AUR1q77HREEk28VlEBGI0Mnbm5cdOsgWN6/ hOVPoehQ9j9BYbvkJKYQixydCNVf6HkAC2ikNEkBbv1iMo/SIfVVfF2yfuDPnw6Hcjv6 drMwQbMwv1wEO80Q9wuNWDDZ9JfA8Gj/C3XQH2I2CVqbpG/p759u0wmHy1XudxevyZ5f HmVeReANCgcn7ZAVe9kLqLEATzJPTFDd27Lli+tZt5G/TCQoj8DJX6UammjGgj+1mgFq XPx5zfptbyoxmIZVU7mXMajb03T9ORkXMu/JaPLjN0ltAX611M+3eBgtgVvPqBvRZWpo gVgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1uICMTdmy7z9pB75Mch2NFlVD+NbfNNI62Uo/i1QIsM=; b=BDuRvv1eNltYAHZdgejG+N8LsaRbpFtgAPvUCUP+E7Lt7g3/dEX1+I9Hbj2Xx2FuON 3gmKiYE//307aJZ6B0p1vUAZ1+KCcqcce1BVHPnXb4h2lGGsYB7JLOip0C5xG3DVj5JW tJ5zsFJa6C/EpIHbP+PYPSCB2MrOOjlZP8OxDvzqNxApxZku0EMbsOHos64iqx/oYZy+ KoV5qUdDR/3UCBVVqYAsi8w566FnyqXGLrJRfK/ZFz1ztRfdp6CKiGrdPgFH4pw7mRX3 wqyyBF0alVqPe2yOMPNvG+ehom41IdmXk+UjYz2eyJ7+fGNvHLEll4ou1vRbPo0l9gJo ySAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ep21-20020a1709069b5500b0087bdc5bc155si10228352ejc.909.2023.02.05.20.38.14; Sun, 05 Feb 2023 20:38:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbjBFEfc (ORCPT + 99 others); Sun, 5 Feb 2023 23:35:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbjBFEfZ (ORCPT ); Sun, 5 Feb 2023 23:35:25 -0500 Received: from kozue.soulik.info (kozue.soulik.info [IPv6:2001:19f0:7000:8404:5054:ff:fe75:428f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2579F1B331; Sun, 5 Feb 2023 20:35:03 -0800 (PST) Received: from misaki.sumomo.pri (unknown [192.168.0.134]) by kozue.soulik.info (Postfix) with ESMTPA id 11A44101CD1; Mon, 6 Feb 2023 13:34:54 +0900 (JST) From: ayaka To: linux-media@vger.kernel.org Cc: randy.li@synaptics.com, Brian.Starkey@arm.com, boris.brezillon@collabora.com, frkoenig@chromium.org, hans.verkuil@cisco.com, hiroh@chromium.org, hverkuil@xs4all.nl, kernel@collabora.com, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, mchehab@kernel.org, narmstrong@baylibre.com, nicolas@ndufresne.ca, sakari.ailus@iki.fi, stanimir.varbanov@linaro.org, tfiga@chromium.org, Helen Koike Subject: [PATCH v7 8/9] media: mediabus: Add helpers to convert a ext_pix format to/from a mbus_fmt Date: Mon, 6 Feb 2023 12:33:07 +0800 Message-Id: <20230206043308.28365-9-ayaka@soulik.info> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230206043308.28365-1-ayaka@soulik.info> References: <20230206043308.28365-1-ayaka@soulik.info> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757055095972794177?= X-GMAIL-MSGID: =?utf-8?q?1757055095972794177?= From: Helen Koike Just a new version of v4l2_fill_mbus_format() and v4l2_fill_ext_pix_format() to deal with the new v4l2_ext_pix_format struct. This is needed to convert the VIMC driver to the EXT_FMT/EXT_BUF iocts. Signed-off-by: Boris Brezillon Signed-off-by: Helen Koike --- Changes in v6: - Rename v4l2_fill_ext_pix_format() to v4l2_fill_ext_pix_format_from_mbus() (Tomasz) Changes in v4: - Add helper v4l2_fill_ext_pix_format() - Rebased on top of media/master (post 5.8-rc1) Changes in v3: - Rebased on top of media/master (post 5.4-rc1) Changes in v2: - New patch --- include/media/v4l2-mediabus.h | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h index 5bce6e423e94..3959d0abde03 100644 --- a/include/media/v4l2-mediabus.h +++ b/include/media/v4l2-mediabus.h @@ -252,4 +252,46 @@ v4l2_fill_mbus_format_mplane(struct v4l2_mbus_framefmt *mbus_fmt, mbus_fmt->xfer_func = pix_mp_fmt->xfer_func; } +/** + * v4l2_fill_ext_pix_format_from_mbus - Ancillary routine that fills a &struct + * v4l2_ext_pix_format fields from a &struct v4l2_mbus_framefmt. + * + * @pix_fmt: pointer to &struct v4l2_ext_pix_format to be filled + * @mbus_fmt: pointer to &struct v4l2_mbus_framefmt to be used as model + */ +static inline void +v4l2_fill_ext_pix_format_from_mbus(struct v4l2_ext_pix_format *pix_fmt, + const struct v4l2_mbus_framefmt *mbus_fmt) +{ + pix_fmt->width = mbus_fmt->width; + pix_fmt->height = mbus_fmt->height; + pix_fmt->field = mbus_fmt->field; + pix_fmt->colorspace = mbus_fmt->colorspace; + pix_fmt->ycbcr_enc = mbus_fmt->ycbcr_enc; + pix_fmt->quantization = mbus_fmt->quantization; + pix_fmt->xfer_func = mbus_fmt->xfer_func; +} + +/** + * v4l2_fill_mbus_format_ext - Ancillary routine that fills a &struct + * v4l2_mbus_framefmt from a &struct v4l2_ext_pix_format. + * + * @mbus_fmt: pointer to &struct v4l2_mbus_framefmt to be filled + * @pix_fmt: pointer to &struct v4l2_ext_pix_format to be used as model + * @code: data format code (from &enum v4l2_mbus_pixelcode) + */ +static inline void +v4l2_fill_mbus_format_ext(struct v4l2_mbus_framefmt *mbus_fmt, + const struct v4l2_ext_pix_format *pix_fmt, u32 code) +{ + mbus_fmt->width = pix_fmt->width; + mbus_fmt->height = pix_fmt->height; + mbus_fmt->field = pix_fmt->field; + mbus_fmt->colorspace = pix_fmt->colorspace; + mbus_fmt->ycbcr_enc = pix_fmt->ycbcr_enc; + mbus_fmt->quantization = pix_fmt->quantization; + mbus_fmt->xfer_func = pix_fmt->xfer_func; + mbus_fmt->code = code; +} + #endif