Loading drivers/media/platform/msm/vidc/msm_vidc.c +15 −24 Original line number Diff line number Diff line Loading @@ -670,20 +670,25 @@ int output_buffer_cache_invalidate(struct msm_vidc_inst *inst, return 0; } static bool valid_v4l2_buffer(struct v4l2_buffer *b, struct msm_vidc_inst *inst) { enum vidc_ports port = !V4L2_TYPE_IS_MULTIPLANAR(b->type) ? MAX_PORT_NUM : b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ? CAPTURE_PORT : b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ? OUTPUT_PORT : MAX_PORT_NUM; return port != MAX_PORT_NUM && inst->fmts[port]->num_planes == b->length; } int msm_vidc_prepare_buf(void *instance, struct v4l2_buffer *b) { struct msm_vidc_inst *inst = instance; if (!inst || !b) if (!inst || !b || !valid_v4l2_buffer(b, inst)) return -EINVAL; if (!V4L2_TYPE_IS_MULTIPLANAR(b->type) || !b->length || (b->length > VIDEO_MAX_PLANES)) { dprintk(VIDC_ERR, "%s: wrong input params\n", __func__); return -EINVAL; } if (is_dynamic_output_buffer_mode(b, inst)) return 0; Loading Loading @@ -803,15 +808,8 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b) int rc = 0; int i; if (!inst || !b) return -EINVAL; if (!V4L2_TYPE_IS_MULTIPLANAR(b->type) || !b->length || (b->length > VIDEO_MAX_PLANES)) { dprintk(VIDC_ERR, "%s: wrong input params\n", __func__); if (!inst || !b || !valid_v4l2_buffer(b, inst)) return -EINVAL; } rc = map_and_register_buf(inst, b); if (rc == -EEXIST) { Loading Loading @@ -888,16 +886,9 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b) struct buffer_info *buffer_info = NULL; int i = 0, rc = 0; if (!inst || !b) if (!inst || !b || !valid_v4l2_buffer(b, inst)) return -EINVAL; if (!V4L2_TYPE_IS_MULTIPLANAR(b->type) || !b->length || (b->length > VIDEO_MAX_PLANES)) { dprintk(VIDC_ERR, "%s: wrong input params\n", __func__); return -EINVAL; } if (inst->session_type == MSM_VIDC_DECODER) rc = msm_vdec_dqbuf(instance, b); if (inst->session_type == MSM_VIDC_ENCODER) Loading Loading
drivers/media/platform/msm/vidc/msm_vidc.c +15 −24 Original line number Diff line number Diff line Loading @@ -670,20 +670,25 @@ int output_buffer_cache_invalidate(struct msm_vidc_inst *inst, return 0; } static bool valid_v4l2_buffer(struct v4l2_buffer *b, struct msm_vidc_inst *inst) { enum vidc_ports port = !V4L2_TYPE_IS_MULTIPLANAR(b->type) ? MAX_PORT_NUM : b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ? CAPTURE_PORT : b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ? OUTPUT_PORT : MAX_PORT_NUM; return port != MAX_PORT_NUM && inst->fmts[port]->num_planes == b->length; } int msm_vidc_prepare_buf(void *instance, struct v4l2_buffer *b) { struct msm_vidc_inst *inst = instance; if (!inst || !b) if (!inst || !b || !valid_v4l2_buffer(b, inst)) return -EINVAL; if (!V4L2_TYPE_IS_MULTIPLANAR(b->type) || !b->length || (b->length > VIDEO_MAX_PLANES)) { dprintk(VIDC_ERR, "%s: wrong input params\n", __func__); return -EINVAL; } if (is_dynamic_output_buffer_mode(b, inst)) return 0; Loading Loading @@ -803,15 +808,8 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b) int rc = 0; int i; if (!inst || !b) return -EINVAL; if (!V4L2_TYPE_IS_MULTIPLANAR(b->type) || !b->length || (b->length > VIDEO_MAX_PLANES)) { dprintk(VIDC_ERR, "%s: wrong input params\n", __func__); if (!inst || !b || !valid_v4l2_buffer(b, inst)) return -EINVAL; } rc = map_and_register_buf(inst, b); if (rc == -EEXIST) { Loading Loading @@ -888,16 +886,9 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b) struct buffer_info *buffer_info = NULL; int i = 0, rc = 0; if (!inst || !b) if (!inst || !b || !valid_v4l2_buffer(b, inst)) return -EINVAL; if (!V4L2_TYPE_IS_MULTIPLANAR(b->type) || !b->length || (b->length > VIDEO_MAX_PLANES)) { dprintk(VIDC_ERR, "%s: wrong input params\n", __func__); return -EINVAL; } if (inst->session_type == MSM_VIDC_DECODER) rc = msm_vdec_dqbuf(instance, b); if (inst->session_type == MSM_VIDC_ENCODER) Loading