mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hsia-Jun Li <Randy.Li@synaptics.com>
To: Nicolas Dufresne <nicolas@ndufresne.ca>
Cc: linux-media@vger.kernel.org, ayaka <ayaka@soulik.info>,
	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, sakari.ailus@iki.fi,
	stanimir.varbanov@linaro.org, tfiga@chromium.org,
	Helen Koike <helen.koike@collabora.com>
Subject: Re: [PATCH v7 1/9] media: v4l2: Extend pixel formats to unify single/multi-planar handling (and more)
Date: Thu, 29 Jun 2023 11:43:30 +0800	[thread overview]
Message-ID: <9b732791-87c0-c970-eb68-b02531cc1bdc@synaptics.com> (raw)
In-Reply-To: <6674abe5681c0f4a4e4466e034393359346cfda7.camel@ndufresne.ca>


On 6/29/23 00:27, Nicolas Dufresne wrote:
> CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe.
>
>
> Hi,
>
> please avoid HTML replies on the mailing list.
  I need to blame outlook.
> Le mardi 27 juin 2023 à 14:42 +0800, Hsia-Jun Li a écrit :
>>> +/**
>>> + * struct v4l2_ext_pix_format - extended multiplanar format definition
>>> + * @type:          enum v4l2_buf_type; type of the data stream
>>> + * @width:         image width in pixels
>>> + * @height:                image height in pixels
>>> + * @pixelformat:   little endian four character code (fourcc)
>>> + * @modifier:              modifier applied to the format (used for tiled formats
>>> + *                 and other kind of HW-specific formats, like compressed
>>> + *                 formats) as defined in drm_fourcc.h
>>> + * @field:         enum v4l2_field; field order (for interlaced video)
>>> + * @colorspace:            enum v4l2_colorspace; supplemental to pixelformat
>>> + * @plane_fmt:             per-plane information
>>> + * @flags:         format flags (V4L2_PIX_FMT_FLAG_*)
>>> + * @ycbcr_enc:             enum v4l2_ycbcr_encoding, Y'CbCr encoding
>>> + * @hsv_enc:               enum v4l2_hsv_encoding, HSV encoding
>>> + * @quantization:  enum v4l2_quantization, colorspace quantization
>>> + * @xfer_func:             enum v4l2_xfer_func, colorspace transfer function
>>> + * @reserved:              drivers and applications must zero this array
>>> + */
>>> +struct v4l2_ext_pix_format {
>>> +   __u32                           type;
>>> +   __u32                           width;
>>> +   __u32                           height;
>>> +   __u32                           pixelformat;
>>> +   __u64                           modifier;
>>> +   __u32                           field;
>>> +   __u32                           colorspace;
>>> +
>>> +   struct v4l2_plane_pix_format    plane_fmt[VIDEO_MAX_PLANES];
>>> +   __u8                            flags;
>>> +    union {
>>> +           __u8                            ycbcr_enc;
>>> +           __u8                            hsv_enc;
>>> +   };
>>> +   __u8                            quantization;
>>> +   __u8                            xfer_func;
>>>
>>>
>>>
>>>
>>>
>>      I heard that a suggestion that we could remove colorimetry fields
>>        here.
>>      Although those are useless for codec M2M drivers if no pixel
>>        formats translation invoked.
>>      Even HDMI(DRM) cares about colorspace.
>>      For example if a downsink(TV) shows RGB formats,  with an YUV
>>        input frame buffer, colorimetry would be important or the wrong
>>        EOTF would be used. If YUV is MPEG range(linear EOTF) while a
>>        non-linear EOFT (full range) is used, you would found the black is
>>        not black enough while the white looks a gray. Also color bias
>>        would happen.
>>      This problem may not happen to a ultra high resolution TV while
>>        only YUV type color formats are supported due to HDMI bandwidth
>>        limitation.
>>      The problem I want to raise is the time cost for enumeration.
>>        Each pixel format with a colorimetry setting would invoke a
>>        ioctl(). For the application likes Gstreamer would enum all the
>>        possible colorimetries.
>>      It would be better we could have something like DRM blob id that
>>        application could copy the data from a non-DMA buffer from the
>>        kernel.
> This is a good topic. Colorimetry could indeed be moved away from the format,
> considering they cannot be enumerated. It remains that this information needs to
> be passed around, and the format of a blob in media space is not has restricted
> as with display HW. I think keeping an "exploded version" of the colorimetry
> remains needed.
>
> Remember though that for stateful decoder, were the information could be stored
> in the bitstream, the decoder is responsible for returning that information.
> Currently its passed through the G_FMT call, it would need to be replaced with a
> control, similar to the HDR10 static metadata. If the colorimetry is no longer
> static in the future, and may change while streaming, one option would be RO
> request. This was foreseen for HDR10+ and Dolby Vision metadata notably, though
> other options exists.

That is why I want to promote importing a whole buffer(framebuffer id) 
from drm.

We can't pass such DMA metadate with the main data(graphics here) in a 
queue.

>
> There exist known decoders that can do YUV to RGB conversion using an inline
> post procesor (VC8000D and newer is an example), and for these to return correct
> colors, the colorimetry information needs to be passed. So its not strictly
> useless.
>
> In short, if we drop colorimetry from format, we also need to go ahead and

I am worrying when people setup up a UVC device(usb camera), they may 
ignore this step.

Camera could be in a BT.601 colorspace than BT.709 which has a slight 
difference. And BT.601 has a full range variant.
> design a replacement for it, that allow for the application to detect changes.
>
> regards,
> Nicolas
>
-- 
Hsia-Jun(Randy) Li


  reply	other threads:[~2023-06-29  3:43 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 [this message]
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 ` [PATCH v7 8/9] media: mediabus: Add helpers to convert a ext_pix format to/from a mbus_fmt ayaka
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=9b732791-87c0-c970-eb68-b02531cc1bdc@synaptics.com \
    --to=randy.li@synaptics.com \
    --cc=Brian.Starkey@arm.com \
    --cc=ayaka@soulik.info \
    --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=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

all inboxes | Powered by JetHome®