Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3521478ybn; Fri, 27 Sep 2019 07:34:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOX/Os0XqdEtnb479EpOVko75xUlO2zYOm5GF8qQWAPqBTKqDA1Z3J9s5Kc7QOM/m2cYmM X-Received: by 2002:aa7:cb46:: with SMTP id w6mr5144416edt.238.1569594894133; Fri, 27 Sep 2019 07:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569594894; cv=none; d=google.com; s=arc-20160816; b=AXT0oRxQI32eY/JiuLfA5eeW0cjUx0qPorHQEwk2EfEf1A2pv2MZbNfHZVw17o8DfB OG7xBFrIHWSeROA2FDVxYuh8dLKduqCeMiSNnK9q09qcZbZnIMrtCsstOdfJEq3dC4rx 0u60TtHpkN2voSPmv0cMTFJ7u08NYckuJNqlLKfDyPbyp6tuAetiTowUN/f5DBa8c93H SBy/ye1+m7uNXkfCWhrePRTK9fcmAvehfrYzRw+DG2uVItpo03gJj4jPgE0e6nvvnrA5 ct+oVHtQMOokbbXsdFWGyTa7Vp6mMGuPzznOvD5/Ol22RqSsMU+guEgRb6Lw3UI8Imxg YK2g== 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:mime-version :message-id:date:subject:cc:to:from; bh=WEs+TaJP2iULA2e4R0SFhj8Y8kNsxjLhwq4UezBdMDU=; b=RFGh6XIj5COeFeHpsetM6b2g1rd/oHR3hz8Fj9dgZLWnJczcuiyc1D95IcoIbQT20d Tf8ZzSQ3HxBeU08dvaLCbklAkRCREpbVHIgqXRLVk7zscE/uT2YH2t4eWuJt7g9wR08d MBvbOOrjaYd8Li/lB/N1k+nDAj41icSZUfPquoY+WQ4OqvIuEY1IZlWmi6f8R0eUi/D6 790I+rnDqsuNfI3huQo2snaVgO1FH1N+VQMX3+ZSQ+4FNqvw01rSognUgi4PQWYYallT i5rOlydBS0gQSn4JezmnGqlC7fOYYcrGRbgEDLwZn/WXCPa5plAyJyHXw/FvgF83TjKL jC0Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si1716271ede.118.2019.09.27.07.34.29; Fri, 27 Sep 2019 07:34:54 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727593AbfI0OeS (ORCPT + 99 others); Fri, 27 Sep 2019 10:34:18 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:55551 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726540AbfI0OeS (ORCPT ); Fri, 27 Sep 2019 10:34:18 -0400 X-Originating-IP: 86.250.200.211 Received: from localhost.localdomain (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 0EE6620019; Fri, 27 Sep 2019 14:34:14 +0000 (UTC) From: Paul Kocialkowski To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com Cc: Mauro Carvalho Chehab , Paul Kocialkowski , Chen-Yu Tsai , Maxime Ripard , Hans Verkuil , Ezequiel Garcia , Tomasz Figa , Nicolas Dufresne , Jernej Skrabec , Jonas Karlman , Thomas Petazzoni Subject: [PATCH v8 0/3] HEVC/H.265 stateless support for V4L2 and Cedrus Date: Fri, 27 Sep 2019 16:34:08 +0200 Message-Id: <20190927143411.141526-1-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 v7: * Rebased on latest media tree; * Fixed holes in structures for cacheline alignment; * Added decode mode and start code controls (only per-slice and no start code is 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 (3): media: v4l: Add definitions for HEVC stateless decoding 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 | 553 +++++++++++++++- .../media/uapi/v4l/pixfmt-compressed.rst | 23 + .../media/uapi/v4l/vidioc-queryctrl.rst | 18 + .../media/videodev2.h.rst.exceptions | 3 + drivers/media/v4l2-core/v4l2-ctrls.c | 108 ++- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + drivers/staging/media/sunxi/cedrus/Makefile | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 52 +- 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 | 212 ++++++ include/media/v4l2-ctrls.h | 7 + 17 files changed, 1907 insertions(+), 9 deletions(-) create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_h265.c create mode 100644 include/media/hevc-ctrls.h -- 2.23.0