linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ayaka <ayaka@soulik.info>
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 <helen.koike@collabora.com>
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	[thread overview]
Message-ID: <20230206043308.28365-9-ayaka@soulik.info> (raw)
In-Reply-To: <20230206043308.28365-1-ayaka@soulik.info>

From: Helen Koike <helen.koike@collabora.com>

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 <boris.brezillon@collabora.com>
Signed-off-by: Helen Koike <helen.koike@collabora.com>
---
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
-- 
2.17.1


  parent reply	other threads:[~2023-02-06  4:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06  4:32 [RFC PATCH v7 0/9] media: v4l2: Add extended fmt and buffer ayaka
2023-02-06  4:33 ` [PATCH v7 1/9] media: v4l2: Extend pixel formats to unify single/multi-planar handling (and more) ayaka
     [not found]   ` <1e3a583f-f9ef-d2d3-6571-ac3b79d800ce@synaptics.com>
2023-06-28 16:27     ` Nicolas Dufresne
2023-06-29  3:43       ` Hsia-Jun Li
2023-07-13 10:26   ` Tomasz Figa
2023-07-21  6:03     ` Hsia-Jun Li
2023-02-06  4:33 ` [PATCH v7 2/9] media: vivid: Convert to v4l2_ext_pix_format ayaka
2023-07-13 10:39   ` Tomasz Figa
2023-07-17 16:00     ` Randy Li
2023-07-20 20:09       ` Nicolas Dufresne
2023-07-28  7:22         ` Tomasz Figa
2023-07-28 18:40           ` Randy Li
2023-08-04 20:19           ` Nicolas Dufresne
2023-07-28  7:18       ` Tomasz Figa
2023-02-06  4:33 ` [PATCH v7 3/9] media: v4l2: Add extended buffer (de)queue operations for video types ayaka
2023-02-06  4:33 ` [PATCH v7 4/9] media: videobuf2-v4l2: reorganize flags handling ayaka
2023-02-06  4:33 ` [PATCH v7 5/9] media: videobuf2: Expose helpers for Ext qbuf/dqbuf ayaka
2023-02-06  4:33 ` [PATCH v7 6/9] media: vivid: use vb2_ioctls_ext_{d}qbuf hooks ayaka
2023-02-06  4:33 ` [PATCH v7 7/9] media: vimc: " ayaka
2023-02-06  4:33 ` ayaka [this message]
2023-02-06  4:33 ` [PATCH v7 9/9] media: vimc: Convert to v4l2_ext_pix_format ayaka

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=20230206043308.28365-9-ayaka@soulik.info \
    --to=ayaka@soulik.info \
    --cc=Brian.Starkey@arm.com \
    --cc=boris.brezillon@collabora.com \
    --cc=frkoenig@chromium.org \
    --cc=hans.verkuil@cisco.com \
    --cc=helen.koike@collabora.com \
    --cc=hiroh@chromium.org \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=nicolas@ndufresne.ca \
    --cc=randy.li@synaptics.com \
    --cc=sakari.ailus@iki.fi \
    --cc=stanimir.varbanov@linaro.org \
    --cc=tfiga@chromium.org \
    /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;
as well as URLs for NNTP newsgroup(s).