Skip to contentSkip to conversation

NVIDIA Tegra video decoder driver

PATCH Applied Dmitry Osipenko 3 participants 12 messages Dec 12, 2017 – Nov 23, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v5 cover NVIDIA Tegra video decoder driver

VDE driver provides accelerated video decoding to NVIDIA Tegra SoC's, it is a result of reverse-engineering efforts. Driver has been tested on Toshiba AC100 and Acer A500, it should work on any Tegra20 device.

In userspace this driver is utilized by libvdpau-tegra [0] that implements VDPAU interface, so any video player that supports VDPAU can provide accelerated video decoding on Tegra20 on Linux.

[0] https://github.com/grate-driver/libvdpau-tegra

Change log:
v5:
- Moved driver to staging/media as per Hans's Verkuil request
- Addressed review comments to v4 from Vladimir Zapolskiy and Dan Carpenter
- Updated 'TODO', reflecting that this driver require upcoming support of stateless decoders by V4L2
- Dropped patch that enabled VDE driver in tegra_defconfig for now as I realized that Tegra's DRM staging config is disabled there and right now we are relying on it in libvdpau-tegra
- Added myself to MAINTAINERS in the "Introduce driver" patch as per Vladimir's suggestion

v4:
- Added mmio-sram "IRAM DT node" patch from Vladimir Zapolskiy to the series, I modified it to cover all Tegra's and not only Tegra20
- Utilized genalloc for the reservation of IRAM region as per Vladimir's suggestion, VDE driver now selects SRAM driver in Kconfig
- Added defconfig patch to the series
- Described VDE registers in DT per HW unit, excluding BSE-A / UCQ and holes between the units
- Extended DT compatibility property with Tegra30/114/124/132 in the binding doc.
- Removed BSE-A interrupt from the DT binding because it's very likely that Audio Bitstream Engine isn't integrated with VDE
- Removed UCQ interrupt from the DT binding because in TRM it is represented as a distinct HW block that probably should have its own driver
- Addressed v3 review comments: factored out DT binding addition into a standalone patch, moved binding to media/, removed clocks/resets-names

v3:
- Suppressed compilation warnings reported by 'kbuild test robot'

v2:
- Addressed v1 review comments from Stephen Warren and Dan Carpenter
- Implemented runtime PM
- Miscellaneous code cleanups
- Changed 'TODO'
- CC'd media maintainers for the review as per Greg's K-H request, v1 can be viewed at https://lkml.org/lkml/2017/9/25/606

Dmitry Osipenko (3):
media: dt: bindings: Add binding for NVIDIA Tegra Video Decoder Engine
staging: media: Introduce NVIDIA Tegra video decoder driver
ARM: dts: tegra20: Add video decoder node

Vladimir Zapolskiy (1):
ARM: dts: tegra20: Add device tree node to describe IRAM

 .../devicetree/bindings/media/nvidia,tegra-vde.txt |   55 +
 MAINTAINERS                                        |    9 +
 arch/arm/boot/dts/tegra20.dtsi                     |   35 +
 drivers/staging/media/Kconfig                      |    2 +
 drivers/staging/media/Makefile                     |    1 +
 drivers/staging/media/tegra-vde/Kconfig            |    7 +
 drivers/staging/media/tegra-vde/Makefile           |    1 +
 drivers/staging/media/tegra-vde/TODO               |    4 +
 drivers/staging/media/tegra-vde/tegra-vde.c        | 1213 ++++++++++++++++++++
 drivers/staging/media/tegra-vde/uapi.h             |   78 ++
 10 files changed, 1405 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt
 create mode 100644 drivers/staging/media/tegra-vde/Kconfig
 create mode 100644 drivers/staging/media/tegra-vde/Makefile
 create mode 100644 drivers/staging/media/tegra-vde/TODO
 create mode 100644 drivers/staging/media/tegra-vde/tegra-vde.c
 create mode 100644 drivers/staging/media/tegra-vde/uapi.h
Signature · 1 line
2.15.1
#1 lore raw

PATCH v5 1/4 media: dt: bindings: Add binding for NVIDIA Tegra Video Decoder Engine

Add binding documentation for the Video Decoder Engine which is found on NVIDIA Tegra20/30/114/124/132 SoC's.

---
 .../devicetree/bindings/media/nvidia,tegra-vde.txt | 55 ++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt
Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt new file +55 -0
new file mode 100644
index 000000000000..470237ed6fe5
@@ -0,0 +1,55 @@
+NVIDIA Tegra Video Decoder Engine
+
+Required properties:
+- compatible : Must contain one of the following values:
+   - "nvidia,tegra20-vde"
+   - "nvidia,tegra30-vde"
+   - "nvidia,tegra114-vde"
+   - "nvidia,tegra124-vde"
+   - "nvidia,tegra132-vde"
+- reg : Must contain an entry for each entry in reg-names.
+- reg-names : Must include the following entries:
+  - sxe
+  - bsev
+  - mbe
+  - ppe
+  - mce
+  - tfe
+  - ppb
+  - vdma
+  - frameid
+- iram : Must contain phandle to the mmio-sram device node that represents
+         IRAM region used by VDE.
+- interrupts : Must contain an entry for each entry in interrupt-names.
+- interrupt-names : Must include the following entries:
+  - sync-token
+  - bsev
+  - sxe
+- clocks : Must include the following entries:
+  - vde
+- resets : Must include the following entries:
+  - vde
+
+Example:
+
+video-codec@6001a000 {
+	compatible = "nvidia,tegra20-vde";
+	reg = <0x6001a000 0x1000 /* Syntax Engine */
+	       0x6001b000 0x1000 /* Video Bitstream Engine */
+	       0x6001c000  0x100 /* Macroblock Engine */
+	       0x6001c200  0x100 /* Post-processing Engine */
+	       0x6001c400  0x100 /* Motion Compensation Engine */
+	       0x6001c600  0x100 /* Transform Engine */
+	       0x6001c800  0x100 /* Pixel prediction block */
+	       0x6001ca00  0x100 /* Video DMA */
+	       0x6001d800  0x300 /* Video frame controls */>;
+	reg-names = "sxe", "bsev", "mbe", "ppe", "mce",
+		    "tfe", "ppb", "vdma", "frameid";
+	iram = <&vde_pool>; /* IRAM region */
+	interrupts = <GIC_SPI  9 IRQ_TYPE_LEVEL_HIGH>, /* Sync token interrupt */
+		     <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, /* BSE-V interrupt */
+		     <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; /* SXE interrupt */
+	interrupt-names = "sync-token", "bsev", "sxe";
+	clocks = <&tegra_car TEGRA20_CLK_VDE>;
+	resets = <&tegra_car 61>;
+};
Signature · 1 line
2.15.1
#2 lore raw

PATCH v5 2/4 staging: media: Introduce NVIDIA Tegra video decoder driver

In reply to Dmitry Osipenko

NVIDIA Tegra20/30/114/124/132 SoC's have video decoder engine that supports standard set of video formats like H.264 / MPEG-4 / WMV / VC1.

---
 MAINTAINERS                                 |    9 +
 drivers/staging/media/Kconfig               |    2 +
 drivers/staging/media/Makefile              |    1 +
 drivers/staging/media/tegra-vde/Kconfig     |    7 +
 drivers/staging/media/tegra-vde/Makefile    |    1 +
 drivers/staging/media/tegra-vde/TODO        |    4 +
 drivers/staging/media/tegra-vde/tegra-vde.c | 1213 +++++++++++++++++++++++++++
 drivers/staging/media/tegra-vde/uapi.h      |   78 ++
 8 files changed, 1315 insertions(+)
 create mode 100644 drivers/staging/media/tegra-vde/Kconfig
 create mode 100644 drivers/staging/media/tegra-vde/Makefile
 create mode 100644 drivers/staging/media/tegra-vde/TODO
 create mode 100644 drivers/staging/media/tegra-vde/tegra-vde.c
 create mode 100644 drivers/staging/media/tegra-vde/uapi.h
MAINTAINERS +9 -0
index 7d195739f892..7f7c24949a06 100644
@@ -8706,6 +8706,15 @@ T:	git git://linuxtv.org/media_tree.git
 S:	Maintained
 F:	drivers/media/dvb-frontends/stv6111*
 
+MEDIA DRIVERS FOR NVIDIA TEGRA - VDE
+M:	Dmitry Osipenko <[email protected]>
+L:	[email protected]
+L:	[email protected]
+T:	git git://linuxtv.org/media_tree.git
+S:	Maintained
+F:	Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt
+F:	drivers/staging/media/tegra-vde/
+
 MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
 M:	Mauro Carvalho Chehab <[email protected]>
 M:	Mauro Carvalho Chehab <[email protected]>
drivers/staging/media/Kconfig +2 -0
index 3a09140700e6..227437f22acf 100644
@@ -31,4 +31,6 @@ source "drivers/staging/media/imx/Kconfig"
 
 source "drivers/staging/media/omap4iss/Kconfig"
 
+source "drivers/staging/media/tegra-vde/Kconfig"
+
 endif
drivers/staging/media/Makefile +1 -0
index f25327163c67..59a47f69884f 100644
@@ -5,3 +5,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA)	+= imx/
 obj-$(CONFIG_VIDEO_DM365_VPFE)	+= davinci_vpfe/
 obj-$(CONFIG_VIDEO_OMAP4)	+= omap4iss/
 obj-$(CONFIG_INTEL_ATOMISP)     += atomisp/
+obj-$(CONFIG_TEGRA_VDE)		+= tegra-vde/
drivers/staging/media/tegra-vde/Kconfig new file +7 -0
new file mode 100644
index 000000000000..ec3ddddebdaa
@@ -0,0 +1,7 @@
+config TEGRA_VDE
+	tristate "NVIDIA Tegra Video Decoder Engine driver"
+	depends on ARCH_TEGRA || COMPILE_TEST
+	select SRAM
+	help
+	    Say Y here to enable support for the NVIDIA Tegra video decoder
+	    driver.
drivers/staging/media/tegra-vde/Makefile new file +1 -0
new file mode 100644
index 000000000000..444c1d62daa1
@@ -0,0 +1 @@
+obj-$(CONFIG_TEGRA_VDE)	+= tegra-vde.o
drivers/staging/media/tegra-vde/TODO new file +4 -0
new file mode 100644
index 000000000000..31aaa3e66d80
@@ -0,0 +1,4 @@
+TODO:
+	- Implement V4L2 API once it gains support for stateless decoders.
+
+Contact: Dmitry Osipenko <[email protected]>
drivers/staging/media/tegra-vde/tegra-vde.c new file +1213 -0

1,213 lines not on this page · raw message

drivers/staging/media/tegra-vde/uapi.h new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.15.1
#3 lore raw

Re: [PATCH v5 2/4] staging: media: Introduce NVIDIA Tegra video decoder driver

Hi Dmitry,

Quoted 87 lines · Dmitry Osipenko

NVIDIA Tegra20/30/114/124/132 SoC's have video decoder engine that supports standard set of video formats like H.264 / MPEG-4 / WMV / VC1.

---
 MAINTAINERS                                 |    9 +
 drivers/staging/media/Kconfig               |    2 +
 drivers/staging/media/Makefile              |    1 +
 drivers/staging/media/tegra-vde/Kconfig     |    7 +
 drivers/staging/media/tegra-vde/Makefile    |    1 +
 drivers/staging/media/tegra-vde/TODO        |    4 +
 drivers/staging/media/tegra-vde/tegra-vde.c | 1213 +++++++++++++++++++++++++++
 drivers/staging/media/tegra-vde/uapi.h      |   78 ++
 8 files changed, 1315 insertions(+)
 create mode 100644 drivers/staging/media/tegra-vde/Kconfig
 create mode 100644 drivers/staging/media/tegra-vde/Makefile
 create mode 100644 drivers/staging/media/tegra-vde/TODO
 create mode 100644 drivers/staging/media/tegra-vde/tegra-vde.c
 create mode 100644 drivers/staging/media/tegra-vde/uapi.h
MAINTAINERS +9 -0
index 7d195739f892..7f7c24949a06 100644
@@ -8706,6 +8706,15 @@ T:       git git://linuxtv.org/media_tree.git
 S:     Maintained
 F:     drivers/media/dvb-frontends/stv6111*
 
+MEDIA DRIVERS FOR NVIDIA TEGRA - VDE
+M:     Dmitry Osipenko <[email protected]>
+L:     [email protected]
+L:     [email protected]
+T:     git git://linuxtv.org/media_tree.git
+S:     Maintained
+F:     Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt
+F:     drivers/staging/media/tegra-vde/
+
 MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
 M:     Mauro Carvalho Chehab <[email protected]>
 M:     Mauro Carvalho Chehab <[email protected]>
drivers/staging/media/Kconfig +2 -0
index 3a09140700e6..227437f22acf 100644
@@ -31,4 +31,6 @@ source "drivers/staging/media/imx/Kconfig"
 
 source "drivers/staging/media/omap4iss/Kconfig"
 
+source "drivers/staging/media/tegra-vde/Kconfig"
+
 endif
drivers/staging/media/Makefile +1 -0
index f25327163c67..59a47f69884f 100644
@@ -5,3 +5,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA)   += imx/
 obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/
 obj-$(CONFIG_VIDEO_OMAP4)      += omap4iss/
 obj-$(CONFIG_INTEL_ATOMISP)     += atomisp/
+obj-$(CONFIG_TEGRA_VDE)                += tegra-vde/
drivers/staging/media/tegra-vde/Kconfig new file +7 -0
new file mode 100644
index 000000000000..ec3ddddebdaa
@@ -0,0 +1,7 @@
+config TEGRA_VDE
+       tristate "NVIDIA Tegra Video Decoder Engine driver"
+       depends on ARCH_TEGRA || COMPILE_TEST
+       select SRAM
+       help
+           Say Y here to enable support for the NVIDIA Tegra video decoder
+           driver.
drivers/staging/media/tegra-vde/Makefile new file +1 -0
new file mode 100644
index 000000000000..444c1d62daa1
@@ -0,0 +1 @@
+obj-$(CONFIG_TEGRA_VDE)        += tegra-vde.o
drivers/staging/media/tegra-vde/TODO new file +0 -0
new file mode 100644
index 000000000000..31aaa3e66d80

drivers/staging/media/tegra-vde/TODO line 4

Quoted 4 lines
drivers/staging/media/tegra-vde/TODO new file +4 -0
@@ -0,0 +1,4 @@
+TODO:
+       - Implement V4L2 API once it gains support for stateless decoders.
+
+Contact: Dmitry Osipenko <[email protected]>

The API for H264 stateless decoding is ready.
See https://lkml.org/lkml/2020/11/18/795.

One minor comment below.

Quoted 54 lines
drivers/staging/media/tegra-vde/uapi.h new file +48 -0
new file mode 100644
index 000000000000..a50c7bcae057
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016-2017 Dmitry Osipenko <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _UAPI_TEGRA_VDE_H_
+#define _UAPI_TEGRA_VDE_H_
+
+#include <linux/types.h>
+#include <asm/ioctl.h>
+
+#define FLAG_B_FRAME           (1 << 0)
+#define FLAG_REFERENCE         (1 << 1)
+
+struct tegra_vde_h264_frame {
+       __s32 y_fd;
+       __s32 cb_fd;
+       __s32 cr_fd;
+       __s32 aux_fd;
+       __u32 y_offset;
+       __u32 cb_offset;
+       __u32 cr_offset;
+       __u32 aux_offset;
+       __u32 frame_num;
+       __u32 flags;
+
+       __u32 reserved;
+} __attribute__((packed));
+
+struct tegra_vde_h264_decoder_ctx {
+       __s32 bitstream_data_fd;
+       __u32 bitstream_data_offset;
+
+       __u64 dpb_frames_ptr;
+       __u8  dpb_frames_nb;
+       __u8  dpb_ref_frames_with_earlier_poc_nb;
+
+       // SPS
+       __u8  baseline_profile;
+       __u8  level_idc;
+       __u8  log2_max_pic_order_cnt_lsb;
+       __u8  log2_max_frame_num;
+       __u8  pic_order_cnt_type;
+       __u8  direct_8x8_inference_flag;

drivers/staging/media/tegra-vde/uapi.h line 58

Quoted 10 lines
drivers/staging/media/tegra-vde/uapi.h new file +10 -0
+       __u8  pic_width_in_mbs;
+       __u8  pic_height_in_mbs;
+
+       // PPS
+       __u8  pic_init_qp;
+       __u8  deblocking_filter_control_present_flag;
+       __u8  constrained_intra_pred_flag;
+       __u8  chroma_qp_index_offset;
+       __u8  pic_order_present_flag;
+

This seems to be bottom_field_pic_order_in_frame_present_flag, as there is no "pic_order_present_flag" syntax element.

Thanks,
Ezequiel

#4 lore raw

Re: [PATCH v5 2/4] staging: media: Introduce NVIDIA Tegra video decoder driver

22.11.2020 04:02, Ezequiel Garcia пишет:

Quoted 2 lines

Hi Dmitry,

...

Quoted 9 lines

drivers/staging/media/tegra-vde/TODO line 4

Quoted 6 lines

+++ b/drivers/staging/media/tegra-vde/TODO

drivers/staging/media/tegra-vde/TODO new file +4 -0
@@ -0,0 +1,4 @@
+TODO:
+       - Implement V4L2 API once it gains support for stateless decoders.
+
+Contact: Dmitry Osipenko <[email protected]>

The API for H264 stateless decoding is ready.
See https://lkml.org/lkml/2020/11/18/795.

Hello Ezequiel,

Thank you for the notification! My last attempt at implementing V4L API support was about a year ago and it stopped once I realized that there is no userspace which uses that API. FFMPEG and chromium browser had some kind of V4L support, but it all was oriented at downstream driver stacks, and thus, not usable. Do you know what is the current status?

Quoted 2 lines

One minor comment below.

...

Quoted 10 lines

drivers/staging/media/tegra-vde/uapi.h line 58

Quoted 7 lines
drivers/staging/media/tegra-vde/uapi.h new file +7 -0
+       // PPS
+       __u8  pic_init_qp;
+       __u8  deblocking_filter_control_present_flag;
+       __u8  constrained_intra_pred_flag;
+       __u8  chroma_qp_index_offset;
+       __u8  pic_order_present_flag;
+

This seems to be bottom_field_pic_order_in_frame_present_flag, as there is no "pic_order_present_flag" syntax element.

Correct, looks like I borrowed that name from the libvdpau API.

https://vdpau.pages.freedesktop.org/libvdpau/struct_vdp_picture_info_h264.html#a405f7ef26ea76bb2c446e151062fc001

#5 lore raw

Re: [PATCH v5 2/4] staging: media: Introduce NVIDIA Tegra video decoder driver

Quoted 15 lines · Dmitry Osipenko

22.11.2020 04:02, Ezequiel Garcia пишет:

Quoted 2 lines

Hi Dmitry,

...

Quoted 9 lines

drivers/staging/media/tegra-vde/TODO line 4

Quoted 6 lines

+++ b/drivers/staging/media/tegra-vde/TODO

drivers/staging/media/tegra-vde/TODO new file +4 -0
@@ -0,0 +1,4 @@
+TODO:
+       - Implement V4L2 API once it gains support for stateless decoders.
+
+Contact: Dmitry Osipenko <[email protected]>

The API for H264 stateless decoding is ready.
See https://lkml.org/lkml/2020/11/18/795.

Quoted 8 lines

Hello Ezequiel,

Thank you for the notification! My last attempt at implementing V4L API support was about a year ago and it stopped once I realized that there is no userspace which uses that API. FFMPEG and chromium browser had some kind of V4L support, but it all was oriented at downstream driver stacks, and thus, not usable. Do you know what is the current status?

The bulk of the API, which relies on the stateless decoder interface [1], and H264 stateless V4L2 controls has been ready for some time now, and there are various implementations supporting it.

Chromium supports it [2], and I've tested it on chromebooks, through chromeos builds. We haven't tried a non-chromeos build, and I would say it's quite some work.

GStreamer support is available as well. See [3] which should work for the latest H264 controls (the ones being moved out of staging).

LibreELEC developers maintain an Ffmpeg branch [4], I expect it will be updated for the latest H264 controls soon, and hopefully merged in mainline Ffmpeg.

GStreamer and Ffmpeg are relatively straightforward to build and test.

Thanks,
Ezequiel

[1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-stateless-decoder.html
[2] https://github.com/chromium/chromium/tree/master/media/gpu/v4l2
[3] https://gitlab.freedesktop.org/ezequielgarcia/gst-plugins-bad/-/tree/h264_stable_uapi
[4] https://github.com/Kwiboo/FFmpeg/tree/v4l2-request-hwaccel-4.3.

Quoted 17 lines
Quoted 2 lines

One minor comment below.

...

Quoted 10 lines

drivers/staging/media/tegra-vde/uapi.h line 58

Quoted 7 lines
drivers/staging/media/tegra-vde/uapi.h new file +7 -0
+       // PPS
+       __u8  pic_init_qp;
+       __u8  deblocking_filter_control_present_flag;
+       __u8  constrained_intra_pred_flag;
+       __u8  chroma_qp_index_offset;
+       __u8  pic_order_present_flag;
+

This seems to be bottom_field_pic_order_in_frame_present_flag, as there is no "pic_order_present_flag" syntax element.

Correct, looks like I borrowed that name from the libvdpau API.

https://vdpau.pages.freedesktop.org/libvdpau/struct_vdp_picture_info_h264.html#a405f7ef26ea76bb2c446e151062fc001

#6 lore raw

Re: [PATCH v5 2/4] staging: media: Introduce NVIDIA Tegra video decoder driver

23.11.2020 06:07, Ezequiel Garcia пишет:

Quoted 42 lines · Dmitry Osipenko
Quoted 15 lines

22.11.2020 04:02, Ezequiel Garcia пишет:

Quoted 2 lines

Hi Dmitry,

...

Quoted 9 lines

drivers/staging/media/tegra-vde/TODO line 4

Quoted 6 lines

+++ b/drivers/staging/media/tegra-vde/TODO

drivers/staging/media/tegra-vde/TODO new file +4 -0
@@ -0,0 +1,4 @@
+TODO:
+       - Implement V4L2 API once it gains support for stateless decoders.
+
+Contact: Dmitry Osipenko <[email protected]>

The API for H264 stateless decoding is ready.
See https://lkml.org/lkml/2020/11/18/795.

Quoted 8 lines

Hello Ezequiel,

Thank you for the notification! My last attempt at implementing V4L API support was about a year ago and it stopped once I realized that there is no userspace which uses that API. FFMPEG and chromium browser had some kind of V4L support, but it all was oriented at downstream driver stacks, and thus, not usable. Do you know what is the current status?

The bulk of the API, which relies on the stateless decoder interface [1], and H264 stateless V4L2 controls has been ready for some time now, and there are various implementations supporting it.

Chromium supports it [2], and I've tested it on chromebooks, through chromeos builds. We haven't tried a non-chromeos build, and I would say it's quite some work.

GStreamer support is available as well. See [3] which should work for the latest H264 controls (the ones being moved out of staging).

LibreELEC developers maintain an Ffmpeg branch [4], I expect it will be updated for the latest H264 controls soon, and hopefully merged in mainline Ffmpeg.

GStreamer and Ffmpeg are relatively straightforward to build and test.

Quoted 7 lines

Thanks,
Ezequiel

[1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-stateless-decoder.html
[2] https://github.com/chromium/chromium/tree/master/media/gpu/v4l2
[3] https://gitlab.freedesktop.org/ezequielgarcia/gst-plugins-bad/-/tree/h264_stable_uapi
[4] https://github.com/Kwiboo/FFmpeg/tree/v4l2-request-hwaccel-4.3.

Alright, thank you.

#7 lore raw

PATCH v5 3/4 ARM: dts: tegra20: Add device tree node to describe IRAM

In reply to Dmitry Osipenko

From: Vladimir Zapolskiy <[email protected]>

All Tegra20 SoCs contain 256KiB IRAM, which is used to store resume code and by a video decoder engine.

---
 arch/arm/boot/dts/tegra20.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/tegra20.dtsi +8 -0
index 914f59166a99..36909df653c3 100644
@@ -10,6 +10,14 @@
 	compatible = "nvidia,tegra20";
 	interrupt-parent = <&lic>;
 
+	iram@40000000 {
+		compatible = "mmio-sram";
+		reg = <0x40000000 0x40000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0x40000000 0x40000>;
+	};
+
 	host1x@50000000 {
 		compatible = "nvidia,tegra20-host1x", "simple-bus";
 		reg = <0x50000000 0x00024000>;
Signature · 1 line
2.15.1
#8 lore raw

Re: [PATCH v5 3/4] ARM: dts: tegra20: Add device tree node to describe IRAM

Quoted 10 lines · Dmitry Osipenko

From: Vladimir Zapolskiy <[email protected]>

All Tegra20 SoCs contain 256KiB IRAM, which is used to store resume code and by a video decoder engine.

---
 arch/arm/boot/dts/tegra20.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

Applied, thanks.

Thierry

#9 lore raw

PATCH v5 4/4 ARM: dts: tegra20: Add video decoder node

In reply to Dmitry Osipenko

Add Video Decoder Engine device node.

---
 arch/arm/boot/dts/tegra20.dtsi | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm/boot/dts/tegra20.dtsi +27 -0
index 36909df653c3..864a95872b8d 100644
@@ -16,6 +16,11 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges = <0 0x40000000 0x40000>;
+
+		vde_pool: vde {
+			reg = <0x400 0x3fc00>;
+			pool;
+		};
 	};
 
 	host1x@50000000 {
@@ -258,6 +263,28 @@
 		*/
 	};
 
+	vde@6001a000 {
+		compatible = "nvidia,tegra20-vde";
+		reg = <0x6001a000 0x1000   /* Syntax Engine */
+		       0x6001b000 0x1000   /* Video Bitstream Engine */
+		       0x6001c000  0x100   /* Macroblock Engine */
+		       0x6001c200  0x100   /* Post-processing Engine */
+		       0x6001c400  0x100   /* Motion Compensation Engine */
+		       0x6001c600  0x100   /* Transform Engine */
+		       0x6001c800  0x100   /* Pixel prediction block */
+		       0x6001ca00  0x100   /* Video DMA */
+		       0x6001d800  0x300>; /* Video frame controls */
+		reg-names = "sxe", "bsev", "mbe", "ppe", "mce",
+			    "tfe", "ppb", "vdma", "frameid";
+		iram = <&vde_pool>; /* IRAM region */
+		interrupts = <GIC_SPI  9 IRQ_TYPE_LEVEL_HIGH>, /* Sync token interrupt */
+			     <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, /* BSE-V interrupt */
+			     <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; /* SXE interrupt */
+		interrupt-names = "sync-token", "bsev", "sxe";
+		clocks = <&tegra_car TEGRA20_CLK_VDE>;
+		resets = <&tegra_car 61>;
+	};
+
 	apbmisc@70000800 {
 		compatible = "nvidia,tegra20-apbmisc";
 		reg = <0x70000800 0x64   /* Chip revision */
Signature · 1 line
2.15.1
#10 lore raw

Re: [PATCH v5 4/4] ARM: dts: tegra20: Add video decoder node

Quoted 6 lines · Dmitry Osipenko

Add Video Decoder Engine device node.

---
 arch/arm/boot/dts/tegra20.dtsi | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Applied, thanks.

Thierry

#11 lore raw
In reply to Dmitry Osipenko
Quoted 9 lines · Dmitry Osipenko

VDE driver provides accelerated video decoding to NVIDIA Tegra SoC's, it is a result of reverse-engineering efforts. Driver has been tested on Toshiba AC100 and Acer A500, it should work on any Tegra20 device.

In userspace this driver is utilized by libvdpau-tegra [0] that implements VDPAU interface, so any video player that supports VDPAU can provide accelerated video decoding on Tegra20 on Linux.

[0] https://github.com/grate-driver/libvdpau-tegra

Thierry, driver has been approved by media maintainers and should appear in 4.16 (it is already in -next). Please schedule the DT patches for 4.16, thanks.