aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vc4/vc4_irq.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-05-17 22:57:06 -0400
committerDave Airlie <airlied@redhat.com>2017-05-17 22:57:06 -0400
commite98c58e55f68f8785aebfab1f8c9a03d8de0afe1 (patch)
tree8357e8fda6efb0867ac39fc6b9211a579721d00a /drivers/gpu/drm/vc4/vc4_irq.c
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff)
parent9cf8f5802f39d9991158b29033c852bccfc3a4d4 (diff)
Merge tag 'drm-misc-next-2017-05-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next
UAPI Changes: - Return -ENODEV instead of -ENXIO when creating cma fb w/o valid gem (Daniel) - Add aspect ratio and custom scaling propertis to connector state (Maarten) Cross-subsystem Changes: - None Core Changes: - Add Laurent as bridge reviewer and Andrzej as bridge maintainer (Archit) - Maintain new STM driver through -misc (Yannick) - Misc doc improvements (as is tradition) (Daniel) - Add driver-private objects to atomic state (Dhinakaran) - Deprecate preclose hook in modern drivers (use postclose) (Daniel) - Add hwmode to vblank struct. This fixes mode access in irq context and reduced a bunch of boilerplate (Daniel) Driver Changes: - vc4: Add out-fence support to vc4 V3D rendering (Eric) - stm: Add stm32f429 display hw and am-480272h3tmqw-t01h panel support (Yannick) - vc4: Remove 256MB cma limit from vc4 (Eric) - dw-hdmi: Disable audio when inactive, instead of always enabled (Romain) - zte: Add support for VGA to the ZTE driver (Shawn) - i915: Track DP MST bandwidth and check it in atomic_check (Dhinakaran) - vgem: Enable gem dmabuf import iface to facilitate ion testing (Laura) - vc4: Add support for Cygnus (new dt compat string + couple bug fixes) (Eric) - pl111: Add driver for pl111 CLCD display controller (Eric/Tom) - vgem: Subclass drm_device instead of standalone platform device (Chris) Cc: Archit Taneja <architt@codeaurora.org> Cc: Eric Anholt <eric@anholt.net> Cc: Yannick Fertre <yannick.fertre@st.com> Cc: Romain Perier <romain.perier@collabora.com> Cc: Navare, Manasi D <manasi.d.navare@intel.com> Cc: Shawn Guo <shawn.guo@linaro.org> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: Laura Abbott <labbott@redhat.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Tom Cooksey <tom.cooksey@arm.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> * tag 'drm-misc-next-2017-05-16' of git://anongit.freedesktop.org/git/drm-misc: (72 commits) drm: add missing declaration to drm_blend.h drm/dp: Wait up all outstanding tx waiters drm/dp: Read the tx msg state once after checking for an event drm/prime: Forward declare struct device drm/vblank: Lock down vblank->hwmode more drm/vblank: drop the mode argument from drm_calc_vbltimestamp_from_scanoutpos drm/vblank: Add FIXME comments about moving the vblank ts hooks drm/vblank: Switch to bool in_vblank_irq in get_vblank_timestamp drm/vblank: Switch drm_driver->get_vblank_timestamp to return a bool drm/vgem: Convert to a struct drm_device subclass gpu: drm: gma500: remove dead code drm/sti: Adjust two checks for null pointers in sti_hqvdp_probe() drm/sti: Fix typos in a comment line drm/sti: Fix a typo in a comment line drm/sti: Replace 17 seq_puts() calls by seq_putc() drm/sti: Reduce function calls for sequence output at five places drm/sti: use seq_puts to display a string drm: Nerf the preclose callback for modern drivers drm/exynos: Merge pre/postclose hooks drm/tegra: switch to postclose ...
Diffstat (limited to 'drivers/gpu/drm/vc4/vc4_irq.c')
-rw-r--r--drivers/gpu/drm/vc4/vc4_irq.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
index cdc6e6760705..7d7af3a93d94 100644
--- a/drivers/gpu/drm/vc4/vc4_irq.c
+++ b/drivers/gpu/drm/vc4/vc4_irq.c
@@ -59,50 +59,45 @@ vc4_overflow_mem_work(struct work_struct *work)
59{ 59{
60 struct vc4_dev *vc4 = 60 struct vc4_dev *vc4 =
61 container_of(work, struct vc4_dev, overflow_mem_work); 61 container_of(work, struct vc4_dev, overflow_mem_work);
62 struct drm_device *dev = vc4->dev; 62 struct vc4_bo *bo = vc4->bin_bo;
63 struct vc4_bo *bo; 63 int bin_bo_slot;
64 struct vc4_exec_info *exec;
65 unsigned long irqflags;
64 66
65 bo = vc4_bo_create(dev, 256 * 1024, true); 67 bin_bo_slot = vc4_v3d_get_bin_slot(vc4);
66 if (IS_ERR(bo)) { 68 if (bin_bo_slot < 0) {
67 DRM_ERROR("Couldn't allocate binner overflow mem\n"); 69 DRM_ERROR("Couldn't allocate binner overflow mem\n");
68 return; 70 return;
69 } 71 }
70 72
71 /* If there's a job executing currently, then our previous 73 spin_lock_irqsave(&vc4->job_lock, irqflags);
72 * overflow allocation is getting used in that job and we need 74
73 * to queue it to be released when the job is done. But if no 75 if (vc4->bin_alloc_overflow) {
74 * job is executing at all, then we can free the old overflow 76 /* If we had overflow memory allocated previously,
75 * object direcctly. 77 * then that chunk will free when the current bin job
76 * 78 * is done. If we don't have a bin job running, then
77 * No lock necessary for this pointer since we're the only 79 * the chunk will be done whenever the list of render
78 * ones that update the pointer, and our workqueue won't 80 * jobs has drained.
79 * reenter. 81 */
80 */ 82 exec = vc4_first_bin_job(vc4);
81 if (vc4->overflow_mem) { 83 if (!exec)
82 struct vc4_exec_info *current_exec; 84 exec = vc4_last_render_job(vc4);
83 unsigned long irqflags; 85 if (exec) {
84 86 exec->bin_slots |= vc4->bin_alloc_overflow;
85 spin_lock_irqsave(&vc4->job_lock, irqflags); 87 } else {
86 current_exec = vc4_first_bin_job(vc4); 88 /* There's nothing queued in the hardware, so
87 if (!current_exec) 89 * the old slot is free immediately.
88 current_exec = vc4_last_render_job(vc4); 90 */
89 if (current_exec) { 91 vc4->bin_alloc_used &= ~vc4->bin_alloc_overflow;
90 vc4->overflow_mem->seqno = current_exec->seqno;
91 list_add_tail(&vc4->overflow_mem->unref_head,
92 &current_exec->unref_list);
93 vc4->overflow_mem = NULL;
94 } 92 }
95 spin_unlock_irqrestore(&vc4->job_lock, irqflags);
96 } 93 }
94 vc4->bin_alloc_overflow = BIT(bin_bo_slot);
97 95
98 if (vc4->overflow_mem) 96 V3D_WRITE(V3D_BPOA, bo->base.paddr + bin_bo_slot * vc4->bin_alloc_size);
99 drm_gem_object_unreference_unlocked(&vc4->overflow_mem->base.base);
100 vc4->overflow_mem = bo;
101
102 V3D_WRITE(V3D_BPOA, bo->base.paddr);
103 V3D_WRITE(V3D_BPOS, bo->base.base.size); 97 V3D_WRITE(V3D_BPOS, bo->base.base.size);
104 V3D_WRITE(V3D_INTCTL, V3D_INT_OUTOMEM); 98 V3D_WRITE(V3D_INTCTL, V3D_INT_OUTOMEM);
105 V3D_WRITE(V3D_INTENA, V3D_INT_OUTOMEM); 99 V3D_WRITE(V3D_INTENA, V3D_INT_OUTOMEM);
100 spin_unlock_irqrestore(&vc4->job_lock, irqflags);
106} 101}
107 102
108static void 103static void
@@ -142,6 +137,10 @@ vc4_irq_finish_render_job(struct drm_device *dev)
142 137
143 vc4->finished_seqno++; 138 vc4->finished_seqno++;
144 list_move_tail(&exec->head, &vc4->job_done_list); 139 list_move_tail(&exec->head, &vc4->job_done_list);
140 if (exec->fence) {
141 dma_fence_signal_locked(exec->fence);
142 exec->fence = NULL;
143 }
145 vc4_submit_next_render_job(dev); 144 vc4_submit_next_render_job(dev);
146 145
147 wake_up_all(&vc4->job_wait_queue); 146 wake_up_all(&vc4->job_wait_queue);