xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Oleksandr Andrushchenko <andr2000@gmail.com>
To: Hans Verkuil <hverkuil@xs4all.nl>,
	"Oleksandr_Andrushchenko@epam.com"
	<Oleksandr_Andrushchenko@epam.com>,
	xen-devel@lists.xenproject.org, konrad.wilk@oracle.com,
	jgross@suse.com, boris.ostrovsky@oracle.com, mchehab@kernel.org,
	linux-media@vger.kernel.org, sakari.ailus@linux.intel.com,
	koji.matsuoka.xm@renesas.com
Subject: Re: [PATCH 1/1] cameraif: add ABI for para-virtual camera
Date: Tue, 11 Sep 2018 09:52:27 +0300	[thread overview]
Message-ID: <f53218ac-f704-b260-543f-72ccb33c7a1f@gmail.com> (raw)
In-Reply-To: <c980f6b7-ffe1-c5f5-5506-b9fb1a37498b@xs4all.nl>

Hi, Hans!

On 09/10/2018 03:26 PM, Hans Verkuil wrote:
> On 09/10/2018 01:49 PM, Oleksandr Andrushchenko wrote:
>> On 09/10/2018 02:09 PM, Hans Verkuil wrote:
>>> On 09/10/2018 11:52 AM, Oleksandr Andrushchenko wrote:
>>>> On 09/10/2018 12:04 PM, Hans Verkuil wrote:
>>>>> On 09/10/2018 10:24 AM, Oleksandr Andrushchenko wrote:
>>>>>> On 09/10/2018 10:53 AM, Hans Verkuil wrote:
>>>>>>> Hi Oleksandr,
>>>>>>>
>>>>>>> On 09/10/2018 09:16 AM, Oleksandr Andrushchenko wrote:
>>>>> <snip>
>>>>>
>>>>>>>>> I suspect that you likely will want to support such sources eventually, so
>>>>>>>>> it pays to design this with that in mind.
>>>>>>>> Again, I think that this is the backend to hide these
>>>>>>>> use-cases from the frontend.
>>>>>>> I'm not sure you can: say you are playing a bluray connected to the system
>>>>>>> with HDMI, then if there is a resolution change, what do you do? You can tear
>>>>>>> everything down and build it up again, or you can just tell frontends that
>>>>>>> something changed and that they have to look at the new vcamera configuration.
>>>>>>>
>>>>>>> The latter seems to be more sensible to me. It is really not much that you
>>>>>>> need to do: all you really need is an event signalling that something changed.
>>>>>>> In V4L2 that's the V4L2_EVENT_SOURCE_CHANGE.
>>>>>> well, this complicates things a lot as I'll have to
>>>>>> re-allocate buffers - right?
>>>>> Right. Different resolutions means different sized buffers and usually lots of
>>>>> changes throughout the whole video pipeline, which in this case can even
>>>>> go into multiple VMs.
>>>>>
>>>>> One additional thing to keep in mind for the future: V4L2_EVENT_SOURCE_CHANGE
>>>>> has a flags field that tells userspace what changed. Right now that is just the
>>>>> resolution, but in the future you can expect flags for cases where just the
>>>>> colorspace information changes, but not the resolution.
>>>>>
>>>>> Which reminds me of two important missing pieces of information in your protocol:
>>>>>
>>>>> 1) You need to communicate the colorspace data:
>>>>>
>>>>> - colorspace
>>>>> - xfer_func
>>>>> - ycbcr_enc/hsv_enc (unlikely you ever want to support HSV pixelformats, so I
>>>>>      think you can ignore hsv_enc)
>>>>> - quantization
>>>>>
>>>>> See https://hverkuil.home.xs4all.nl/spec/uapi/v4l/pixfmt-v4l2.html#c.v4l2_pix_format
>>>>> and the links to the colorspace sections in the V4L2 spec for details).
>>>>>
>>>>> This information is part of the format, it is reported by the driver.
>>>> I'll take a look and think what can be put and how into the protocol,
>>>> do you think I'll have to implement all the above for
>>>> this stage?
>>> Yes. Without it VMs will have no way of knowing how to reproduce the right colors.
>>> They don't *have* to use this information, but it should be there. For cameras
>>> this isn't all that important, for SDTV/HDTV sources this becomes more relevant
>>> (esp. the quantization and ycbcr_enc information) and for sources with BT.2020/HDR
>>> formats this is critical.
>> ok, then I'll add the following to the set_config request/response:
>>
>>       uint32_t colorspace;
>>       uint32_t xfer_func;
>>       uint32_t ycbcr_enc;
>>       uint32_t quantization;
Yet another question here: are the above (color space, xfer etc.) and
display aspect ratio defined per pixel_format or per pixel_format + 
resolution?

If per pixel_format then

.../vcamera/1/formats/YUYV/display-aspect-ratio = "59/58"

or if per resolution

.../vcamera/1/formats/YUYV/640x480/display-aspect-ratio = "59/58"

>>
>> With this respect, I will need to put some OS agnostic constants
>> into the protocol, so if backend and frontend are not Linux/V4L2
>> based they can still talk to each other.
>> I see that V4L2 already defines constants for the above: [1], [2], [3], [4].
>>
>> Do you think I can define the same replacing V4L2_ prefix
>> with XENCAMERA_, e.g. V4L2_XFER_FUNC_SRGB -> XENCAMERA_XFER_FUNC_SRGB?
> Yes.
>
>> Do I need to define all those or there can be some subset of the
>> above for my simpler use-case?
> Most of these defines directly map to standards. I would skip the following
> defines:
>
> V4L2_COLORSPACE_DEFAULT (not applicable)
> V4L2_COLORSPACE_470_SYSTEM_*  (rarely used, if received by the HW the Xen backend
> 			should map this to V4L2_COLORSPACE_SMPTE170M)
> V4L2_COLORSPACE_JPEG (historical V4L2 artifact, see here how to map:
> 	 https://hverkuil.home.xs4all.nl/spec/uapi/v4l/colorspaces-details.html#col-jpeg)
>
> V4L2_COLORSPACE_SMPTE240M (rarely used, map to V4L2_COLORSPACE_SMPTE170M if seen in backend)
>
> V4L2_XFER_FUNC_SMPTE240M (rarely used, map to V4L2_XFER_FUNC_709)
>
> V4L2_YCBCR_ENC_SMPTE240M (rarely used, map to V4L2_YCBCR_ENC_709)
>
> While V4L2 allows 0 (DEFAULT) values for xfer_func, ycbcr_enc and quantization, and
> provides macros to map default values to the actual values (for legacy reasons),
> the Xen backend should always fill this in explicitly, using those same mapping
> macros (see e.g. V4L2_MAP_XFER_FUNC_DEFAULT).
>
> The V4L2 spec has extensive information on colorspaces (sections 2.14-2.17).
>
>>> The vivid driver can actually reproduce all combinations, so that's a good driver
>>> to test this with.
>> You mean I can use it on backend side instead of real HW camera and
>> test all the configurations possible/those of interest?
> Right.
>
> Regards,
>
> 	Hans
Thank you,
Oleksandr

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-09-11  6:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31  9:31 [PATCH 0/1] cameraif: Add ABI for para-virtualized Oleksandr Andrushchenko
2018-07-31  9:31 ` [PATCH 1/1] cameraif: add ABI for para-virtual camera Oleksandr Andrushchenko
2018-08-14  8:30   ` Juergen Gross
2018-08-21  5:54     ` Oleksandr Andrushchenko
2018-09-03 10:16       ` Oleksandr Andrushchenko
2018-09-03 15:25         ` Hans Verkuil
2018-09-04  6:56           ` Oleksandr Andrushchenko
2018-09-09 10:42             ` Hans Verkuil
2018-09-10  5:59               ` Oleksandr Andrushchenko
2018-09-10  8:14                 ` Hans Verkuil
2018-09-10  8:34                   ` Oleksandr Andrushchenko
2018-09-09 10:31   ` Hans Verkuil
2018-09-10  7:16     ` Oleksandr Andrushchenko
2018-09-10  7:53       ` Hans Verkuil
2018-09-10  8:24         ` Oleksandr Andrushchenko
2018-09-10  9:04           ` Hans Verkuil
2018-09-10  9:52             ` Oleksandr Andrushchenko
2018-09-10 11:09               ` Hans Verkuil
2018-09-10 11:49                 ` Oleksandr Andrushchenko
2018-09-10 12:26                   ` Hans Verkuil
2018-09-10 13:16                     ` Oleksandr Andrushchenko
2018-09-11  6:52                     ` Oleksandr Andrushchenko [this message]
2018-09-11  7:04                       ` Hans Verkuil
2018-09-11  7:14                         ` Oleksandr Andrushchenko
2018-09-11  7:52                           ` Hans Verkuil
2018-09-11  8:09                             ` Oleksandr Andrushchenko
2018-09-10 12:48 ` [PATCH 0/1] cameraif: Add ABI for para-virtualized Laurent Pinchart
2018-09-10 13:02   ` Oleksandr Andrushchenko

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=f53218ac-f704-b260-543f-72ccb33c7a1f@gmail.com \
    --to=andr2000@gmail.com \
    --cc=Oleksandr_Andrushchenko@epam.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jgross@suse.com \
    --cc=koji.matsuoka.xm@renesas.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=xen-devel@lists.xenproject.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).