Skip to content

Commit 0356ae6

Browse files
hoshinolinajannau
authored andcommitted
media: apple: isp: Rework meta surface handling & buffer return
Now we keep track of meta surfaces independently, and always allocate 16 of them, plus handle buffer return messages more correctly. Fixes t8112 asserts (for some reason). Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent f613d17 commit 0356ae6

6 files changed

Lines changed: 176 additions & 111 deletions

File tree

drivers/media/platform/apple/isp/isp-drv.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct isp_surf {
4343
void *virt;
4444
refcount_t refcount;
4545
bool gc;
46+
bool submitted;
4647
};
4748

4849
struct isp_message {
@@ -221,6 +222,7 @@ struct apple_isp {
221222
struct isp_surf *data_surf;
222223
struct isp_surf *log_surf;
223224
struct isp_surf *bt_surf;
225+
struct isp_surf *meta_surfs[ISP_MAX_BUFFERS];
224226
struct list_head gc;
225227
struct workqueue_struct *wq;
226228

@@ -252,7 +254,6 @@ struct isp_buffer {
252254
struct vb2_v4l2_buffer vb;
253255
struct list_head link;
254256
struct isp_surf surfs[VB2_MAX_PLANES];
255-
struct isp_surf *meta;
256257
};
257258

258259
#define to_isp_buffer(x) container_of((x), struct isp_buffer, vb)

drivers/media/platform/apple/isp/isp-fw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "isp-iommu.h"
1313
#include "isp-ipc.h"
1414
#include "isp-regs.h"
15+
#include "isp-v4l2.h"
1516

1617
#define ISP_FIRMWARE_MDELAY 1
1718
#define ISP_FIRMWARE_MAX_TRIES 1000

drivers/media/platform/apple/isp/isp-ipc.c

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -284,45 +284,3 @@ int ipc_sm_handle(struct apple_isp *isp, struct isp_channel *chan)
284284

285285
return 0;
286286
}
287-
288-
int ipc_bt_handle(struct apple_isp *isp, struct isp_channel *chan)
289-
{
290-
struct isp_message *req = &chan->req, *rsp = &chan->rsp;
291-
struct isp_buffer *tmp, *buf;
292-
int err = 0;
293-
294-
/* No need to read the whole struct */
295-
u64 meta_iova;
296-
u64 *p_meta_iova = apple_isp_translate(
297-
isp, isp->bt_surf, req->arg0 + ISP_IPC_BUFEXC_STAT_META_OFFSET,
298-
sizeof(u64));
299-
300-
if (!p_meta_iova) {
301-
dev_err(isp->dev, "Failed to find bufexc stat meta\n");
302-
return -EIO;
303-
}
304-
meta_iova = *p_meta_iova;
305-
306-
spin_lock(&isp->buf_lock);
307-
list_for_each_entry_safe_reverse(buf, tmp, &isp->bufs_submitted, link) {
308-
if ((u32)buf->meta->iova == (u32)meta_iova) {
309-
enum vb2_buffer_state state = VB2_BUF_STATE_ERROR;
310-
311-
buf->vb.vb2_buf.timestamp = ktime_get_ns();
312-
buf->vb.sequence = isp->sequence++;
313-
buf->vb.field = V4L2_FIELD_NONE;
314-
if (req->arg2 == ISP_IPC_BUFEXC_FLAG_RENDER)
315-
state = VB2_BUF_STATE_DONE;
316-
vb2_buffer_done(&buf->vb.vb2_buf, state);
317-
list_del(&buf->link);
318-
break;
319-
}
320-
}
321-
spin_unlock(&isp->buf_lock);
322-
323-
rsp->arg0 = req->arg0 | ISP_IPC_FLAG_ACK;
324-
rsp->arg1 = 0x0;
325-
rsp->arg2 = ISP_IPC_BUFEXC_FLAG_ACK;
326-
327-
return err;
328-
}

drivers/media/platform/apple/isp/isp-ipc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@ int ipc_chan_send(struct apple_isp *isp, struct isp_channel *chan,
2121

2222
int ipc_tm_handle(struct apple_isp *isp, struct isp_channel *chan);
2323
int ipc_sm_handle(struct apple_isp *isp, struct isp_channel *chan);
24-
int ipc_bt_handle(struct apple_isp *isp, struct isp_channel *chan);
2524

2625
#endif /* __ISP_IPC_H__ */

0 commit comments

Comments
 (0)