Skip to contentSkip to conversation

Add base layer priority id control

PATCH In review Dikshita Agarwal 3 participants 5 messages Jan 4, 2021 – Jan 13, 2021

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

v4 cover Add base layer priority id control

This series adds base layer priority id control for encoder and support for the same in venus driver.

Changes since v3:
- Rebased the changes on latest media tree.
- Addressed the comments.
- Added driver side implementation for new control.

Dikshita Agarwal (2):
media: v4l2-ctrl: Add base layer priority id control.
venus: venc : Add support for priority ID control.

 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 9 +++++++++
 drivers/media/platform/qcom/venus/core.h                  | 2 ++
 drivers/media/platform/qcom/venus/venc_ctrls.c            | 9 ++++++++-
 drivers/media/v4l2-core/v4l2-ctrls.c                      | 1 +
 include/uapi/linux/v4l2-controls.h                        | 1 +
 5 files changed, 21 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 1/2 media: v4l2-ctrl: Add base layer priority id control.

This control indicates the priority id to be applied to base layer.

---
 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 9 +++++++++
 drivers/media/v4l2-core/v4l2-ctrls.c                      | 1 +
 include/uapi/linux/v4l2-controls.h                        | 1 +
 3 files changed, 11 insertions(+)
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +9 -0
index 1675bcf..24df818 100644
@@ -3655,3 +3655,12 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
        This provides a bitmask which consists of bits [0, LTR_COUNT-1].
        This is applicable to H264 and HEVC encoder and can be applied using
        Request Api.
+
+``V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID (integer)``
+    Specifies a priority identifier for the NAL unit, which will be applied to
+    the base layer. By default this value is set to 0 for the base layer,
+    and the next layer will have the priority ID assigned as 1, 2, 3 and so on.
+    The video encoder can't decide the priority id to be applied to a layer,
+    so this has to come from client.
+    This is applicable to H264 and valid Range is from 0 to 63.
+    Source Rec. ITU-T H.264 (06/2019); G.7.4.1.1, G.8.8.1
drivers/media/v4l2-core/v4l2-ctrls.c +1 -0
index 2ad6b5a..9bd795f 100644
@@ -953,6 +953,7 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_MPEG_VIDEO_LTR_COUNT:			return "LTR Count";
 	case V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX:		return "frame LTR index";
 	case V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES:		return "Use LTR Frames";
+	case V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID:		return "Base Layer Priority ID";
 	case V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS:		return "MPEG-2 Slice Parameters";
 	case V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION:		return "MPEG-2 Quantization Matrices";
 	case V4L2_CID_FWHT_I_FRAME_QP:				return "FWHT I-Frame QP Value";
include/uapi/linux/v4l2-controls.h +1 -0
index c0bb87b..404e69c 100644
@@ -425,6 +425,7 @@ enum v4l2_mpeg_video_multi_slice_mode {
 #define V4L2_CID_MPEG_VIDEO_LTR_COUNT			(V4L2_CID_CODEC_BASE+230)
 #define V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX		(V4L2_CID_CODEC_BASE+231)
 #define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES		(V4L2_CID_CODEC_BASE+232)
+#define V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID	(V4L2_CID_CODEC_BASE+233)
 
 /* CIDs for the MPEG-2 Part 2 (H.262) codec */
 #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL			(V4L2_CID_CODEC_BASE+270)
Signature · 1 line
2.7.4
#2 lore raw

PATCH v4 2/2 venus: venc : Add support for priority ID control.

In reply to Dikshita Agarwal

Add support for base layer priority ID control in
encoder.
This is a preparation patch to support v6.

---
 drivers/media/platform/qcom/venus/core.h       | 2 ++
 drivers/media/platform/qcom/venus/venc_ctrls.c | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/venus/core.h +2 -0
index 54c42a3..a346ddc 100644
@@ -274,6 +274,8 @@ struct venc_controls {
 		u32 hevc;
 		u32 vp9;
 	} level;
+
+	u32 base_priority_id;
 };
 
 struct venus_buffer {
drivers/media/platform/qcom/venus/venc_ctrls.c +8 -1
index 7d010d8..3ead51c 100644
@@ -294,6 +294,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
 			return ret;
 		}
 		break;
+	case V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID:
+		ctr->base_priority_id = ctrl->val;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -309,7 +312,7 @@ int venc_ctrl_init(struct venus_inst *inst)
 {
 	int ret;
 
-	ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 53);
+	ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 54);
 	if (ret)
 		return ret;
 
@@ -523,6 +526,10 @@ int venc_ctrl_init(struct venus_inst *inst)
 			  V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX, 0,
 			  (MAX_LTR_FRAME_COUNT - 1), 1, 0);
 
+	v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
+			  V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID, 0,
+			  6, 1, 0);
+
 	ret = inst->ctrl_handler.error;
 	if (ret)
 		goto err;
Signature · 1 line
2.7.4
Acked-by on v4 2/2
#3 lore raw

Re: [PATCH v4 2/2] venus: venc : Add support for priority ID control.

Quoted 9 lines · Dikshita Agarwal

Add support for base layer priority ID control in
encoder.
This is a preparation patch to support v6.

---
 drivers/media/platform/qcom/venus/core.h       | 2 ++
 drivers/media/platform/qcom/venus/venc_ctrls.c | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
Signature · 2 lines
regards,
Stan
#4 lore raw
In reply to Dikshita Agarwal

Hi Dikshita,

Quoted 2 lines · Dikshita Agarwal

This series adds base layer priority id control for encoder and support for the same in venus driver.

Posted a pull request for this series and the "Add new controls for QP and layer bitrate" series.

Note that because the "Add encoder ctrls for long term reference" is not merged, the control ID for V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID changed and that you need to rebase the "Add encoder ctrls for long term reference" series accordingly.

Regards,

Hans

Quoted 17 lines

Changes since v3:
- Rebased the changes on latest media tree.
- Addressed the comments.
- Added driver side implementation for new control.

Dikshita Agarwal (2):
media: v4l2-ctrl: Add base layer priority id control.
venus: venc : Add support for priority ID control.

 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 9 +++++++++
 drivers/media/platform/qcom/venus/core.h                  | 2 ++
 drivers/media/platform/qcom/venus/venc_ctrls.c            | 9 ++++++++-
 drivers/media/v4l2-core/v4l2-ctrls.c                      | 1 +
 include/uapi/linux/v4l2-controls.h                        | 1 +
 5 files changed, 21 insertions(+), 1 deletion(-)