diff --git a/driver/vidc/inc/msm_vidc_driver.h b/driver/vidc/inc/msm_vidc_driver.h index 931a2bcc2f..827cb803e7 100644 --- a/driver/vidc/inc/msm_vidc_driver.h +++ b/driver/vidc/inc/msm_vidc_driver.h @@ -492,7 +492,6 @@ bool msm_vidc_allow_metadata_subscription(struct msm_vidc_inst *inst, bool msm_vidc_allow_property(struct msm_vidc_inst *inst, u32 hfi_id); int msm_vidc_update_property_cap(struct msm_vidc_inst *inst, u32 hfi_id, bool allow); -bool msm_vidc_allow_reqbufs(struct msm_vidc_inst *inst, u32 type); enum msm_vidc_allow msm_vidc_allow_stop(struct msm_vidc_inst *inst); bool msm_vidc_allow_start(struct msm_vidc_inst *inst); bool msm_vidc_allow_streamon(struct msm_vidc_inst *inst, u32 type); diff --git a/driver/vidc/src/msm_vidc.c b/driver/vidc/src/msm_vidc.c index 6912fc6a88..4c3b21469c 100644 --- a/driver/vidc/src/msm_vidc.c +++ b/driver/vidc/src/msm_vidc.c @@ -397,11 +397,6 @@ int msm_vidc_reqbufs(void *instance, struct v4l2_requestbuffers *b) return -EINVAL; } - if (!msm_vidc_allow_reqbufs(inst, b->type)) { - rc = -EBUSY; - goto exit; - } - port = v4l2_type_to_driver_port(inst, b->type, __func__); if (port < 0) { rc = -EINVAL; diff --git a/driver/vidc/src/msm_vidc_driver.c b/driver/vidc/src/msm_vidc_driver.c index 73e461436a..5046bcdc64 100644 --- a/driver/vidc/src/msm_vidc_driver.c +++ b/driver/vidc/src/msm_vidc_driver.c @@ -1115,38 +1115,6 @@ int msm_vidc_update_property_cap(struct msm_vidc_inst *inst, u32 hfi_id, return rc; } -bool msm_vidc_allow_reqbufs(struct msm_vidc_inst *inst, u32 type) -{ - bool allow = false; - - if (!inst) { - d_vpr_e("%s: invalid params\n", __func__); - return false; - } - if (is_state(inst, MSM_VIDC_OPEN)) { - allow = true; - goto exit; - } - if (type == OUTPUT_MPLANE || type == OUTPUT_META_PLANE) { - if (is_state(inst, MSM_VIDC_INPUT_STREAMING)) { - allow = true; - goto exit; - } - } - if (type == INPUT_MPLANE || type == INPUT_META_PLANE) { - if (is_state(inst, MSM_VIDC_OUTPUT_STREAMING)) { - allow = true; - goto exit; - } - } - -exit: - if (!allow) - i_vpr_e(inst, "%s: type %d not allowed in state %s\n", - __func__, type, state_name(inst->state)); - return allow; -} - enum msm_vidc_allow msm_vidc_allow_stop(struct msm_vidc_inst *inst) { enum msm_vidc_allow allow = MSM_VIDC_DISALLOW; diff --git a/driver/vidc/src/msm_vidc_state.c b/driver/vidc/src/msm_vidc_state.c index 7ff318133d..2f084e7dd9 100644 --- a/driver/vidc/src/msm_vidc_state.c +++ b/driver/vidc/src/msm_vidc_state.c @@ -668,6 +668,7 @@ static int msm_vidc_open_state(struct msm_vidc_inst *inst, { struct v4l2_requestbuffers *b = (struct v4l2_requestbuffers *)data; + /* allow reqbufs request in open state */ rc = msm_vidc_reqbufs(inst, b); if (rc) return rc; @@ -813,6 +814,13 @@ static int msm_vidc_input_streaming_state(struct msm_vidc_inst *inst, { struct v4l2_requestbuffers *b = (struct v4l2_requestbuffers *)data; + /* disallow */ + if (b->type == INPUT_MPLANE || b->type == INPUT_META_PLANE) { + i_vpr_e(inst, "%s: (%s) not allowed for (%s) port\n", + __func__, event_name(event), v4l2_type_name(b->type)); + return -EBUSY; + } + rc = msm_vidc_reqbufs(inst, b); if (rc) return rc; @@ -970,6 +978,13 @@ static int msm_vidc_output_streaming_state(struct msm_vidc_inst *inst, { struct v4l2_requestbuffers *b = (struct v4l2_requestbuffers *)data; + /* disallow */ + if (b->type == OUTPUT_MPLANE || b->type == OUTPUT_META_PLANE) { + i_vpr_e(inst, "%s: (%s) not allowed for (%s) port\n", + __func__, event_name(event), v4l2_type_name(b->type)); + return -EBUSY; + } + rc = msm_vidc_reqbufs(inst, b); if (rc) return rc;