Skip to content

Commit 71e9d2f

Browse files
committed
drm/vc4: Fix overflow mem unreferencing when the binner runs dry.
Overflow memory handling is tricky: While it's still referenced by the BPO registers, we want to keep it from being freed. When we are putting a new set of overflow memory in the registers, we need to assign the old one to the last rendering job using it. We were looking at "what's currently running in the binner", but since the bin/render submission split, we may end up with the binner completing and having no new job while the renderer is still processing. So, if we don't find a bin job at all, look at the highest-seqno (last) render job to attach our overflow to. Signed-off-by: Eric Anholt <[email protected]> Fixes: ca26d28 ("drm/vc4: improve throughput by pipelining binning and rendering jobs") Cc: [email protected]
1 parent a746c17 commit 71e9d2f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

drivers/gpu/drm/vc4/vc4_drv.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,15 @@ vc4_first_render_job(struct vc4_dev *vc4)
329329
struct vc4_exec_info, head);
330330
}
331331

332+
static inline struct vc4_exec_info *
333+
vc4_last_render_job(struct vc4_dev *vc4)
334+
{
335+
if (list_empty(&vc4->render_job_list))
336+
return NULL;
337+
return list_last_entry(&vc4->render_job_list,
338+
struct vc4_exec_info, head);
339+
}
340+
332341
/**
333342
* struct vc4_texture_sample_info - saves the offsets into the UBO for texture
334343
* setup parameters.

drivers/gpu/drm/vc4/vc4_irq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ vc4_overflow_mem_work(struct work_struct *work)
8383

8484
spin_lock_irqsave(&vc4->job_lock, irqflags);
8585
current_exec = vc4_first_bin_job(vc4);
86+
if (!current_exec)
87+
current_exec = vc4_last_render_job(vc4);
8688
if (current_exec) {
87-
vc4->overflow_mem->seqno = vc4->finished_seqno + 1;
89+
vc4->overflow_mem->seqno = current_exec->seqno;
8890
list_add_tail(&vc4->overflow_mem->unref_head,
8991
&current_exec->unref_list);
9092
vc4->overflow_mem = NULL;

0 commit comments

Comments
 (0)