summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-06-13 15:38:59 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-06-13 15:38:59 +0200
commit62082ab3e63f6f474655da98b710e453b4124ed1 (patch)
treee14a5e4599d79c451a6fb480f5d1da993b934791 /linux-core
parent5156f1c897142171e78d0ea2c45a3aecb581fffa (diff)
Make sure we read fence->signaled while spinlocked.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_bo.c11
-rw-r--r--linux-core/drm_fence.c18
-rw-r--r--linux-core/drm_objects.h4
3 files changed, 15 insertions, 18 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index bcb5c95d..1c0eebd0 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -268,7 +268,7 @@ int drm_bo_wait(drm_buffer_object_t * bo, int lazy, int ignore_signals,
if (fence) {
drm_device_t *dev = bo->dev;
- if (drm_fence_object_signaled(fence, bo->fence_type)) {
+ if (drm_fence_object_signaled(dev, fence, bo->fence_type, 0)) {
drm_fence_usage_deref_unlocked(dev, fence);
bo->fence = NULL;
return 0;
@@ -337,7 +337,8 @@ static void drm_bo_cleanup_refs(drm_buffer_object_t * bo, int remove_all)
DRM_FLAG_MASKED(bo->priv_flags, 0, _DRM_BO_FLAG_UNFENCED);
- if (bo->fence && drm_fence_object_signaled(bo->fence, bo->fence_type)) {
+ if (bo->fence && drm_fence_object_signaled(dev, bo->fence,
+ bo->fence_type, 0)) {
drm_fence_usage_deref_unlocked(dev, bo->fence);
bo->fence = NULL;
}
@@ -944,7 +945,7 @@ static int drm_bo_quick_busy(drm_buffer_object_t * bo)
BUG_ON(bo->priv_flags & _DRM_BO_FLAG_UNFENCED);
if (fence) {
drm_device_t *dev = bo->dev;
- if (drm_fence_object_signaled(fence, bo->fence_type)) {
+ if (drm_fence_object_signaled(dev, fence, bo->fence_type, 0)) {
drm_fence_usage_deref_unlocked(dev, fence);
bo->fence = NULL;
return 0;
@@ -966,13 +967,13 @@ static int drm_bo_busy(drm_buffer_object_t * bo)
BUG_ON(bo->priv_flags & _DRM_BO_FLAG_UNFENCED);
if (fence) {
drm_device_t *dev = bo->dev;
- if (drm_fence_object_signaled(fence, bo->fence_type)) {
+ if (drm_fence_object_signaled(dev, fence, bo->fence_type, 0)) {
drm_fence_usage_deref_unlocked(dev, fence);
bo->fence = NULL;
return 0;
}
drm_fence_object_flush(dev, fence, DRM_FENCE_TYPE_EXE);
- if (drm_fence_object_signaled(fence, bo->fence_type)) {
+ if (drm_fence_object_signaled(dev, fence, bo->fence_type, 0)) {
drm_fence_usage_deref_unlocked(dev, fence);
bo->fence = NULL;
return 0;
diff --git a/linux-core/drm_fence.c b/linux-core/drm_fence.c
index ce161dc3..70baad9f 100644
--- a/linux-core/drm_fence.c
+++ b/linux-core/drm_fence.c
@@ -164,7 +164,7 @@ static void drm_fence_object_destroy(drm_file_t * priv,
drm_fence_usage_deref_locked(dev, fence);
}
-static int fence_signaled(drm_device_t * dev,
+int drm_fence_object_signaled(drm_device_t * dev,
drm_fence_object_t * fence,
uint32_t mask, int poke_flush)
{
@@ -200,12 +200,6 @@ static void drm_fence_flush_exe(drm_fence_class_manager_t * fc,
}
}
-int drm_fence_object_signaled(drm_fence_object_t * fence,
- uint32_t type)
-{
- return ((fence->signaled & type) == type);
-}
-
int drm_fence_object_flush(drm_device_t * dev,
drm_fence_object_t * fence,
uint32_t type)
@@ -298,13 +292,13 @@ static int drm_fence_lazy_wait(drm_device_t *dev,
do {
DRM_WAIT_ON(ret, fc->fence_queue, 3 * DRM_HZ,
- (signaled = fence_signaled(dev, fence, mask, 1)));
+ (signaled = drm_fence_object_signaled(dev, fence, mask, 1)));
if (signaled)
return 0;
if (time_after_eq(jiffies, _end))
break;
} while (ret == -EINTR && ignore_signals);
- if (fence_signaled(dev, fence, mask, 0))
+ if (drm_fence_object_signaled(dev, fence, mask, 0))
return 0;
if (time_after_eq(jiffies, _end))
ret = -EBUSY;
@@ -334,7 +328,7 @@ int drm_fence_object_wait(drm_device_t * dev,
return -EINVAL;
}
- if (fence_signaled(dev, fence, mask, 0))
+ if (drm_fence_object_signaled(dev, fence, mask, 0))
return 0;
_end = jiffies + 3 * DRM_HZ;
@@ -365,7 +359,7 @@ int drm_fence_object_wait(drm_device_t * dev,
return ret;
}
}
- if (drm_fence_object_signaled(fence, mask))
+ if (drm_fence_object_signaled(dev, fence, mask, 0))
return 0;
/*
@@ -377,7 +371,7 @@ int drm_fence_object_wait(drm_device_t * dev,
#endif
do {
schedule();
- signaled = fence_signaled(dev, fence, mask, 1);
+ signaled = drm_fence_object_signaled(dev, fence, mask, 1);
} while (!signaled && !time_after_eq(jiffies, _end));
if (!signaled)
diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h
index 03ea927e..42c8e536 100644
--- a/linux-core/drm_objects.h
+++ b/linux-core/drm_objects.h
@@ -198,7 +198,9 @@ extern void drm_fence_flush_old(struct drm_device *dev, uint32_t class,
uint32_t sequence);
extern int drm_fence_object_flush(struct drm_device *dev,
drm_fence_object_t * fence, uint32_t type);
-extern int drm_fence_object_signaled(drm_fence_object_t * fence, uint32_t type);
+extern int drm_fence_object_signaled(struct drm_device *dev,
+ drm_fence_object_t * fence,
+ uint32_t type, int flush);
extern void drm_fence_usage_deref_locked(struct drm_device *dev,
drm_fence_object_t * fence);
extern void drm_fence_usage_deref_unlocked(struct drm_device *dev,