1
0

video: driver: add streamon allow checks inside state handler

use state specific checks inside state_handler instead of
relying global msm_vidc_allow_streamon function.

Change-Id: I67948831612ebb33cdd12a2e9f8561b6095e9433
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
Este cometimento está contido em:
Govindaraj Rajagopal
2023-02-16 15:10:25 +05:30
ascendente 3ba2cb9ed1
cometimento 4afdecc4fd
4 ficheiros modificados com 15 adições e 25 eliminações

Ver ficheiro

@@ -494,7 +494,6 @@ int msm_vidc_update_property_cap(struct msm_vidc_inst *inst, u32 hfi_id,
bool allow);
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);
enum msm_vidc_allow msm_vidc_allow_input_psc(struct msm_vidc_inst *inst);
bool msm_vidc_allow_drain_last_flag(struct msm_vidc_inst *inst);
bool msm_vidc_allow_psc_last_flag(struct msm_vidc_inst *inst);

Ver ficheiro

@@ -1167,27 +1167,6 @@ bool msm_vidc_allow_start(struct msm_vidc_inst *inst)
return allow;
}
bool msm_vidc_allow_streamon(struct msm_vidc_inst *inst, u32 type)
{
if (!inst) {
d_vpr_e("%s: invalid params\n", __func__);
return false;
}
if (type == INPUT_MPLANE || type == INPUT_META_PLANE) {
if (is_state(inst, MSM_VIDC_OPEN) ||
is_state(inst, MSM_VIDC_OUTPUT_STREAMING))
return true;
} else if (type == OUTPUT_MPLANE || type == OUTPUT_META_PLANE) {
if (is_state(inst, MSM_VIDC_OPEN) ||
is_state(inst, MSM_VIDC_INPUT_STREAMING))
return true;
}
i_vpr_e(inst, "%s: type %d not allowed in state %s\n",
__func__, type, state_name(inst->state));
return false;
}
enum msm_vidc_allow msm_vidc_allow_input_psc(struct msm_vidc_inst *inst)
{
enum msm_vidc_allow allow = MSM_VIDC_ALLOW;

Ver ficheiro

@@ -678,6 +678,7 @@ static int msm_vidc_open_state(struct msm_vidc_inst *inst,
{
struct vb2_queue *q = (struct vb2_queue *)data;
/* allow streamon request in open state */
rc = msm_vidc_start_streaming(inst, q);
if (rc)
return rc;
@@ -830,6 +831,13 @@ static int msm_vidc_input_streaming_state(struct msm_vidc_inst *inst,
{
struct vb2_queue *q = (struct vb2_queue *)data;
/* disallow */
if (q->type == INPUT_MPLANE || q->type == INPUT_META_PLANE) {
i_vpr_e(inst, "%s: (%s) not allowed for (%s) type\n",
__func__, event_name(event), v4l2_type_name(q->type));
return -EBUSY;
}
rc = msm_vidc_start_streaming(inst, q);
if (rc)
return rc;
@@ -994,6 +1002,13 @@ static int msm_vidc_output_streaming_state(struct msm_vidc_inst *inst,
{
struct vb2_queue *q = (struct vb2_queue *)data;
/* disallow */
if (q->type == OUTPUT_MPLANE || q->type == OUTPUT_META_PLANE) {
i_vpr_e(inst, "%s: (%s) not allowed for (%s) type\n",
__func__, event_name(event), v4l2_type_name(q->type));
return -EBUSY;
}
rc = msm_vidc_start_streaming(inst, q);
if (rc)
return rc;

Ver ficheiro

@@ -415,9 +415,6 @@ int msm_vidc_start_streaming(struct msm_vidc_inst *inst, struct vb2_queue *q)
return -EINVAL;
}
if (!msm_vidc_allow_streamon(inst, q->type))
return -EBUSY;
if (q->type == INPUT_META_PLANE || q->type == OUTPUT_META_PLANE) {
i_vpr_h(inst, "%s: nothing to start on %s\n",
__func__, v4l2_type_name(q->type));