Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1517246imm; Fri, 7 Sep 2018 01:24:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbSbgPypY66xOwujbu1A9nxUFNzvcIAmhQap0MH/iueqvVmBInMHgDfGJ3n3GijG9hRSH0t X-Received: by 2002:a62:8c8c:: with SMTP id m134-v6mr7220700pfd.130.1536308671267; Fri, 07 Sep 2018 01:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536308671; cv=none; d=google.com; s=arc-20160816; b=w0UeY5XNyBiNrs3tWwhullEm23T36cwGQ3D1ghyEVklNAowtKA0ArY3Zo/qsrA98bz ppq01EUw2rD42qUGYL9HXw+hLr3wu0C+e0O9ZL4K1jUd68zAjRyRhXKl2DzTEK6XC3uq JdRMZtTNK88vi5MiKtJASgfQHIwhG0L/hNaXDXVrHfDEab1BoTYGSA1+v37wTFiV5sRd EZmtASORAO5WPMCRT3wIMYFhN3Qn0RZg0QOT80gNt3T9jPaSFxQdVxp8f9plKE1hhABY 02mHD90ZdQU8XlvHmBIp/ApN1scsA2qPP30BrP9fNppwZoPfhEZtMLw2zU08RApHH6gP PM0Q== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zCogLkfnRD39W0ApnFO41daFTetjBm/HhoZ1Sze430c=; b=VVBOWv7OsmvG6guMAfRD8MT9SABEmEsVYWEGSlohm/LwROfNj38d71D0VPJrbBCSqo Vj8DHIDSvV4olJuI4jCqw6eoJtE2WF0OHT8pTLlrAg4j69VP+JA/VNZmpcyDsaL4skBk zgaOiPnqkOVRwvOmQZgjRYkBoZSR8hHBQKUTTkiIfMwrzISElTT9DfkEfq/Lf/UW5ipa +sAtEBFC+E+C2iGoYloqUsfLzDTkRtBIp+6JLalNdO5DLTaj0fYEBg1GGh4H5cEGFcOU yo2z+UdMNmV7yiDPvOFuJBwx23FQDDd/3ouJsKqg86yf5rLYzKLVqNo1j27veOPNZaq7 OZZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mE7cLOed; 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 c10-v6si7240409plr.155.2018.09.07.01.24.16; Fri, 07 Sep 2018 01:24:31 -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=mE7cLOed; 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 S1727879AbeIGMeg (ORCPT + 99 others); Fri, 7 Sep 2018 08:34:36 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:38593 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbeIGMeg (ORCPT ); Fri, 7 Sep 2018 08:34:36 -0400 Received: by mail-yb1-f196.google.com with SMTP id e18-v6so5150580ybq.5 for ; Fri, 07 Sep 2018 00:54:52 -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:content-transfer-encoding; bh=zCogLkfnRD39W0ApnFO41daFTetjBm/HhoZ1Sze430c=; b=mE7cLOedTcOeYCdFrWL4qbiAmw0xVYHKj2bNq+JUYA9Un4xOBeMGDdPCThfuXLhnq2 dG8oFxLEnxEuhAlzAWfGzlidYoEjsMJikHjdWf19xPbhLWwI5vvzxeX6xHNDqDMArzeD PlBw/6Txf7pFJUcwl91sIOKPWI+JdgLWMfPXs= 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:content-transfer-encoding; bh=zCogLkfnRD39W0ApnFO41daFTetjBm/HhoZ1Sze430c=; b=Qgw+fIdITBX8iWJ5hW0JESVseiE5IvTDitdo1qr2nRzkwbl4E0fMu3N9rTYD7W/XGV hL0At5kpEePiy3/HYj1taKRqnqhzWkOIoFJ1Cv1oAmImftPgPZG446Rmfjz7kWYDITxy 9grlNQPIPMF+NaMv7aOEdRzXbVURSrQg/46czxNdYUvHYR3QQc0UlyfkCWrHAuqJo0Fw m4uD0ooq6WwpFlTbeK6Wej/0MbVuOXkybldFm3JoXX0T6ltPqIDLqtbDf34fkfbZGr9q zG1oGNWiKH+aatNeGJ8pWKQCk91dTTs6vvie+ZcKuuRrVWP79R7A0SHyGTP6E18fkKDV ivEw== X-Gm-Message-State: APzg51Du6r9PlC9OXQg3c0ve2uPx2FHA99kIqfxCJvH8+SJ5hL1IAc9v yfcICgJIA44QvPqUgI2zkpounct4Bjs= X-Received: by 2002:a25:4a43:: with SMTP id x64-v6mr3434354yba.6.1536306892322; Fri, 07 Sep 2018 00:54:52 -0700 (PDT) Received: from mail-yw1-f50.google.com (mail-yw1-f50.google.com. [209.85.161.50]) by smtp.gmail.com with ESMTPSA id o63-v6sm2406190ywc.36.2018.09.07.00.54.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 00:54:52 -0700 (PDT) Received: by mail-yw1-f50.google.com with SMTP id l189-v6so5079562ywb.10 for ; Fri, 07 Sep 2018 00:54:51 -0700 (PDT) X-Received: by 2002:a0d:e547:: with SMTP id o68-v6mr3349864ywe.403.1536306891394; Fri, 07 Sep 2018 00:54:51 -0700 (PDT) MIME-Version: 1.0 References: <20180613140714.1686-1-maxime.ripard@bootlin.com> <20180613140714.1686-2-maxime.ripard@bootlin.com> <80e1d9cb49c6df06843e49332685f2b401023292.camel@collabora.com> <53987ca7a536a21b2eb49626d777a9bf894d6910.camel@bootlin.com> In-Reply-To: From: Tomasz Figa Date: Fri, 7 Sep 2018 16:54:40 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/9] CHROMIUM: v4l: Add H264 low-level decoder API compound controls. To: Paul Kocialkowski Cc: Nicolas Dufresne , Ezequiel Garcia , Maxime Ripard , Pawel Osciak , Hans Verkuil , Alexandre Courbot , Sakari Ailus , Laurent Pinchart , Chen-Yu Tsai , Linux Kernel Mailing List , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , Linux Media Mailing List , jenskuske@gmail.com, linux-sunxi@googlegroups.com, thomas.petazzoni@bootlin.com, groeck@chromium.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 28, 2018 at 5:11 PM Tomasz Figa wrote: > > On Wed, Aug 22, 2018 at 11:45 PM Paul Kocialkowski > wrote: > > > > Hi, > > > > On Wed, 2018-08-22 at 22:38 +0900, Tomasz Figa wrote: > > > On Wed, Aug 22, 2018 at 10:07 PM Paul Kocialkowski > > > wrote: > > > > > > > > Hi, > > > > > > > > On Tue, 2018-08-21 at 13:07 -0400, Nicolas Dufresne wrote: > > > > > Le mardi 21 ao=C3=BBt 2018 =C3=A0 13:58 -0300, Ezequiel Garcia a = =C3=A9crit : > > > > > > On Wed, 2018-06-13 at 16:07 +0200, Maxime Ripard wrote: > > > > > > > From: Pawel Osciak > > > > > > > > > > > > > > Signed-off-by: Pawel Osciak > > > > > > > Reviewed-by: Wu-cheng Li > > > > > > > Tested-by: Tomasz Figa > > > > > > > [rebase44(groeck): include linux/types.h in v4l2-controls.h] > > > > > > > Signed-off-by: Guenter Roeck > > > > > > > Signed-off-by: Maxime Ripard > > > > > > > --- > > > > > > > > > > > > > > > > > > > [..] > > > > > > > diff --git a/include/uapi/linux/videodev2.h > > > > > > > b/include/uapi/linux/videodev2.h > > > > > > > index 242a6bfa1440..4b4a1b25a0db 100644 > > > > > > > --- a/include/uapi/linux/videodev2.h > > > > > > > +++ b/include/uapi/linux/videodev2.h > > > > > > > @@ -626,6 +626,7 @@ struct v4l2_pix_format { > > > > > > > #define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4'= ) /* > > > > > > > H264 with start codes */ > > > > > > > #define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '= 1') /* > > > > > > > H264 without start codes */ > > > > > > > #define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4'= ) /* > > > > > > > H264 MVC */ > > > > > > > +#define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '= 4') /* > > > > > > > H264 parsed slices */ > > > > > > > > > > > > As pointed out by Tomasz, the Rockchip VPU driver expects start= codes > > > > > > [1], so the userspace > > > > > > should be aware of it. Perhaps we could document this pixel for= mat > > > > > > better as: > > > > > > > > > > > > #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4')= /* > > > > > > H264 parsed slices with start codes */ > > > > > > > > > > > > And introduce another pixel format: > > > > > > > > > > > > #define V4L2_PIX_FMT_H264_SLICE_NO_SC v4l2_fourcc(TODO) /* H264 > > > > > > parsed slices without start codes */ > > > > > > > > > > > > For cedrus to use, as it seems it doesn't need start codes. > > > > > > > > > > I must admit that this RK requirement is a bit weird for slice da= ta. > > > > > Though, userspace wise, always adding start-code would be compati= ble, > > > > > as the driver can just offset to remove it. > > > > > > > > This would mean that the stateless API no longer takes parsed bitst= ream > > > > data but effectively the full bitstream, which defeats the purpose = of > > > > the _SLICE pixel formats. > > > > > > > > > > Not entirely. One of the purposes of the _SLICE pixel format was to > > > specify it in a way that adds a requirement of providing the required > > > controls by the client. > > > > I think we need to define what we want the stateless APIs (and these > > formats) to precisely reflect conceptually. I've started discussing thi= s > > in the Request API and V4L2 capabilities thread. > > > > > > > Another option, because I'm not fan of adding dedicated formats f= or > > > > > this, the RK driver could use data_offset (in mplane v4l2 buffers= ), > > > > > just write a start code there. I like this solution because I wou= ld not > > > > > be surprise if some drivers requires in fact an HW specific heade= r, > > > > > that the driver can generate as needed. > > > > > > > > I like this idea, because it implies that the driver should deal wi= th > > > > the specificities of the hardware, instead of making the blurrying = the > > > > lines of stateless API for covering these cases. > > > > > > The spec says > > > > > > "Offset in bytes to video data in the plane. Drivers must set this > > > field when type refers to a capture stream, applications when it > > > refers to an output stream." > > > > > > which would mean that user space would have to know to reserve some > > > bytes at the beginning for the driver to add the start code there. (O= r > > > the driver memmove()ing the data forward when the buffer is queued, > > > assuming that there is enough space in the buffer, but it should > > > normally be the case.) > > > > > > Sounds like a pixel format with full bitstream data and some offsets > > > to particular parts inside given inside a control might be the most > > > flexible and cleanest solution. > > > > I can't help but think that bringing the whole bitstream over to the > > kernel with a dedicated pix fmt just for the sake of having 3 start cod= e > > bytes is rather overkill anyway. > > > > I believe moving the data around to be the best call for this situation= . > > Or maybe there's a way to alloc more data *before* the bufer that is > > exposed to userspace, so userspace can fill it normally and the driver > > can bring-in the necessary heading start code bytes before the buffer? > > After thinking this over for some time, I believe it boils down to > whether we can have an in-kernel library for turning H264 (and other > codec) header structs back into a bitstream, if we end up with more > than one driver need to do it. If that's fine, I think we're okay with > having just the parsed pixel format around. > > Note that I didn't think about this with the Rockchip driver in mind, > since it indeed only needs few bytes. By the way, Alex posted an RFC with stateless codec interface documentation= : https://patchwork.kernel.org/patch/10583233/ I think we should move any discussion there, to have everything in one plac= e. Best regards, Tomasz