summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2013-09-02 07:14:23 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2013-09-02 07:14:23 +0000
commit6855cf0256b1a2427c7b29d03976f44c982337fc (patch)
treef63291fe6fc365442cb19dbef7b26e9d9c096398 /sys
parent4eba2cb4dc8fa2c37985e2d8d7d8755a58fa55d1 (diff)
use DRM_MEMORYBARRIER() for smp_mb__*
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/drmP.h7
-rw-r--r--sys/dev/pci/drm/drm_irq.c13
-rw-r--r--sys/dev/pci/drm/ttm/ttm_bo.c4
3 files changed, 14 insertions, 10 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index c4d706b7279..d2903d4f178 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drmP.h,v 1.147 2013/09/02 06:25:27 jsg Exp $ */
+/* $OpenBSD: drmP.h,v 1.148 2013/09/02 07:14:22 jsg Exp $ */
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*/
@@ -235,6 +235,11 @@ IS_ERR_OR_NULL(const void *ptr)
#define DRM_MEMORYBARRIER() membar(Sync)
#endif
+#define smp_mb__before_atomic_dec() DRM_MEMORYBARRIER()
+#define smp_mb__after_atomic_dec() DRM_MEMORYBARRIER()
+#define smp_mb__before_atomic_inc() DRM_MEMORYBARRIER()
+#define smp_mb__after_atomic_inc() DRM_MEMORYBARRIER()
+
#define DRM_COPY_TO_USER(user, kern, size) copyout(kern, user, size)
#define DRM_COPY_FROM_USER(kern, user, size) copyin(user, kern, size)
diff --git a/sys/dev/pci/drm/drm_irq.c b/sys/dev/pci/drm/drm_irq.c
index 35cc10318b5..eea213fa127 100644
--- a/sys/dev/pci/drm/drm_irq.c
+++ b/sys/dev/pci/drm/drm_irq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_irq.c,v 1.48 2013/09/02 06:25:28 jsg Exp $ */
+/* $OpenBSD: drm_irq.c,v 1.49 2013/09/02 07:14:22 jsg Exp $ */
/**
* \file drm_irq.c
* IRQ support
@@ -213,8 +213,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
*/
if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) {
atomic_inc(&dev->_vblank_count[crtc]);
-// smp_mb__after_atomic_inc();
- DRM_WRITEMEMORYBARRIER();
+ smp_mb__after_atomic_inc();
}
/* Invalidate all timestamps while vblank irq's are off. */
@@ -951,9 +950,9 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)
vblanktimestamp(dev, crtc, tslot) = t_vblank;
}
-// smp_mb__before_atomic_inc();
+ smp_mb__before_atomic_inc();
atomic_add(diff, &dev->_vblank_count[crtc]);
-// smp_mb__after_atomic_inc();
+ smp_mb__after_atomic_inc();
}
/**
@@ -1418,9 +1417,9 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)
/* Increment cooked vblank count. This also atomically commits
* the timestamp computed above.
*/
-// smp_mb__before_atomic_inc();
+ smp_mb__before_atomic_inc();
atomic_inc(&dev->_vblank_count[crtc]);
-// smp_mb__after_atomic_inc();
+ smp_mb__after_atomic_inc();
} else {
DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n",
crtc, (int) diff_ns);
diff --git a/sys/dev/pci/drm/ttm/ttm_bo.c b/sys/dev/pci/drm/ttm/ttm_bo.c
index 2283371f26f..645473fbc4c 100644
--- a/sys/dev/pci/drm/ttm/ttm_bo.c
+++ b/sys/dev/pci/drm/ttm/ttm_bo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttm_bo.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: ttm_bo.c,v 1.2 2013/09/02 07:14:22 jsg Exp $ */
/**************************************************************************
*
* Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
@@ -549,7 +549,7 @@ ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
*
* This function only needs protection against the final kref_put.
*/
- DRM_MEMORYBARRIER();
+ smp_mb__before_atomic_dec();
}
void