lkml.org 
[lkml]   [2021]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH v6 08/11] media: mediabus: Add helpers to convert a ext_pix format to/from a mbus_fmt
    Date
    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 841e190aedd9..055e2abbc1dd 100644
    --- a/include/media/v4l2-mediabus.h
    +++ b/include/media/v4l2-mediabus.h
    @@ -209,4 +209,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.29.2
    \
     
     \ /
      Last update: 2021-01-14 19:11    [W:4.037 / U:0.044 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site