Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp65620pxu; Tue, 13 Oct 2020 16:51:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyojv4R9OwP04sISimDr8uhxJbas2szXCUp1MabjF5AAh53cZIbHpu+kTY7QaV1K35ibJZn X-Received: by 2002:a17:906:490d:: with SMTP id b13mr2363169ejq.122.1602633115798; Tue, 13 Oct 2020 16:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602633115; cv=none; d=google.com; s=arc-20160816; b=d6lunD90WHTRkDaMGHGnJow578veqO8ywXjNQJhfgQCGuzH22XJuTo7fMeKfZQSDBY Vlx9PsHJw5dYcUXQtwerX0D+iuQ95rm39qb5GjpmjpoUUTT4fDEbiOYto7ibsbj02WU0 eEdYa85ziMItcyVd0bXV8fBmZks0muZ1bavIqOSgeHAFJI4mBhvR4yPlH+EUR7hQJcUm C29s3IzhNlz9mH5h6ZK42DYxu3Mnrx6MDYp7hijIlsJYw1ZyIGVqCCpKamNxqIXarCwa 2P/DSX+yHXWbpXwf3E+m9gTArvIG4EIdL7PPyaPayjrU/XjzMRaC/Ac9W8n/2SFBesdL bwag== 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=LIX8UwVd6i1Ks++H9pMW7uUhFrKEYQPcpPoIUC4HcAM=; b=ezU98tAraaMwhQ+NBKALXPAAlBVAfnEnKG5PbnsMiBFEeX2Fp7MnwwACM3wkx7tRFD ozMNo6SDLZ62nVk3kzZ/z6jCRBA774NNi6JcLJUrvMz1ojaBfkedHDl07VJ4RXls5FuK ZOAIafX3l5AmKLviwlMIcUQW2BIj0Nr4n0/sTVKjMqOnn3G1UR99TiiYky5UVEiKZpdY 4Tw9srPAtHVzFQd8YQ4DMMRkGIJ5eQqu2rhYuzAhwdrBKHOFf9eC8IKZnoGbCxAVj5qI EIszpNYFlabBHtsjWQIu6gEWD6ZJirhfanQiWVPKJU9N3Vx5yDwMSWj4b5c4+pF9YWSB FOKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nVgdy1nm; 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 i13si923594ejk.72.2020.10.13.16.51.33; Tue, 13 Oct 2020 16:51:55 -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=nVgdy1nm; 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 S2388356AbgJMOHX (ORCPT + 99 others); Tue, 13 Oct 2020 10:07:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388163AbgJMOHX (ORCPT ); Tue, 13 Oct 2020 10:07:23 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 033C0C0613D0 for ; Tue, 13 Oct 2020 07:07:23 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id u21so2275eja.2 for ; Tue, 13 Oct 2020 07:07:22 -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=LIX8UwVd6i1Ks++H9pMW7uUhFrKEYQPcpPoIUC4HcAM=; b=nVgdy1nmy0T2zzsNhl0z+N717Ybshh5QAq5ClUShuZFu69Z7Zg4XRpdNH9p9tjxE2v /J5m1J493d+7a5D0/ATiWvOT001h/H3o7O1TWCxnJ2LORB8kWDZKWLI0Zbr8X6YPCYjw uLybBHYvln9rQEs7qxhFa25fAALx6fy0Vm+8w= 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=LIX8UwVd6i1Ks++H9pMW7uUhFrKEYQPcpPoIUC4HcAM=; b=byuw30tChUj9bHFhOvzQIzPsDKfYxVi727tv6nJQ1gbEkpriy9b+4VN9bCcznQwa2y fyB6nJCNAUnn1/8OUBA2NYkztkHyG5d1b3Wqaysffvj0NB7xKfo36cFxvGsnidQJivX9 rYv2qQikwNUD9ecix5VTVOeoCY1I37IBcz5Q3wgDVSQbAzMye1sofTmrQMr+iFVxSWmR U09zCdCZ/V6hR48r19tvzsbnAdYh0zjwABrlv4vNr2CvDid4zOn0MY3Nl5n79f1DKRFf UYLBcUmRaEXfNV071KzcmNOmaK7NB0JUljFk8iOtDCov4Bq3rPjAuW9dgfViq4vJKNUr N96A== X-Gm-Message-State: AOAM533Tv58tuQRakasNZXTQVOFj+d39TFQx/wC7fPL8QZ1pJX3fG+JS Dwn2NC7jCwSPxn0zKelDjrDHItaxe8MdKMiV X-Received: by 2002:a17:906:3ada:: with SMTP id z26mr11353574ejd.151.1602598041202; Tue, 13 Oct 2020 07:07:21 -0700 (PDT) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com. [209.85.221.54]) by smtp.gmail.com with ESMTPSA id m16sm12087686edj.37.2020.10.13.07.07.20 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Oct 2020 07:07:20 -0700 (PDT) Received: by mail-wr1-f54.google.com with SMTP id t9so24214579wrq.11 for ; Tue, 13 Oct 2020 07:07:20 -0700 (PDT) X-Received: by 2002:adf:82e5:: with SMTP id 92mr1153384wrc.192.1602598039641; Tue, 13 Oct 2020 07:07:19 -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: <7db412a2-8fd3-6657-4fcd-1fbfde4b2c0e@linaro.org> From: Tomasz Figa Date: Tue, 13 Oct 2020 16:07:08 +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 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. 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 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