From: Marek Olšák Date: Thu, 23 Sep 2010 11:59:42 +0000 (+0200) Subject: r300g: fixup long-lived BO maps being incorrectly unmapped when flushing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=206d92912cfd1ac73233d9c027fa590b60270cb8;p=mesa.git 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. --- diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c index cf665241c48..075ab5cb324 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) {