From patchwork Thu Jul 25 18:55:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 11059589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38FF8912 for ; Thu, 25 Jul 2019 18:57:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 271A228857 for ; Thu, 25 Jul 2019 18:57:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AA74288AF; Thu, 25 Jul 2019 18:57:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B008728857 for ; Thu, 25 Jul 2019 18:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=yZPRoJgeOU/WSi5zfPE5fXvn1g9JNr/zXmo+ME3XXa8=; b=a1tbR9Akn1+x3R 2qbtErLlMSJD/TE+a0o9Z9mJVCfi1hp1T1POZxQVq4Di26Qk1/QxpONVEV/NIpPn2DYPBaEz5Pyfs 0xpupFSLEnt5nSHhjV0f6WR0XPCVZ6lIUwPrlyQxJLAxPIUn4ZonMYCSeET/UHT5Skix2IdGl/WJj FSY0o5EGHnxk3OmUyZJUBiWAesaOqlkNZ69HMVip6SiCDfMiMPKCxwmTNV7+7X7ppvai+OrXejjqO frLFk+0Xi0LuiPoCCfKtXES31dipIJxW1sqjASTpdeUDbd+w9A6lJlzzXdGSlo+UiO97+wDKnhaq4 RZjOSmOa91dQi//p7wqw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hqivN-0006oJ-6O; Thu, 25 Jul 2019 18:57:09 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hqium-0006LQ-9P for linux-arm-kernel@lists.infradead.org; Thu, 25 Jul 2019 18:56:35 +0000 X-Originating-IP: 93.29.109.196 Received: from localhost.localdomain (196.109.29.93.rev.sfr.net [93.29.109.196]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 5372E40007; Thu, 25 Jul 2019 18:56:14 +0000 (UTC) From: Paul Kocialkowski To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com Subject: [PATCH v7 0/4] HEVC/H.265 stateless support for V4L2 and Cedrus Date: Thu, 25 Jul 2019 20:55:58 +0200 Message-Id: <20190725185602.22522-1-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190725_115632_637667_4A93359F X-CRM114-Status: GOOD ( 15.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans Verkuil , Jernej Skrabec , Sakari Ailus , Alexandre Courbot , Jonas Karlman , Maxime Ripard , Greg Kroah-Hartman , Tomasz Figa , Paul Kocialkowski , Chen-Yu Tsai , Boris Brezillon , Nicolas Dufresne , Thomas Petazzoni , Mauro Carvalho Chehab , Ezequiel Garcia Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP HEVC/H.265 stateless support for V4L2 and Cedrus This is early support for HEVC/H.265 stateless decoding in V4L2, including both definitions and driver support for the Cedrus VPU driver, which concerns Allwinner devices. A specific pixel format is introduced for the HEVC slice format and controls are provided to pass the bitstream metadata to the decoder. Some bitstream extensions are intentionally not supported at this point. Since this is the first proposal for stateless HEVC/H.265 support in V4L2, reviews and comments about the controls definitions are particularly welcome. On the Cedrus side, the H.265 implementation covers frame pictures with both uni-directional and bi-direction prediction modes (P/B slices). Field pictures (interleaved), scaling lists and 10-bit output are not supported at this point. Changes since v6: * Rebased on latest media tree from Hans; * Reordered some fields to avoid holes and multi-padding; * Updated the documentation. Changes since v5: * Rebased atop latest next media tree; * Moved to flags instead of u8 fields; * Added padding to ensure 64-bit alignment (tested with GDB on 32 and 64-bit architectures); * Reworked cedrus H.265 driver support a bit for flags; * Split off codec-specific control validation and init; * Added HEVC controls fields cleanup at std_validate to allow reliable control comparison with memcmp; * Fixed various misc reported mistakes. Changes since v4: * Rebased atop latest H.254 series. Changes since v3: * Updated commit messages; * Updated CID base to avoid conflicts; * Used cpu_to_le32 for packed le32 data; * Fixed misc minor issues in the drive code; * Made it clear in the docs that the API will evolve; * Made the pixfmt private and split commits about it. Changes since v2: * Moved headers to non-public API; * Added H265 capability for A64 and H5; * Moved docs to ext-ctrls-codec.rst; * Mentionned sections of the spec in the docs; * Added padding to control structures for 32-bit alignment; * Made write function use void/size in bytes; * Reduced the number of arguments to helpers when possible; * Removed PHYS_OFFSET since we already set PFN_OFFSET; * Added comments where suggested; * Moved to timestamp for references instead of index; * Fixed some style issues reported by checkpatch. Changes since v1: * Added a H.265 capability to whitelist relevant platforms; * Switched over to tags instead of buffer indices in the DPB * Declared variable in their reduced scope as suggested; * Added the H.265/HEVC spec to the biblio; * Used in-doc references to the spec and the required APIs; * Removed debugging leftovers. Cheers! Paul Kocialkowski (4): media: v4l2-ctrl: Add a comment on why we zero out compound controls fields media: v4l: Add definitions for the HEVC slice controls media: pixfmt: Document the HEVC slice pixel format media: cedrus: Add HEVC/H.265 decoding support Documentation/media/uapi/v4l/biblio.rst | 9 + .../media/uapi/v4l/ext-ctrls-codec.rst | 486 +++++++++++++- .../media/uapi/v4l/pixfmt-compressed.rst | 21 + .../media/uapi/v4l/vidioc-queryctrl.rst | 18 + .../media/videodev2.h.rst.exceptions | 3 + drivers/media/v4l2-core/v4l2-ctrls.c | 93 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + drivers/staging/media/sunxi/cedrus/Makefile | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 31 +- drivers/staging/media/sunxi/cedrus/cedrus.h | 18 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 9 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 616 ++++++++++++++++++ .../staging/media/sunxi/cedrus/cedrus_hw.c | 4 + .../staging/media/sunxi/cedrus/cedrus_regs.h | 271 ++++++++ .../staging/media/sunxi/cedrus/cedrus_video.c | 10 + include/media/hevc-ctrls.h | 198 ++++++ include/media/v4l2-ctrls.h | 7 + 17 files changed, 1789 insertions(+), 8 deletions(-) create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_h265.c create mode 100644 include/media/hevc-ctrls.h