Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3524606ybi; Mon, 27 May 2019 01:20:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqygaj0EP38LUYCrawz6LZZRTcKGJy3m0YSj0d+2LD21u6cEoVA/bmCrjvtajVB7+dye0vFA X-Received: by 2002:a62:38d8:: with SMTP id f207mr74449956pfa.131.1558945223102; Mon, 27 May 2019 01:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558945223; cv=none; d=google.com; s=arc-20160816; b=Z/5OSXpbOnT9BGSAFRxy9W1pix0yL8HkL61B6UF2ATbVzKMawByZPAD1K4boZmmqyE NNi6PhKrp4jrcwRhPYEfcBCJ2Kiq4dgvRaD8KnowtusdpxDdq1ZLGyVPjoKPynG5idWV EsSEM6rh4WQwHZt9qi6qsJvZomSAWGiK7KRZImyoAycr2pql6H0yzwXrRWEOnepb+td3 wYJArYdaYFVWF2LxM4Q1KUHvK4TsMUky44hWOWMdkXARfjXENv4/WrZpVdQvkm+ErNXv v31+2+5mmAbPrXAJwx8Kj3eEi8i34r43n/MowMf54HzQwZ3OFfj3kNS6y+h0el36IeXx AXdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8ngdR6Ro3qn7ZGyLFGLKvSdhPqv+ELHfz/McePmePXw=; b=A/if3BDM+55GlT7F08nMWIO+7U5k9aR5LLqgDORwAvJgO0DYlDoWxly5EvTrAJtvJa odnzY6OoWpUlB8xhTYw9ZNYu8SGIsVDhsiSc2TKNpxVT7K88mWaJ/B/OlcTMOqcF8whC NUtHCmr69Ni/s0hvwI+9rkYPBKqgAgtKmjb8dso2GZbfdsOFf2HO131A9HqsJIjXOpYv nxMWqa01X5JZS7zkXOfQV4zkTA0EcsS4VkRVDDqqluKBxI1jjEnGpZGZmzvj5OmCb43P jEbS9E2sUh//ug3ka11dsC8Qeu2MnAjg5I5r1qqS0l8eCZ50xz8uSERhtmiEzix2+8pj uImA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NF9jvX+K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id p34si12153006pgb.12.2019.05.27.01.20.06; Mon, 27 May 2019 01:20:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NF9jvX+K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726458AbfE0IS5 (ORCPT + 99 others); Mon, 27 May 2019 04:18:57 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:33147 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbfE0IS4 (ORCPT ); Mon, 27 May 2019 04:18:56 -0400 Received: by mail-ed1-f68.google.com with SMTP id n17so25555247edb.0 for ; Mon, 27 May 2019 01:18:54 -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=8ngdR6Ro3qn7ZGyLFGLKvSdhPqv+ELHfz/McePmePXw=; b=NF9jvX+KkRyAzN9Z4tiBQoEU28hBWIbk6SBE+vj7vIe+t8OUdUSFFDLsKzQ/isEFCk nrbsvjniSWyiJMEk76S+sK16S555XHSeQYeBF9vbygt6X4e0nFFdUMYoo+EMNJesiydQ MrVuRYeOno70/Yg3H19nWhrXl6xrD0J6Mjhkg= 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=8ngdR6Ro3qn7ZGyLFGLKvSdhPqv+ELHfz/McePmePXw=; b=fgKBIgWMfA1Zffq8x4I9IPadiOQMbSHqvuu4DCDwQ8VAboJAJninyfCzJoEXblQsmT OUm6Tus1B/9jEo+erOLXvssiEOdjchQ4vu0xSBp1B+80ubtwCZ+EFe26EcEhpWlFm4Dm HLfUjRcOYoLYRqUMeIBu7vqSsjq66oGhiIvV8zPNBVNdxbbxDDBoLYnr3+qgCgJAi8Bn CYIe2Kl4ixrOyHPOs8BR9vlfDR0u6CPOxqL7qrsKQpWq4lQ9c1vLJ/K02+u87t6LC9Hm 6grngw3XxxxZp1T6XfHqk+7zcpF2AZk7Y3V+gztnCgDJrPM47yG2vlzFEtdgMmp9GbQZ ly/w== X-Gm-Message-State: APjAAAWZ8mASkBMfIfdq7OwPECzUOSDryee/yaYyYqgxkEl0JFVmb3qt sEEc0Apq9XV4vTWKjjm6NlhiLVWgikTKpQ== X-Received: by 2002:a05:6402:1717:: with SMTP id y23mr16720896edu.304.1558945133621; Mon, 27 May 2019 01:18:53 -0700 (PDT) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com. [209.85.221.45]) by smtp.gmail.com with ESMTPSA id d24sm3089577edb.5.2019.05.27.01.18.51 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Mon, 27 May 2019 01:18:52 -0700 (PDT) Received: by mail-wr1-f45.google.com with SMTP id s17so15991582wru.3 for ; Mon, 27 May 2019 01:18:51 -0700 (PDT) X-Received: by 2002:adf:ec42:: with SMTP id w2mr22234669wrn.77.1558945131083; Mon, 27 May 2019 01:18:51 -0700 (PDT) MIME-Version: 1.0 References: <20190117162008.25217-1-stanimir.varbanov@linaro.org> <20190117162008.25217-11-stanimir.varbanov@linaro.org> <60b3efff-31c1-bc04-8af9-deebb8bc013a@xs4all.nl> <01b6683f-9378-e6f2-501f-e2213e6c690d@xs4all.nl> In-Reply-To: From: Tomasz Figa Date: Mon, 27 May 2019 17:18:39 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 10/10] venus: dec: make decoder compliant with stateful codec API To: Hans Verkuil Cc: Stanimir Varbanov , Linux Media Mailing List , Mauro Carvalho Chehab , Linux Kernel Mailing List , linux-arm-msm , Vikash Garodia , Alexandre Courbot , Malathi Gottam Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 27, 2019 at 4:39 PM Hans Verkuil wrote: > > On 5/27/19 5:51 AM, Tomasz Figa wrote: > > On Tue, May 21, 2019 at 9:27 PM Hans Verkuil wrote: > >> > >> On 5/21/19 11:09 AM, Tomasz Figa wrote: > >>> Hi Stan, > >>> > >>> On Mon, May 20, 2019 at 11:47 PM Stanimir Varbanov > >>> wrote: > >>>> > >>>> Hi Tomasz, > >>>> > >>>> On 4/24/19 3:39 PM, Tomasz Figa wrote: > >>>>> On Wed, Apr 24, 2019 at 9:15 PM Stanimir Varbanov > >>>>> wrote: > >>>>>> > >>>>>> Hi Hans, > >>>>>> > >>>>>> On 2/15/19 3:44 PM, Hans Verkuil wrote: > >>>>>>> Hi Stanimir, > >>>>>>> > >>>>>>> I never paid much attention to this patch series since others were busy > >>>>>>> discussing it and I had a lot of other things on my plate, but then I heard > >>>>>>> that this patch made G_FMT blocking. > >>>>>> > >>>>>> OK, another option could be to block REQBUF(CAPTURE) until event from hw > >>>>>> is received that the stream is parsed and the resolution is correctly > >>>>>> set by application. Just to note that I'd think to this like a temporal > >>>>>> solution until gstreamer implements v4l events. > >>>>>> > >>>>>> Is that looks good to you? > >>>>> > >>>>> Hmm, I thought we concluded that gstreamer sets the width and height > >>>>> in OUTPUT queue before querying the CAPTURE queue and so making the > >>>>> driver calculate the CAPTURE format based on what's set on OUTPUT > >>>>> would work fine. Did I miss something? > >>>> > >>>> Nobody is miss something. > >>>> > >>>> First some background about how Venus implements stateful codec API. > >>>> > >>>> The Venus firmware can generate two events "sufficient" and > >>>> "insufficient" buffer requirements (this includes decoder output buffer > >>>> size and internal/scratch buffer sizes). Presently I always set minimum > >>>> possible decoder resolution no matter what the user said, and by that > >>>> way I'm sure that "insufficient" event will always be triggered by the > >>>> firmware (the other reason to take this path is because this is the > >>>> least-common-divider for all supported Venus hw/fw versions thus common > >>>> code in the driver). The reconfiguration (during codec Initialization > >>>> sequence) is made from STREAMON(CAPTURE) context. Now, to make that > >>>> re-configuration happen I need to wait for "insufficient" event from > >>>> firmware in order to know the real coded resolution. > >>>> > >>>> In the case of gstreamer where v4l2_events support is missing I have to > >>>> block (wait for firmware event) REQBUF(CAPTURE) (vb2::queue_setup) or > >>>> STREAMON(CAPTURE) (vb2::start_streaming). > >>>> > >>>> I tried to set the coded resolution to the firmware as-is it set by > >>>> gstreamer but then I cannot receive the "sufficient" event for VP8 and > >>>> VP9 codecs. So I return back to the solution with minimum resolution above. > >>>> > >>>> I'm open for suggestions. > >>> > >>> I think you could still keep setting the minimum size and wait for the > >>> "insufficient" event. At the same time, you could speculatively > >>> advertise the expected "sufficient" size on the CAPTURE queue before > >>> the hardware signals those. Even if you mispredict them, you'll get > >>> the event, update the CAPTURE resolution and send the source change > >>> event to the application, which would then give you the correct > >>> buffers. Would that work for you? > >> > >> As I understand it this still would require event support, which gstreamer > >> doesn't have. > > > > I don't think it matches what I remember from the earlier discussion. > > As long as Gstreamer sets the visible resolution (from the container > > AFAIR) on OUTPUT, the driver would adjust it to something that is > > expected to be the right framebuffer resolution and so Gstreamer would > > be able to continue. Of course if the expected value doesn't match, it > > wouldn't work, but it's the same as currently for Coda AFAICT. > > > >> > >> I think it is OK to have REQBUFS sleep in this case. However, I would only > > > > Why REQBUFS? While that could possibly allow us to allocate the right > > buffers, Gstreamer wouldn't be able to know the right format, because > > it would query it before REQBUFS, wouldn't it? > > Oops, you are right. It's got to be in G_FMT(CAPTURE), but *only* if > nobody subscribed to the SOURCE_CHANGE event. > > > > > For this reason, s5p-mfc makes G_FMT(CAPTURE) blocking and if we > > decide to forcefully keep the compatibility, even with in drivers, we > > should probably do the same here. > > > >> enable this behavior if the application didn't subscribe to the SOURCE_CHANGE > >> event. That's easy enough to check in the driver. And that means that if the > >> application is well written, then the driver will behave in a completely > >> standard way that the compliance test can check. > > > > I guess one could have some helpers for this. They would listen to the > > source change events internally and block / wake-up appropriate ioctls > > whenever necessary. > > I really do not want this for new drivers. gstreamer should be fixed. > A blocking G_FMT is just plain bad. Only those drivers that do this, can > still block if nobody subscribed to EVENT_SOURCE_CHANGE. Yeah and that's why I just suggested to mimic coda, which doesn't block, but apparently gstreamer still works with it. > > > Another question: If we intend this to be implemented in new drivers > > too, should it be documented in the spec? > > We most certainly do NOT want to implement this in new drivers. > Makes sense. When venus was merged initially, did it already have a blocking G_FMT? Best regards, Tomasz