brcm2708-gpu-fw: update to latest version
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0484-drm-vc4-Fix-overflow-mem-unreferencing-when-the-binn.patch
1 From 379b5d818939dc58742278f744b60241a577568d Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Thu, 21 Jul 2016 13:39:11 -0700
4 Subject: [PATCH] drm/vc4: Fix overflow mem unreferencing when the binner runs
5 dry.
6
7 Overflow memory handling is tricky: While it's still referenced by the
8 BPO registers, we want to keep it from being freed. When we are
9 putting a new set of overflow memory in the registers, we need to
10 assign the old one to the last rendering job using it.
11
12 We were looking at "what's currently running in the binner", but since
13 the bin/render submission split, we may end up with the binner
14 completing and having no new job while the renderer is still
15 processing. So, if we don't find a bin job at all, look at the
16 highest-seqno (last) render job to attach our overflow to.
17
18 Signed-off-by: Eric Anholt <eric@anholt.net>
19 Fixes: ca26d28bbaa3 ("drm/vc4: improve throughput by pipelining binning and rendering jobs")
20 Cc: stable@vger.kernel.org
21 ---
22 drivers/gpu/drm/vc4/vc4_drv.h | 9 +++++++++
23 drivers/gpu/drm/vc4/vc4_irq.c | 4 +++-
24 2 files changed, 12 insertions(+), 1 deletion(-)
25
26 --- a/drivers/gpu/drm/vc4/vc4_drv.h
27 +++ b/drivers/gpu/drm/vc4/vc4_drv.h
28 @@ -329,6 +329,15 @@ vc4_first_render_job(struct vc4_dev *vc4
29 struct vc4_exec_info, head);
30 }
31
32 +static inline struct vc4_exec_info *
33 +vc4_last_render_job(struct vc4_dev *vc4)
34 +{
35 + if (list_empty(&vc4->render_job_list))
36 + return NULL;
37 + return list_last_entry(&vc4->render_job_list,
38 + struct vc4_exec_info, head);
39 +}
40 +
41 /**
42 * struct vc4_texture_sample_info - saves the offsets into the UBO for texture
43 * setup parameters.
44 --- a/drivers/gpu/drm/vc4/vc4_irq.c
45 +++ b/drivers/gpu/drm/vc4/vc4_irq.c
46 @@ -83,8 +83,10 @@ vc4_overflow_mem_work(struct work_struct
47
48 spin_lock_irqsave(&vc4->job_lock, irqflags);
49 current_exec = vc4_first_bin_job(vc4);
50 + if (!current_exec)
51 + current_exec = vc4_last_render_job(vc4);
52 if (current_exec) {
53 - vc4->overflow_mem->seqno = vc4->finished_seqno + 1;
54 + vc4->overflow_mem->seqno = current_exec->seqno;
55 list_add_tail(&vc4->overflow_mem->unref_head,
56 &current_exec->unref_list);
57 vc4->overflow_mem = NULL;