Message ID | 20231116154816.70959-1-andrzej.p@collabora.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp3300482vqg; Thu, 16 Nov 2023 07:49:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUYf94JJOkD8xk5pI1aboF6dR3ak36qP/oeZheSaekIPJzxzVb64dqzVr5+BW/za8XngsF X-Received: by 2002:a17:90b:1e10:b0:280:2935:af27 with SMTP id pg16-20020a17090b1e1000b002802935af27mr16327299pjb.7.1700149741996; Thu, 16 Nov 2023 07:49:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700149741; cv=none; d=google.com; s=arc-20160816; b=KAhcM37tD6Rtg1GQydGkYy/0FamJonHc7eEsBk9gU0Wy4YZ++iZw7mJdH9jZnUs74o vsZsj4gDIVMDOICUuW4kIOsfYmgT6O1e+xTpDKBNGoqGDkqZZZnPc8g235dWnUZVKJNu x+dg0PFCo/Zk3pFGH/g1Mt0FjcSGVrw6ku2PFB6NQQQ+iyQNvYvQqq3LpsjjmuyFOLFX cGiMzBKWa8xroVtpuTwdbBBxKtlpkeqZ4assXuO8qNdqOFZm/O2vxVhHpI+5Hzxuwcio EH4gFomzZ/ChyLZPcCIbvg7WO79yKKgrBJuLR7A/K7laJ9IgJ77PSkPaMAHIOPS5e8NB 1w6A== 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=BCsPc2hkIlKBzosazQcR8OUSpp9dx/9CdGqOlYZb/vk=; fh=hmveWuESrCs1SRnU5EOciZPVSPu9pA05pGOH2f1jU60=; b=BeKuJrlqrArKHji3HuVVssOuOk23Dsud2zf5sN+Z2GVAxyiD1CxOGUKwpgw+HBtPeD yqiGj++NpDJAfaD/chhThVDtXEgIyBdPA2x92337l/Z8g9vq+crMkDVHHKDfTNnCLwsZ h58lj2RiKhgPmVUUZtzeKDjiMWGind235dkgK6Xx745cmYhNsh1sLjratXc5gzdi4/xu ypWRbuQEzwr29+SDLeDwKefHV8suuHfKR05jvB3zo646VivYBYG9yfUe03mB3HbG42RE o8LM4hwSXidmRZhlhZ44lbnbpIaIrusJUYp+qEGT0N+wCwMMhlHzxLSgsZxJUu+XCh73 zUYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ev+qQXOi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id y10-20020a17090aca8a00b0027d15abe599si2287249pjt.143.2023.11.16.07.49.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 07:49:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ev+qQXOi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3429C817ABD0; Thu, 16 Nov 2023 07:48:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345317AbjKPPse (ORCPT <rfc822;jaysivo@gmail.com> + 30 others); Thu, 16 Nov 2023 10:48:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345232AbjKPPsc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 16 Nov 2023 10:48:32 -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 17596D59; Thu, 16 Nov 2023 07:48:28 -0800 (PST) Received: from localhost.localdomain (cola.collaboradmins.com [195.201.22.229]) (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: andrzej.p) by madras.collabora.co.uk (Postfix) with ESMTPSA id DF506660734C; Thu, 16 Nov 2023 15:48:25 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1700149706; bh=qOGURixP10SKLR9eMJf0x73f6ugT8/gbvL3YowPyUCo=; h=From:To:Cc:Subject:Date:From; b=ev+qQXOisOTKnWgq1P8D8oEK9yX30W34JGRLzV4HX5MsrGgm5YSfT1TzKlVvs57sN jBk6KH6DXlhwFAnLWXHB/J/NH2MvGglS/ROafXqXx8zTDgGQ8+WZsx19p3SrsoMg5F /PwJvvgMErv+GUu7KnFg1TZMdE9xO2GWaJPnoNG99XheUvcgUFrpHjxZhTgTgqxFR9 ymC+EI1dQI66IedwlkqLLasg7uL6hGRYGeKzn0qkMvTzPvWDhrDR5Sg4RAZkfg8GBs J93wjM93c473Jgzoq4nMovXzxh68aVPVQYttT5nW3me3sAFvu6FDEAOcJh4z0RnULv KW8GoQcONBLTQ== From: Andrzej Pietrasiewicz <andrzej.p@collabora.com> To: linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Cc: Hugues Fruchet <hugues.fruchet@foss.st.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Andrzej Pietrasiewicz <andrzej.p@collabora.com>, Benjamin Gaignard <benjamin.gaignard@collabora.com>, Daniel Almeida <daniel.almeida@collabora.com>, Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>, Hans Verkuil <hverkuil-cisco@xs4all.nl>, Mauro Carvalho Chehab <mchehab@kernel.org>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Nicolas Dufresne <nicolas.dufresne@collabora.com>, Philipp Zabel <p.zabel@pengutronix.de>, kernel@collabora.com Subject: [RFC 0/6] H.264 stateless encoder RFC 0/6 Date: Thu, 16 Nov 2023 16:48:10 +0100 Message-Id: <20231116154816.70959-1-andrzej.p@collabora.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 16 Nov 2023 07:48:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782736215675846883 X-GMAIL-MSGID: 1782736215675846883 |
Series |
H.264 stateless encoder RFC 0/6
|
|
Message
Andrzej Pietrasiewicz
Nov. 16, 2023, 3:48 p.m. UTC
Dear All, This series adds uAPI for stateless H.264 encoding and an accompanying driver using it. It has been tested on an stm32mp25 and there exists a gstreamer user: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5676 example pipeline: gst-launch-1.0 videotestsrc num-buffers=30 ! video/x-raw, format=YUY2 ! v4l2slh264enc ! filesink location=test.h264 Rebased onto v6.6 with: - some patches from ST to actually run the hardware - my previous VP8 statless encoding series - VP8 support for H1 from Hugues Fruchet In particular, this series depends on the latter, which can be found here: https://patchwork.linuxtv.org/project/linux-media/list/?series=11358 Here's a branch which contains everything needed to actually run: https://gitlab.collabora.com/linux/for-upstream/-/tree/h264-enc-rfc-6.6 I kindly ask for comments. Regards, Andrzej Pietrasiewicz (6): media: verisilicon Correct a typo in H1_REG_ENC_CTRL2_DEBLOCKING_FILTER_MODE media: verisilicon: Correct a typo in H1_REG_MAD_CTRL_MAD_THRESHOLD media: verisilicon: Improve constant's name media: verisilicon: Update H1 register definitions media: uapi: Add H.264 stateless encoding uAPI media: verisilicon: Add H.264 stateless encoder drivers/media/platform/verisilicon/Makefile | 1 + drivers/media/platform/verisilicon/hantro.h | 3 + .../media/platform/verisilicon/hantro_drv.c | 10 + .../platform/verisilicon/hantro_h1_h264_enc.c | 493 +++++++++++ .../platform/verisilicon/hantro_h1_regs.h | 20 +- .../platform/verisilicon/hantro_h1_vp8_enc.c | 2 +- .../media/platform/verisilicon/hantro_h264.c | 777 ++++++++++++++++++ .../media/platform/verisilicon/hantro_hw.h | 23 + .../platform/verisilicon/stm32mp25_venc_hw.c | 22 +- drivers/media/v4l2-core/v4l2-ctrls-core.c | 54 ++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 9 + include/uapi/linux/v4l2-controls.h | 85 ++ include/uapi/linux/videodev2.h | 2 + 13 files changed, 1496 insertions(+), 5 deletions(-) create mode 100644 drivers/media/platform/verisilicon/hantro_h1_h264_enc.c
Comments
On Thu, Nov 16, 2023 at 9:48 AM Andrzej Pietrasiewicz <andrzej.p@collabora.com> wrote: > > Dear All, > > This series adds uAPI for stateless H.264 encoding and an > accompanying driver using it. > > It has been tested on an stm32mp25 and there exists > a gstreamer user: > > https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5676 > > example pipeline: > > gst-launch-1.0 videotestsrc num-buffers=30 ! video/x-raw, format=YUY2 ! > v4l2slh264enc ! filesink location=test.h264 > > Rebased onto v6.6 with: > > - some patches from ST to actually run the hardware > - my previous VP8 statless encoding series > - VP8 support for H1 from Hugues Fruchet > > In particular, this series depends on the latter, which can be > found here: > > https://patchwork.linuxtv.org/project/linux-media/list/?series=11358 > > Here's a branch which contains everything needed to actually run: > > https://gitlab.collabora.com/linux/for-upstream/-/tree/h264-enc-rfc-6.6 > > I kindly ask for comments. I attempted to port this to an i.MX8M Mini without much success. I get the driver to enumerate, and the gst-inspect of the v4l2codecs detects the device for the encoder, but I get t a bunch of errors. Pipeline is PREROLLING ... [ 141.946608] f->type = 10 [ 141.951595] f->type = 10 [ 141.954331] f->type = 10 [ 141.957027] f->type = 9 [ 141.959512] trying format S264 [ 141.962583] trying format NV12 [ 141.965639] OUTPUT codec mode: -1 [ 141.968962] fmt - w: 640, h: 480 [ 141.972202] CAPTURE codec mode: 8 [ 141.975529] fmt - w: 640, h: 480 [ 141.978778] f->type = 10 [ 141.981316] trying format YUYV [ 141.984384] OUTPUT codec mode: -1 [ 141.987707] fmt - w: 640, h: 480 [ 141.998500] Codec mode = 8 [ 142.018876] plane 0 size: 4194304, sizeimage: 4194304 [ 142.023986] plane 0 size: 614400, sizeimage: 614400 Pipeline is PREROLLED ... Setting pipeline to PLAYING ...[ 142.035697] plane 0 size: 4194304, sizeimage: 4194304 Redistribute latency... New cl[ 142.042146] plane 0 size: 614400, sizeimage: 614400 ock: GstSystemClock ERROR: from element /GstPipeline:pipeline0/v4l2slh264enc:v4l2slh264enc0: Driver did not ack the request. Additional debug info: ../subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264enc.c(1002): gst_v4l2_codec_h264_enc_encode_frame (): /GstPipeline:pipeline0/v4l2slh264enc:v4l2slh264enc0 Execution ended after 0:00:01.019990114 Setting pipeline to NULL ... ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data stream error. Additional debug info: ../subprojects/gstreamer/libs/gst/base/gstbasesrc.c(3153): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: streaming stopped, reason error (-5) ERROR: from element /GstPipeline:pipeline0/GstFileSink:filesink0: Error while writing to file "test.h264". Additional debug info: ../subprojects/gstreamer/plugins/elements/gstfilesink.c(716): gst_file_sink_event (): /GstPipeline:pipeline0/GstFileSink:filesink0 [ 144.058389] hantro_watchdog:127: frame processing timed out! Freeing pipeline ... [h264-enc-st-dev] root@localhost:~/gstreamer# If I can get this working, I can do more testing. I don't know how similar the H1 is on the STM32 vs the i.MX8M Mini. I don't have a datasheet for the STM32, but the registers that I checked seemed like they matched, but I don't know enough about how this all works, so I'm a bit at a loss. I can post my own RFC if people are open to reviewing it too. I'll go through and review what I can. adam > > Regards, > > Andrzej Pietrasiewicz (6): > media: verisilicon Correct a typo in > H1_REG_ENC_CTRL2_DEBLOCKING_FILTER_MODE > media: verisilicon: Correct a typo in H1_REG_MAD_CTRL_MAD_THRESHOLD > media: verisilicon: Improve constant's name > media: verisilicon: Update H1 register definitions > media: uapi: Add H.264 stateless encoding uAPI > media: verisilicon: Add H.264 stateless encoder > > drivers/media/platform/verisilicon/Makefile | 1 + > drivers/media/platform/verisilicon/hantro.h | 3 + > .../media/platform/verisilicon/hantro_drv.c | 10 + > .../platform/verisilicon/hantro_h1_h264_enc.c | 493 +++++++++++ > .../platform/verisilicon/hantro_h1_regs.h | 20 +- > .../platform/verisilicon/hantro_h1_vp8_enc.c | 2 +- > .../media/platform/verisilicon/hantro_h264.c | 777 ++++++++++++++++++ > .../media/platform/verisilicon/hantro_hw.h | 23 + > .../platform/verisilicon/stm32mp25_venc_hw.c | 22 +- > drivers/media/v4l2-core/v4l2-ctrls-core.c | 54 ++ > drivers/media/v4l2-core/v4l2-ctrls-defs.c | 9 + > include/uapi/linux/v4l2-controls.h | 85 ++ > include/uapi/linux/videodev2.h | 2 + > 13 files changed, 1496 insertions(+), 5 deletions(-) > create mode 100644 drivers/media/platform/verisilicon/hantro_h1_h264_enc.c > > -- > 2.25.1 > >