From eb84e2653d597ed5daccf3c901d797ac8ef13de5 Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Wed, 12 Dec 2018 19:34:46 +0800 Subject: msm: vidc: Support interlaced clips playback Add a new event to configure if allow to trigger port reconfig event for scan type change for UBWC interlaced video playback Change-Id: Ie20d6a006a82511b18ea0a6fe8de0cf43d6a0582 Signed-off-by: Yiming Cao --- drivers/media/platform/msm/vidc/msm_vdec.c | 27 ++++++++++++++++++++++ drivers/media/platform/msm/vidc/msm_vidc_common.c | 14 +++++++++++ .../media/platform/msm/vidc/msm_vidc_internal.h | 1 + include/uapi/linux/v4l2-controls.h | 6 +++++ 4 files changed, 48 insertions(+) diff --git a/drivers/media/platform/msm/vidc/msm_vdec.c b/drivers/media/platform/msm/vidc/msm_vdec.c index fc8da8dc0c2c..f838f99ab0c8 100644 --- a/drivers/media/platform/msm/vidc/msm_vdec.c +++ b/drivers/media/platform/msm/vidc/msm_vdec.c @@ -600,6 +600,16 @@ static struct msm_vidc_ctrl msm_vdec_ctrls[] = { .default_value = 0, .step = OPERATING_FRAME_RATE_STEP, }, + { + .id = V4L2_CID_MPEG_VIDC_VIDEO_ALLOW_UBWC_LINEAR_EVENT, + .name = "Allow ubwc linear event", + .type = V4L2_CTRL_TYPE_BOOLEAN, + .minimum = V4L2_MPEG_VIDC_VIDEO_ALLOW_UBWC_LINEAR_EVENT_DISABLE, + .maximum = V4L2_MPEG_VIDC_VIDEO_ALLOW_UBWC_LINEAR_EVENT_ENABLE, + .default_value = + V4L2_MPEG_VIDC_VIDEO_ALLOW_UBWC_LINEAR_EVENT_DISABLE, + .step = 1, + } }; #define NUM_CTRLS ARRAY_SIZE(msm_vdec_ctrls) @@ -2081,6 +2091,7 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst) inst->buffer_mode_set[CAPTURE_PORT] = HAL_BUFFER_MODE_STATIC; inst->prop.fps = DEFAULT_FPS; inst->operating_rate = 0; + inst->allow_ubwc_linear_event = 0; return rc; } @@ -2707,6 +2718,22 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) inst, inst->operating_rate >> 16, ctrl->val >> 16); inst->operating_rate = ctrl->val; break; + case V4L2_CID_MPEG_VIDC_VIDEO_ALLOW_UBWC_LINEAR_EVENT: + switch (ctrl->val) { + case V4L2_MPEG_VIDC_VIDEO_ALLOW_UBWC_LINEAR_EVENT_ENABLE: + inst->allow_ubwc_linear_event = 1; + break; + case V4L2_MPEG_VIDC_VIDEO_ALLOW_UBWC_LINEAR_EVENT_DISABLE: + inst->allow_ubwc_linear_event = 0; + break; + default: + dprintk(VIDC_ERR, + "Invalid allow ubwc linear event control value %d\n", + ctrl->val); + rc = -ENOTSUPP; + break; + } + break; default: break; } diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.c b/drivers/media/platform/msm/vidc/msm_vidc_common.c index 610ed9c6fed9..bbf5e33a99f7 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_common.c +++ b/drivers/media/platform/msm/vidc/msm_vidc_common.c @@ -1210,6 +1210,20 @@ static void handle_event_change(enum hal_command_response cmd, void *data) break; } + /* + * Force output to linear format if it's interlaced UBWC format + * to support interlaced clips playback + */ + if ((inst->allow_ubwc_linear_event) && + (event_notify->pic_struct == + MSM_VIDC_PIC_STRUCT_MAYBE_INTERLACED)) { + u32 fmt_fourcc = inst->fmts[CAPTURE_PORT].fourcc; + + if ((fmt_fourcc == V4L2_PIX_FMT_NV12_TP10_UBWC) || + (fmt_fourcc == V4L2_PIX_FMT_NV12_UBWC)) + inst->fmts[CAPTURE_PORT].fourcc = V4L2_PIX_FMT_NV12; + } + /* Bit depth and pic struct changed event are combined into a single * event (insufficient event) for the userspace. Currently bitdepth * changes is only for HEVC and interlaced support is for all diff --git a/drivers/media/platform/msm/vidc/msm_vidc_internal.h b/drivers/media/platform/msm/vidc/msm_vidc_internal.h index 08dad912bd57..95ec7e771d85 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_internal.h +++ b/drivers/media/platform/msm/vidc/msm_vidc_internal.h @@ -300,6 +300,7 @@ struct msm_vidc_inst { u32 pic_struct; u32 colour_space; u32 operating_rate; + bool allow_ubwc_linear_event; }; extern struct msm_vidc_drv *vidc_driver; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 25cb17ca6bf3..19a68dcb4070 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1232,6 +1232,12 @@ enum v4l2_mpeg_vidc_video_venc_send_skipped_frame { V4L2_MPEG_VIDC_VIDEO_SEND_SKIPPED_FRAME_ENABLE = 1 }; +#define V4L2_CID_MPEG_VIDC_VIDEO_ALLOW_UBWC_LINEAR_EVENT \ + (V4L2_CID_MPEG_MSM_VIDC_BASE + 104) +enum v4l2_mpeg_vidc_video_allow_ubwc_linear_event { + V4L2_MPEG_VIDC_VIDEO_ALLOW_UBWC_LINEAR_EVENT_DISABLE = 0, + V4L2_MPEG_VIDC_VIDEO_ALLOW_UBWC_LINEAR_EVENT_ENABLE = 1 +}; /* Camera class control IDs */ -- cgit v1.2.3