This is rather overkill since currently all drivers call this from
hardirq (or at least timers). But maybe in the future we're going to
have thread irq handlers and what not, doesn't hurt to be prepared.
Plus this is an easy start for sprinkling these fence annotations into
shared code.

Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Chris Wilson <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_vblank.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 85e5f2db1608..93a5bba5f665 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -24,6 +24,7 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include <linux/dma-fence.h>
 #include <linux/export.h>
 #include <linux/moduleparam.h>
 
@@ -1908,7 +1909,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned 
int pipe)
 {
        struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
        unsigned long irqflags;
-       bool disable_irq;
+       bool disable_irq, fence_cookie;
 
        if (drm_WARN_ON_ONCE(dev, !drm_dev_has_vblank(dev)))
                return false;
@@ -1916,6 +1917,8 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned 
int pipe)
        if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
                return false;
 
+       fence_cookie = dma_fence_begin_signalling();
+
        spin_lock_irqsave(&dev->event_lock, irqflags);
 
        /* Need timestamp lock to prevent concurrent execution with
@@ -1928,6 +1931,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned 
int pipe)
        if (!vblank->enabled) {
                spin_unlock(&dev->vblank_time_lock);
                spin_unlock_irqrestore(&dev->event_lock, irqflags);
+               dma_fence_end_signalling(fence_cookie);
                return false;
        }
 
@@ -1953,6 +1957,8 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned 
int pipe)
        if (disable_irq)
                vblank_disable_fn(&vblank->disable_timer);
 
+       dma_fence_end_signalling(fence_cookie);
+
        return true;
 }
 EXPORT_SYMBOL(drm_handle_vblank);
-- 
2.26.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to