Mesa (7.9): r300g: fixup long-lived BO maps being incorrectly unmapped when flushing

Marek Olšák mareko at kemper.freedesktop.org
Sat Sep 25 00:14:15 UTC 2010


Module: Mesa
Branch: 7.9
Commit: aa05753059b9196fe5c1602fd8692b7809d8cc45
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa05753059b9196fe5c1602fd8692b7809d8cc45

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Sep 23 13:59:42 2010 +0200

r300g: fixup long-lived BO maps being incorrectly unmapped when flushing

Based on commit 3ddc714b20ac4e28b80c6f88d1993445fff2262c by Dave Airlie.

NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 206d92912cfd1ac73233d9c027fa590b60270cb8)

---

 src/gallium/winsys/radeon/drm/radeon_drm_buffer.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
index cf66524..075ab5c 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
@@ -118,8 +118,10 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf,
 		return NULL;
     }
 
-    if (buf->bo->ptr != NULL)
+    if (buf->bo->ptr != NULL) {
+        remove_from_list(buf);
 	return buf->bo->ptr;
+    }
 
     if (flags & PB_USAGE_DONTBLOCK) {
         uint32_t domain;
@@ -142,14 +144,18 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf,
     if (radeon_bo_map(buf->bo, write)) {
         return NULL;
     }
-    insert_at_tail(&buf->mgr->buffer_map_list, buf);
+
+    remove_from_list(buf);
     return buf->bo->ptr;
 }
 
 static void
 radeon_drm_buffer_unmap_internal(struct pb_buffer *_buf)
 {
-    (void)_buf;
+    struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
+    if (is_empty_list(buf)) { /* = is not inserted... */
+        insert_at_tail(&buf->mgr->buffer_map_list, buf);
+    }
 }
 
 static void
@@ -163,7 +169,7 @@ radeon_drm_buffer_get_base_buffer(struct pb_buffer *buf,
 
 
 static enum pipe_error
-radeon_drm_buffer_validate(struct pb_buffer *_buf, 
+radeon_drm_buffer_validate(struct pb_buffer *_buf,
 			   struct pb_validate *vl,
 			   unsigned flags)
 {




More information about the mesa-commit mailing list