Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4931699pxu; Tue, 13 Oct 2020 10:23:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmaUxkll0sQDizX0bWThBuyeNUKQk8TJgrScn7M1SWBGgrmP4wPB9qg1TkYZgQMxlb0YDA X-Received: by 2002:a17:906:6c82:: with SMTP id s2mr880264ejr.182.1602609834989; Tue, 13 Oct 2020 10:23:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602609834; cv=none; d=google.com; s=arc-20160816; b=uLDJqITjIFRsDOvckTihKulGp2J0TYnNijidkU3WgwXu456XXprO40J/BpbkZyJ76m k2HfFWLRXm1058twbEtSHxmRFIfzGEOIftlruFxmweG15KqPbwZnsviIsd+uFdQnhLYw IdWa4lEJgltOXWIU0zHkkghy/NmahSaIhDw/FQehwu7KyGfParBlNUY7zA8iK8d3CInl 19QVwaQZnBXsAW3TWjzjKLZMZ6Xh4XuwncO/F7caeBAhayG69AOSBaC0cQa6YsFE1Rss 7D45uyj7PReZdUgvH2UnaRf+otlasO+nf3bfnUzvCvGlOR+fRN37g+Kv1OYXa/UwBjTs ctVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=MrCe+fAhHMGrdhxvZeVe4VCsJwXNPJ2vDfc4pR9NNGI=; b=JyfJtJyUn68TJO5qJmhadR0gDlLMq7QvEi3/Sw92VOZwwoD6zVVPfI7vcCoaQGNkze VjjE/JWG/sZeEkOdvHCs+PnpYnJkRgOkXMkqzkMj1VidVwMrtW2E+gR/zIgi9H5VqM49 L+HznP3nV/LTDOGVynJMvchXCrs6PeOHWTQ3UzymT3X0CkWVVBoWPeoVE3T0n7qM9YO1 feABrfOpbPzd7Y5/bt+/Oz6FaBLUk9oUG3e75VPaphdINeNUWbT4xzUvsdJhzBDJLCcS 3z5DkDdRMvXRLLifNTi5LeNi2EfwyrJN0RXp4PFJ+OkjjneIvYzEzX/5cdeUve1+odVj 2AqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Y5+le0Fr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ba15si236124edb.347.2020.10.13.10.23.26; Tue, 13 Oct 2020 10:23:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Y5+le0Fr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730506AbgJMO5K (ORCPT + 99 others); Tue, 13 Oct 2020 10:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbgJMO5K (ORCPT ); Tue, 13 Oct 2020 10:57:10 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D327C0613D2 for ; Tue, 13 Oct 2020 07:57:08 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id dt13so158728ejb.12 for ; Tue, 13 Oct 2020 07:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MrCe+fAhHMGrdhxvZeVe4VCsJwXNPJ2vDfc4pR9NNGI=; b=Y5+le0FrK0gc0sI3ClCsyabPmjiq8Lpe5XhHwVQtv+wa27I1xJq5O48lKl3HpOAA3L BV4En4dVfrEvE5vUxkt5+l8Tpqvia9KZlR6VZwPkoh/qATqt3Y/qKyHpxJXUqMpaIDCs Foge/AeycLUOPpNMOOZlkHil1fRi7Wxa1AwP8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MrCe+fAhHMGrdhxvZeVe4VCsJwXNPJ2vDfc4pR9NNGI=; b=db28q5l6kgFas8pmTPkW85BaCLfOJYkDr8SiV/5ikFdWXwOIFW9zzbmmMsD2zUsnfS tJZL73szny9rp7aJhnDTp+jRjcBE8sb+iC2UeKHP4Gx/Vkz1e91YfCyeHFdQ1XI03fJ3 KSGeGB9zhQZrMfJZZ4lNTz7rTSRuH64jInzNCSmB+t5G8uiF+BLSLnaGDaguNB1L3X80 A7Ke9E/x04qHYyRjj7JqUjTSRMpwbBJr82C00HExetdDFsnEzDraKrNSuqkEAwFRZwfs g0RqLPoQHxi9U6dx8ZLCx+WJYAoshxkkBWbT8yutPDBAl4SLFQ5vtP2uSWJXcjzXmwlj 6+XA== X-Gm-Message-State: AOAM531OIGVIcuWf9trego2A21VqTrpvN7SzaaN5guwX6yfDs/E59JoG GHvxts9pYrPcPdfjO0AA+dGARR5mZcbtiA== X-Received: by 2002:a17:906:bfe2:: with SMTP id vr2mr155581ejb.248.1602601026712; Tue, 13 Oct 2020 07:57:06 -0700 (PDT) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com. [209.85.128.42]) by smtp.gmail.com with ESMTPSA id i18sm110813ejr.59.2020.10.13.07.57.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Oct 2020 07:57:05 -0700 (PDT) Received: by mail-wm1-f42.google.com with SMTP id f21so218567wml.3 for ; Tue, 13 Oct 2020 07:57:05 -0700 (PDT) X-Received: by 2002:a1c:96ca:: with SMTP id y193mr290708wmd.22.1602601024883; Tue, 13 Oct 2020 07:57:04 -0700 (PDT) MIME-Version: 1.0 References: <20200702100017.24700-1-stanimir.varbanov@linaro.org> <8dafbb4b-4626-5191-c57a-f3ef19c14618@linaro.org> <7db412a2-8fd3-6657-4fcd-1fbfde4b2c0e@linaro.org> In-Reply-To: From: Tomasz Figa Date: Tue, 13 Oct 2020 16:56:54 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] v4l: Add source change event for colorimetry To: Stanimir Varbanov Cc: Linux Media Mailing List , Linux Kernel Mailing List , Hans Verkuil , Mauro Carvalho Chehab , Nicolas Dufresne Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 13, 2020 at 4:53 PM Stanimir Varbanov wrote: > > > > On 10/13/20 5:07 PM, Tomasz Figa wrote: > > On Tue, Oct 13, 2020 at 3:53 PM Stanimir Varbanov > > wrote: > >> > >> > >> > >> On 10/13/20 4:40 PM, Tomasz Figa wrote: > >>> On Tue, Oct 13, 2020 at 11:03 AM Stanimir Varbanov > >>> wrote: > >>>> > >>>> Hi, > >>>> > >>>> On 7/2/20 2:52 PM, Stanimir Varbanov wrote: > >>>>> Hi, > >>>>> > >>>>> Once we have this event there is still open question how the client will > >>>>> know the data buffer on which the new colorspace is valid/applied. > >>>>> > >>>>> The options could be: > >>>>> * a new buffer flag and > >>>>> * some information in the v4l2_event structure. > >>>>> > >>>>> Thoughts? > >>>> > >>>> Kindly ping. > >>>> > >>> > >>> The event itself sounds good to me, but how do we know which buffer is > >>> the first to have the new colorimetry? > >> > >> I think Hans have a very good idea to have width/height and colorspace > >> specifiers in v4l2_ext_buffer [1]. > >> > >> [1] https://lkml.org/lkml/2020/9/9/531 > >> > > > > Hmm, I think that would basically make the event obsolete and without > > solving that problem I suspect the event is not very useful, because > > one could already receive and display (incorrectly) some buffers > > before realizing that they have different colorimetry > > Yes, I agree. I wasn't sure does Hans's idea will be well received, thus > I pinged. > > > > > I believe for now we would have to handle this like a resolution > > change - flush the CAPTURE queue and the next buffer after the flush > > would have the new colorimetry. With the new API we could optimize the > > I'm not sure what you mean by flush capture queue? Dequeue until LAST > flag (EPIPE) and stop streaming g_fmt(capture queue) and decide what is > changed and start streaming ? Yes, although no strict need to stop streaming, other ways are defined as well, e.g. DEC_CMD_START. Of course we would need to make appropriate changes to the spec and so I'd just unify it with the resolution change sequence. I think we could rename it to "Stream parameter change". > > > decoding by getting rid of the flushes and relying on the in-bound > > information. > > > > Best regards, > > Tomasz > > > >>> > >>> Best regards, > >>> Tomasz > >>> > >>>>> > >>>>> On 7/2/20 1:00 PM, Stanimir Varbanov wrote: > >>>>>> This event indicate that the source colorspace is changed > >>>>>> during run-time. The client has to retrieve the new colorspace > >>>>>> identifiers by getting the format (G_FMT). > >>>>>> > >>>>>> Signed-off-by: Stanimir Varbanov > >>>>>> --- > >>>>>> .../userspace-api/media/v4l/vidioc-dqevent.rst | 11 ++++++++++- > >>>>>> .../userspace-api/media/videodev2.h.rst.exceptions | 1 + > >>>>>> include/uapi/linux/videodev2.h | 1 + > >>>>>> 3 files changed, 12 insertions(+), 1 deletion(-) > >>>>>> > >>>>>> diff --git a/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst b/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst > >>>>>> index a9a176d5256d..3f69c753db58 100644 > >>>>>> --- a/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst > >>>>>> +++ b/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst > >>>>>> @@ -381,7 +381,16 @@ call. > >>>>>> that many Video Capture devices are not able to recover from a temporary > >>>>>> loss of signal and so restarting streaming I/O is required in order for > >>>>>> the hardware to synchronize to the video signal. > >>>>>> - > >>>>>> + * - ``V4L2_EVENT_SRC_CH_COLORIMETRY`` > >>>>>> + - 0x0002 > >>>>>> + - This event gets triggered when a colorspace change is detected at > >>>>>> + an input. By colorspace change here we include also changes in the > >>>>>> + colorspace specifiers (transfer function, Y'CbCr encoding and > >>>>>> + quantization). This event can come from an input or from video decoder. > >>>>>> + Once the event has been send to the client the driver has to update > >>>>>> + the colorspace specifiers internally so that they could be retrieved by > >>>>>> + client. In that case queue re-negotiation is not needed as this change > >>>>>> + only reflects on the interpretation of the data. > >>>>>> > >>>>>> Return Value > >>>>>> ============ > >>>>>> diff --git a/Documentation/userspace-api/media/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/videodev2.h.rst.exceptions > >>>>>> index ca05e4e126b2..54fc21af852d 100644 > >>>>>> --- a/Documentation/userspace-api/media/videodev2.h.rst.exceptions > >>>>>> +++ b/Documentation/userspace-api/media/videodev2.h.rst.exceptions > >>>>>> @@ -492,6 +492,7 @@ replace define V4L2_EVENT_CTRL_CH_FLAGS ctrl-changes-flags > >>>>>> replace define V4L2_EVENT_CTRL_CH_RANGE ctrl-changes-flags > >>>>>> > >>>>>> replace define V4L2_EVENT_SRC_CH_RESOLUTION src-changes-flags > >>>>>> +replace define V4L2_EVENT_SRC_CH_COLORIMETRY src-changes-flags > >>>>>> > >>>>>> replace define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ :c:type:`v4l2_event_motion_det` > >>>>>> > >>>>>> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > >>>>>> index 303805438814..b5838bc4e3a3 100644 > >>>>>> --- a/include/uapi/linux/videodev2.h > >>>>>> +++ b/include/uapi/linux/videodev2.h > >>>>>> @@ -2351,6 +2351,7 @@ struct v4l2_event_frame_sync { > >>>>>> }; > >>>>>> > >>>>>> #define V4L2_EVENT_SRC_CH_RESOLUTION (1 << 0) > >>>>>> +#define V4L2_EVENT_SRC_CH_COLORIMETRY (1 << 1) > >>>>>> > >>>>>> struct v4l2_event_src_change { > >>>>>> __u32 changes; > >>>>>> > >>>>> > >>>> > >>>> -- > >>>> regards, > >>>> Stan > >> > >> -- > >> regards, > >> Stan > > -- > regards, > Stan