r300g: Handle PIPE_BUFFER_USAGE_DONTBLOCK as intended.
authorMichel Dänzer <daenzer@vmware.com>
Sun, 6 Sep 2009 16:12:14 +0000 (18:12 +0200)
committerMichel Dänzer <daenzer@vmware.com>
Sun, 6 Sep 2009 16:12:14 +0000 (18:12 +0200)
Return NULL if the BO is busy, otherwise just map it.

src/gallium/winsys/drm/radeon/core/radeon_buffer.c

index 07551e7cd16ccea087fa73216c64bcb6e4872b4d..ee39af9f76ab085fadf5d8137bfef12d36f27290 100644 (file)
@@ -134,8 +134,11 @@ static void *radeon_buffer_map(struct pipe_winsys *ws,
         (struct radeon_pipe_buffer*)buffer;
     int write = 0;
 
-    if (!(flags & PIPE_BUFFER_USAGE_DONTBLOCK)) {
-        radeon_bo_wait(radeon_buffer->bo);
+    if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
+        uint32_t domain;
+
+        if (radeon_bo_is_busy(radeon_buffer->bo, &domain))
+            return NULL;
     }
     if (flags & PIPE_BUFFER_USAGE_CPU_WRITE) {
         write = 1;