diff options
| author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-11-19 07:45:16 -0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-11-19 07:45:16 -0800 |
| commit | 13879a35f36f9eeea7f781f36f12ab498ec6c381 (patch) | |
| tree | 1e9d089b729b2431a0f5fab2baf8b20eaafbf982 | |
| parent | ac25624726546da2fe3513b1b026ae58b5aaf82c (diff) | |
| parent | 3b7705d676b03f0d45e4b3ea4662555ab01e4a4e (diff) | |
Merge "msm: vidc: Fix instance formats initialization issue"
| -rw-r--r-- | drivers/media/platform/msm/vidc/msm_vdec.c | 28 | ||||
| -rw-r--r-- | drivers/media/platform/msm/vidc/msm_venc.c | 28 |
2 files changed, 52 insertions, 4 deletions
diff --git a/drivers/media/platform/msm/vidc/msm_vdec.c b/drivers/media/platform/msm/vidc/msm_vdec.c index c80f535d95e1..5959f61c677c 100644 --- a/drivers/media/platform/msm/vidc/msm_vdec.c +++ b/drivers/media/platform/msm/vidc/msm_vdec.c @@ -1957,6 +1957,8 @@ const struct vb2_ops *msm_vdec_get_vb2q_ops(void) int msm_vdec_inst_init(struct msm_vidc_inst *inst) { int rc = 0; + struct msm_vidc_format *fmt = NULL; + if (!inst) { dprintk(VIDC_ERR, "Invalid input = %pK\n", inst); return -EINVAL; @@ -1964,12 +1966,34 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst) inst->prop.height[CAPTURE_PORT] = DEFAULT_HEIGHT; inst->prop.width[CAPTURE_PORT] = DEFAULT_WIDTH; inst->prop.num_planes[CAPTURE_PORT] = 2; - inst->fmts[CAPTURE_PORT] = vdec_formats[0]; + + /* By default, initialize CAPTURE port to NV12 format */ + fmt = msm_comm_get_pixel_fmt_fourcc(vdec_formats, + ARRAY_SIZE(vdec_formats), V4L2_PIX_FMT_NV12, + CAPTURE_PORT); + if (!fmt || fmt->type != CAPTURE_PORT) { + dprintk(VIDC_ERR, + "vdec_formats corrupted\n"); + return -EINVAL; + } + memcpy(&inst->fmts[fmt->type], fmt, + sizeof(struct msm_vidc_format)); inst->prop.height[OUTPUT_PORT] = DEFAULT_HEIGHT; inst->prop.width[OUTPUT_PORT] = DEFAULT_WIDTH; inst->prop.num_planes[OUTPUT_PORT] = 1; - inst->fmts[OUTPUT_PORT] = vdec_formats[2]; + + /* By default, initialize OUTPUT port to H264 decoder */ + fmt = msm_comm_get_pixel_fmt_fourcc(vdec_formats, + ARRAY_SIZE(vdec_formats), V4L2_PIX_FMT_H264, + OUTPUT_PORT); + if (!fmt || fmt->type != OUTPUT_PORT) { + dprintk(VIDC_ERR, + "vdec_formats corrupted\n"); + return -EINVAL; + } + memcpy(&inst->fmts[fmt->type], fmt, + sizeof(struct msm_vidc_format)); inst->capability.height.min = MIN_SUPPORTED_HEIGHT; inst->capability.height.max = DEFAULT_HEIGHT; diff --git a/drivers/media/platform/msm/vidc/msm_venc.c b/drivers/media/platform/msm/vidc/msm_venc.c index ec6695a670b0..ebdafd66e590 100644 --- a/drivers/media/platform/msm/vidc/msm_venc.c +++ b/drivers/media/platform/msm/vidc/msm_venc.c @@ -4096,6 +4096,8 @@ const struct v4l2_ctrl_ops *msm_venc_get_ctrl_ops(void) int msm_venc_inst_init(struct msm_vidc_inst *inst) { int rc = 0; + struct msm_vidc_format *fmt = NULL; + if (!inst) { dprintk(VIDC_ERR, "Invalid input = %pK\n", inst); return -EINVAL; @@ -4103,12 +4105,34 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst) inst->prop.height[CAPTURE_PORT] = DEFAULT_HEIGHT; inst->prop.width[CAPTURE_PORT] = DEFAULT_WIDTH; inst->prop.num_planes[CAPTURE_PORT] = 1; - inst->fmts[CAPTURE_PORT] = venc_formats[4]; + + /* By default, initialize CAPTURE port to H264 encoder */ + fmt = msm_comm_get_pixel_fmt_fourcc(venc_formats, + ARRAY_SIZE(venc_formats), V4L2_PIX_FMT_H264, + CAPTURE_PORT); + if (!fmt || fmt->type != CAPTURE_PORT) { + dprintk(VIDC_ERR, + "venc_formats corrupted\n"); + return -EINVAL; + } + memcpy(&inst->fmts[fmt->type], fmt, + sizeof(struct msm_vidc_format)); inst->prop.height[OUTPUT_PORT] = DEFAULT_HEIGHT; inst->prop.width[OUTPUT_PORT] = DEFAULT_WIDTH; inst->prop.num_planes[OUTPUT_PORT] = 1; - inst->fmts[OUTPUT_PORT] = venc_formats[0]; + + /* By default, initialize OUTPUT port to NV12 format */ + fmt = msm_comm_get_pixel_fmt_fourcc(venc_formats, + ARRAY_SIZE(venc_formats), V4L2_PIX_FMT_NV12, + OUTPUT_PORT); + if (!fmt || fmt->type != OUTPUT_PORT) { + dprintk(VIDC_ERR, + "venc_formats corrupted\n"); + return -EINVAL; + } + memcpy(&inst->fmts[fmt->type], fmt, + sizeof(struct msm_vidc_format)); inst->capability.height.min = MIN_SUPPORTED_HEIGHT; inst->capability.height.max = DEFAULT_HEIGHT; |
