Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp587408imm; Wed, 6 Jun 2018 02:40:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKITH98c4/o63/D38Wg5c4+6LAsO/Ep0E2e4PPl3h5Ld9Ub3mEX/A/zbXDEhTO/NbJndw9Lr X-Received: by 2002:a17:902:5409:: with SMTP id d9-v6mr2553957pli.0.1528278052345; Wed, 06 Jun 2018 02:40:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528278052; cv=none; d=google.com; s=arc-20160816; b=dADqHIjqdl2t1kggEB65hg5x+ECgnhs8DhRq0mxlHn2emg3xiWtcH6YnZv7I3DUzjh tcdmGUkxCazBa0Gak/qBeqYGFCH4VuBkhsmKCiXX2qzeDTxIdL+D0FzQz5eqECEQU/ic RpwrNlFgG+3AfZHUCQme5/OTsAMCsI34DOq5H8EMUjc70F8T6XJZYKvuqpIHa1dhFPH9 tWwH9upRCAqeRDRCpxSbLtmgYSEVDi92vrAYT3ESPKJGsioHa/XtcgDo/61bGCByyoFM csQ+gXzBIBk9d1/egaCPwcmUEHGFWy5ZIGhj27kG7F/lefn05/saHz74V1Smmiqos61l Vk3w== 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=31qzKTZ1Ry7D27+N6nFtmH/yPkX85vCA40Wd8OIWAN4=; b=CLqIhxW7ZIsefvGfuDaniKjupwT08v5nHDRLKZGjpKnF8xe7S0Odu3g8ggj1maqCB+ 2GGAMLCjjnJZvhbAhA+oKE6J3pSeXF8v7WHcenPFgq1Vur7yL9m/l5nSClQ10nbLH5+E siaSS6L6jAu2VEGYT30GYnF8/ev93k/xTpoa3uA8PdJhrJO8Ji3owKdH4/KFqI7IJHbu KeOEcbnH54Tj0cxgh+HopCG6Ox5ARcyXGgA3v9R6DLGoTs8Te9ThAJnVOrlOIhpYn3EU NSwFy9ZWrbvOz6XxUQ7SZGQUXIUmh6CGFafBGBgouY6pHJ5cF4EJaJAKuYf4Rl71C7Xi o16Q== 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 a97-v6si22023534pla.552.2018.06.06.02.40.37; Wed, 06 Jun 2018 02:40:52 -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 S932496AbeFFJkN (ORCPT + 99 others); Wed, 6 Jun 2018 05:40:13 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:47759 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932415AbeFFJkM (ORCPT ); Wed, 6 Jun 2018 05:40:12 -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 1fQUvK-0006zq-Eo; Wed, 06 Jun 2018 11:40:10 +0200 Message-ID: <1528278003.3438.3.camel@pengutronix.de> Subject: Re: [RFC PATCH 2/2] media: docs-rst: Add encoder UAPI specification to Codec Interfaces From: Philipp Zabel To: Tomasz Figa Cc: Pawel Osciak , Linux Media Mailing List , Linux Kernel Mailing List , Mauro Carvalho Chehab , Hans Verkuil , 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?= , Stanimir Varbanov , todor.tomov@linaro.org, nicolas@ndufresne.ca, Paul Kocialkowski , Laurent Pinchart Date: Wed, 06 Jun 2018 11:40:03 +0200 In-Reply-To: References: <20180605103328.176255-1-tfiga@chromium.org> <20180605103328.176255-3-tfiga@chromium.org> <1528199628.4074.15.camel@pengutronix.de> <1528208578.4074.19.camel@pengutronix.de> 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 Wed, 2018-06-06 at 18:17 +0900, Tomasz Figa wrote: > On Tue, Jun 5, 2018 at 11:23 PM Philipp Zabel wrote: > > > > On Tue, 2018-06-05 at 21:31 +0900, Tomasz Figa wrote: > > [...] > > > +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. > > > > > + > > > > > + ii. Others: per spec > > > > > + > > > > > + c. Return fields: > > > > > + > > > > > + i. fmt.pix_mp.width, fmt.pix_mp.height should be 0. > > > > > + > > > > > + .. note:: > > > > > + > > > > > + After a coded format is set, the set of raw formats > > > > > + supported as source on the OUTPUT queue may change. > > > > > > > > So setting CAPTURE potentially also changes OUTPUT format? > > > > > > Yes, but at this point userspace hasn't yet set the desired format. > > > > > > > If the encoded stream supports colorimetry information, should that > > > > information be taken from the CAPTURE queue? > > > > > > What's colorimetry? Is it something that is included in > > > v4l2_pix_format(_mplane)? Is it something that can vary between raw > > > input and encoded output? > > > > FTR, yes, I meant the colorspace, ycbcr_enc, quantization, and xfer_func > > fields of the v4l2_pix_format(_mplane) structs. GStreamer uses the term > > "colorimetry" to pull these fields together into a single parameter. > > > > The codecs usually don't care at all about this information, except some > > streams (such as h.264 in the VUI parameters section of the SPS header) > > may optionally contain a representation of these fields, so it may be > > desirable to let encoders write the configured colorimetry or to let > > decoders return the detected colorimetry via G_FMT(CAP) after a source > > change event. > > > > I think it could be useful to enforce the same colorimetry on CAPTURE > > and OUTPUT queue if the hardware doesn't do any colorspace conversion. > > After thinking a bit more on this, I guess it wouldn't overly > complicate things if we require that the values from OUTPUT queue are > copied to CAPTURE queue, if the stream doesn't include such > information or the hardware just can't parse them. And for encoders it would be copied from CAPTURE queue to OUTPUT queue? > Also, userspace > that can't parse them wouldn't have to do anything, as the colorspace > default on OUTPUT would be V4L2_COLORSPACE_DEFAULT and if hardware > can't parse it either, it would just be propagated to CAPTURE. I wonder if this wouldn't change the meaning of V4L2_COLORSPACE_DEFAULT? Documentation/media/uapi/v4l/colorspaces-defs.rst states:       - The default colorspace. This can be used by applications to let         the driver fill in the colorspace. This sounds to me like it is intended to be used by the application only, like V4L2_FIELD_ANY. If we let decoders return V4L2_COLORSPACE_DEFAULT on the CAPTURE queue to indicate they have no idea about colorspace, it should be mentioned explicitly and maybe clarify in colorspaces-defs.rst as well. [...] > > > > > +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. > > > > > > > > Does this mean that hardware that doesn't support changing parameters at > > > > runtime at all must stop streaming and restart streaming internally with > > > > every parameter change? Or is it acceptable to not allow the controls to > > > > be changed during streaming? > > > > > > That's a good question. I'd be leaning towards the latter (not allow), > > > as to keep kernel code simple, but maybe we could have others > > > (especially Pawel) comment on this. > > > > Same here. > > Same as where? :) I'd be leaning towards the latter (not allow) as well. > > [...] > > > > > +2. Enumerating formats on OUTPUT queue must only return OUTPUT formats > > > > > + supported for the CAPTURE format currently set. > > > > > + > > > > > +3. Setting/changing format on OUTPUT queue does not change formats > > > > > + available on CAPTURE queue. An attempt to set OUTPUT format that > > > > > + is not supported for the currently selected CAPTURE format must > > > > > + result in an error (-EINVAL) from :c:func:`VIDIOC_S_FMT`. > > > > > > > > Same as for decoding, is this limited to pixel format? Why isn't the > > > > pixel format corrected to a supported choice? What about > > > > width/height/colorimetry? > > > > > > Width/height/colorimetry(Do you mean color space?) is a part of > > > v4l2_pix_format(_mplane). I believe that's what this point was about. > > > > Yes. My question was more about whether this should return -EINVAL or > > whether TRY_FMT/S_FMT should change the parameters to valid values. > > As per the standard semantics of TRY_/S_FMT, they should adjust the > format on given queue. We only require that the state on other queue > is left intact. This contradicts 3. above, which says S_FMT(OUT) should instead return -EINVAL if the format doesn't match. regards Philipp