Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1839779imm; Thu, 7 Jun 2018 00:56:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKzW6DM/UYU7sQ/SiJw8DfSOj9PjyIODsxz/UFogQZm3rZsVWj+ItUFlCnaPDeJBtAphJrh X-Received: by 2002:a63:931c:: with SMTP id b28-v6mr698251pge.167.1528358209124; Thu, 07 Jun 2018 00:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528358209; cv=none; d=google.com; s=arc-20160816; b=EJMZpl0R1OJXDkY4SkwbGPKr71ERA1V8Ah+yE6+HSyfc4uaBJpx75as+YEetbSmMfl eIa+JGoUDoW6ssgXNtpnrtoecQkNRJRTpGmapN+XCGOdqJU9jf8ktqu2p1JZT9gLdOmx PrkMKwigyvRwdTO6SB+FMI73Mwsv4Z+l1WC72PVogWP3xnatzBtGVZ1dy/vfhCbXzlza VTOfQBekWohZBV4Zebh0QXRxM8lqdgHDkgGulcF5FWdZvjMI1TuJP88Pur6dkmmY3FY7 MaqMSEX/ksS5/cbHIwlseI2SkmIOlK1JqcEWMSc8J/z9WsHxIRQ5+RHyLnBtCO40iib+ C8/g== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=tKZb5lpatKAMcbOlqRJXz1FSEEm7g7Il++K80ZfSmqw=; b=ClQ6DbYlt8X/hZqKTEiearmvNBMj+FMkJbGoTzhVbF9n28kyas2NiZwN1n/6WWEOi2 b6FZ1EVhsvbLMSazLnjOQm39c/pHCN1vnII27fa7arFLVJ3DZnQrsSXat5P0pinY2MKr lh3L6JP7pPChpi3BdCeHGgITtgs5d+8+ugBlyYpA7JTyBq34TbRGTPOroLN2beSftg8X SosD4HLpGKPkV3BMpfbN3k259GVd4su/FOxFq4i+ooSAVqWU/R5crGNN5eCPRujt6qfN divRM+/eD3UEzSQtkDeEvi8MWPbu0akBA6sCvh13t4gKXu2eQMlx4JnWys25WsYlFzGS eshw== 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 c10-v6si41984367pgv.446.2018.06.07.00.56.34; Thu, 07 Jun 2018 00:56:49 -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 S1753383AbeFGH1Y (ORCPT + 99 others); Thu, 7 Jun 2018 03:27:24 -0400 Received: from lb3-smtp-cloud8.xs4all.net ([194.109.24.29]:43159 "EHLO lb3-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753017AbeFGH1X (ORCPT ); Thu, 7 Jun 2018 03:27:23 -0400 Received: from [192.168.2.10] ([212.251.195.8]) by smtp-cloud8.xs4all.net with ESMTPA id QpKHfDJ3RdJgZQpKKfSxVn; Thu, 07 Jun 2018 09:27:21 +0200 Subject: Re: [RFC PATCH 2/2] media: docs-rst: Add encoder UAPI specification to Codec Interfaces To: Tomasz Figa , Philipp Zabel Cc: Pawel Osciak , Linux Media Mailing List , Linux Kernel Mailing List , Mauro Carvalho Chehab , 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 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> From: Hans Verkuil Message-ID: <41fd04f2-fc44-1792-81e6-a3d4d384adc5@xs4all.nl> Date: Thu, 7 Jun 2018 09:27:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfNAGxU0ox+dWJtAPoSGGnHWb1bu/ucVQJ8py+wbYS2G7WuFOZUECJqg56yxMeox1hYrroxTLDzMgBJr1TP/nzHxnW9rUuexamUbVU0FEMtHHqMcqXLZb y9kRYjjM/qyWFXw4aXs03FgrThGUiXzAhLWD0tkaChG9qHkTDlxZUBTR/VRlnXH/jC2AVQWlti8wuTuEilN0UgqMSHnhkFmJ3sTcE4D3whSfekmZGJuRzuVG aq4rgsaNWz9MhlYBwfQ0e+yPwAe0vj+Kddr77rse7ygVlHwHJ1z3f/9/EsH4JNOXdqgCxzN1ZfZb5rLigHBJUcUIG08cRFqihAVqvB1MI+9GC9a9vR0U0y1h l+raYlxjQaBlD07xuHi3gubDMokIVrRJi1lK0cGZ5oL2Ykng+/R3Eghgpuu68+mUGxFBZY3GlH03d9qycXWNoie1vAPrikT1u9vKYhncJrI8G/zEgh6gqxa/ ON1onyrNhloBiWDaafkdusfaPanPEFuxIT22a9BaL+ISSeOsGb9KQBErWTTykZJhd6ERQ/QTMoK8sCQz5sFGW9xtFuJmIZgj/2JVjz0CDx6DsHwslY/uXDsw CT5pwUdLce/J7D7rzp5WDQzSXi30/RcyBSSIotFY5MsFe8ysWsuL31cuxd0sBQe6EkveUXKJCoFf0uvNvmiHzXqQ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/06/2018 12:37 PM, Tomasz Figa wrote: > 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. Correct. All mem2mem drivers should just copy the colorimetry from the output buffers to the capture buffers, unless the decoder hardware is able to extract that data from the stream, in which case it can overwrite it for the capture buffer. Currently colorspace converters are not supported since the V4L2 API does not provide a way to let userspace define colorimetry for the capture queue. I have a patch to add a new v4l2_format flag for that since forever, but since we do not have any drivers that can do this in the kernel it has never been upstreamed. What is supported is basic RGB <-> YUV conversions since that's selected through the provided pixelformat. Regards, Hans