From 1543e317f1da31b75942316931e8f491a8920811 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Thu, 04 Jan 2024 10:08:02 +0000
Subject: [PATCH] disable FB
---
kernel/drivers/media/platform/rockchip/isp/isp_rockit.c | 69 +++++++++++++++++++++++++++++++---
1 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/kernel/drivers/media/platform/rockchip/isp/isp_rockit.c b/kernel/drivers/media/platform/rockchip/isp/isp_rockit.c
index d97cc27..6a5fa40 100644
--- a/kernel/drivers/media/platform/rockchip/isp/isp_rockit.c
+++ b/kernel/drivers/media/platform/rockchip/isp/isp_rockit.c
@@ -240,10 +240,16 @@
rockit_cfg->frame.u64PTS = stream->curr_buf->vb.vb2_buf.timestamp;
rockit_cfg->frame.u32TimeRef = stream->curr_buf->vb.sequence;
+ v4l2_dbg(2, rkisp_debug, &dev->v4l2_dev,
+ "%s stream:%d seq:%d buf:0x%x done\n",
+ __func__, stream->id,
+ stream->curr_buf->vb.sequence,
+ stream->curr_buf->buff_addr[0]);
} else {
if (stream->ispdev->cap_dev.wrap_line &&
stream->id == RKISP_STREAM_MP) {
- if (stream_cfg->is_discard || stream->ops->is_stream_stopped(stream))
+ if (dev->is_first_double || stream_cfg->is_discard ||
+ stream->ops->is_stream_stopped(stream))
return 0;
} else if (stream_cfg->dst_fps) {
if (!stream_cfg->is_discard && !stream->curr_buf) {
@@ -259,7 +265,7 @@
rkisp_dmarx_get_frame(stream->ispdev, &seq, NULL, &ns, true);
if (!ns)
- ns = ktime_get_ns();
+ ns = rkisp_time_get_ns(dev);
rockit_cfg->frame.u64PTS = ns;
@@ -316,8 +322,9 @@
int width, int height, int wrap_line)
{
struct rkisp_stream *stream = NULL;
- struct rkisp_buffer *isp_buf;
+ struct rkisp_buffer *isp_buf, *buf_temp;
int offset, i, ret;
+ unsigned long lock_flags = 0;
stream = rkisp_rockit_get_stream(input_rockit_cfg);
@@ -337,16 +344,18 @@
if (stream->ispdev->cap_dev.wrap_line && stream->id == RKISP_STREAM_MP)
rkisp_dvbm_init(stream);
+ spin_lock_irqsave(&stream->vbq_lock, lock_flags);
if (stream->curr_buf) {
list_add_tail(&stream->curr_buf->queue, &stream->buf_queue);
+ if (stream->curr_buf == stream->next_buf)
+ stream->next_buf = NULL;
stream->curr_buf = NULL;
}
if (stream->next_buf) {
list_add_tail(&stream->next_buf->queue, &stream->buf_queue);
stream->next_buf = NULL;
}
-
- list_for_each_entry(isp_buf, &stream->buf_queue, queue) {
+ list_for_each_entry_safe(isp_buf, buf_temp, &stream->buf_queue, queue) {
if (stream->out_isp_fmt.mplanes == 1) {
for (i = 0; i < stream->out_isp_fmt.cplanes - 1; i++) {
height = stream->out_fmt.height;
@@ -358,6 +367,7 @@
}
}
}
+ spin_unlock_irqrestore(&stream->vbq_lock, lock_flags);
return 0;
}
@@ -421,6 +431,46 @@
}
EXPORT_SYMBOL(rkisp_rockit_free_tb_stream_buf);
+int rkisp_rockit_free_stream_buf(struct rockit_cfg *input_rockit_cfg)
+{
+ struct rkisp_stream *stream;
+ struct rkisp_buffer *buf;
+ unsigned long lock_flags = 0;
+
+ if (!input_rockit_cfg)
+ return -EINVAL;
+ stream = rkisp_rockit_get_stream(input_rockit_cfg);
+ if (!stream)
+ return -EINVAL;
+
+ if (stream->streaming)
+ return 0;
+
+ spin_lock_irqsave(&stream->vbq_lock, lock_flags);
+ if (stream->curr_buf) {
+ list_add_tail(&stream->curr_buf->queue, &stream->buf_queue);
+ if (stream->curr_buf == stream->next_buf)
+ stream->next_buf = NULL;
+ stream->curr_buf = NULL;
+ }
+ if (stream->next_buf) {
+ list_add_tail(&stream->next_buf->queue, &stream->buf_queue);
+ stream->next_buf = NULL;
+ }
+
+ while (!list_empty(&stream->buf_queue)) {
+ buf = list_first_entry(&stream->buf_queue,
+ struct rkisp_buffer, queue);
+ list_del(&buf->queue);
+ }
+ rkisp_rockit_buf_state_clear(stream);
+ spin_unlock_irqrestore(&stream->vbq_lock, lock_flags);
+ rkisp_rockit_buf_free(stream);
+
+ return 0;
+}
+EXPORT_SYMBOL(rkisp_rockit_free_stream_buf);
+
void rkisp_rockit_buf_state_clear(struct rkisp_stream *stream)
{
struct rkisp_stream_cfg *stream_cfg;
@@ -446,6 +496,7 @@
return -EINVAL;
stream_cfg = &rockit_cfg->rkisp_dev_cfg[dev_id].rkisp_stream_cfg[stream->id];
+ mutex_lock(&stream_cfg->freebuf_lock);
for (i = 0; i < ROCKIT_BUF_NUM_MAX; i++) {
if (stream_cfg->rkisp_buff[i]) {
isprk_buf = (struct rkisp_rockit_buffer *)stream_cfg->rkisp_buff[i];
@@ -458,12 +509,14 @@
stream_cfg->rkisp_buff[i] = NULL;
}
}
+ mutex_unlock(&stream_cfg->freebuf_lock);
return 0;
}
void rkisp_rockit_dev_init(struct rkisp_device *dev)
{
- int i;
+ struct rkisp_stream_cfg *stream_cfg;
+ int i, j;
if (rockit_cfg == NULL) {
rockit_cfg = kzalloc(sizeof(struct rockit_cfg), GFP_KERNEL);
@@ -477,6 +530,10 @@
dev->hw_dev->isp[i]->name;
rockit_cfg->rkisp_dev_cfg[i].isp_dev =
dev->hw_dev->isp[i];
+ for (j = 0; j < RKISP_MAX_STREAM; j++) {
+ stream_cfg = &rockit_cfg->rkisp_dev_cfg[i].rkisp_stream_cfg[j];
+ mutex_init(&stream_cfg->freebuf_lock);
+ }
}
}
}
--
Gitblit v1.6.2