media: rockchip: vicap clean toisp buf struct after free buf

Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: I75a9b88a92e4e13fc8282f8b8d1950ed13729a5b
This commit is contained in:
Zefa Chen
2024-11-28 16:33:03 +08:00
committed by Tao Huang
parent 694e7d4a4a
commit d3de0c6b1e
2 changed files with 11 additions and 3 deletions

View File

@@ -5716,6 +5716,7 @@ void rkcif_free_rx_buf(struct rkcif_stream *stream, int buf_num)
if (buf->dbufs.is_init)
v4l2_subdev_call(sd, core, ioctl,
RKISP_VICAP_CMD_RX_BUFFER_FREE, &buf->dbufs);
memset(buf, 0, sizeof(*buf));
buf->dummy.is_free = true;
}
@@ -5772,10 +5773,13 @@ void rkcif_free_rx_buf(struct rkcif_stream *stream, int buf_num)
if (buf->dbufs.is_init)
v4l2_subdev_call(sd, core, ioctl,
RKISP_VICAP_CMD_RX_BUFFER_FREE, &buf->dbufs);
if (!dev->is_thunderboot)
if (!dev->is_thunderboot) {
rkcif_free_buffer(dev, &buf->dummy);
else
memset(buf, 0, sizeof(*buf));
buf->dummy.is_free = true;
} else {
list_add_tail(&buf->list_free, &priv->buf_free_list);
}
atomic_dec(&stream->buf_cnt);
stream->total_buf_num--;
}
@@ -5857,6 +5861,8 @@ int rkcif_init_rx_buf(struct rkcif_stream *stream, int buf_num)
else
return -EINVAL;
}
INIT_LIST_HEAD(&stream->rx_buf_head);
while (true) {
buf = &stream->rx_buf[i];
memset(buf, 0, sizeof(*buf));

View File

@@ -98,6 +98,8 @@ static void sditf_buffree_work(struct work_struct *work)
if (rx_buf) {
list_del(&rx_buf->list_free);
rkcif_free_reserved_mem_buf(priv->cif_dev, rx_buf);
memset(rx_buf, 0, sizeof(*rx_buf));
rx_buf->dummy.is_free = true;
}
}
spin_unlock_irqrestore(&priv->cif_dev->buffree_lock, flags);
@@ -1320,7 +1322,7 @@ static int sditf_s_rx_buffer(struct v4l2_subdev *sd,
is_free = true;
}
if (!is_free && (!dbufs->is_switch)) {
if (!is_free && (!dbufs->is_switch) && stream->state == RKCIF_STATE_STREAMING) {
list_add_tail(&rx_buf->list, &stream->rx_buf_head);
rkcif_assign_check_buffer_update_toisp(stream);
if (cif_dev->resume_mode != RKISP_RTT_MODE_ONE_FRAME) {