Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp636459imm; Wed, 6 Jun 2018 03:38:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLWS28/CVGhvTrWjT7aof101iKwgNnZLmYtoeRHZnEiLMkDrM//gmzMhAznDt4rT6VEoTe9 X-Received: by 2002:a17:902:d716:: with SMTP id w22-v6mr2628702ply.98.1528281528098; Wed, 06 Jun 2018 03:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528281528; cv=none; d=google.com; s=arc-20160816; b=c9gcEY56fb+glLdLnrjfb9zybRr/KNUx56fwhuAhvAemJsKkE12yiVBZmgZ0qxXpvW zVlOhp2hfsuttIZMvC8sli7lCnYcvfVGuDpptUkH2J/G0lmXmg+YG0rUQrwKe7sL7KQt KLcFo4xVS6krcmGxNuDXYFmxfcfZauvALoXgsuT6Npp9YgXw11cCa4qCdtyFXhqKhwMP 9Xri5Tci4Mt7xp+YcY6vqkQkFT6P6nHscvWpPTTkWCCxnZLyppy3J8IXeja9fACl4QiB LpVFa4amkLUD/3oik4jMQ39uSjJOWqBMkJMDRaxSnbYOw+J6ZAwYeHljTRHHYZ5Wxr1r Q10w== 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 :arc-authentication-results; bh=zsnj/kr6GOpFudroHR+tBSXw9PIPMG2poNuzKuBdhe0=; b=DZKcksukAwU7sxaUUFUV7kkJ6iPjhIXtU3K8BlMopoGRm/EEQyE4Q/u5hLteagu/qp GMIbKGYMxj3odcWv7RAeEwyEReMJ57lllVqGOdYzcKDCEIp+SXF40J6HtzRgL3QPk23A zqDTHZWuk6r0FHwa68n/ip5qw7t7j6LDaethvoH8wSWFsSahNyTfCPE3n4N52Ul0NGn+ 5g6EWOPtRgi9yfd+3aKOJ6g15kAzXucWbkR6ype8znOhRJljWMSJv4H5MUYslsSd7kcV N+mxbhGsMEMoHbsnh9oxDhn/4lsADYGpeOFaar+k+2fLJU1tYvuEreYHem01ng8LwJm9 SQ3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oDqMaPBA; 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 k74-v6si11586287pgc.304.2018.06.06.03.38.33; Wed, 06 Jun 2018 03:38:48 -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=oDqMaPBA; 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 S932514AbeFFKhh (ORCPT + 99 others); Wed, 6 Jun 2018 06:37:37 -0400 Received: from mail-vk0-f68.google.com ([209.85.213.68]:35956 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932378AbeFFKhg (ORCPT ); Wed, 6 Jun 2018 06:37:36 -0400 Received: by mail-vk0-f68.google.com with SMTP id o138-v6so3370360vkd.3 for ; Wed, 06 Jun 2018 03:37:35 -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=zsnj/kr6GOpFudroHR+tBSXw9PIPMG2poNuzKuBdhe0=; b=oDqMaPBAVOY+2aDUWo+82Y/rWY6QeSJJZC4RrCopXLvwEY/zeB1ob2NRs272rKf7+y 5+JErm+vJN3hXHMatqy9BilzaR9QUUnpbNHn+RgucQgBslyzTYa1oHlTsBqva8So1Lv6 0/kHlFLcXS/LkyfaVdpyEYpFPn/mtjK3YXi9A= 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=zsnj/kr6GOpFudroHR+tBSXw9PIPMG2poNuzKuBdhe0=; b=IzbyXCQXFNxOEZqmOhHWi21w9y2ZPlkfl7JCvMaFI+ySb0nbdy9/eA5vwtcPYOr0jf lkDzIlnvM4rBdELj+aZDlEwRoVHjiMoMTjuHffoMWkrJYI0ZEPxMsCBNv8IM6UHGdHEg sBA6d5nLafL5Sw8elY1CQs8Q96Tg+16oqVhXxiOuz1YhMfB4Uc/XmBoL6RA1+1WrtjCT Kh9ZXSyb4VLRuPMFvmc9iZl/gXk8KaeY7ZMVN0Cli2ONPt5s/RioHPSHCiIhSSUXAsK5 ozALIk6kIlTbpOvGlA3e6mszayZhIdTCdTSaInSLMshZY/QeZtxspPQpQciWac6az+E7 WsSg== X-Gm-Message-State: APt69E0Iknpp853O9+o4q5INwDeb/lsi2u5CuTSrWbaRJ6h3tpIDg5Dc kpMY9QnLj4CIso7SILkJlK5d9yL5htw= X-Received: by 2002:a1f:1094:: with SMTP id 20-v6mr1489016vkq.188.1528281454806; Wed, 06 Jun 2018 03:37:34 -0700 (PDT) Received: from mail-vk0-f48.google.com (mail-vk0-f48.google.com. [209.85.213.48]) by smtp.gmail.com with ESMTPSA id w13-v6sm13637606uac.53.2018.06.06.03.37.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 03:37:33 -0700 (PDT) Received: by mail-vk0-f48.google.com with SMTP id n134-v6so3345244vke.12 for ; Wed, 06 Jun 2018 03:37:33 -0700 (PDT) X-Received: by 2002:a1f:5387:: with SMTP id h129-v6mr1440994vkb.179.1528281452709; Wed, 06 Jun 2018 03:37:32 -0700 (PDT) MIME-Version: 1.0 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> <1528278003.3438.3.camel@pengutronix.de> In-Reply-To: <1528278003.3438.3.camel@pengutronix.de> From: Tomasz Figa Date: Wed, 6 Jun 2018 19:37:21 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 2/2] media: docs-rst: Add encoder UAPI specification to Codec Interfaces To: Philipp Zabel 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, =?UTF-8?B?VGlmZmFueSBMaW4gKOael+aFp+ePiik=?= , =?UTF-8?B?QW5kcmV3LUNUIENoZW4gKOmZs+aZuui/qik=?= , Stanimir Varbanov , todor.tomov@linaro.org, nicolas@ndufresne.ca, Paul Kocialkowski , Laurent Pinchart 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 Wed, Jun 6, 2018 at 6:40 PM Philipp Zabel wrote: > > 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? > I guess iy would be from OUTPUT to CAPTURE for encoders as well, since the colorimetry of OUTPUT is ultimately defined by the raw frames that userspace is going to be feeding to the encoder. > > 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. Yes, it would change it slightly (in a non-contradicting way) and we need to update the description indeed. > > [...] > > > > > > +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. Ack. Thanks for clarifying. > > > > [...] > > > > > > +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. Right. That point needs to be fixed. Best regards, Tomasz