Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7915357rwb; Tue, 6 Dec 2022 11:27:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf62Ve2DbWFUL0o1MJdNXegd+lwOL/qyb4d1Zfcg8vGr/m0mC2wMIgwOYlbYPvfSHjSu15nq X-Received: by 2002:a17:906:8597:b0:7c0:e380:3d44 with SMTP id v23-20020a170906859700b007c0e3803d44mr10905363ejx.498.1670354839227; Tue, 06 Dec 2022 11:27:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670354839; cv=none; d=google.com; s=arc-20160816; b=gjyd+x+hFdFKoaqSCpmt9kgk79KP0xApWKl1mdsKLV20Mqzj1HifwgyW+uyNjt2v6m KQ0JnvKN11Q0BqP3FEoW7KRdENTrMKusuCCj69/Pp1OL9yAZUesYVd3Sl7jrA/GFc3z4 TZ8Nf98KIsdmCaJ7hIlrKhAmbyQjqZbWKn4DOjN8+hpeVoPxlJbTljw9pRnOpqC0sm3o xdAhGGuFFp1UVPdE+8aJi7ma1wRvdJY64eFiPKs0zkJjAUDuByuSvihDOoX3nZIl0gFM PcCc3XiJj4bv4iFqqU5P6gRxJe97c0EtSfDDn40SfPUA0Z4cLmELyMzjJFVYP+X6Z2iL 1ZYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=3OQ8cXy5y9MlNorapbLitRP+snhppMoI9DXwdQnn52A=; b=cdzFq5JI3V44bWqZ9Z/2gacopHPGCheo2ECOqoG1Hpx5DTzPSePh09zdDdSK9UNl99 G7Ahefmz+6hrd3pNS1jp7nZ8vTsBXOUWOk9+Nsxt43VEJzOBo9E1BKQQ5FSVHklfo6tv UqSSLVdXQB4JOe98U1gQ2A2zWH1/q5XVqIUTf43srMrxrxZEOOVNwxRSaM9nIo5nIgBx 1S8fpA1jur1VEw/3sQoqv1YHe5rqHj4bptbVg2KQtAN3QWBDVe3qng7HzUHNAw0heE3J b9cndZWW1pTy9jedBIpBn+UOBgaSN7REmPGPu/lS/V+mMb9/ykD8bUnEkWVmXo6Eidwl QsrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iDe6TZ4x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o12-20020aa7d3cc000000b0046277d2cb0csi2301293edr.470.2022.12.06.11.27.00; Tue, 06 Dec 2022 11:27:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iDe6TZ4x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229724AbiLFTPm (ORCPT + 77 others); Tue, 6 Dec 2022 14:15:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbiLFTPe (ORCPT ); Tue, 6 Dec 2022 14:15:34 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A867040920; Tue, 6 Dec 2022 11:15:32 -0800 (PST) Received: from nicolas-tpx395.localdomain (192-222-136-102.qc.cable.ebox.net [192.222.136.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nicolas) by madras.collabora.co.uk (Postfix) with ESMTPSA id BA1326602B2C; Tue, 6 Dec 2022 19:15:29 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1670354130; bh=CbpetSjHvQviX156mgDvQrxS6ZNVFJ4ayCXN+Hd15qE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=iDe6TZ4x00XduKQhsVWMhOUhifd4fAGQA9W2enB/w5rC3edcQ/UI+OZavlqkN5oVp F+lzQXnH3pwvD7jdJDEJblO+lcAe4GVxCmE2yrCGBZpxKCIOgjpPAawBjwZLfM9Uv0 Lwt7F0G7xJ41Enn33lr7MsOvKPJBgDPEQ1rfzvK4+HzJqQkDo+76V1NAyp2FEWfg95 AzxfbUBPShVt/5xm31KHmE1oH95UngzsQmuDXSSIM5INSl/BPdKHwlU2tkPE08W0AM J5/WbklRLVxYqwT3boakWqqAVs9tJP/+v0CqNUEKoC0szKgc9p3l2rmbmXKjYT44S1 mmW7MXw4jfWHw== Message-ID: <6c75bbbf497f9baa5d99f642bd466751e2b0d460.camel@collabora.com> Subject: Re: [PATCH] media: cedrus: Convert to MPLANE uAPI From: Nicolas Dufresne To: Chen-Yu Tsai , Hans Verkuil Cc: Jernej =?UTF-8?Q?=C5=A0krabec?= , Mauro Carvalho Chehab , Samuel Holland , linux-media@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Tue, 06 Dec 2022 14:15:19 -0500 In-Reply-To: References: <20221129074530.640251-1-wenst@chromium.org> <45143854.fMDQidcC6G@kista> <5d79ed06-15c0-3564-97b6-5fd4433acabf@xs4all.nl> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le mardi 06 d=C3=A9cembre 2022 =C3=A0 20:23 +0800, Chen-Yu Tsai a =C3=A9cri= t=C2=A0: > On Tue, Dec 6, 2022 at 4:35 PM Hans Verkuil wr= ote: > >=20 > > On 05/12/2022 22:01, Jernej =C5=A0krabec wrote: > > > Hi Chen-Yu! > > >=20 > > > Dne torek, 29. november 2022 ob 08:45:30 CET je Chen-Yu Tsai napisal(= a): > > > > The majority of the V4L2 stateless video decoder drivers use the MP= LANE > > > > interface. > > > >=20 > > > > On the userspace side, Gstreamer supports non-MPLANE and MPLANE > > > > interfaces. Chromium only supports the MPLANE interface, and is not= yet > > > > usable with standard desktop Linux. FFmpeg support for either has n= ot > > > > landed. > > >=20 > > > I don't like fixing userspace issues in kernel, if kernel side works = fine. > > > Implementing missing non-MPLANE support in Chromium will also allow i= t to work > > > with older kernels. > > >=20 > > > Hans, what's linux-media politics about such changes? > >=20 > > Not keen on this. Does the cedrus HW even have support for multiple pla= nes? > > I suspect not, in which case the driver shouldn't suggest that it can d= o that. Hi Hans, > >=20 > > Now, if the hardware *can* support this, then there is an argument to b= e made > > for the cedrus driver to move to the multiplanar API before moving it o= ut > > of staging to allow such future enhancements. >=20 > AFAIK it can, but has some limitations on how far apart the buffers for > the separate planes can be. Nicolas mentioned that I could support the > multiplanar API, but only allow the contiguous single planar formats, > so NV12 instead of NV12M. indeed, MPLANE buffer API is not an advertisement for MPLANE support. The p= ixel formats exposed through ENUM_FMT are the only possible advertisement, and o= nly single allocation format (NV12) remains exposed. Putting my userspace hat on, I see see an effort by the author of MPLANE AP= I to make it so it would completely replaced the older API. The effort have imho= very bad consequences (duplication of pixel formats), but if we also don't enfor= ce porting existing drivers to the new API, we add yet another consequence, bu= t this time on userspace, which must handle both C structures to actually wor= k generically. I totally understand that from driver maintainer point of view= , this change have absolutely no value, but we force userspace complexity sim= ply because we leave it to driver author to pick older or newer (totally equiva= lent) APIs. To me, the problem is that V4L2 API maintainers didn't adopt the new = API despite merging it. The adoption should have deprecated usage of the old AP= I, at least in new drivers (since 2011). This should also have been an unstaging requirement. regards, Nicolas >=20 > And I suspect that reference frames have to be contiguous as well. > So I guess the overall answer is that it can't. But the same goes for > Hantro or rkvdec, which both use the multiplanar API. >=20 > This conversion was done so that I could use Cedrus as a testbed for > developing new codec support, as I already own an H6 device. Added > bonus is trying to get V4L2 decoder support to work for desktop Linux, > without the libraries that ChromeOS ships. >=20 > > Note that you have to choose whether to support single or multiplanar, = you > > can't support both at the same time. > >=20 > > So the decision to move to multiplanar should be led by the HW capabili= ties. > >=20 > > And Chromium really needs to support non-multiplanar formats as well. I= 'm > > really surprised to hear that it doesn't, to be honest. >=20 > Chromium does support non-multiplanar formats, such as NV12. In fact > this is the preferred format, unless it's on MediaTek, in which it > switches to MM21 as the capture format, and does untiling in software. > This support for formats is separate from using the multiplanar API. >=20 > Support for video decoders is mostly driven by ChromeOS. Currently all th= e > hardware ChromeOS supports, be it stateful or stateless, use the multipla= nar > API, so there hasn't been a real need to support it yet. >=20 >=20 > Regards > ChenYu >=20 > > Regards, > >=20 > > Hans > >=20 > > >=20 > > > Best regards, > > > Jernej > > >=20 > > > >=20 > > > > A fallback route using libv4l is also available. The library transl= ates > > > > MPLANE interface ioctl calls to non-MPLANE ones, provided that the = pixel > > > > format used is single plane. > > > >=20 > > > > Convert the Cedrus driver to the MPLANE interface, while keeping th= e > > > > supported formats single plane. Besides backward compatibility thro= ugh > > > > the plugin, the hardware requires that different planes not be loca= ted > > > > too far apart in memory. Keeping the single plane pixel format make= s > > > > this easy to enforce. > > > >=20 > > > > Signed-off-by: Chen-Yu Tsai > > > > --- > > > >=20 > > > > This has been tested with Fluster. The score remained the same with= or > > > > without the patch. This also helps with getting VP8 decoding workin= g > > > > with Chromium's in-tree test program "video_decode_accelerator_test= s", > > > > though Chromium requires other changes regarding buffer allocation = and > > > > management. > > >=20 > > >=20 > >=20