mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 22:52:19 +02:00
media: meson: vdec: Stop direct calls to queue num_buffers field
Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. This allows us to change how the number of buffers is computed in the future. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> CC: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
9d5ffd498d
commit
8858adab50
|
|
@ -167,22 +167,23 @@ static void process_num_buffers(struct vb2_queue *q,
|
|||
bool is_reqbufs)
|
||||
{
|
||||
const struct amvdec_format *fmt_out = sess->fmt_out;
|
||||
unsigned int buffers_total = q->num_buffers + *num_buffers;
|
||||
unsigned int q_num_bufs = vb2_get_num_buffers(q);
|
||||
unsigned int buffers_total = q_num_bufs + *num_buffers;
|
||||
u32 min_buf_capture = v4l2_ctrl_g_ctrl(sess->ctrl_min_buf_capture);
|
||||
|
||||
if (q->num_buffers + *num_buffers < min_buf_capture)
|
||||
*num_buffers = min_buf_capture - q->num_buffers;
|
||||
if (q_num_bufs + *num_buffers < min_buf_capture)
|
||||
*num_buffers = min_buf_capture - q_num_bufs;
|
||||
if (is_reqbufs && buffers_total < fmt_out->min_buffers)
|
||||
*num_buffers = fmt_out->min_buffers - q->num_buffers;
|
||||
*num_buffers = fmt_out->min_buffers - q_num_bufs;
|
||||
if (buffers_total > fmt_out->max_buffers)
|
||||
*num_buffers = fmt_out->max_buffers - q->num_buffers;
|
||||
*num_buffers = fmt_out->max_buffers - q_num_bufs;
|
||||
|
||||
/* We need to program the complete CAPTURE buffer list
|
||||
* in registers during start_streaming, and the firmwares
|
||||
* are free to choose any of them to write frames to. As such,
|
||||
* we need all of them to be queued into the driver
|
||||
*/
|
||||
sess->num_dst_bufs = q->num_buffers + *num_buffers;
|
||||
sess->num_dst_bufs = q_num_bufs + *num_buffers;
|
||||
q->min_buffers_needed = max(fmt_out->min_buffers, sess->num_dst_bufs);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user