Re: [PATCHv4 1/2] media: docs-rst: Document memory-to-memory video decoder interface

From: Hans Verkuil
Date: Wed Jun 12 2019 - 03:06:42 EST


On 6/12/19 8:49 AM, Hans Verkuil wrote:
> On 6/12/19 2:25 AM, Nicolas Dufresne wrote:
>> Le mardi 11 juin 2019 Ã 10:29 +0200, Hans Verkuil a Ãcrit :
>>> On 6/10/19 9:54 PM, Nicolas Dufresne wrote:
>>>> Hi Hans,
>>>>
>>>> I went through it, and I think we are close to ready. Unfortunately, I
>>>> believe the SOURCE_CHANGE event is still under specified. There was a
>>>> post recently to try and add a new flag for changes in color space
>>>> which is not included here. We are also missing a workflow for changes
>>>> that don't affect the allocation but will affect the rendering on a
>>>> display (like colorimetry). Userspace needs to know at which frames
>>>> these parameter changes in order to signal that to the following
>>>> processing block. I think we must have a plane for this.
>>>
>>> Yes, we need a new flag for the SOURCE_CHANGE event to indicate colorimetry
>>> changes. That's actually useful for e.g. HDMI receivers as well.
>>>
>>> But I don't see why that should make much of a change to the spec: you still
>>> have to drain the capture queue, the only difference is that you don't need
>>> to reallocate buffers, you can just restart the decoder.
>>
>> I don't think you need to drain the queue if the change is just
>> metadata that have no impact on the buffers allocation or layout. I
>> think we should have a way to communicate these changed while
>> streaming. Basically, something like the event, but serialized.
>
> I guess we can extend the struct v4l2_event_src_change and add a buffer
> index field to indicate at which capture buffer index the colorimetry
> change takes effect. Then there is no need for draining.

Just wanted to add something here: for now drivers can just use SOURCE_CHANGE
+ drain if they detect a colorimetry change. It's not as efficient as it can
be, but it will work. Applications can easily check that they don't need to
reallocate since the reported sizeimage will be the same for the old and new
formats.

> In the future when we create replacement streaming ioctls and have a
> new, larger struct v4l2_buffer, then we can add the colorimetry information
> there as well.

When this is in place, then it would make sense to add a V4L2_EVENT_SRC_CH_COLORIMETRY
flag that just indicates that something changed w.r.t. colorimetry.

We DO need this flag for HDMI receivers in any case.

Regards,

Hans