From patchwork Mon Dec 19 15:56:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 3099 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2468547wrn; Mon, 19 Dec 2022 07:59:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf6w6zPf6//0Zj5j9+tyB9j1m622u+q8am5TsIvQ8xq8+cqN2Xj/nPJA2GbRk6SVjHdCxusi X-Received: by 2002:a17:902:ccd0:b0:188:7da8:a970 with SMTP id z16-20020a170902ccd000b001887da8a970mr50022751ple.8.1671465540471; Mon, 19 Dec 2022 07:59:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671465540; cv=none; d=google.com; s=arc-20160816; b=wLHrVgTLnvPw633YDhR78q2XhzDCaVgzuZ2JGYLIX94I9Z+OXcapXP7AIMEdSTzDWG xuaf9C4IyX8VPzEP34Mawjpyl92jwpqsY/N95o9LW8m01xx7Hr8PzeqkuQRywhWxJRJ4 6nsYfS8+92OyMBrKuTpgkBOYOLq88eNO/YaTx28FNuxr8lImK7vPRuFO/owsLfJGRrpb nqXXgr7ZoAJpkGuIIPG0tb5p15dicVUCYP33jKlAbseZ8+esnXLFP7cNZTtHkeCPmfSk KZ00li+ryigO8mhpXRwlihMw5XfGiGGVkwONrFOYjMk4HJQHYIW0ODzi6fEhOKfhO39E zXPA== 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=yE9ts2/piWUja2GKLYFKN4wXJJdBHTnIqQ3YXNL7p3s=; b=0CR6n6I0URhhkz6SFUXesI3BOigwb6DySMHS029R5YH3k0leA24eATBYQuohU0sWNH 4zXrfuaRy8M1Rv9Ovo4Lu67uptB91Pbbh8ZGkplmeaJ1jKgeu2qzbr69NmZOHDOGBsHH qfr+tA2YYgnC33HveijK1GB9cYUbedWM57+cfN3ktBsFTOyPeCb7rQocgwjPkG8FpKDc Yuri9Jjksu+f1oaHX3fpfMkonEbMYAkCqLqcSmIXd7uNI9+V4mg+G975XznpJD0LAMqU 6dmoA+HmqrB5hwIytTpR0dLlwjT4qga0fPqv1j6y6osFdRgxJA6XiypGkhp/JsHrXwie b+KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KhN5FkuS; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t6-20020a170902bc4600b00186e4a758a0si10408979plz.573.2022.12.19.07.58.47; Mon, 19 Dec 2022 07:59:00 -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=KhN5FkuS; 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 S232568AbiLSP4j (ORCPT + 99 others); Mon, 19 Dec 2022 10:56:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232043AbiLSP41 (ORCPT ); Mon, 19 Dec 2022 10:56:27 -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 0E6EB6272; Mon, 19 Dec 2022 07:56:25 -0800 (PST) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:f69c:5603:d4ce:7aa2]) (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 91FE36602C25; Mon, 19 Dec 2022 15:56:23 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1671465383; bh=UyVulrVn+7bAVKLq/DGXCKRzuRojbWRGKmItzsniUQ0=; h=From:To:Cc:Subject:Date:From; b=KhN5FkuStBnUYbcL5zO5utJ1twZs259RkiQ0rKTDWaQya+3fTR3t4H3pp2ndipwOA aey+i8pzNYFD6bYYiK2nSWMzgMISxOKWGj+oh6sVpfgC/69zqQnrtumXX5PqK64H0z uhzN+iFAfYKGXjbDSatqMCYi2jJgbz2eT2aC6prJnuyio8KDJNBQBYJPrTGs6x9EQ3 06TiqQHu0pWkQxFkIbvZFQdv00x3vuTT0vNWV5GFn/s5FS6zVm4xZ/gY1rIpxxeo2q TJWk+nhf3cocvtDTRfQQJyRgglb2kLz16xYwG+Brxl6dcpdBQuJ1e07zrMmh6Uzc8G ZhXwW5Sa+Zm4A== 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 v1 0/9] AV1 stateless decoder for RK3588 Date: Mon, 19 Dec 2022 16:56:07 +0100 Message-Id: <20221219155616.848690-1-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.34.1 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752658650197592080?= X-GMAIL-MSGID: =?utf-8?q?1752658650197592080?= This series implement AV1 stateless decoder for RK3588 SoC. The harware 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 and NV12 pixel formats. A native 10bits NV12_4L4 format is possible but need more investigation to be completly documented and enabled. It is based on Daniel's "[RFC,v3] media: Add AV1 uAPI" [1] patches and Sebastian's device-tree patches for RK3588. The full branch can be found here: https://gitlab.collabora.com/linux/for-upstream/-/commits/rk3588_av1_decoder_v1 Fluster score is: 151/239 while testing AV1-TEST-VECTORS with GStreamer-AV1-V4L2SL-Gst1.0. The failing tests are: - 10bits bitstream because 10bits output formats aren't yet implemented. - the 2 tests with 2 spatial layers: few errors in luma/chroma values - tests with resolution < hardware limit (64x64) Benjamin Benjamin Gaignard (9): dt-bindings: media: rockchip-vpu: Add rk3588 vpu compatible 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 .../bindings/media/rockchip-vpu.yaml | 1 + drivers/media/platform/verisilicon/Makefile | 3 + drivers/media/platform/verisilicon/hantro.h | 5 + .../media/platform/verisilicon/hantro_drv.c | 54 + .../media/platform/verisilicon/hantro_hw.h | 102 + .../platform/verisilicon/hantro_postproc.c | 3 + .../media/platform/verisilicon/hantro_v4l2.c | 5 + .../verisilicon/rockchip_av1_entropymode.c | 4536 +++++++++++++++++ .../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 | 2280 +++++++++ .../verisilicon/rockchip_vpu981_regs.h | 477 ++ .../platform/verisilicon/rockchip_vpu_hw.c | 116 + 14 files changed, 8291 insertions(+) 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