LinuxTV Patchwork media: venus: Add support for H265 controls required by gstreamer V4L2 H265 module

login
register
mail settings
Submitter Kelvin Lawson
Date Nov. 30, 2018, 5:31 p.m.
Message ID <1543599060-3776-1-git-send-email-klawson@lisden.com>
Download mbox | patch
Permalink /patch/53234/
State Changes Requested
Delegated to: Hans Verkuil
Headers show

Comments

Kelvin Lawson - Nov. 30, 2018, 5:31 p.m.
Add support for V4L2_CID_MPEG_VIDEO_HEVC_PROFILE and
V4L2_CID_MPEG_VIDEO_HEVC_LEVEL controls required by gstreamer V4L2 H265
encoder module.

Signed-off-by: Kelvin Lawson <klawson@lisden.com>
---
 drivers/media/platform/qcom/venus/venc_ctrls.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
Stanimir Varbanov - Dec. 7, 2018, 9:43 a.m.
Hi Kelvin,

Thanks for the patch!

On 11/30/18 7:31 PM, Kelvin Lawson wrote:
> Add support for V4L2_CID_MPEG_VIDEO_HEVC_PROFILE and
> V4L2_CID_MPEG_VIDEO_HEVC_LEVEL controls required by gstreamer V4L2 H265
> encoder module.
> 
> Signed-off-by: Kelvin Lawson <klawson@lisden.com>
> ---
>  drivers/media/platform/qcom/venus/venc_ctrls.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c
> index 45910172..ad1a4d8 100644
> --- a/drivers/media/platform/qcom/venus/venc_ctrls.c
> +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c
> @@ -101,6 +101,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
>  	case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
>  		ctr->profile.h264 = ctrl->val;
>  		break;
> +	case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
> +		ctr->profile.hevc = ctrl->val;
> +		break;
>  	case V4L2_CID_MPEG_VIDEO_VP8_PROFILE:
>  		ctr->profile.vpx = ctrl->val;
>  		break;
> @@ -110,6 +113,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
>  	case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
>  		ctr->level.h264 = ctrl->val;
>  		break;
> +	case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:
> +		ctr->level.hevc = ctrl->val;
> +		break;
>  	case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP:
>  		ctr->h264_i_qp = ctrl->val;
>  		break;
> @@ -217,6 +223,19 @@ int venc_ctrl_init(struct venus_inst *inst)
>  		0, V4L2_MPEG_VIDEO_MPEG4_LEVEL_0);
>  
>  	v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops,
> +		V4L2_CID_MPEG_VIDEO_HEVC_PROFILE,
> +		V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> +		~((1 << V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN) |
> +		  (1 << V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE) |
> +		  (1 << V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10)),
> +		V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN);
> +
> +	v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops,
> +		V4L2_CID_MPEG_VIDEO_HEVC_LEVEL,
> +		V4L2_MPEG_VIDEO_HEVC_LEVEL_6_2,
> +		0, V4L2_MPEG_VIDEO_HEVC_LEVEL_1);
> +
> +	v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops,

you are adding two new menu controls but forgot to increment the count
of controls in v4l2_ctrl_handler_init(). Can you resend with that fixed?

>  		V4L2_CID_MPEG_VIDEO_H264_PROFILE,
>  		V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH,
>  		~((1 << V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE) |
>

Patch

diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c
index 45910172..ad1a4d8 100644
--- a/drivers/media/platform/qcom/venus/venc_ctrls.c
+++ b/drivers/media/platform/qcom/venus/venc_ctrls.c
@@ -101,6 +101,9 @@  static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
 		ctr->profile.h264 = ctrl->val;
 		break;
+	case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
+		ctr->profile.hevc = ctrl->val;
+		break;
 	case V4L2_CID_MPEG_VIDEO_VP8_PROFILE:
 		ctr->profile.vpx = ctrl->val;
 		break;
@@ -110,6 +113,9 @@  static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
 		ctr->level.h264 = ctrl->val;
 		break;
+	case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:
+		ctr->level.hevc = ctrl->val;
+		break;
 	case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP:
 		ctr->h264_i_qp = ctrl->val;
 		break;
@@ -217,6 +223,19 @@  int venc_ctrl_init(struct venus_inst *inst)
 		0, V4L2_MPEG_VIDEO_MPEG4_LEVEL_0);
 
 	v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops,
+		V4L2_CID_MPEG_VIDEO_HEVC_PROFILE,
+		V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
+		~((1 << V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN) |
+		  (1 << V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE) |
+		  (1 << V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10)),
+		V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN);
+
+	v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops,
+		V4L2_CID_MPEG_VIDEO_HEVC_LEVEL,
+		V4L2_MPEG_VIDEO_HEVC_LEVEL_6_2,
+		0, V4L2_MPEG_VIDEO_HEVC_LEVEL_1);
+
+	v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops,
 		V4L2_CID_MPEG_VIDEO_H264_PROFILE,
 		V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH,
 		~((1 << V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE) |

Privacy Policy