diff mbox series

[RESEND,v3] venus: venc: set inband mode property to FW.

Message ID 1610090618-30070-1-git-send-email-dikshita@codeaurora.org
State New
Headers show
Series [RESEND,v3] venus: venc: set inband mode property to FW. | expand

Commit Message

Dikshita Agarwal Jan. 8, 2021, 7:23 a.m. UTC
set HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER to FW
to support inband sequence header mode.

Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>

Changes since v2:
- fixed Null pointer dereference (Stanimir, Fritz)
- added set property call at correct place.
---
 drivers/media/platform/qcom/venus/venc.c       | 14 ++++++++++++++
 drivers/media/platform/qcom/venus/venc_ctrls.c | 17 ++++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)

Comments

Fritz Koenig Jan. 12, 2021, 5:33 p.m. UTC | #1
On Thu, Jan 7, 2021 at 11:26 PM Dikshita Agarwal
<dikshita@codeaurora.org> wrote:
>
> set HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER to FW
> to support inband sequence header mode.
>
> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
>
> Changes since v2:
> - fixed Null pointer dereference (Stanimir, Fritz)
> - added set property call at correct place.
> ---
>  drivers/media/platform/qcom/venus/venc.c       | 14 ++++++++++++++
>  drivers/media/platform/qcom/venus/venc_ctrls.c | 17 ++++++++++++++++-
>  2 files changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
> index 3a2e449..ae21a7c 100644
> --- a/drivers/media/platform/qcom/venus/venc.c
> +++ b/drivers/media/platform/qcom/venus/venc.c
> @@ -536,6 +536,7 @@ static int venc_set_properties(struct venus_inst *inst)
>         struct hfi_idr_period idrp;
>         struct hfi_quantization quant;
>         struct hfi_quantization_range quant_range;
> +       struct hfi_enable en;
>         u32 ptype, rate_control, bitrate;
>         u32 profile, level;
>         int ret;
> @@ -655,6 +656,19 @@ static int venc_set_properties(struct venus_inst *inst)
>         if (ret)
>                 return ret;
>
> +       if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264 ||
> +           inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) {

nit: declare |struct hfi_enable en| in this scope

Reviewed-by: Fritz Koenig <frkoenig@chromium.org>

> +               ptype = HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER;
> +               if (ctr->header_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE)
> +                       en.enable = 0;
> +               else
> +                       en.enable = 1;
> +
> +               ret = hfi_session_set_property(inst, ptype, &en);
> +               if (ret)
> +                       return ret;
> +       }
> +
>         if (!ctr->bitrate_peak)
>                 bitrate *= 2;
>         else
> diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c
> index cf860e6..3ce02ad 100644
> --- a/drivers/media/platform/qcom/venus/venc_ctrls.c
> +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c
> @@ -158,6 +158,20 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
>                 break;
>         case V4L2_CID_MPEG_VIDEO_HEADER_MODE:
>                 ctr->header_mode = ctrl->val;
> +               mutex_lock(&inst->lock);
> +               if (inst->streamon_out && inst->streamon_cap) {
> +                       if (ctrl->val == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE)
> +                               en.enable = 0;
> +                       else
> +                               en.enable = 1;
> +                       ptype = HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER;
> +                       ret = hfi_session_set_property(inst, ptype, &en);
> +                       if (ret) {
> +                               mutex_unlock(&inst->lock);
> +                               return ret;
> +                       }
> +               }
> +               mutex_unlock(&inst->lock);
>                 break;
>         case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB:
>                 break;
> @@ -289,7 +303,8 @@ int venc_ctrl_init(struct venus_inst *inst)
>         v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops,
>                 V4L2_CID_MPEG_VIDEO_HEADER_MODE,
>                 V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME,
> -               1 << V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME,
> +               ~((1 << V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) |
> +               (1 << V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME)),
>                 V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE);
>
>         v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops,
> --
> 2.7.4
>
patchwork-bot+linux-arm-msm@kernel.org March 1, 2021, 7:59 p.m. UTC | #2
Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Fri,  8 Jan 2021 12:53:37 +0530 you wrote:
> set HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER to FW

> to support inband sequence header mode.

> 

> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>

> 

> Changes since v2:

> - fixed Null pointer dereference (Stanimir, Fritz)

> - added set property call at correct place.

> 

> [...]


Here is the summary with links:
  - [RESEND,v3] venus: venc: set inband mode property to FW.
    https://git.kernel.org/qcom/c/002c22bd360e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index 3a2e449..ae21a7c 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -536,6 +536,7 @@  static int venc_set_properties(struct venus_inst *inst)
 	struct hfi_idr_period idrp;
 	struct hfi_quantization quant;
 	struct hfi_quantization_range quant_range;
+	struct hfi_enable en;
 	u32 ptype, rate_control, bitrate;
 	u32 profile, level;
 	int ret;
@@ -655,6 +656,19 @@  static int venc_set_properties(struct venus_inst *inst)
 	if (ret)
 		return ret;
 
+	if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264 ||
+	    inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) {
+		ptype = HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER;
+		if (ctr->header_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE)
+			en.enable = 0;
+		else
+			en.enable = 1;
+
+		ret = hfi_session_set_property(inst, ptype, &en);
+		if (ret)
+			return ret;
+	}
+
 	if (!ctr->bitrate_peak)
 		bitrate *= 2;
 	else
diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c
index cf860e6..3ce02ad 100644
--- a/drivers/media/platform/qcom/venus/venc_ctrls.c
+++ b/drivers/media/platform/qcom/venus/venc_ctrls.c
@@ -158,6 +158,20 @@  static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
 		break;
 	case V4L2_CID_MPEG_VIDEO_HEADER_MODE:
 		ctr->header_mode = ctrl->val;
+		mutex_lock(&inst->lock);
+		if (inst->streamon_out && inst->streamon_cap) {
+			if (ctrl->val == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE)
+				en.enable = 0;
+			else
+				en.enable = 1;
+			ptype = HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER;
+			ret = hfi_session_set_property(inst, ptype, &en);
+			if (ret) {
+				mutex_unlock(&inst->lock);
+				return ret;
+			}
+		}
+		mutex_unlock(&inst->lock);
 		break;
 	case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB:
 		break;
@@ -289,7 +303,8 @@  int venc_ctrl_init(struct venus_inst *inst)
 	v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops,
 		V4L2_CID_MPEG_VIDEO_HEADER_MODE,
 		V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME,
-		1 << V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME,
+		~((1 << V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) |
+		(1 << V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME)),
 		V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE);
 
 	v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops,