Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp813916imm; Wed, 25 Jul 2018 06:42:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfEiVHDCXbAyawAr0pXZ+UoCdkB33P3RZD+qSpi4hhGllGyjZPxBptOD2683eny33oLuJIA X-Received: by 2002:a62:a119:: with SMTP id b25-v6mr22013181pff.163.1532526166984; Wed, 25 Jul 2018 06:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532526166; cv=none; d=google.com; s=arc-20160816; b=MN/NJMpvPIb3qhsNwRShk5D9njHmJlRll79neiFn1b/PTMhpMz84VFCRr80NQU46PA eaK3lTxo2oDwvFWf68Pgv3UwtbgJ5AEmrY+29YAjOxiXBymTJZcxIzGXV+k2n7vblJ/s ow8StlCLHjmZe2kk/nq7Fa1+MfV32kS4HrB3hE5bpY31DypzQhfXk9MipLuOSZvYjYPQ 3vV7fq6vHEDJ/11Z1ULgvQSbcpLo/bNYKxsFwd9gq7/D/yftNX/tBgVRgQPg37ePaiU2 DEWk3NNtF/SPH3njTOTrzc7QbL65UfoXfVlz/gGb1SR+DpW4QaM91QJexOT3y/OjiuHG kOAw== 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 :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=WifToc4Bhx/l+1dYv7rKu+3FwiIDmxnB3MqDLYcUAx0=; b=tfkar7wWWgnlPBjXfg8I+elKUEcUu7zDl6cuwz4nl3rw9mkdJdG3qDhoKDPbhRoAht vAW6j54YQZnRAUZV7ovKhistRLtIK5lEFKJvq80dbP+cwrGGGw9lNAC4BgprJht/qGsv nJ7ZVS/dUjBUx4XCnt5tRJNvZOc+nPLCQdaixYTJ4z7KWPYt5kULwMGnofd7g5RhwPNr D6AgHLLFlvSe5tG8g5/p+4TWcUM+zrwgtOUAaN/af8cY71TOfVlM20SBJ0qU6IoTza4a 28wzNllpBOVR7IGNSN9l1yYn0CO6eWLuek5UDGG4LWRIH7OR6dMz3MgdRFHPSuN9UtpW +XdQ== ARC-Authentication-Results: i=1; mx.google.com; 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 m7-v6si1371132plt.7.2018.07.25.06.42.31; Wed, 25 Jul 2018 06:42:46 -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; 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 S1729130AbeGYOxD (ORCPT + 99 others); Wed, 25 Jul 2018 10:53:03 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:58095 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729052AbeGYOxD (ORCPT ); Wed, 25 Jul 2018 10:53:03 -0400 Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1fiK2X-0006zE-IM; Wed, 25 Jul 2018 15:41:17 +0200 Message-ID: <1532526073.4879.6.camel@pengutronix.de> Subject: Re: [PATCH 2/2] media: docs-rst: Document memory-to-memory video encoder interface From: Philipp Zabel To: Tomasz Figa , linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Stanimir Varbanov , Mauro Carvalho Chehab , Hans Verkuil , Pawel Osciak , Alexandre Courbot , kamil@wypas.org, a.hajda@samsung.com, Kyungmin Park , jtp.park@samsung.com, Tiffany Lin =?UTF-8?Q?=28=E6=9E=97=E6=85=A7=E7=8F=8A=29?= , Andrew-CT Chen =?UTF-8?Q?=28=E9=99=B3=E6=99=BA=E8=BF=AA=29?= , todor.tomov@linaro.org, nicolas@ndufresne.ca, Paul Kocialkowski , Laurent Pinchart , Dave Stevenson , ezequiel@collabora.com Date: Wed, 25 Jul 2018 15:41:13 +0200 In-Reply-To: <20180724140621.59624-3-tfiga@chromium.org> References: <20180724140621.59624-1-tfiga@chromium.org> <20180724140621.59624-3-tfiga@chromium.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-07-24 at 23:06 +0900, Tomasz Figa wrote: > Due to complexity of the video encoding process, the V4L2 drivers of > stateful encoder hardware require specific sequences of V4L2 API calls > to be followed. These include capability enumeration, initialization, > encoding, encode parameters change, drain and reset. > > Specifics of the above have been discussed during Media Workshops at > LinuxCon Europe 2012 in Barcelona and then later Embedded Linux > Conference Europe 2014 in Düsseldorf. The de facto Codec API that > originated at those events was later implemented by the drivers we already > have merged in mainline, such as s5p-mfc or coda. > > The only thing missing was the real specification included as a part of > Linux Media documentation. Fix it now and document the encoder part of > the Codec API. > > Signed-off-by: Tomasz Figa Thanks a lot for the update, > --- > Documentation/media/uapi/v4l/dev-encoder.rst | 550 +++++++++++++++++++ > Documentation/media/uapi/v4l/devices.rst | 1 + > Documentation/media/uapi/v4l/v4l2.rst | 2 + > 3 files changed, 553 insertions(+) > create mode 100644 Documentation/media/uapi/v4l/dev-encoder.rst > > diff --git a/Documentation/media/uapi/v4l/dev-encoder.rst b/Documentation/media/uapi/v4l/dev-encoder.rst > new file mode 100644 > index 000000000000..28be1698e99c > --- /dev/null > +++ b/Documentation/media/uapi/v4l/dev-encoder.rst > @@ -0,0 +1,550 @@ > +.. -*- coding: utf-8; mode: rst -*- > + > +.. _encoder: > + > +**************************************** > +Memory-to-memory Video Encoder Interface > +**************************************** > + > +Input data to a video encoder are raw video frames in display order > +to be encoded into the output bitstream. Output data are complete chunks of > +valid bitstream, including all metadata, headers, etc. The resulting stream > +must not need any further post-processing by the client. > + > +Performing software stream processing, header generation etc. in the driver > +in order to support this interface is strongly discouraged. In case such > +operations are needed, use of Stateless Video Encoder Interface (in > +development) is strongly advised. > + [...] > + > +Commit points > +============= > + > +Setting formats and allocating buffers triggers changes in the behavior > +of the driver. > + > +1. Setting format on ``CAPTURE`` queue may change the set of formats > + supported/advertised on the ``OUTPUT`` queue. In particular, it also > + means that ``OUTPUT`` format may be reset and the client must not > + rely on the previously set format being preserved. Since the only property of the CAPTURE format that can be set directly via S_FMT is the pixelformat, should this be made explicit? 1. Setting pixelformat on ``CAPTURE`` queue may change the set of formats supported/advertised on the ``OUTPUT`` queue. In particular, it also means that ``OUTPUT`` format may be reset and the client must not rely on the previously set format being preserved. ? > +2. Enumerating formats on ``OUTPUT`` queue must only return formats > + supported for the ``CAPTURE`` format currently set. Same here, as it usually is the codec selected by CAPTURE pixelformat that determines the supported OUTPUT pixelformats and resolutions. 2. Enumerating formats on ``OUTPUT`` queue must only return formats    supported for the ``CAPTURE`` pixelformat currently set. This could prevent the possible misconception that the CAPTURE width/height might in any form limit the OUTPUT format, when in fact it is determined by it. > +3. Setting/changing format on ``OUTPUT`` queue does not change formats > + available on ``CAPTURE`` queue. 3. Setting/changing format on the ``OUTPUT`` queue does not change pixelformats available on the ``CAPTURE`` queue. ? Because setting OUTPUT width/height or CROP SELECTION very much limits the possible values of CAPTURE width/height. Maybe 'available' in this context should be specified somewhere to mean 'returned by ENUM_FMT and allowed by S_FMT/TRY_FMT'. > + An attempt to set ``OUTPUT`` format that > + is not supported for the currently selected ``CAPTURE`` format must > + result in the driver adjusting the requested format to an acceptable > + one. An attempt to set ``OUTPUT`` format that is not supported for the currently selected ``CAPTURE`` pixelformat must result in the driver adjusting the requested format to an acceptable one. > +4. Enumerating formats on ``CAPTURE`` queue always returns the full set of > + supported coded formats, irrespective of the current ``OUTPUT`` > + format. > + > +5. After allocating buffers on the ``CAPTURE`` queue, it is not possible to > + change format on it. > + > +To summarize, setting formats and allocation must always start with the > +``CAPTURE`` queue and the ``CAPTURE`` queue is the master that governs the > +set of supported formats for the ``OUTPUT`` queue. To summarize, setting formats and allocation must always start with setting the encoded pixelformat on the ``CAPTURE`` queue. The ``CAPTURE`` queue is the master that governs the set of supported formats for the ``OUTPUT`` queue. Or is this too verbose? regards Philipp