Skip to contentSkip to conversation

media: HEVC: RPS clean up

PATCH Superseded Benjamin Gaignard 3 participants 14 messages Oct 12, 2021 – Nov 10, 2021

Subsystems (7)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover media: HEVC: RPS clean up

This series aims to clean up Reference Picture Set usage and flags.

Long term flag was named with RPS prefix while it is not used for RPS but for mark long term references in DBP. Remane it and remove the two other useless RPS flags.

Clarify documentation about RPS lists content and make sure that Hantro driver use them correctly (i.e without look up in DBP).

These patches are the last in my backlog impacting HEVC uAPI. From my point of view, once they get merged, you could start talking about how move HEVC uAPI to stable.

version 2:
- change DPB field name from rps to flags

Please note that the only purpose of commits 3 and 4 is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge them.

GStreamer HEVC plugin merge request can be found here:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079

With those piece of code fluster score is 77/147.

Benjamin

Benjamin Gaignard (4):
media: hevc: Remove RPS named flags
media: hevc: Embedded indexes in RPS
media: hantro: Use syscon instead of 'ctrl' register
arm64: dts: imx8mq: Add node to G2 hardware

 .../media/v4l/ext-ctrls-codec.rst             | 14 +++---
 arch/arm64/boot/dts/freescale/imx8mq.dtsi     | 43 +++++++++++++----
 drivers/staging/media/hantro/hantro.h         |  5 +-
 .../staging/media/hantro/hantro_g2_hevc_dec.c | 27 +++--------
 drivers/staging/media/hantro/imx8m_vpu_hw.c   | 48 ++++++++++++-------
 .../staging/media/sunxi/cedrus/cedrus_h265.c  |  2 +-
 include/media/hevc-ctrls.h                    |  6 +--
 7 files changed, 84 insertions(+), 61 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/4 media: hevc: Remove RPS named flags

Marking a picture as long-term reference is valid for DPB but not for RPS. Change flag name to match with it description in HEVC spec chapiter "8.3.2 Decoding process for reference picture set".
Remove the other unused RPS flags.

---
version 2:
- change DPB field name from rps to flags

 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 8 +++-----
 drivers/staging/media/hantro/hantro_g2_hevc_dec.c         | 2 +-
 drivers/staging/media/sunxi/cedrus/cedrus_h265.c          | 2 +-
 include/media/hevc-ctrls.h                                | 6 ++----
 4 files changed, 7 insertions(+), 11 deletions(-)
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +3 -5
index e141f0e4eec9..38da33e61c3d 100644
@@ -3166,11 +3166,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
 	:c:func:`v4l2_timeval_to_ns()` function to convert the struct
 	:c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
     * - __u8
-      - ``rps``
-      - The reference set for the reference frame
-        (V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_BEFORE,
-        V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_AFTER or
-        V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR)
+      - ``flags``
+      - Long term flag for the reference frame
+        (V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE)
     * - __u8
       - ``field_pic``
       - Whether the reference is a field picture or a frame.
drivers/staging/media/hantro/hantro_g2_hevc_dec.c +1 -1
index 76a921163b9a..bbf71dcea099 100644
@@ -445,7 +445,7 @@ static int set_ref(struct hantro_ctx *ctx)
 		chroma_addr = luma_addr + cr_offset;
 		mv_addr = luma_addr + mv_offset;
 
-		if (dpb[i].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR)
+		if (dpb[i].flags == V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE)
 			dpb_longterm_e |= BIT(V4L2_HEVC_DPB_ENTRIES_NUM_MAX - 1 - i);
 
 		hantro_write_addr(vpu, G2_REG_ADDR_REF(i), luma_addr);
drivers/staging/media/sunxi/cedrus/cedrus_h265.c +1 -1
index 3d9561d4aadb..1edfc3823a57 100644
@@ -169,7 +169,7 @@ static void cedrus_h265_ref_pic_list_write(struct cedrus_dev *dev,
 		unsigned int index = list[i];
 		u8 value = list[i];
 
-		if (dpb[index].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR)
+		if (dpb[index].flags == V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE)
 			value |= VE_DEC_H265_SRAM_REF_PIC_LIST_LT_REF;
 
 		/* Each SRAM word gathers up to 4 references. */
include/media/hevc-ctrls.h +2 -4
index ef63bc205756..01ccda48d8c5 100644
@@ -127,15 +127,13 @@ struct v4l2_ctrl_hevc_pps {
 	__u64	flags;
 };
 
-#define V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_BEFORE	0x01
-#define V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_AFTER	0x02
-#define V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR		0x03
+#define V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE	0x01
 
 #define V4L2_HEVC_DPB_ENTRIES_NUM_MAX		16
 
 struct v4l2_hevc_dpb_entry {
 	__u64	timestamp;
-	__u8	rps;
+	__u8	flags;
 	__u8	field_pic;
 	__u16	pic_order_cnt[2];
 	__u8	padding[2];
Signature · 1 line
2.30.2
maintainer Acked-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] media: hevc: Remove RPS named flags

Hi Benjamin,

Dne torek, 12. oktober 2021 ob 16:35:49 CET je Benjamin Gaignard napisal(a):

Quoted 2 lines

Marking a picture as long-term reference is valid for DPB but not for RPS. Change flag name to match with it description in HEVC spec chapiter

chapiter -> chapter

Quoted 8 lines

"8.3.2 Decoding process for reference picture set". Remove the other unused RPS flags.

---
version 2:
- change DPB field name from rps to flags

Review

Quoted 7 lines
 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 8 +++-----
 drivers/staging/media/hantro/hantro_g2_hevc_dec.c         | 2 +-
 drivers/staging/media/sunxi/cedrus/cedrus_h265.c          | 2 +-
 include/media/hevc-ctrls.h                                | 6 ++----
 4 files changed, 7 insertions(+), 11 deletions(-)
(quoted diff) renamed from Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +0 -0

Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst

drivers/

Quoted 19 lines

index e141f0e4eec9..38da33e61c3d 100644

Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +3 -5
@@ -3166,11 +3166,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
 	:c:func:`v4l2_timeval_to_ns()` function to convert the struct
 	:c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
     * - __u8
-      - ``rps``
-      - The reference set for the reference frame
-        (V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_BEFORE,
-        V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_AFTER or
-        V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR)
+      - ``flags``
+      - Long term flag for the reference frame
+        (V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE)
     * - __u8
       - ``field_pic``
       - Whether the reference is a field picture or a frame.
drivers/ renamed from drivers/staging/media/hantro/hantro_g2_hevc_dec.c +0 -0

staging/media/hantro/hantro_g2_hevc_dec.c

drivers/staging/media/hantro/hantro_g2_hevc_dec.c static int set_ref(struct hantro_ctx *ctx) · line 448

Quoted 9 lines

index 76a921163b9a..bbf71dcea099 100644

drivers/staging/media/hantro/hantro_g2_hevc_dec.c +1 -1
@@ -445,7 +445,7 @@ static int set_ref(struct hantro_ctx *ctx)
 		chroma_addr = luma_addr + cr_offset;
 		mv_addr = luma_addr + mv_offset;
 
-		if (dpb[i].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR)
+		if (dpb[i].flags == 

V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE)

drivers/staging/media/hantro/hantro_g2_hevc_dec.c static int set_ref(struct hantro_ctx *ctx) · line 449

Quoted 1 line
drivers/staging/media/hantro/hantro_g2_hevc_dec.c +0 -0
 			dpb_longterm_e |= 

BIT(V4L2_HEVC_DPB_ENTRIES_NUM_MAX - 1 - i);

drivers/

Quoted 3 lines
drivers/staging/media/hantro/hantro_g2_hevc_dec.c +0 -0
 		hantro_write_addr(vpu, G2_REG_ADDR_REF(i), luma_addr);
drivers/ renamed from drivers/staging/media/sunxi/cedrus/cedrus_h265.c +0 -0

staging/media/sunxi/cedrus/cedrus_h265.c

drivers/staging/media/sunxi/cedrus/cedrus_h265.c static void cedrus_h265_ref_pic_list_write(struct

Quoted 4 lines

index 3d9561d4aadb..1edfc3823a57 100644

drivers/staging/media/sunxi/cedrus/cedrus_h265.c +0 -0
@@ -169,7 +169,7 @@ static void cedrus_h265_ref_pic_list_write(struct 

cedrus_dev *dev,

drivers/staging/media/sunxi/cedrus/cedrus_h265.c static void cedrus_h265_ref_pic_list_write(struct cedrus_dev *dev,

Quoted 5 lines
drivers/staging/media/sunxi/cedrus/cedrus_h265.c +1 -1
 		unsigned int index = list[i];
 		u8 value = list[i];
 
-		if (dpb[index].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR)
+		if (dpb[index].flags == 

V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE)

Flags are usually checked with "&", same goes in Hantro case.

Once all fixed, this patch is:

Best regards,
Jernej

drivers/staging/media/sunxi/cedrus/cedrus_h265.c static void cedrus_h265_ref_pic_list_write(struct · line 173

Quoted 1 line
drivers/staging/media/sunxi/cedrus/cedrus_h265.c +0 -0
 			value |= 

VE_DEC_H265_SRAM_REF_PIC_LIST_LT_REF;

Quoted 28 lines
drivers/staging/media/sunxi/cedrus/cedrus_h265.c +0 -0
 		/* Each SRAM word gathers up to 4 references. */
include/media/hevc-ctrls.h +2 -4
index ef63bc205756..01ccda48d8c5 100644
@@ -127,15 +127,13 @@ struct v4l2_ctrl_hevc_pps {
 	__u64	flags;
 };
 
-#define V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_BEFORE	0x01
-#define V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_AFTER	0x02
-#define V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR		0x03
+#define V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE	0x01
 
 #define V4L2_HEVC_DPB_ENTRIES_NUM_MAX		16
 
 struct v4l2_hevc_dpb_entry {
 	__u64	timestamp;
-	__u8	rps;
+	__u8	flags;
 	__u8	field_pic;
 	__u16	pic_order_cnt[2];
 	__u8	padding[2];
Signature · 1 line
2.30.2
#3 lore raw

PATCH v2 2/4 media: hevc: Embedded indexes in RPS

In reply to Benjamin Gaignard

Reference Picture Set lists provide indexes of short and long term reference in DBP array.
Fix Hantro to not do a look up in DBP entries.
Make documentation more clear about it.

---
 .../media/v4l/ext-ctrls-codec.rst             |  6 ++---
 .../staging/media/hantro/hantro_g2_hevc_dec.c | 25 +++++--------------
 2 files changed, 9 insertions(+), 22 deletions(-)
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +3 -3
index 38da33e61c3d..b12ad5b3eaba 100644
@@ -3381,15 +3381,15 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
     * - __u8
       - ``poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
       - PocStCurrBefore as described in section 8.3.2 "Decoding process for reference
-        picture set.
+        picture set": provides the index of the short term before references in DPB array.
     * - __u8
       - ``poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
       - PocStCurrAfter as described in section 8.3.2 "Decoding process for reference
-        picture set.
+        picture set": provides the index of the short term after references in DPB array.
     * - __u8
       - ``poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
       - PocLtCurr as described in section 8.3.2 "Decoding process for reference
-        picture set.
+        picture set": provides the index of the long term references in DPB array.
     * - __u64
       - ``flags``
       - See :ref:`Decode Parameters Flags <hevc_decode_params_flags>`
drivers/staging/media/hantro/hantro_g2_hevc_dec.c +6 -19
index bbf71dcea099..33fe502de447 100644
@@ -269,24 +269,11 @@ static void set_params(struct hantro_ctx *ctx)
 	hantro_reg_write(vpu, &g2_apf_threshold, 8);
 }
 
-static int find_ref_pic_index(const struct v4l2_hevc_dpb_entry *dpb, int pic_order_cnt)
-{
-	int i;
-
-	for (i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
-		if (dpb[i].pic_order_cnt[0] == pic_order_cnt)
-			return i;
-	}
-
-	return 0x0;
-}
-
 static void set_ref_pic_list(struct hantro_ctx *ctx)
 {
 	const struct hantro_hevc_dec_ctrls *ctrls = &ctx->hevc_dec.ctrls;
 	struct hantro_dev *vpu = ctx->dev;
 	const struct v4l2_ctrl_hevc_decode_params *decode_params = ctrls->decode_params;
-	const struct v4l2_hevc_dpb_entry *dpb = decode_params->dpb;
 	u32 list0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] = {};
 	u32 list1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] = {};
 	static const struct hantro_reg ref_pic_regs0[] = {
@@ -330,11 +317,11 @@ static void set_ref_pic_list(struct hantro_ctx *ctx)
 	/* List 0 contains: short term before, short term after and long term */
 	j = 0;
 	for (i = 0; i < decode_params->num_poc_st_curr_before && j < ARRAY_SIZE(list0); i++)
-		list0[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_before[i]);
+		list0[j++] = decode_params->poc_st_curr_before[i];
 	for (i = 0; i < decode_params->num_poc_st_curr_after && j < ARRAY_SIZE(list0); i++)
-		list0[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_after[i]);
+		list0[j++] = decode_params->poc_st_curr_after[i];
 	for (i = 0; i < decode_params->num_poc_lt_curr && j < ARRAY_SIZE(list0); i++)
-		list0[j++] = find_ref_pic_index(dpb, decode_params->poc_lt_curr[i]);
+		list0[j++] = decode_params->poc_lt_curr[i];
 
 	/* Fill the list, copying over and over */
 	i = 0;
@@ -343,11 +330,11 @@ static void set_ref_pic_list(struct hantro_ctx *ctx)
 
 	j = 0;
 	for (i = 0; i < decode_params->num_poc_st_curr_after && j < ARRAY_SIZE(list1); i++)
-		list1[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_after[i]);
+		list1[j++] = decode_params->poc_st_curr_after[i];
 	for (i = 0; i < decode_params->num_poc_st_curr_before && j < ARRAY_SIZE(list1); i++)
-		list1[j++] = find_ref_pic_index(dpb, decode_params->poc_st_curr_before[i]);
+		list1[j++] = decode_params->poc_st_curr_before[i];
 	for (i = 0; i < decode_params->num_poc_lt_curr && j < ARRAY_SIZE(list1); i++)
-		list1[j++] = find_ref_pic_index(dpb, decode_params->poc_lt_curr[i]);
+		list1[j++] = decode_params->poc_lt_curr[i];
 
 	i = 0;
 	while (j < ARRAY_SIZE(list1))
Signature · 1 line
2.30.2
#4 lore raw

PATCH v2 3/4 media: hantro: Use syscon instead of 'ctrl' register

In reply to Benjamin Gaignard

In order to be able to share the control hardware block between VPUs use a syscon instead a ioremap it in the driver. To keep the compatibility with older DT if 'nxp,imx8mq-vpu-ctrl' phandle is not found look at 'ctrl' reg-name.
With the method it becomes useless to provide a list of register names so remove it.

Please note that the only purpose of this commit is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge it.

---
 drivers/staging/media/hantro/hantro.h       |  5 ++-
 drivers/staging/media/hantro/imx8m_vpu_hw.c | 48 +++++++++++++--------
 2 files changed, 34 insertions(+), 19 deletions(-)
drivers/staging/media/hantro/hantro.h +3 -2
index c2e2dca38628..20478988a55e 100644
@@ -13,6 +13,7 @@
 #define HANTRO_H_
 
 #include <linux/platform_device.h>
+#include <linux/regmap.h>
 #include <linux/videodev2.h>
 #include <linux/wait.h>
 #include <linux/clk.h>
@@ -170,7 +171,7 @@ hantro_vdev_to_func(struct video_device *vdev)
  * @reg_bases:		Mapped addresses of VPU registers.
  * @enc_base:		Mapped address of VPU encoder register for convenience.
  * @dec_base:		Mapped address of VPU decoder register for convenience.
- * @ctrl_base:		Mapped address of VPU control block.
+ * @ctrl_base:		Regmap of VPU control block.
  * @vpu_mutex:		Mutex to synchronize V4L2 calls.
  * @irqlock:		Spinlock to synchronize access to data structures
  *			shared with interrupt handlers.
@@ -189,7 +190,7 @@ struct hantro_dev {
 	void __iomem **reg_bases;
 	void __iomem *enc_base;
 	void __iomem *dec_base;
-	void __iomem *ctrl_base;
+	struct regmap *ctrl_base;
 
 	struct mutex vpu_mutex;	/* video_device lock */
 	spinlock_t irqlock;
drivers/staging/media/hantro/imx8m_vpu_hw.c +31 -17

83 lines not on this page · raw message

Signature · 1 line
2.30.2
#5 lore raw

PATCH v2 4/4 arm64: dts: imx8mq: Add node to G2 hardware

In reply to Benjamin Gaignard

Split the VPU node in two: one for G1 and one for G2 since they are different hardware blocks.
Add syscon for the hardware control block.
Remove the reg-names property that is useless.
Each VPU node only needs one interrupt.
Change G2 assigned clock to match the specification.
In both nodes all the clocks need to be assigned to make sure that the control block will be correctly clocked even if only one device node is enabled.

Please note that the only purpose of this commit is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge it.

---
 arch/arm64/boot/dts/freescale/imx8mq.dtsi | 43 ++++++++++++++++++-----
 1 file changed, 34 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/freescale/imx8mq.dtsi +34 -9
index 4066b1612655..9125e52147df 100644
@@ -1432,15 +1432,16 @@ usb3_phy1: usb-phy@382f0040 {
 			status = "disabled";
 		};
 
-		vpu: video-codec@38300000 {
+		vpu_ctrl: syscon@38320000 {
+			compatible = "nxp,imx8mq-vpu-ctrl", "syscon";
+			reg = <0x38320000 0x10000>;
+		};
+
+		vpu_g1: video-codec@38300000 {
 			compatible = "nxp,imx8mq-vpu";
-			reg = <0x38300000 0x10000>,
-			      <0x38310000 0x10000>,
-			      <0x38320000 0x10000>;
-			reg-names = "g1", "g2", "ctrl";
-			interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
-				     <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
-			interrupt-names = "g1", "g2";
+			reg = <0x38300000 0x10000>;
+			interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "g1";
 			clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>,
 				 <&clk IMX8MQ_CLK_VPU_G2_ROOT>,
 				 <&clk IMX8MQ_CLK_VPU_DEC_ROOT>;
@@ -1453,9 +1454,33 @@ vpu: video-codec@38300000 {
 						 <&clk IMX8MQ_VPU_PLL_OUT>,
 						 <&clk IMX8MQ_SYS1_PLL_800M>,
 						 <&clk IMX8MQ_VPU_PLL>;
-			assigned-clock-rates = <600000000>, <600000000>,
+			assigned-clock-rates = <600000000>, <300000000>,
+					       <800000000>, <0>;
+			power-domains = <&pgc_vpu>;
+			nxp,imx8m-vpu-ctrl = <&vpu_ctrl>;
+		};
+
+		vpu_g2: video-codec@38310000 {
+			compatible = "nxp,imx8mq-vpu-g2";
+			reg = <0x38310000 0x10000>;
+			interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "g2";
+			clocks = <&clk IMX8MQ_CLK_VPU_G1_ROOT>,
+				 <&clk IMX8MQ_CLK_VPU_G2_ROOT>,
+				 <&clk IMX8MQ_CLK_VPU_DEC_ROOT>;
+			clock-names = "g1", "g2",  "bus";
+			assigned-clocks = <&clk IMX8MQ_CLK_VPU_G1>,
+					  <&clk IMX8MQ_CLK_VPU_G2>,
+					  <&clk IMX8MQ_CLK_VPU_BUS>,
+					  <&clk IMX8MQ_VPU_PLL_BYPASS>;
+			assigned-clock-parents = <&clk IMX8MQ_VPU_PLL_OUT>,
+						 <&clk IMX8MQ_VPU_PLL_OUT>,
+						 <&clk IMX8MQ_SYS1_PLL_800M>,
+						 <&clk IMX8MQ_VPU_PLL>;
+			assigned-clock-rates = <600000000>, <300000000>,
 					       <800000000>, <0>;
 			power-domains = <&pgc_vpu>;
+			nxp,imx8m-vpu-ctrl = <&vpu_ctrl>;
 		};
 
 		pcie0: pcie@33800000 {
Signature · 1 line
2.30.2
maintainer
#6 lore raw
In reply to Benjamin Gaignard

Hi Benjamin!

Dne torek, 12. oktober 2021 ob 16:35:48 CEST je Benjamin Gaignard napisal(a):

Quoted 6 lines

This series aims to clean up Reference Picture Set usage and flags.

Long term flag was named with RPS prefix while it is not used for RPS but for mark long term references in DBP. Remane it and remove the two other useless RPS flags.

Quoted 6 lines

Clarify documentation about RPS lists content and make sure that Hantro driver use them correctly (i.e without look up in DBP).

These patches are the last in my backlog impacting HEVC uAPI. From my point of view, once they get merged, you could start talking about how move HEVC uAPI to stable.

With your changes, HEVC uAPI controls still won't be complete. Cedrus needs entry point control, which in turn needs dynamic array support. I'm a bit lazy implementing that control, but I guess I can take a look in a month or so. rkvdec also needs more fields for HEVC. With patches collected here:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/
patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch fluster HEVC test score is reportedly 121/135 (8-bit tests only).

I would certainly wait with moving HEVC uAPI to stable.

Best regards,
Jernej

Quoted 34 lines

version 2:
- change DPB field name from rps to flags

Please note that the only purpose of commits 3 and 4 is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge them.

GStreamer HEVC plugin merge request can be found here:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079

With those piece of code fluster score is 77/147.

Benjamin

Benjamin Gaignard (4):
media: hevc: Remove RPS named flags
media: hevc: Embedded indexes in RPS
media: hantro: Use syscon instead of 'ctrl' register
arm64: dts: imx8mq: Add node to G2 hardware

 .../media/v4l/ext-ctrls-codec.rst             | 14 +++---
 arch/arm64/boot/dts/freescale/imx8mq.dtsi     | 43 +++++++++++++----
 drivers/staging/media/hantro/hantro.h         |  5 +-
 .../staging/media/hantro/hantro_g2_hevc_dec.c | 27 +++--------
 drivers/staging/media/hantro/imx8m_vpu_hw.c   | 48 ++++++++++++-------
 .../staging/media/sunxi/cedrus/cedrus_h265.c  |  2 +-
 include/media/hevc-ctrls.h                    |  6 +--
 7 files changed, 84 insertions(+), 61 deletions(-)
Signature · 1 line
2.30.2
#7 lore raw

Le 12/10/2021 à 17:34, Jernej Škrabec a écrit :

Quoted 15 lines

Hi Benjamin!

Dne torek, 12. oktober 2021 ob 16:35:48 CEST je Benjamin Gaignard napisal(a):

Quoted 6 lines

This series aims to clean up Reference Picture Set usage and flags.

Long term flag was named with RPS prefix while it is not used for RPS but for mark long term references in DBP. Remane it and remove the two other useless RPS flags.

Quoted 6 lines

Clarify documentation about RPS lists content and make sure that Hantro driver use them correctly (i.e without look up in DBP).

These patches are the last in my backlog impacting HEVC uAPI.
From my point of view, once they get merged, you could start talking
about how move HEVC uAPI to stable.

Quoted 7 lines

With your changes, HEVC uAPI controls still won't be complete. Cedrus needs entry point control, which in turn needs dynamic array support. I'm a bit lazy implementing that control, but I guess I can take a look in a month or so. rkvdec also needs more fields for HEVC. With patches collected here:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/
patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch fluster HEVC test score is reportedly 121/135 (8-bit tests only).

Hi Jernej,

Thanks for your feedback, getting a list of missing items in HEVC uAPI
will definitively help to fill the hope.
The patch you mention for rkvdec are already merged in mainline kernel (at
least for uAPI part).
Cedrus needs are about num_entry_point_offsets, offset_len_minus1 and entry_point_offset_minus1[ i ] in HEVC specifications ?

Regards,
Benjamin

Quoted 40 lines

I would certainly wait with moving HEVC uAPI to stable.

Best regards,
Jernej

Quoted 33 lines

version 2:
- change DPB field name from rps to flags

Please note that the only purpose of commits 3 and 4 is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge them.

GStreamer HEVC plugin merge request can be found here:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079

With those piece of code fluster score is 77/147.

Benjamin

Benjamin Gaignard (4):
media: hevc: Remove RPS named flags
media: hevc: Embedded indexes in RPS
media: hantro: Use syscon instead of 'ctrl' register
arm64: dts: imx8mq: Add node to G2 hardware

  .../media/v4l/ext-ctrls-codec.rst             | 14 +++---
  arch/arm64/boot/dts/freescale/imx8mq.dtsi     | 43 +++++++++++++----
  drivers/staging/media/hantro/hantro.h         |  5 +-
  .../staging/media/hantro/hantro_g2_hevc_dec.c | 27 +++--------
  drivers/staging/media/hantro/imx8m_vpu_hw.c   | 48 ++++++++++++-------
  .../staging/media/sunxi/cedrus/cedrus_h265.c  |  2 +-
  include/media/hevc-ctrls.h                    |  6 +--
  7 files changed, 84 insertions(+), 61 deletions(-)
Signature · 1 line
2.30.2
maintainer
#8 lore raw
CC Alex Bee

Alex, please take a look to these patches too.

Dne torek, 12. oktober 2021 ob 17:57:50 CEST je Benjamin Gaignard napisal(a):

Quoted 5 lines · Jernej Škrabec
Quoted 3 lines

Hi Benjamin!

Dne torek, 12. oktober 2021 ob 16:35:48 CEST je Benjamin Gaignard

napisal(a):

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This series aims to clean up Reference Picture Set usage and flags.

Long term flag was named with RPS prefix while it is not used for RPS but for mark long term references in DBP. Remane it and remove the two other useless RPS flags.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Clarify documentation about RPS lists content and make sure that Hantro driver use them correctly (i.e without look up in DBP).

These patches are the last in my backlog impacting HEVC uAPI.
From my point of view, once they get merged, you could start talking
about how move HEVC uAPI to stable.

With your changes, HEVC uAPI controls still won't be complete. Cedrus

needs

Quoted 1 line
Quoted 1 line

entry point control, which in turn needs dynamic array support. I'm a bit

lazy

Quoted 6 lines
Quoted 5 lines

implementing that control, but I guess I can take a look in a month or so. rkvdec also needs more fields for HEVC. With patches collected here:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/
patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch fluster HEVC test score is reportedly 121/135 (8-bit tests only).

Quoted 6 lines

Hi Jernej,

Thanks for your feedback, getting a list of missing items in HEVC uAPI will definitively help to fill the hope.
The patch you mention for rkvdec are already merged in mainline kernel (at least for uAPI part).

Are they? What about:
video_parameter_set_id
seq_parameter_set_id
pic_parameter_set_id
short_term_ref_pic_set_size
long_term_ref_pic_set_size

At least I don't see them in linux-next. Maybe that information can be obtained in some other way?

Quoted 1 line

Cedrus needs are about num_entry_point_offsets, offset_len_minus1 and

entry_point_offset_minus1[ i ]

Quoted 1 line

in HEVC specifications ?

Yes, Cedrus needs to know whole list of entry points. I don't think we need to worry about offset_len_minus1, list could be pre-processed - just number of entry points and their values.

Best regards,
Jernej

Quoted 45 lines

Regards,
Benjamin

Quoted 40 lines

I would certainly wait with moving HEVC uAPI to stable.

Best regards,
Jernej

Quoted 33 lines

version 2:
- change DPB field name from rps to flags

Please note that the only purpose of commits 3 and 4 is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge them.

GStreamer HEVC plugin merge request can be found here:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079

With those piece of code fluster score is 77/147.

Benjamin

Benjamin Gaignard (4):
media: hevc: Remove RPS named flags
media: hevc: Embedded indexes in RPS
media: hantro: Use syscon instead of 'ctrl' register
arm64: dts: imx8mq: Add node to G2 hardware

  .../media/v4l/ext-ctrls-codec.rst             | 14 +++---
  arch/arm64/boot/dts/freescale/imx8mq.dtsi     | 43 +++++++++++++----
  drivers/staging/media/hantro/hantro.h         |  5 +-
  .../staging/media/hantro/hantro_g2_hevc_dec.c | 27 +++--------
  drivers/staging/media/hantro/imx8m_vpu_hw.c   | 48 ++++++++++++-------
  .../staging/media/sunxi/cedrus/cedrus_h265.c  |  2 +-
  include/media/hevc-ctrls.h                    |  6 +--
  7 files changed, 84 insertions(+), 61 deletions(-)
Signature · 1 line
2.30.2
#9 lore raw

Hi Benjamin, Jernej
Am 12.10.21 um 18:08 schrieb Jernej Škrabec:

Quoted 3 lines
CC Alex Bee

Alex, please take a look to these patches too.

These patches don't remove anything that would be need for rkvdec hevc - but indeed - we need some more:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch#L242-L305

v4l2_ctrl_hevc_sps:
__u8 video_parameter_set_id
__u8 seq_parameter_set_id

v4l2_ctrl_hevc_pps:
__u8 pic_parameter_set_id
__u16 short_term_ref_pic_set_size
__u16 long_term_ref_pic_set_size

As far as I can see, they are all part of the spec and should be therefore good to go in the uapi.

As you might now, even rkvdec is a frame-based decoder, it doesn't fully parse slice headers in HW for HEVC and we need to set references in SW which requires looping over the slices. Downstream we have a hack to give num_slices in v4l2_ctrl_hevc_sps for doing that. That could fully go away, if V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS could get dynamic array control support and would make upstreaming this a lot easier - as far as I'm concered this would be required for RPi HEVC decoder as well. As a last resort we could also implement a HW specifc control à la
V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP - but I'd like to avoid that, knowing it would certainly be better from performance pov.

Alex.

Quoted 105 lines

Dne torek, 12. oktober 2021 ob 17:57:50 CEST je Benjamin Gaignard napisal(a):

Quoted 5 lines · Jernej Škrabec
Quoted 3 lines

Hi Benjamin!

Dne torek, 12. oktober 2021 ob 16:35:48 CEST je Benjamin Gaignard

napisal(a):

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This series aims to clean up Reference Picture Set usage and flags.

Long term flag was named with RPS prefix while it is not used for RPS but for mark long term references in DBP. Remane it and remove the two other useless RPS flags.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Clarify documentation about RPS lists content and make sure that Hantro driver use them correctly (i.e without look up in DBP).

These patches are the last in my backlog impacting HEVC uAPI.
From my point of view, once they get merged, you could start talking
about how move HEVC uAPI to stable.

With your changes, HEVC uAPI controls still won't be complete. Cedrus

needs

Quoted 1 line
Quoted 1 line

entry point control, which in turn needs dynamic array support. I'm a bit

lazy

Quoted 6 lines
Quoted 5 lines

implementing that control, but I guess I can take a look in a month or so. rkvdec also needs more fields for HEVC. With patches collected here:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/
patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch fluster HEVC test score is reportedly 121/135 (8-bit tests only).

Quoted 6 lines

Hi Jernej,

Thanks for your feedback, getting a list of missing items in HEVC uAPI will definitively help to fill the hope.
The patch you mention for rkvdec are already merged in mainline kernel (at least for uAPI part).

Are they? What about:
video_parameter_set_id
seq_parameter_set_id
pic_parameter_set_id
short_term_ref_pic_set_size
long_term_ref_pic_set_size

At least I don't see them in linux-next. Maybe that information can be obtained in some other way?

Quoted 1 line

Cedrus needs are about num_entry_point_offsets, offset_len_minus1 and

entry_point_offset_minus1[ i ]

Quoted 1 line

in HEVC specifications ?

Yes, Cedrus needs to know whole list of entry points. I don't think we need to worry about offset_len_minus1, list could be pre-processed - just number of entry points and their values.

Best regards,
Jernej

Quoted 45 lines

Regards,
Benjamin

Quoted 40 lines

I would certainly wait with moving HEVC uAPI to stable.

Best regards,
Jernej

Quoted 33 lines

version 2:
- change DPB field name from rps to flags

Please note that the only purpose of commits 3 and 4 is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge them.

GStreamer HEVC plugin merge request can be found here:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079

With those piece of code fluster score is 77/147.

Benjamin

Benjamin Gaignard (4):
media: hevc: Remove RPS named flags
media: hevc: Embedded indexes in RPS
media: hantro: Use syscon instead of 'ctrl' register
arm64: dts: imx8mq: Add node to G2 hardware

   .../media/v4l/ext-ctrls-codec.rst             | 14 +++---
   arch/arm64/boot/dts/freescale/imx8mq.dtsi     | 43 +++++++++++++----
   drivers/staging/media/hantro/hantro.h         |  5 +-
   .../staging/media/hantro/hantro_g2_hevc_dec.c | 27 +++--------
   drivers/staging/media/hantro/imx8m_vpu_hw.c   | 48 ++++++++++++-------
   .../staging/media/sunxi/cedrus/cedrus_h265.c  |  2 +-
   include/media/hevc-ctrls.h                    |  6 +--
   7 files changed, 84 insertions(+), 61 deletions(-)
Signature · 1 line
2.30.2
#10 lore raw

Le 15/10/2021 à 12:33, Alex Bee a écrit :

Quoted 14 lines

Hi Benjamin, Jernej
Am 12.10.21 um 18:08 schrieb Jernej Škrabec:

Quoted 3 lines
CC Alex Bee

Alex, please take a look to these patches too.

These patches don't remove anything that would be need for rkvdec hevc
- but indeed - we need some more:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch#L242-L305

v4l2_ctrl_hevc_sps:
__u8    video_parameter_set_id
__u8    seq_parameter_set_id

Quoted 6 lines

v4l2_ctrl_hevc_pps:
__u8    pic_parameter_set_id
__u16    short_term_ref_pic_set_size
__u16    long_term_ref_pic_set_size

As far as I can see, they are all part of the spec and should be therefore good to go in the uapi.

Do you have any plan to upstream these fields in HEVC uAPI ?

Regards,
Benjamin

Quoted 117 lines

As you might now, even rkvdec is a frame-based decoder, it doesn't fully parse slice headers in HW for HEVC and we need to set references in SW which requires looping over the slices. Downstream we have a hack to give num_slices in v4l2_ctrl_hevc_sps for doing that. That could fully go away, if V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS could get dynamic array control support and would make upstreaming this a lot easier - as far as I'm concered this would be required for RPi HEVC decoder as well. As a last resort we could also implement a HW specifc control à la
V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP - but I'd like to avoid that, knowing it would certainly be better from performance pov.

Alex.

Quoted 109 lines

Dne torek, 12. oktober 2021 ob 17:57:50 CEST je Benjamin Gaignard napisal(a):

Quoted 5 lines · Jernej Škrabec
Quoted 3 lines

Hi Benjamin!

Dne torek, 12. oktober 2021 ob 16:35:48 CEST je Benjamin Gaignard

napisal(a):

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This series aims to clean up Reference Picture Set usage and flags.

Long term flag was named with RPS prefix while it is not used for RPS but for mark long term references in DBP. Remane it and remove the two other useless RPS flags.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Clarify documentation about RPS lists content and make sure that Hantro driver use them correctly (i.e without look up in DBP).

These patches are the last in my backlog impacting HEVC uAPI. From my point of view, once they get merged, you could start talking about how move HEVC uAPI to stable.

With your changes, HEVC uAPI controls still won't be complete. Cedrus

needs

Quoted 1 line
Quoted 1 line

entry point control, which in turn needs dynamic array support. I'm a bit

lazy

Quoted 7 lines
Quoted 6 lines

implementing that control, but I guess I can take a look in a month or so. rkvdec also needs more fields for HEVC. With patches collected here:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/

patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch fluster HEVC test score is reportedly 121/135 (8-bit tests only).

Quoted 6 lines

Hi Jernej,

Thanks for your feedback, getting a list of missing items in HEVC uAPI will definitively help to fill the hope.
The patch you mention for rkvdec are already merged in mainline kernel (at least for uAPI part).

Are they? What about:
video_parameter_set_id
seq_parameter_set_id
pic_parameter_set_id
short_term_ref_pic_set_size
long_term_ref_pic_set_size

At least I don't see them in linux-next. Maybe that information can be obtained in some other way?

Quoted 1 line

Cedrus needs are about num_entry_point_offsets, offset_len_minus1 and

entry_point_offset_minus1[ i ]

Quoted 1 line

in HEVC specifications ?

Yes, Cedrus needs to know whole list of entry points. I don't think we need to worry about offset_len_minus1, list could be pre-processed - just number of entry points and their values.

Best regards,
Jernej

Quoted 48 lines

Regards,
Benjamin

Quoted 43 lines

I would certainly wait with moving HEVC uAPI to stable.

Best regards,
Jernej

Quoted 36 lines

version 2:
- change DPB field name from rps to flags

Please note that the only purpose of commits 3 and 4 is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge them.

GStreamer HEVC plugin merge request can be found here:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079

With those piece of code fluster score is 77/147.

Benjamin

Benjamin Gaignard (4):
    media: hevc: Remove RPS named flags
    media: hevc: Embedded indexes in RPS
    media: hantro: Use syscon instead of 'ctrl' register
    arm64: dts: imx8mq: Add node to G2 hardware

   .../media/v4l/ext-ctrls-codec.rst             | 14 +++--- arch/arm64/boot/dts/freescale/imx8mq.dtsi     | 43
+++++++++++++----
   drivers/staging/media/hantro/hantro.h         |  5 +- .../staging/media/hantro/hantro_g2_hevc_dec.c | 27 +++-------- drivers/staging/media/hantro/imx8m_vpu_hw.c   | 48
++++++++++++-------
   .../staging/media/sunxi/cedrus/cedrus_h265.c  |  2 +- include/media/hevc-ctrls.h                    |  6 +--

   7 files changed, 84 insertions(+), 61 deletions(-)
Signature · 1 line
2.30.2
#11 lore raw

Am 15.10.21 um 16:06 schrieb Benjamin Gaignard:

Quoted 15 lines

Le 15/10/2021 à 12:33, Alex Bee a écrit :

Quoted 13 lines

Hi Benjamin, Jernej
Am 12.10.21 um 18:08 schrieb Jernej Škrabec:

Quoted 3 lines
CC Alex Bee

Alex, please take a look to these patches too.

These patches don't remove anything that would be need for rkvdec hevc - but indeed - we need some more:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch#L242-L305

v4l2_ctrl_hevc_sps:
__u8    video_parameter_set_id
__u8    seq_parameter_set_id

Quoted 8 lines
Quoted 6 lines

v4l2_ctrl_hevc_pps:
__u8    pic_parameter_set_id
__u16    short_term_ref_pic_set_size
__u16    long_term_ref_pic_set_size

As far as I can see, they are all part of the spec and should be therefore good to go in the uapi.

Do you have any plan to upstream these fields in HEVC uAPI ?

I might be upstreaming them at some point, yes.

With this I just wanted to underline Jernej said: HEVC uapi is NOT ready to get unstaged yet.

Quoted 121 lines

Regards,
Benjamin

Quoted 117 lines

As you might now, even rkvdec is a frame-based decoder, it doesn't fully parse slice headers in HW for HEVC and we need to set references in SW which requires looping over the slices. Downstream we have a hack to give num_slices in v4l2_ctrl_hevc_sps for doing that. That could fully go away, if V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS could get dynamic array control support and would make upstreaming this a lot easier - as far as I'm concered this would be required for RPi HEVC decoder as well. As a last resort we could also implement a HW specifc control à la
V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP - but I'd like to avoid that, knowing it would certainly be better from performance pov.

Alex.

Quoted 109 lines

Dne torek, 12. oktober 2021 ob 17:57:50 CEST je Benjamin Gaignard napisal(a):

Quoted 5 lines · Jernej Škrabec
Quoted 3 lines

Hi Benjamin!

Dne torek, 12. oktober 2021 ob 16:35:48 CEST je Benjamin Gaignard

napisal(a):

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This series aims to clean up Reference Picture Set usage and flags.

Long term flag was named with RPS prefix while it is not used for RPS but for mark long term references in DBP. Remane it and remove the two other useless RPS flags.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Clarify documentation about RPS lists content and make sure that Hantro driver use them correctly (i.e without look up in DBP).

These patches are the last in my backlog impacting HEVC uAPI. From my point of view, once they get merged, you could start talking about how move HEVC uAPI to stable.

With your changes, HEVC uAPI controls still won't be complete. Cedrus

needs

Quoted 1 line
Quoted 1 line

entry point control, which in turn needs dynamic array support. I'm a bit

lazy

Quoted 7 lines
Quoted 6 lines

implementing that control, but I guess I can take a look in a month or so. rkvdec also needs more fields for HEVC. With patches collected here:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/

patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch fluster HEVC test score is reportedly 121/135 (8-bit tests only).

Quoted 6 lines

Hi Jernej,

Thanks for your feedback, getting a list of missing items in HEVC uAPI will definitively help to fill the hope.
The patch you mention for rkvdec are already merged in mainline kernel (at least for uAPI part).

Are they? What about:
video_parameter_set_id
seq_parameter_set_id
pic_parameter_set_id
short_term_ref_pic_set_size
long_term_ref_pic_set_size

At least I don't see them in linux-next. Maybe that information can be obtained in some other way?

Quoted 1 line

Cedrus needs are about num_entry_point_offsets, offset_len_minus1 and

entry_point_offset_minus1[ i ]

Quoted 1 line

in HEVC specifications ?

Yes, Cedrus needs to know whole list of entry points. I don't think we need to worry about offset_len_minus1, list could be pre-processed - just number of entry points and their values.

Best regards,
Jernej

Quoted 48 lines

Regards,
Benjamin

Quoted 43 lines

I would certainly wait with moving HEVC uAPI to stable.

Best regards,
Jernej

Quoted 36 lines

version 2:
- change DPB field name from rps to flags

Please note that the only purpose of commits 3 and 4 is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge them.

GStreamer HEVC plugin merge request can be found here:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079

With those piece of code fluster score is 77/147.

Benjamin

Benjamin Gaignard (4):
    media: hevc: Remove RPS named flags
    media: hevc: Embedded indexes in RPS
    media: hantro: Use syscon instead of 'ctrl' register
    arm64: dts: imx8mq: Add node to G2 hardware

   .../media/v4l/ext-ctrls-codec.rst             | 14 +++--- arch/arm64/boot/dts/freescale/imx8mq.dtsi     | 43
+++++++++++++----
   drivers/staging/media/hantro/hantro.h         |  5 +- .../staging/media/hantro/hantro_g2_hevc_dec.c | 27 +++-------- drivers/staging/media/hantro/imx8m_vpu_hw.c   | 48
++++++++++++-------
   .../staging/media/sunxi/cedrus/cedrus_h265.c  |  2 +- include/media/hevc-ctrls.h                    |  6 +--

   7 files changed, 84 insertions(+), 61 deletions(-)
Signature · 1 line
2.30.2
#12 lore raw

Le 15/10/2021 à 16:14, Alex Bee a écrit :

Quoted 22 lines

Am 15.10.21 um 16:06 schrieb Benjamin Gaignard:

Quoted 20 lines

Le 15/10/2021 à 12:33, Alex Bee a écrit :

Quoted 18 lines

Hi Benjamin, Jernej
Am 12.10.21 um 18:08 schrieb Jernej Škrabec:

Quoted 3 lines
CC Alex Bee

Alex, please take a look to these patches too.

These patches don't remove anything that would be need for rkvdec hevc - but indeed - we need some more:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch#L242-L305

v4l2_ctrl_hevc_sps:
__u8    video_parameter_set_id
__u8    seq_parameter_set_id

v4l2_ctrl_hevc_pps:
__u8    pic_parameter_set_id
__u16    short_term_ref_pic_set_size
__u16    long_term_ref_pic_set_size

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

As far as I can see, they are all part of the spec and should be therefore good to go in the uapi.

Do you have any plan to upstream these fields in HEVC uAPI ?

I might be upstreaming them at some point, yes.

With this I just wanted to underline Jernej said: HEVC uapi is NOT ready to get unstaged yet.

Ok but the question is how to get it unstaged ?
Should we continue to do changes in staged uAPI ?
or send a RFC to move it to stable and review all the missing parts at that time ?

Regards,
Benjamin

Quoted 122 lines
Quoted 122 lines

Regards,
Benjamin

Quoted 117 lines

As you might now, even rkvdec is a frame-based decoder, it doesn't fully parse slice headers in HW for HEVC and we need to set references in SW which requires looping over the slices. Downstream we have a hack to give num_slices in v4l2_ctrl_hevc_sps for doing that. That could fully go away, if V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS could get dynamic array control support and would make upstreaming this a lot easier - as far as I'm concered this would be required for RPi HEVC decoder as well. As a last resort we could also implement a HW specifc control à la
V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP - but I'd like to avoid that, knowing it would certainly be better from performance pov.

Alex.

Quoted 109 lines

Dne torek, 12. oktober 2021 ob 17:57:50 CEST je Benjamin Gaignard napisal(a):

Quoted 5 lines · Jernej Škrabec
Quoted 3 lines

Hi Benjamin!

Dne torek, 12. oktober 2021 ob 16:35:48 CEST je Benjamin Gaignard

napisal(a):

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This series aims to clean up Reference Picture Set usage and flags.

Long term flag was named with RPS prefix while it is not used for RPS but for mark long term references in DBP. Remane it and remove the two other useless RPS flags.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Clarify documentation about RPS lists content and make sure that Hantro driver use them correctly (i.e without look up in DBP).

These patches are the last in my backlog impacting HEVC uAPI. From my point of view, once they get merged, you could start talking about how move HEVC uAPI to stable.

With your changes, HEVC uAPI controls still won't be complete. Cedrus

needs

Quoted 1 line
Quoted 1 line

entry point control, which in turn needs dynamic array support. I'm a bit

lazy

Quoted 7 lines
Quoted 6 lines

implementing that control, but I guess I can take a look in a month or so. rkvdec also needs more fields for HEVC. With patches collected here:
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/

patches/linux/default/linux-2001-v4l-wip-rkvdec-hevc.patch fluster HEVC test score is reportedly 121/135 (8-bit tests only).

Quoted 6 lines

Hi Jernej,

Thanks for your feedback, getting a list of missing items in HEVC uAPI will definitively help to fill the hope.
The patch you mention for rkvdec are already merged in mainline kernel (at least for uAPI part).

Are they? What about:
video_parameter_set_id
seq_parameter_set_id
pic_parameter_set_id
short_term_ref_pic_set_size
long_term_ref_pic_set_size

At least I don't see them in linux-next. Maybe that information can be obtained in some other way?

Quoted 1 line

Cedrus needs are about num_entry_point_offsets, offset_len_minus1 and

entry_point_offset_minus1[ i ]

Quoted 1 line

in HEVC specifications ?

Yes, Cedrus needs to know whole list of entry points. I don't think we need to worry about offset_len_minus1, list could be pre-processed - just number of entry points and their values.

Best regards,
Jernej

Quoted 48 lines

Regards,
Benjamin

Quoted 43 lines

I would certainly wait with moving HEVC uAPI to stable.

Best regards,
Jernej

Quoted 36 lines

version 2:
- change DPB field name from rps to flags

Please note that the only purpose of commits 3 and 4 is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge them.

GStreamer HEVC plugin merge request can be found here:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079

With those piece of code fluster score is 77/147.

Benjamin

Benjamin Gaignard (4):
    media: hevc: Remove RPS named flags
    media: hevc: Embedded indexes in RPS
    media: hantro: Use syscon instead of 'ctrl' register
    arm64: dts: imx8mq: Add node to G2 hardware

   .../media/v4l/ext-ctrls-codec.rst             | 14 +++--- arch/arm64/boot/dts/freescale/imx8mq.dtsi     | 43
+++++++++++++----
   drivers/staging/media/hantro/hantro.h         |  5 +- .../staging/media/hantro/hantro_g2_hevc_dec.c | 27 +++-------- drivers/staging/media/hantro/imx8m_vpu_hw.c   | 48
++++++++++++-------
   .../staging/media/sunxi/cedrus/cedrus_h265.c  |  2 +- include/media/hevc-ctrls.h                    |  6 +--

   7 files changed, 84 insertions(+), 61 deletions(-)
Signature · 1 line
2.30.2
#13 lore raw
In reply to Benjamin Gaignard

Le 12/10/2021 à 16:35, Benjamin Gaignard a écrit :

Quoted 8 lines

This series aims to clean up Reference Picture Set usage and flags.

Long term flag was named with RPS prefix while it is not used for RPS but for mark long term references in DBP. Remane it and remove the two other useless RPS flags.

Clarify documentation about RPS lists content and make sure that Hantro driver use them correctly (i.e without look up in DBP).

This series generates feedback about what is missing to move HEVC uAPI out of staging but lack of remarks about the proposed changes themselves. Does someone has an opinion about this RPS flag clean up ?

Regards,
Benjamin

Quoted 34 lines

These patches are the last in my backlog impacting HEVC uAPI.
From my point of view, once they get merged, you could start talking
about how move HEVC uAPI to stable.

version 2:
- change DPB field name from rps to flags

Please note that the only purpose of commits 3 and 4 is to allow to test G2 hardware block for IMX8MQ until a proper solution isuing power domain can be found. Do not merge them.

GStreamer HEVC plugin merge request can be found here:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079

With those piece of code fluster score is 77/147.

Benjamin

Benjamin Gaignard (4):
media: hevc: Remove RPS named flags
media: hevc: Embedded indexes in RPS
media: hantro: Use syscon instead of 'ctrl' register
arm64: dts: imx8mq: Add node to G2 hardware

  .../media/v4l/ext-ctrls-codec.rst             | 14 +++---
  arch/arm64/boot/dts/freescale/imx8mq.dtsi     | 43 +++++++++++++----
  drivers/staging/media/hantro/hantro.h         |  5 +-
  .../staging/media/hantro/hantro_g2_hevc_dec.c | 27 +++--------
  drivers/staging/media/hantro/imx8m_vpu_hw.c   | 48 ++++++++++++-------
  .../staging/media/sunxi/cedrus/cedrus_h265.c  |  2 +-
  include/media/hevc-ctrls.h                    |  6 +--
  7 files changed, 84 insertions(+), 61 deletions(-)