Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1992083imm; Thu, 7 Jun 2018 03:47:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKgGWoz1fgTRmUS8vBtusEZzwlDpP4I9nox+YEDDJc87IJUx2Ce000LGYnLlyNdFnfqdQ6Q X-Received: by 2002:a62:e310:: with SMTP id g16-v6mr1301850pfh.25.1528368450766; Thu, 07 Jun 2018 03:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528368450; cv=none; d=google.com; s=arc-20160816; b=DvZlt8cq1KBSfvoMxYA/jhD9vCtO0mpIdKaOWeIyX5zqb9vzdBVfpDBD/UHbWrzPN9 j9vyQ7s3fCKDnRZGappjw3PAudDrQC/9sveD1w2N8kIGNZ/APR7gSMMuTw7TFZLTDjVG x93szbs4TCyGSx2cas6QkOoSi2225kPV45IojN1rqOBqP5GxetMRxitYy3D0IB1ilB/I r3JmQWmTHxZtrNm7yn3j128hgncWzCkcIkiuQ7GGfHYj/cr0hpMlccnEWUR+JroGVc5e rYo+vg/hQ1DQumYUrMpuK7C0/rDWorz75c8X7vNv0YzpVurJI+LJ7PsHT36TMWzHRy63 rJFQ== 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=7Cva3wNZMaK1OqNONtbo8Yd44rszdthkN7c2ZAK27Jc=; b=W6Qn5FaScb+Usc268hhT/bE8Cg/fhGPq28lG1b/S+eDRurXYyyQXyKLhjbVXBEhyY6 0aMucjWxpnA8cmooD/ScS3VnXVJCDRGF4TF23B+HuEaqFLlxSeMTTq/kIbZsUrX9d2Ev hqErJZnxWtMWd288mXseBP4Pt26mcvFa8Ql/DHWd5Qiu3ALmkiEzgCI1nZh0sBc6IBNX BJLOBlYgy8FTbaXjZdF2Ajm/ZzLVFLLXFBb5e0pA0n5YrfIo2R0mGoJHNFwAD7RPn9Qb mL3J5NbHSLxko9KrjJnyaCUK/sGT9jj2m+XKTMl/DPc/jQL+rwFel58iMiQg/JA3mBZS gLlw== 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 n64-v6si28942356pfh.210.2018.06.07.03.47.15; Thu, 07 Jun 2018 03:47:30 -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 S1753068AbeFGKkG (ORCPT + 99 others); Thu, 7 Jun 2018 06:40:06 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:47141 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753088AbeFGKkE (ORCPT ); Thu, 7 Jun 2018 06:40:04 -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 1fQsKn-0001mW-5L; Thu, 07 Jun 2018 12:40:01 +0200 Message-ID: <1528367999.3308.7.camel@pengutronix.de> Subject: Re: [RFC PATCH 2/2] media: docs-rst: Add encoder UAPI specification to Codec Interfaces From: Philipp Zabel To: Hans Verkuil , Tomasz Figa , linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , =?UTF-8?Q?Pawe=C5=82_O=C5=9Bciak?= , Alexandre Courbot , Kamil Debski , Andrzej Hajda , Kyungmin Park , Jeongtae Park , Tiffany Lin , Andrew-CT Chen , Stanimir Varbanov , Todor Tomov , Nicolas Dufresne , Paul Kocialkowski , Laurent Pinchart Date: Thu, 07 Jun 2018 12:39:59 +0200 In-Reply-To: <32e8a7b8-5629-c089-7375-0513512784ff@xs4all.nl> References: <20180605103328.176255-1-tfiga@chromium.org> <20180605103328.176255-3-tfiga@chromium.org> <32e8a7b8-5629-c089-7375-0513512784ff@xs4all.nl> 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 Thu, 2018-06-07 at 11:21 +0200, Hans Verkuil wrote: [...] > > +Encoder > > +======= [...] > > +Initialization > > +-------------- > > + > > +1. (optional) Enumerate supported formats and resolutions. See > > + capability enumeration. > > + > > +2. Set a coded format on the CAPTURE queue via :c:func:`VIDIOC_S_FMT` > > + > > + a. Required fields: > > + > > + i. type = CAPTURE > > + > > + ii. fmt.pix_mp.pixelformat set to a coded format to be produced > > + > > + b. Return values: > > + > > + i. EINVAL: unsupported format. > > I'm still not sure about returning an error in this case. > > And what should TRY_FMT do? Also the documentation currently states in [1]: Drivers should not return an error code unless the type field is invalid, this is a mechanism to fathom device capabilities and to approach parameters acceptable for both the application and driver.  [1] https://linuxtv.org/downloads/v4l-dvb-apis-new/uapi/v4l/vidioc-g-fmt.html > Do you know what current codecs do? Return EINVAL or replace with a supported format? At least coda replaces incorrect pixelformat with a supported format. > It would be nice to standardize on one rule or another. > > The spec says that it should always return a valid format, but not all drivers adhere > to that. Perhaps we need to add a flag to let the driver signal the behavior of S_FMT > to userspace. > > This is a long-standing issue with S_FMT, actually. > [...] > > +Encoding parameter changes > > +-------------------------- > > + > > +The client is allowed to use :c:func:`VIDIOC_S_CTRL` to change encoder > > +parameters at any time. The driver must apply the new setting starting > > +at the next frame queued to it. > > + > > +This specifically means that if the driver maintains a queue of buffers > > +to be encoded and at the time of the call to :c:func:`VIDIOC_S_CTRL` not all the > > +buffers in the queue are processed yet, the driver must not apply the > > +change immediately, but schedule it for when the next buffer queued > > +after the :c:func:`VIDIOC_S_CTRL` starts being processed. > > Is this what drivers do today? I thought it was applied immediately? > This sounds like something for which you need the Request API. coda currently doesn't support dynamically changing controls at all. > > + > > +Flush > > +----- > > + > > +Flush is the process of draining the CAPTURE queue of any remaining > > +buffers. After the flush sequence is complete, the client has received > > +all encoded frames for all OUTPUT buffers queued before the sequence was > > +started. > > + > > +1. Begin flush by issuing :c:func:`VIDIOC_ENCODER_CMD`. > > + > > + a. Required fields: > > + > > + i. cmd = ``V4L2_ENC_CMD_STOP`` > > + > > +2. The driver must process and encode as normal all OUTPUT buffers > > + queued by the client before the :c:func:`VIDIOC_ENCODER_CMD` was issued. > > Note: TRY_ENCODER_CMD should also be supported, likely via a standard helper > in v4l2-mem2mem.c. TRY_ENCODER_CMD can be used to check whether the hardware supports things like V4L2_ENC_CMD_STOP_AT_GOP_END, I don't think this will be the same for all codecs. regards Philipp