Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9756704rwl; Wed, 11 Jan 2023 09:31:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXuux1ZsnPS2p+DgyhZzX4Gt/TML3wbNHbkUBkU3PsYsgbQCsc4RSz/2veoohuz0KPUjwVsq X-Received: by 2002:a17:906:6bce:b0:84d:3b56:5a16 with SMTP id t14-20020a1709066bce00b0084d3b565a16mr13516206ejs.27.1673458295495; Wed, 11 Jan 2023 09:31:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673458295; cv=none; d=google.com; s=arc-20160816; b=FOyMDoFO4prfkDMJ/SU3hMKS0OI8swnK50cI92M34vp28FQRvCRqiFA68+YPTUlnuh GRW//1BDEBS5LPqJWClRNpl4am1ApjQ+r0JASPBH3DxV9AxSwqntiZEgk70Jash7Z90q czeonkrSsWnjeDzjH81BW4NxAZ1xKC1K/U/c///BZOWzXAAeKnO7FNPJSatyaOKcVktX 2DpcTASVAobYXHBqdYoKoWXvZw1bsOyiRrXBowPGLB/o5CB8UzQRM6rmddLwnEdnFV6v Znuaj9dms72iRg9IF9a5cXw3H48WpnOlJjdgsVwRz5Z3ObRAzomB4mRYoXGGcTu29iAf D4rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kLX9Lb4EoAPhzJlvhLTHmGZtA8mJ8sDCR7z5rPVHq8M=; b=xuL0P8LOmAlRtm7RyGfNRwKOk0VsBYZhQTZqTu5QvwITmN3zaTvN4lCQpBj2Am4P8A caSaEVyl4wtJY4elrn2Fqa9V52jKAmS9ELa7LKvlbTnYsp8SWwgO+Ne9RDQ0X83h5Rix zbueN+UViRoXz1bTAdi5Hr80qUC16GSZ0aqYZ5p2o3btBKLmFRp4ff7fUoBXDLcYbwoX TX1HFwnMKK2ZIuzwVMQJ+aKRK0FgLf+9/U/Sh7NR+6xPWHvrUCozsPQw+nLfpvOS5RPo dN2awavTjoc5oxq1O3+WEpO+vZUeM1B08gWlYSCKJkPsnAsqalz7w6EsyBCTOsqZt2up rIpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WFoTx95Z; 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 sg30-20020a170907a41e00b007c12fc0bd81si3205103ejc.362.2023.01.11.09.31.22; Wed, 11 Jan 2023 09:31:35 -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=WFoTx95Z; 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 S232477AbjAKQ7o (ORCPT + 51 others); Wed, 11 Jan 2023 11:59:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233181AbjAKQ7m (ORCPT ); Wed, 11 Jan 2023 11:59:42 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21BCE316; Wed, 11 Jan 2023 08:59:41 -0800 (PST) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:1ee3:efce:e4f6:17a3]) (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: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id 4C7DB6602D3E; Wed, 11 Jan 2023 16:59:39 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1673456379; bh=9Bbn1WtPvFToVRLim4iaHmWZPH9+E68UmmrGT4o+e4I=; h=From:To:Cc:Subject:Date:From; b=WFoTx95ZPrw/C12ELNi1zWuHnZ07VBxKUa40UwfuM2g9OZMBfReNpwi5xd76xlpuc Wq6JGleRrkgFF3UBymcmuOG4kJRju1AdcKCUyv4wCjOo05T5voVcAtIQWKsuriHQdi 5qp2JJQRKHpw9qdIbaOvFqBSlpwOXbQZ+Q8XDP4T72yllZUWiVQysThPI8qETaxnx2 0tn/6nRunH2g8B/zuQw4R8DupeIxfBwJQLldK0HvHjgVqDJqPwha8KS9T/lGrxwla0 uf2kj7ySYhLSmztqJN3+JzBnJfJLFProaRsywazYwVqPjkvd1rvjxzhbJ4OEpLK+iG yEfskYBC7c4JA== From: Benjamin Gaignard To: ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, mchehab@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, heiko@sntech.de, daniel.almeida@collabora.com, nicolas.dufresne@collabora.co.uk Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Benjamin Gaignard Subject: [PATCH v3 00/13] AV1 stateless decoder for RK3588 Date: Wed, 11 Jan 2023 17:59:18 +0100 Message-Id: <20230111165931.753763-1-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 This series implement AV1 stateless decoder for RK3588 SoC. The hardware support 8 and 10 bits bitstreams up to 7680x4320. AV1 feature like film grain or scaling are done by the postprocessor. The driver can produce NV12_4L4, NV12_10LE40_4L4, NV12 and P010 pixels formats. Even if Rockchip have named the hardware VPU981 it looks like a VC9000 but with a different registers mapping. It is based on Daniel's "[PATCH v4] media: Add AV1 uAPI" [1] patches. The full branch can be found here: https://gitlab.collabora.com/linux/for-upstream/-/commits/rk3588_av1_decoder_v3 Fluster score is: 200/239 while testing AV1-TEST-VECTORS with GStreamer-AV1-V4L2SL-Gst1.0. The failing tests are: - the 2 tests with 2 spatial layers: few errors in luma/chroma values - tests with resolution < hardware limit (64x64) - 10bits film grain test: bad macroblocks while decoding, the same 8bits test is working fine. Changes in v3: - Fix arrays loops limites. - Remove unused field. - Reset raw pixel formats list when bit depth or film grain feature values change. - Enable post-processor P010 support Changes in v2: - Remove useless +1 in sbs computation. - Describe NV12_10LE40_4L4 pixels format. - Post-processor could generate P010. - Fix comments done on v1. - The last patch make sure that only post-processed formats are used when film grain feature is enabled. Benjamin [1] https://lore.kernel.org/linux-media/20230103154832.6982-1-daniel.almeida@collabora.com/T/#u Benjamin Gaignard (12): dt-bindings: media: rockchip-vpu: Add rk3588 vpu compatible media: Add NV12_10LE40_4L4 pixel format media: verisilicon: Get bit depth for V4L2_PIX_FMT_NV12_10LE40_4L4 media: verisilicon: Add AV1 decoder mode and controls media: verisilicon: Save bit depth for AV1 decoder media: verisilicon: Check AV1 bitstreams bit depth media: verisilicon: Compute motion vectors size for AV1 frames media: verisilicon: Add AV1 entropy helpers media: verisilicon: Add Rockchip AV1 decoder media: verisilicon: Add film grain feature to AV1 driver media: verisilicon: Enable AV1 decoder on rk3588 media: verisilicon: Conditionnaly ignore native formats Nicolas Dufresne (1): v4l2-common: Add support for fractional bpp .../bindings/media/rockchip-vpu.yaml | 1 + .../media/v4l/pixfmt-yuv-planar.rst | 4 + drivers/media/platform/verisilicon/Makefile | 3 + drivers/media/platform/verisilicon/hantro.h | 8 + .../media/platform/verisilicon/hantro_drv.c | 69 + .../media/platform/verisilicon/hantro_hw.h | 102 + .../platform/verisilicon/hantro_postproc.c | 7 + .../media/platform/verisilicon/hantro_v4l2.c | 22 +- .../media/platform/verisilicon/hantro_v4l2.h | 1 + .../verisilicon/rockchip_av1_entropymode.c | 4546 +++++++++++++++++ .../verisilicon/rockchip_av1_entropymode.h | 272 + .../verisilicon/rockchip_av1_filmgrain.c | 401 ++ .../verisilicon/rockchip_av1_filmgrain.h | 36 + .../verisilicon/rockchip_vpu981_hw_av1_dec.c | 2278 +++++++++ .../verisilicon/rockchip_vpu981_regs.h | 477 ++ .../platform/verisilicon/rockchip_vpu_hw.c | 134 + drivers/media/v4l2-core/v4l2-common.c | 149 +- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/media/v4l2-common.h | 2 + include/uapi/linux/videodev2.h | 1 + 20 files changed, 8439 insertions(+), 75 deletions(-) create mode 100644 drivers/media/platform/verisilicon/rockchip_av1_entropymode.c create mode 100644 drivers/media/platform/verisilicon/rockchip_av1_entropymode.h create mode 100644 drivers/media/platform/verisilicon/rockchip_av1_filmgrain.c create mode 100644 drivers/media/platform/verisilicon/rockchip_av1_filmgrain.h create mode 100644 drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c create mode 100644 drivers/media/platform/verisilicon/rockchip_vpu981_regs.h -- 2.34.1