mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
media: iris: Improve last flag handling
Improve the handling of the V4L2_BUF_FLAG_LAST flag in the driver: - Ensure that the last flag is not sent multiple times. - Attach the last flag to the first capture buffer returned during flush, triggered by a sequence change, addressing cases where the firmware does not set the last flag. Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> Tested-by: Vikash Garodia <quic_vgarodia@quicinc.com> # on sa8775p-ride Signed-off-by: Bryan O'Donoghue <bod@kernel.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
parent
ac72ad9dea
commit
f15cb8652b
|
|
@ -636,6 +636,7 @@ int iris_vb2_buffer_done(struct iris_inst *inst, struct iris_buffer *buf)
|
|||
v4l2_event_queue_fh(&inst->fh, &ev);
|
||||
v4l2_m2m_mark_stopped(m2m_ctx);
|
||||
}
|
||||
inst->last_buffer_dequeued = true;
|
||||
}
|
||||
|
||||
state = VB2_BUF_STATE_DONE;
|
||||
|
|
|
|||
|
|
@ -457,7 +457,12 @@ static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet)
|
|||
timestamp_us = timestamp_hi;
|
||||
timestamp_us = (timestamp_us << 32) | timestamp_lo;
|
||||
} else {
|
||||
flags |= V4L2_BUF_FLAG_LAST;
|
||||
if (pkt->stream_id == 1 && !inst->last_buffer_dequeued) {
|
||||
if (iris_drc_pending(inst)) {
|
||||
flags |= V4L2_BUF_FLAG_LAST;
|
||||
inst->last_buffer_dequeued = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
buf->timestamp = timestamp_us;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
* @sequence_out: a sequence counter for output queue
|
||||
* @tss: timestamp metadata
|
||||
* @metadata_idx: index for metadata buffer
|
||||
* @last_buffer_dequeued: a flag to indicate that last buffer is sent by driver
|
||||
*/
|
||||
|
||||
struct iris_inst {
|
||||
|
|
@ -74,6 +75,7 @@ struct iris_inst {
|
|||
u32 sequence_out;
|
||||
struct iris_ts_metadata tss[VIDEO_MAX_FRAME];
|
||||
u32 metadata_idx;
|
||||
bool last_buffer_dequeued;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ void iris_vb2_buf_queue(struct vb2_buffer *vb2)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (V4L2_TYPE_IS_CAPTURE(vb2->vb2_queue->type)) {
|
||||
if (!inst->last_buffer_dequeued && V4L2_TYPE_IS_CAPTURE(vb2->vb2_queue->type)) {
|
||||
if ((inst->sub_state & IRIS_INST_SUB_DRC &&
|
||||
inst->sub_state & IRIS_INST_SUB_DRC_LAST) ||
|
||||
(inst->sub_state & IRIS_INST_SUB_DRAIN &&
|
||||
|
|
@ -319,6 +319,7 @@ void iris_vb2_buf_queue(struct vb2_buffer *vb2)
|
|||
v4l2_event_queue_fh(&inst->fh, &eos);
|
||||
v4l2_m2m_mark_stopped(m2m_ctx);
|
||||
}
|
||||
inst->last_buffer_dequeued = true;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,6 +487,8 @@ static int iris_vdec_process_streamon_output(struct iris_inst *inst)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
inst->last_buffer_dequeued = false;
|
||||
|
||||
return iris_inst_change_sub_state(inst, clear_sub_state, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user