mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
media: rockchip: isp: add frame loss info to procfs
Change-Id: Idecd94535da352fcde5f2a462d4596316f9ea049 Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
@@ -487,11 +487,12 @@ static void rkisp_bridge_save_fbcgain(struct rkisp_device *dev, struct rkisp_isp
|
||||
|
||||
spin_lock_irqsave(&hw->buf_lock, lock_flags);
|
||||
if (dev->cur_fbcgain) {
|
||||
v4l2_dbg(3, rkisp_debug, &br_dev->sd,
|
||||
v4l2_dbg(1, rkisp_debug, &br_dev->sd,
|
||||
"%s old mfbcgain buf is exit, frame_id %d\n",
|
||||
__func__, dev->cur_fbcgain->frame_id);
|
||||
list_add_tail(&dev->cur_fbcgain->list, &hw->list);
|
||||
dev->cur_fbcgain = NULL;
|
||||
br_dev->dbg.frameloss++;
|
||||
}
|
||||
dev->cur_fbcgain = fbcgain;
|
||||
rkisp_bridge_try_sendtohal(dev);
|
||||
@@ -597,6 +598,7 @@ static int frame_end(struct rkisp_bridge_device *dev, bool en, u32 state)
|
||||
hw->cur_buf = NULL;
|
||||
} else {
|
||||
v4l2_dbg(1, rkisp_debug, &dev->sd, "no buf, lost frame:%d\n", dev->dbg.id);
|
||||
dev->dbg.frameloss++;
|
||||
}
|
||||
|
||||
if (hw->nxt_buf) {
|
||||
@@ -1276,6 +1278,7 @@ static int bridge_s_stream(struct v4l2_subdev *sd, int on)
|
||||
"%s %d\n", __func__, on);
|
||||
|
||||
if (on) {
|
||||
memset(&dev->dbg, 0, sizeof(dev->dbg));
|
||||
atomic_inc(&dev->ispdev->cap_dev.refcnt);
|
||||
ret = bridge_start_stream(sd);
|
||||
} else {
|
||||
@@ -1467,11 +1470,12 @@ void rkisp_bridge_save_spbuf(struct rkisp_device *dev, struct rkisp_buffer *sp_b
|
||||
|
||||
spin_lock_irqsave(&hw->buf_lock, lock_flags);
|
||||
if (dev->cur_spbuf) {
|
||||
v4l2_dbg(3, rkisp_debug, &br_dev->sd,
|
||||
v4l2_dbg(1, rkisp_debug, &br_dev->sd,
|
||||
"%s old sp buf is exit, frame_id %d\n",
|
||||
__func__, dev->cur_spbuf->vb.sequence);
|
||||
rkisp_spbuf_queue(&dev->cap_dev.stream[RKISP_STREAM_SP], dev->cur_spbuf);
|
||||
dev->cur_spbuf = NULL;
|
||||
dev->cap_dev.stream[RKISP_STREAM_SP].dbg.frameloss++;
|
||||
}
|
||||
dev->cur_spbuf = sp_buf;
|
||||
rkisp_bridge_try_sendtohal(dev);
|
||||
|
||||
@@ -1094,8 +1094,10 @@ static void update_dmatx_v2(struct rkisp_stream *stream)
|
||||
else
|
||||
hdr_qbuf(&dev->hdr.q_tx[index], buf);
|
||||
}
|
||||
if (!buf && dev->hw_dev->dummy_buf.mem_priv)
|
||||
if (!buf && dev->hw_dev->dummy_buf.mem_priv) {
|
||||
buf = &dev->hw_dev->dummy_buf;
|
||||
stream->dbg.frameloss++;
|
||||
}
|
||||
if (buf)
|
||||
mi_set_y_addr(stream, buf->dma_addr);
|
||||
}
|
||||
@@ -1126,6 +1128,7 @@ static void update_mi(struct rkisp_stream *stream)
|
||||
mi_set_y_addr(stream, dummy_buf->dma_addr);
|
||||
mi_set_cb_addr(stream, dummy_buf->dma_addr);
|
||||
mi_set_cr_addr(stream, dummy_buf->dma_addr);
|
||||
stream->dbg.frameloss++;
|
||||
}
|
||||
|
||||
mi_set_y_offset(stream, 0);
|
||||
@@ -1409,6 +1412,7 @@ static int mi_frame_end(struct rkisp_stream *stream)
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"multiple long data in hdr frame\n");
|
||||
rkisp_buf_queue(&cap->rdbk_buf[RDBK_L]->vb.vb2_buf);
|
||||
stream->dbg.frameloss++;
|
||||
}
|
||||
cap->rdbk_buf[RDBK_L] = stream->curr_buf;
|
||||
} else if (stream->id == RKISP_STREAM_DMATX1) {
|
||||
@@ -1416,6 +1420,7 @@ static int mi_frame_end(struct rkisp_stream *stream)
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"multiple middle data in hdr frame\n");
|
||||
rkisp_buf_queue(&cap->rdbk_buf[RDBK_M]->vb.vb2_buf);
|
||||
stream->dbg.frameloss++;
|
||||
}
|
||||
cap->rdbk_buf[RDBK_M] = stream->curr_buf;
|
||||
} else if (stream->id == RKISP_STREAM_DMATX2) {
|
||||
@@ -1423,6 +1428,7 @@ static int mi_frame_end(struct rkisp_stream *stream)
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"multiple short data in hdr frame\n");
|
||||
rkisp_buf_queue(&cap->rdbk_buf[RDBK_S]->vb.vb2_buf);
|
||||
stream->dbg.frameloss++;
|
||||
}
|
||||
cap->rdbk_buf[RDBK_S] = stream->curr_buf;
|
||||
rdbk_frame_end(stream);
|
||||
@@ -1869,6 +1875,7 @@ rkisp_start_streaming(struct vb2_queue *queue, unsigned int count)
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
memset(&stream->dbg, 0, sizeof(stream->dbg));
|
||||
atomic_inc(&dev->cap_dev.refcnt);
|
||||
if (!dev->isp_inp || !stream->linked) {
|
||||
v4l2_err(v4l2_dev, "check video link or isp input\n");
|
||||
|
||||
@@ -495,8 +495,10 @@ static void update_dmatx_v2(struct rkisp_stream *stream)
|
||||
else
|
||||
hdr_qbuf(&dev->hdr.q_tx[index], buf);
|
||||
}
|
||||
if (!buf && dev->hw_dev->dummy_buf.mem_priv)
|
||||
if (!buf && dev->hw_dev->dummy_buf.mem_priv) {
|
||||
buf = &dev->hw_dev->dummy_buf;
|
||||
stream->dbg.frameloss++;
|
||||
}
|
||||
if (buf)
|
||||
mi_set_y_addr(stream, buf->dma_addr);
|
||||
}
|
||||
@@ -535,6 +537,7 @@ static void update_mi(struct rkisp_stream *stream)
|
||||
dummy_buf->dma_addr, false);
|
||||
rkisp_write(dev, stream->config->mi.cr_base_ad_init,
|
||||
dummy_buf->dma_addr, false);
|
||||
stream->dbg.frameloss++;
|
||||
}
|
||||
|
||||
mi_set_y_offset(stream, 0);
|
||||
@@ -681,6 +684,7 @@ static void rdbk_frame_end(struct rkisp_stream *stream)
|
||||
return;
|
||||
|
||||
RDBK_FRM_UNMATCH:
|
||||
stream->dbg.frameloss++;
|
||||
if (cap->rdbk_buf[RDBK_L])
|
||||
rkisp_buf_queue(&cap->rdbk_buf[RDBK_L]->vb.vb2_buf);
|
||||
if (cap->rdbk_buf[RDBK_S])
|
||||
@@ -1158,6 +1162,7 @@ rkisp_start_streaming(struct vb2_queue *queue, unsigned int count)
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
memset(&stream->dbg, 0, sizeof(stream->dbg));
|
||||
atomic_inc(&dev->cap_dev.refcnt);
|
||||
if (!dev->isp_inp || !stream->linked) {
|
||||
v4l2_err(v4l2_dev, "check video link or isp input\n");
|
||||
|
||||
@@ -71,6 +71,7 @@ struct frame_debug_info {
|
||||
u32 interval;
|
||||
u32 delay;
|
||||
u32 id;
|
||||
u32 frameloss;
|
||||
};
|
||||
|
||||
struct max_input {
|
||||
|
||||
@@ -245,13 +245,14 @@ static int isp_show(struct seq_file *p, void *v)
|
||||
sdev->in_crop.width, sdev->in_crop.height, val,
|
||||
sdev->in_crop.left, sdev->in_crop.top);
|
||||
if (IS_HDR_RDBK(dev->hdr.op_mode))
|
||||
seq_printf(p, "%-10s mode:frame%d (frame:%d rate:%dms %s time:%dms) cnt(total:%d X1:%d X2:%d X3:%d)\n",
|
||||
seq_printf(p, "%-10s mode:frame%d (frame:%d rate:%dms %s time:%dms frameloss:%d) cnt(total:%d X1:%d X2:%d X3:%d)\n",
|
||||
"Isp Read",
|
||||
dev->rd_mode - 3,
|
||||
dev->dmarx_dev.cur_frame.id,
|
||||
(u32)(dev->dmarx_dev.cur_frame.timestamp - dev->dmarx_dev.pre_frame.timestamp) / 1000 / 1000,
|
||||
(dev->isp_state & ISP_FRAME_END) ? "idle" : "working",
|
||||
sdev->dbg.interval / 1000 / 1000,
|
||||
sdev->dbg.frameloss,
|
||||
dev->rdbk_cnt,
|
||||
dev->rdbk_cnt_x1,
|
||||
dev->rdbk_cnt_x2,
|
||||
@@ -265,7 +266,7 @@ static int isp_show(struct seq_file *p, void *v)
|
||||
sdev->dbg.delay / 1000);
|
||||
|
||||
if (dev->br_dev.en)
|
||||
seq_printf(p, "%-10s rkispp%d Format:%s%s Size:%dx%d (frame:%d rate:%dms)\n",
|
||||
seq_printf(p, "%-10s rkispp%d Format:%s%s Size:%dx%d (frame:%d rate:%dms frameloss:%d)\n",
|
||||
"Output",
|
||||
dev->dev_id,
|
||||
(dev->br_dev.work_mode & ISP_ISPP_FBC) ? "FBC" : "YUV",
|
||||
@@ -273,13 +274,14 @@ static int isp_show(struct seq_file *p, void *v)
|
||||
dev->br_dev.crop.width,
|
||||
dev->br_dev.crop.height,
|
||||
dev->br_dev.dbg.id,
|
||||
dev->br_dev.dbg.interval / 1000 / 1000);
|
||||
dev->br_dev.dbg.interval / 1000 / 1000,
|
||||
dev->br_dev.dbg.frameloss);
|
||||
for (val = 0; val < RKISP_MAX_STREAM; val++) {
|
||||
struct rkisp_stream *stream = &dev->cap_dev.stream[val];
|
||||
|
||||
if (!stream->streaming)
|
||||
continue;
|
||||
seq_printf(p, "%-10s %s Format:%c%c%c%c Size:%dx%d (frame:%d rate:%dms delay:%dms)\n",
|
||||
seq_printf(p, "%-10s %s Format:%c%c%c%c Size:%dx%d (frame:%d rate:%dms delay:%dms frameloss:%d)\n",
|
||||
"Output",
|
||||
stream->vnode.vdev.name,
|
||||
stream->out_fmt.pixelformat,
|
||||
@@ -290,7 +292,8 @@ static int isp_show(struct seq_file *p, void *v)
|
||||
stream->out_fmt.height,
|
||||
stream->dbg.id,
|
||||
stream->dbg.interval / 1000 / 1000,
|
||||
stream->dbg.delay / 1000 / 1000);
|
||||
stream->dbg.delay / 1000 / 1000,
|
||||
stream->dbg.frameloss);
|
||||
}
|
||||
|
||||
switch (dev->isp_ver) {
|
||||
|
||||
@@ -654,6 +654,10 @@ static void rkisp_rdbk_trigger_handle(struct rkisp_device *dev, u32 cmd)
|
||||
isp = hw->isp[id];
|
||||
rkisp_rdbk_trigger_event(isp, T_CMD_DEQUEUE, &t);
|
||||
isp->dmarx_dev.pre_frame = isp->dmarx_dev.cur_frame;
|
||||
if (t.frame_id > isp->dmarx_dev.pre_frame.id &&
|
||||
t.frame_id - isp->dmarx_dev.pre_frame.id > 1)
|
||||
isp->isp_sdev.dbg.frameloss +=
|
||||
t.frame_id - isp->dmarx_dev.pre_frame.id + 1;
|
||||
isp->dmarx_dev.cur_frame.id = t.frame_id;
|
||||
isp->dmarx_dev.cur_frame.sof_timestamp = t.sof_timestamp;
|
||||
isp->dmarx_dev.cur_frame.timestamp = t.frame_timestamp;
|
||||
@@ -2230,6 +2234,7 @@ static int rkisp_isp_sd_s_stream(struct v4l2_subdev *sd, int on)
|
||||
}
|
||||
|
||||
rkisp_start_3a_run(isp_dev);
|
||||
memset(&isp_dev->isp_sdev.dbg, 0, sizeof(isp_dev->isp_sdev.dbg));
|
||||
mutex_lock(&isp_dev->hw_dev->dev_lock);
|
||||
atomic_inc(&isp_dev->hw_dev->refcnt);
|
||||
atomic_set(&isp_dev->isp_sdev.frm_sync_seq, 0);
|
||||
|
||||
Reference in New Issue
Block a user