Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4454313imu; Tue, 29 Jan 2019 01:41:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN6kd2Km9tBBxzXxkuEfFFMY+I6Xl88WRnE2S21XkQuULjYTq/U2VCeJ9K76J3z2jMMDe1dX X-Received: by 2002:a62:26c7:: with SMTP id m190mr25895387pfm.79.1548754889519; Tue, 29 Jan 2019 01:41:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548754889; cv=none; d=google.com; s=arc-20160816; b=rCZdA/TFetoR1QFnjM/ddZ6Vbj/69S2P4R5WVDymVvbzfiwlpHgUc/coQ8vaY0hntM fIbn74krmLo777BxcnIiXLmHG57hJXX5HZTEU3Cj52AdnpGfDdhyZcI2xwl6di9oCQ+B 1hI54xXWwc8T5YwE435P1zxZQbTa90sSa2tFqcl8r6w2jCQ6nIZpgkvpbAExUUOnLKO2 /WEIksZosjDVkxXwr8L/KD3/v4Q21RVV1pfh2jGgR9lOIDvU/pH+bdcu/ffyYgNkoPI1 //e35yDDyTszTBZD3U6knTmh1UqPdh5awMJ/k5vkrp69L6vPCIJPzxlUyw4KV1OMeOAV cIJg== 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=Nm1T119/ObMPWzlbIjDOJhaxurTOMjpaUAb/kBTk4so=; b=02V6uxKc8CcmZkHJYNZ3Im9DwXdl2XeSvbp4M+yAIHaG1IjKhpyVRDFHBTmMKSs8MH NQBCs0brP70S2LmwhXMzZs2Q/t3/2Wu+6Vl+r1Xrnk05xcGsSI6dt1ZGShdHJTAFWBCO uYYYLpeV3Y6m1+L/6NmqqVWRJLFhoJ2Buiu2ujLyY3PpD+MzLq5srwPnT+vBJtx7NlbR dYq5OHBXgwBgFHmbr4oMc9vN2sqiSnQ7P8H8EiDlUUvVdvPnBiikCsEDSrQTrtM4jdi8 QXlpByUzVHrsnT8V6ksXa7K0Dtj/+2S1zqdrtOZihgDjLcazOOxdn7sFnssU1UWU1RjG Ka+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ffxiBSYw; 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 b61si8334004plb.70.2019.01.29.01.41.14; Tue, 29 Jan 2019 01:41:29 -0800 (PST) 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=ffxiBSYw; 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 S1728481AbfA2JjV (ORCPT + 99 others); Tue, 29 Jan 2019 04:39:21 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:36121 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727342AbfA2JjS (ORCPT ); Tue, 29 Jan 2019 04:39:18 -0500 Received: by mail-oi1-f194.google.com with SMTP id x23so15607587oix.3 for ; Tue, 29 Jan 2019 01:39:18 -0800 (PST) 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=Nm1T119/ObMPWzlbIjDOJhaxurTOMjpaUAb/kBTk4so=; b=ffxiBSYwq/uNpoCkbvO9KLc1zr4H28VXciGMmTIaTzIhmwEObRT4vl2TPKOpBTLWlS 234Nh/yOKNs+T510GOhT1amqWCH0mO2mMp8v12ILQqKnc5mA0ts+vOPPI6/1t8JgtVJC Jk8H9gh4jF//cLmvDPSkwjAQk0kFl0X6xppLs= 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=Nm1T119/ObMPWzlbIjDOJhaxurTOMjpaUAb/kBTk4so=; b=AW8Q8yS+nOvjLTsfw3KVbJ0wkU0mmZnWI2mvM7+JboXaPZCJDNO+xTGy2l1VK4rPMb O7tPXDwnwkCZ/SYr6aEk3mZjItEu9AJI/JrcIXXtRLHcafCR5wzokXp/TdCWky7xNyjE 3QQmsWUKxLJYic1zBfuXR/+Fvy9a8XMFi+LWiUjMJ0Ugh8ZGNL4kxwqMhmb8SIruImyL H8vHI2AobM8rLVhTuI/+odXANPz54B7rmJlloGsglzvqCC1c2SL3GvzAIZW2VAWRxcb6 ngoltQbUQDWonBlMFBECrD7MLAIJm7w5+UHx86jaHbwD6NLO9KQ+Q3hJjAb3hnVSuryg 5UTA== X-Gm-Message-State: AJcUukdn+GzumhuhS78Y7pNnJqilNMz8af1JSIcMbFo/NYHhBB0xOVU1 M/NjP1Yq1eTRQB7v/DkSxroYnfjtyG0= X-Received: by 2002:aca:dd88:: with SMTP id u130mr8496999oig.204.1548754757372; Tue, 29 Jan 2019 01:39:17 -0800 (PST) Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com. [209.85.167.181]) by smtp.gmail.com with ESMTPSA id x4sm6064651oix.32.2019.01.29.01.39.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 01:39:15 -0800 (PST) Received: by mail-oi1-f181.google.com with SMTP id r62so15650465oie.1 for ; Tue, 29 Jan 2019 01:39:15 -0800 (PST) X-Received: by 2002:aca:ea57:: with SMTP id i84mr8842617oih.346.1548754754671; Tue, 29 Jan 2019 01:39:14 -0800 (PST) MIME-Version: 1.0 References: <776e63c9-d4a5-342a-e0f7-200ef144ffc4@rock-chips.com> <64c793e08d61181b78125b3956ec38623fa5d261.camel@bootlin.com> <82FA0C3F-BC54-4D89-AECB-90D81B89B1CE@soulik.info> <42520087-4EAE-4F7F-BCA0-42E422170E91@soulik.info> <20190129080944.pfhumtugsm7mzzcc@flea> In-Reply-To: <20190129080944.pfhumtugsm7mzzcc@flea> From: Tomasz Figa Date: Tue, 29 Jan 2019 18:39:03 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [linux-sunxi] [PATCH v2 1/2] media: v4l: Add definitions for the HEVC slice format and controls To: Maxime Ripard Cc: Alexandre Courbot , Paul Kocialkowski , Ayaka , Randy Li , =?UTF-8?Q?Jernej_=C5=A0krabec?= , Linux Media Mailing List , LKML , devel@driverdev.osuosl.org, "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , Mauro Carvalho Chehab , Hans Verkuil , Ezequiel Garcia , Thomas Petazzoni , "open list:ARM/Rockchip SoC..." 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, Jan 29, 2019 at 5:09 PM Maxime Ripard w= rote: > > On Tue, Jan 29, 2019 at 04:44:35PM +0900, Alexandre Courbot wrote: > > On Fri, Jan 25, 2019 at 10:04 PM Paul Kocialkowski > > > On Thu, 2019-01-24 at 20:23 +0800, Ayaka wrote: > > > > > > > > Sent from my iPad > > > > > > > > > On Jan 24, 2019, at 6:27 PM, Paul Kocialkowski wrote: > > > > > > > > > > Hi, > > > > > > > > > > > On Thu, 2019-01-10 at 21:32 +0800, ayaka wrote: > > > > > > I forget a important thing, for the rkvdec and rk hevc decoder,= it would > > > > > > requests cabac table, scaling list, picture parameter set and r= eference > > > > > > picture storing in one or various of DMA buffers. I am not talk= ing about > > > > > > the data been parsed, the decoder would requests a raw data. > > > > > > > > > > > > For the pps and rps, it is possible to reuse the slice header, = just let > > > > > > the decoder know the offset from the bitstream bufer, I would s= uggest to > > > > > > add three properties(with sps) for them. But I think we need a = method to > > > > > > mark a OUTPUT side buffer for those aux data. > > > > > > > > > > I'm quite confused about the hardware implementation then. From w= hat > > > > > you're saying, it seems that it takes the raw bitstream elements = rather > > > > > than parsed elements. Is it really a stateless implementation? > > > > > > > > > > The stateless implementation was designed with the idea that only= the > > > > > raw slice data should be passed in bitstream form to the decoder.= For > > > > > H.264, it seems that some decoders also need the slice header in = raw > > > > > bitstream form (because they take the full slice NAL unit), see t= he > > > > > discussions in this thread: > > > > > media: docs-rst: Document m2m stateless video decoder interface > > > > > > > > Stateless just mean it won=E2=80=99t track the previous result, but= I don=E2=80=99t > > > > think you can define what a date the hardware would need. Even you > > > > just build a dpb for the decoder, it is still stateless, but parsin= g > > > > less or more data from the bitstream doesn=E2=80=99t stop a decoder= become a > > > > stateless decoder. > > > > > > Yes fair enough, the format in which the hardware decoder takes the > > > bitstream parameters does not make it stateless or stateful per-se. > > > It's just that stateless decoders should have no particular reason fo= r > > > parsing the bitstream on their own since the hardware can be designed > > > with registers for each relevant bitstream element to configure the > > > decoding pipeline. That's how GPU-based decoder implementations are > > > implemented (VAAPI/VDPAU/NVDEC, etc). > > > > > > So the format we have agreed on so far for the stateless interface is > > > to pass parsed elements via v4l2 control structures. > > > > > > If the hardware can only work by parsing the bitstream itself, I'm no= t > > > sure what the best solution would be. Reconstructing the bitstream in > > > the kernel is a pretty bad option, but so is parsing in the kernel or > > > having the data both in parsed and raw forms. Do you see another > > > possibility? > > > > Is reconstructing the bitstream so bad? The v4l2 controls provide a > > generic interface to an encoded format which the driver needs to > > convert into a sequence that the hardware can understand. Typically > > this is done by populating hardware-specific structures. Can't we > > consider that in this specific instance, the hardware-specific > > structure just happens to be identical to the original bitstream > > format? > > > > I agree that this is not strictly optimal for that particular > > hardware, but such is the cost of abstractions, and in this specific > > case I don't believe the cost would be particularly high? > > I mean, that argument can be made for the rockchip driver as well. If > reconstructing the bitstream is something we can do, and if we don't > care about being suboptimal for one particular hardware, then why the > rockchip driver doesn't just recreate the bitstream from that API? > > After all, this is just a hardware specific header that happens to be > identical to the original bitstream format I think in another thread (about H.264 I believe), we realized that it could be a good idea to just include the Slice NAL units in the Annex.B format in the buffers and that should work for all the hardware we could think of (given offsets to particular parts inside of the buffer). Wouldn't something similar work here for HEVC? I don't really get the meaning of "raw" for "cabac table, scaling list, picture parameter set and reference picture", since those are parts of the bitstream, which needs to be parsed to obtain those. Best regards, Tomasz