Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2396762imu; Thu, 24 Jan 2019 12:03:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN4TulogskiU3UMyd2aQMVcgkldTRxfdgP58hNwIEIsXqb7W+f9Cn6jPmZhiwn2ny9kxMMMH X-Received: by 2002:a63:77ce:: with SMTP id s197mr7188956pgc.89.1548360226424; Thu, 24 Jan 2019 12:03:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548360226; cv=none; d=google.com; s=arc-20160816; b=TqY7gUvUt2HGqtx8X7myo9FBIQ54O36KDgTZYcM1+uhSKvXUpYyfdopCnN8xRrP3bI ssPTfdUpBzKsNd1q3kYZfQ0cSxgt22lFSBCSd9arGD1e+3Unch9ybDQCUxyrQYmGKXRr bjuha2CSIupmMhaCg5jcBQUA3MGPNe1KHz0km9z8fWt9uQ7gJKbLXPZYti86udimM5j6 jKu/ZSDLyO3Y/oeDnfpTjH0tWKK6+t4u1uiygW2SSNBDHfre0bWxnhk0mgn5ij0B9KNa J5mxYhTmXrAbCzvTB6G8PnueU4IAt89otIY75KFi3Z2F9cBmyVaTkZki9uncsh1MXqLu eenQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=1Qc1gApNtNYgosohgQj5nrLUiVb3/k8Wu8CPPbCMbKQ=; b=piOeF5ozvYeDK4BqrJeGkAI8FOMWx2cJ8jkRsJr+NxOi9gQ1VxKNItPaOdWRWNA12h lJA0wcfhKh/TxlqAE5Dvo+hPrp3Z13MRcL8bRemorOoVeAWOuvtpj2BM3d3HyGfB9WAN 13r66+pnIaAnxEM/yvZdlOPLwEau1ZwoSizzufRR6Yd0Q49vPGPVqi1KkyqOcM1KoOCU 10yMSzUSNBBUaycsKfrqqF+rKtvdY2VkIvvw4FoxyIrMTMg6psWBdnMhSTYDQ3F/LIf3 Rw6WVfBgy9e6y1g490OJmOwfKEUrQCxnJv8xFbwimmdGhd0+ZuJ5EXKhlFZ5f+iKH74Y 68lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b="TXClimY/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 189si22072004pfd.142.2019.01.24.12.03.30; Thu, 24 Jan 2019 12:03:46 -0800 (PST) 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=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b="TXClimY/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729937AbfAXUCJ (ORCPT + 99 others); Thu, 24 Jan 2019 15:02:09 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:35395 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727940AbfAXUCG (ORCPT ); Thu, 24 Jan 2019 15:02:06 -0500 Received: by mail-qt1-f196.google.com with SMTP id v11so8183108qtc.2 for ; Thu, 24 Jan 2019 12:02:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndufresne-ca.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=1Qc1gApNtNYgosohgQj5nrLUiVb3/k8Wu8CPPbCMbKQ=; b=TXClimY/73VMKnv/m6INBwNilNlPO9nRGWx/gSYL8QjI/B6Kn2CLRBkyrj/VaUliOk Ys26YKl7BC29duAOeWCO+v/lLrI+YgOsZevVV85NDjY5IWQki0g0uKFTUH0oTvJL4WAz yASFrfESFkLfvUt+acg5glTExCFBi3BWWVJt/QOoPu7kedsrwdugtTEMYjI+Zn+qFLjZ WVDWfdvakdDiBvGCh0zt7RC19opKSI1e+ZD/0DxjKAk4498OyUi6PghPGDidzi3ukZOu 4GsbO2zW3uYl01Px30JfNRvkfLW88PWtJ8IupCdSyi6WutBESYAY6Gn5EWkJW15MVnls LEQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=1Qc1gApNtNYgosohgQj5nrLUiVb3/k8Wu8CPPbCMbKQ=; b=U7MQoluxpLGDuIfviVEG2DX/uIZ7hm3NEXabf5XrFYxAHnwC5zSqu0EX63ULsdnRO5 hWivEf3DqChx4nbcPuDmAvUZvCrFT4tJ+1EZp3FaIryM1V/myWCX+NqYWvow4IzdDDKI w5cO5GMtbG1DicRRc1Enf+7alg65OWZA7Wxhp+5tmoCbiK+jA+ldRUuEtoOvyrnq1lXX Qqb0pyEz6Z5QD0kojtFwWTpdVN9PyCH7mlfMgA+VroKWV2A2OzZ9AFevNlfoorAJ2+wH pvBY7mHTK3OUf2/jQd2VJB/4mwTOp1i6kalF8dNSx+Sp08xj9WqJyPfBc+ZjsUntFM7G oDTA== X-Gm-Message-State: AJcUukeWFajdp8eKk/yP1l6lqU1MVxAaw8VS/7mRta/iPVn7bTMHxXvb LZhQ/WCUu+pC+CT7N9FUY+tMiJp081ELPbrL X-Received: by 2002:a0c:b6c3:: with SMTP id h3mr7728962qve.128.1548360125408; Thu, 24 Jan 2019 12:02:05 -0800 (PST) Received: from skullcanyon ([192.222.193.21]) by smtp.gmail.com with ESMTPSA id y32sm80764578qth.3.2019.01.24.12.02.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 12:02:04 -0800 (PST) Message-ID: <74aef8bfac022ba8ea875b1c69538ad91bf00a0b.camel@ndufresne.ca> Subject: Re: [PATCH v2 2/2] media: docs-rst: Document memory-to-memory video encoder interface From: Nicolas Dufresne To: Tomasz Figa Cc: Hans Verkuil , Linux Media Mailing List , Linux Kernel Mailing List , Mauro Carvalho Chehab , =?UTF-8?Q?Pawe=C5=82_O=C5=9Bciak?= , Alexandre Courbot , Kamil Debski , Andrzej Hajda , Kyungmin Park , Jeongtae Park , Philipp Zabel , Tiffany Lin , Andrew-CT Chen , Stanimir Varbanov , Todor Tomov , Paul Kocialkowski , Laurent Pinchart , dave.stevenson@raspberrypi.org, Ezequiel Garcia , Maxime Jourdan Date: Thu, 24 Jan 2019 15:02:02 -0500 In-Reply-To: References: <20181022144901.113852-1-tfiga@chromium.org> <20181022144901.113852-3-tfiga@chromium.org> <4cd223f0-b09c-da07-f26c-3b3f7a8868d7@xs4all.nl> <5fb0f2db44ba7aa3788b61f2aa9a30d4f4984de5.camel@ndufresne.ca> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.4 (3.30.4-1.fc29) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le mercredi 23 janvier 2019 à 19:02 +0900, Tomasz Figa a écrit : > On Sun, Nov 18, 2018 at 10:34 AM Nicolas Dufresne wrote: > > Le samedi 17 novembre 2018 à 12:37 +0100, Hans Verkuil a écrit : > > > > > Does V4L2_CID_MIN_BUFFERS_FOR_CAPTURE make any sense for encoders? > > > > > > > > We do account for it in GStreamer (the capture/output handling is > > > > generic), but I don't know if it's being used anywhere. > > > > > > Do you use this value directly for REQBUFS, or do you use it as the minimum > > > value but in practice use more buffers? > > > > We add more buffers to that value. We assume this value is what will be > > held by the driver, hence without adding some buffers, the driver would > > go idle as soon as one is dequeued. We also need to allocate for the > > importing driver. > > > > In general, if we have a pipeline with Driver A sending to Driver B, > > both driver will require a certain amount of buffers to operate. E.g. > > with DRM display, the driver will hold on 1 buffer (the scannout > > buffer). > > > > In GStreamer, it's implemented generically, so we do: > > > > MIN_BUFFERS_FOR + remote_min + 1 > > > > If only MIN_BUFFERS_FOR was allocated, ignoring remote driver > > requirement, the streaming will likely get stuck. > > What happens if the driver doesn't report it? If the driver does not report it because it does not use it (I think CODA decoder is like that), there is no issue. If the driver do not report but needs extra, the driver will end up growing count in REQBUFS, so the end result will be under-allocation since the remote requirement won't be accounted. Streaming will hang. A good example is transcoding, you encoder will never have enough frames to reproduce an output, because the decoder is waiting for his frame to come back. Only solution to that would be a memcpy(), or double allocation (redoing REQBUFS later on). The MIN_BUFFERS_FOR announcement is the optimal way, avoiding copies and allocating twice. > > Best regards, > Tomasz