linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Enable JPEG encoding on rk3588
@ 2024-04-12 15:15 Emmanuel Gil Peyrot
  2024-04-12 15:15 ` [PATCH v3 1/2] media: dt-binding: media: Document rk3588’s VEPU121 Emmanuel Gil Peyrot
  2024-04-12 15:15 ` [PATCH v3 2/2] arm64: dts: rockchip: Add one VEPU121 to rk3588 Emmanuel Gil Peyrot
  0 siblings, 2 replies; 5+ messages in thread
From: Emmanuel Gil Peyrot @ 2024-04-12 15:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Emmanuel Gil Peyrot, Ezequiel Garcia, Philipp Zabel,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiko Stuebner, Joerg Roedel, Will Deacon,
	Robin Murphy, Sebastian Reichel, Cristian Ciocaltea,
	Dragan Simic, Shreeya Patel, Chris Morgan, Andy Yan,
	Nicolas Frattaroli, linux-media, linux-rockchip, devicetree,
	linux-arm-kernel, iommu

Only the JPEG encoder is available for now, although there are patches
for the undocumented VP8 encoder floating around[0].

This has been tested on a rock-5b, resulting in four /dev/video*
encoders.  The userspace program I’ve been using to test them is
Onix[1], using the jpeg-encoder example, it will pick one of these four
at random (but displays the one it picked):
% ffmpeg -i <input image> -pix_fmt yuvj420p temp.yuv
% jpeg-encoder temp.yuv <width> <height> NV12 <quality> output.jpeg

[0] https://patchwork.kernel.org/project/linux-rockchip/list/?series=789885
[1] https://crates.io/crates/onix

Changes since v2:
- Only expose a single VEPU121, since the driver doesn’t yet support
  exposing them all as a single video node to userspace.

Changes since v1:
- Dropped patches 1 and 4.
- Use the proper compatible form, since this device should be fully
  compatible with the VEPU of rk356x.
- Describe where the VEPU121 name comes from, and list other encoders
  and decoders present in this SoC.
- Properly test the device tree changes, I previously couldn’t since I
  was using a too recent version of python-jsonschema…

Emmanuel Gil Peyrot (2):
  media: dt-binding: media: Document rk3588’s VEPU121
  arm64: dts: rockchip: Add one VEPU121 to rk3588

 .../bindings/media/rockchip,rk3568-vepu.yaml  |  8 +++--
 arch/arm64/boot/dts/rockchip/rk3588s.dtsi     | 29 +++++++++++++++++++
 2 files changed, 35 insertions(+), 2 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] media: dt-binding: media: Document rk3588’s VEPU121
  2024-04-12 15:15 [PATCH v3 0/2] Enable JPEG encoding on rk3588 Emmanuel Gil Peyrot
@ 2024-04-12 15:15 ` Emmanuel Gil Peyrot
  2024-04-13 21:22   ` Krzysztof Kozlowski
  2024-04-12 15:15 ` [PATCH v3 2/2] arm64: dts: rockchip: Add one VEPU121 to rk3588 Emmanuel Gil Peyrot
  1 sibling, 1 reply; 5+ messages in thread
From: Emmanuel Gil Peyrot @ 2024-04-12 15:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Emmanuel Gil Peyrot, Ezequiel Garcia, Philipp Zabel,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiko Stuebner, Joerg Roedel, Will Deacon,
	Robin Murphy, Sebastian Reichel, Cristian Ciocaltea,
	Dragan Simic, Shreeya Patel, Chris Morgan, Andy Yan,
	Nicolas Frattaroli, linux-media, linux-rockchip, devicetree,
	linux-arm-kernel, iommu

This encoder-only device is present four times on this SoC, and should
support everything the rk3568 vepu supports (so JPEG, H.264 and VP8
encoding).

According to the TRM[1], there is also the VEPU580 encoder which
supports H.264 and H.265, and various VDPU* decoders, of which only the
VDPU981 is currently supported.  This patch describes only the VEPU121.

[1] https://github.com/FanX-Tek/rk3588-TRM-and-Datasheet

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
---
 .../devicetree/bindings/media/rockchip,rk3568-vepu.yaml   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml b/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
index 9d90d8d0565a..4c6cb21da041 100644
--- a/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
+++ b/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
@@ -15,8 +15,12 @@ description:
 
 properties:
   compatible:
-    enum:
-      - rockchip,rk3568-vepu
+    oneOf:
+      - const: rockchip,rk3568-vepu
+      - items:
+          - enum:
+              - rockchip,rk3588-vepu121
+          - const: rockchip,rk3568-vepu
 
   reg:
     maxItems: 1
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] arm64: dts: rockchip: Add one VEPU121 to rk3588
  2024-04-12 15:15 [PATCH v3 0/2] Enable JPEG encoding on rk3588 Emmanuel Gil Peyrot
  2024-04-12 15:15 ` [PATCH v3 1/2] media: dt-binding: media: Document rk3588’s VEPU121 Emmanuel Gil Peyrot
@ 2024-04-12 15:15 ` Emmanuel Gil Peyrot
  1 sibling, 0 replies; 5+ messages in thread
From: Emmanuel Gil Peyrot @ 2024-04-12 15:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Emmanuel Gil Peyrot, Ezequiel Garcia, Philipp Zabel,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiko Stuebner, Joerg Roedel, Will Deacon,
	Robin Murphy, Sebastian Reichel, Cristian Ciocaltea,
	Dragan Simic, Shreeya Patel, Chris Morgan, Andy Yan,
	Nicolas Frattaroli, linux-media, linux-rockchip, devicetree,
	linux-arm-kernel, iommu

The TRM (version 1.0 page 385) lists five VEPU121 cores, but only four
interrupts are listed (on page 24), and the driver would expose them all
as different video nodes so only one of them is exposed for now.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
---
 arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 29 +++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
index 87b83c87bd55..5c6cc4cd81df 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
@@ -2488,6 +2488,35 @@ gpio4: gpio@fec50000 {
 		};
 	};
 
+	/*
+	 * Currently only one of the four JPEG encoders is exposed, this
+	 * reduces the optimal throughput by four.
+	 *
+	 * Once the driver is made to expose all four devices as a single video
+	 * node, the rest can be enabled again, see the full patch here:
+	 * https://lore.kernel.org/linux-media/20240327134115.424846-1-linkmauve@linkmauve.fr/T/#m3a6df0ba15e4af40b998b0ff2a02b0dd0d730c8e
+	 */
+
+	jpeg_enc0: video-codec@fdba0000 {
+		compatible = "rockchip,rk3588-vepu121", "rockchip,rk3568-vepu";
+		reg = <0x0 0xfdba0000 0x0 0x800>;
+		interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH 0>;
+		clocks = <&cru ACLK_JPEG_ENCODER0>, <&cru HCLK_JPEG_ENCODER0>;
+		clock-names = "aclk", "hclk";
+		iommus = <&jpeg_enc0_mmu>;
+		power-domains = <&power RK3588_PD_VDPU>;
+	};
+
+	jpeg_enc0_mmu: iommu@fdba0800 {
+		compatible = "rockchip,rk3588-iommu", "rockchip,rk3568-iommu";
+		reg = <0x0 0xfdba0800 0x0 0x40>;
+		interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH 0>;
+		clocks = <&cru ACLK_JPEG_ENCODER0>, <&cru HCLK_JPEG_ENCODER0>;
+		clock-names = "aclk", "iface";
+		power-domains = <&power RK3588_PD_VDPU>;
+		#iommu-cells = <0>;
+	};
+
 	av1d: video-codec@fdc70000 {
 		compatible = "rockchip,rk3588-av1-vpu";
 		reg = <0x0 0xfdc70000 0x0 0x800>;
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] media: dt-binding: media: Document rk3588’s VEPU121
  2024-04-12 15:15 ` [PATCH v3 1/2] media: dt-binding: media: Document rk3588’s VEPU121 Emmanuel Gil Peyrot
@ 2024-04-13 21:22   ` Krzysztof Kozlowski
  2024-04-15 16:49     ` Conor Dooley
  0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-13 21:22 UTC (permalink / raw)
  To: Emmanuel Gil Peyrot, linux-kernel
  Cc: Ezequiel Garcia, Philipp Zabel, Mauro Carvalho Chehab,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	Joerg Roedel, Will Deacon, Robin Murphy, Sebastian Reichel,
	Cristian Ciocaltea, Dragan Simic, Shreeya Patel, Chris Morgan,
	Andy Yan, Nicolas Frattaroli, linux-media, linux-rockchip,
	devicetree, linux-arm-kernel, iommu

On 12/04/2024 17:15, Emmanuel Gil Peyrot wrote:
> This encoder-only device is present four times on this SoC, and should
> support everything the rk3568 vepu supports (so JPEG, H.264 and VP8
> encoding).
> 
> According to the TRM[1], there is also the VEPU580 encoder which
> supports H.264 and H.265, and various VDPU* decoders, of which only the
> VDPU981 is currently supported.  This patch describes only the VEPU121.
> 
> [1] https://github.com/FanX-Tek/rk3588-TRM-and-Datasheet
> 
> Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>

So you ignored all the tags? No one will pick up your patch if you are
going to keep ignoring them...

Subject: drop the second, redundant "media".

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] media: dt-binding: media: Document rk3588’s VEPU121
  2024-04-13 21:22   ` Krzysztof Kozlowski
@ 2024-04-15 16:49     ` Conor Dooley
  0 siblings, 0 replies; 5+ messages in thread
From: Conor Dooley @ 2024-04-15 16:49 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Emmanuel Gil Peyrot, linux-kernel, Ezequiel Garcia,
	Philipp Zabel, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, Joerg Roedel,
	Will Deacon, Robin Murphy, Sebastian Reichel, Cristian Ciocaltea,
	Dragan Simic, Shreeya Patel, Chris Morgan, Andy Yan,
	Nicolas Frattaroli, linux-media, linux-rockchip, devicetree,
	linux-arm-kernel, iommu

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

On Sat, Apr 13, 2024 at 11:22:51PM +0200, Krzysztof Kozlowski wrote:
> On 12/04/2024 17:15, Emmanuel Gil Peyrot wrote:
> > This encoder-only device is present four times on this SoC, and should
> > support everything the rk3568 vepu supports (so JPEG, H.264 and VP8
> > encoding).
> > 
> > According to the TRM[1], there is also the VEPU580 encoder which
> > supports H.264 and H.265, and various VDPU* decoders, of which only the
> > VDPU981 is currently supported.  This patch describes only the VEPU121.
> > 
> > [1] https://github.com/FanX-Tek/rk3588-TRM-and-Datasheet
> > 
> > Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
> 
> So you ignored all the tags? No one will pick up your patch if you are
> going to keep ignoring them...

If Nicolas's concern about breakage due to exposing multiple video
devices was addressed:
Acked-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-15 16:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12 15:15 [PATCH v3 0/2] Enable JPEG encoding on rk3588 Emmanuel Gil Peyrot
2024-04-12 15:15 ` [PATCH v3 1/2] media: dt-binding: media: Document rk3588’s VEPU121 Emmanuel Gil Peyrot
2024-04-13 21:22   ` Krzysztof Kozlowski
2024-04-15 16:49     ` Conor Dooley
2024-04-12 15:15 ` [PATCH v3 2/2] arm64: dts: rockchip: Add one VEPU121 to rk3588 Emmanuel Gil Peyrot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).