summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2010-03-20 16:14:20 -0700
committerCorbin Simpson <[email protected]>2010-03-20 16:16:11 -0700
commit20dedcca3ca5bfeaaa275bec8a14ca8c69615f6a (patch)
tree6183c44ae82d111a67b7769fe9c1b8f608486825 /src/gallium
parentc2d17dce27d412012a3a45bbde954fb9374d5db9 (diff)
radeong: Test the BO ptr for NULL instead of using a bool.
Slight memory savings, but more importantly also avoids a potential NULL dereference.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c
index 73472aabc5e..2f7456e12dd 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c
@@ -23,7 +23,6 @@ struct radeon_drm_buffer {
boolean flinked;
uint32_t flink;
- boolean mapped;
struct radeon_drm_buffer *next, *prev;
};
@@ -56,10 +55,10 @@ radeon_drm_buffer_destroy(struct pb_buffer *_buf)
{
struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
- if (buf->mapped) {
+ if (buf->bo->ptr != NULL) {
remove_from_list(buf);
radeon_bo_unmap(buf->bo);
- buf->mapped = false;
+ buf->bo->ptr = NULL;
}
radeon_bo_unref(buf->bo);
@@ -73,7 +72,7 @@ radeon_drm_buffer_map(struct pb_buffer *_buf,
struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
int write;
- if (buf->mapped)
+ if (buf->bo->ptr != NULL)
return buf->bo->ptr;
if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
@@ -95,7 +94,6 @@ radeon_drm_buffer_map(struct pb_buffer *_buf,
if (radeon_bo_map(buf->bo, write)) {
return NULL;
}
- buf->mapped = true;
insert_at_tail(&buf->mgr->buffer_map_list, buf);
return buf->bo->ptr;
}
@@ -365,12 +363,10 @@ void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr)
struct radeon_drm_buffer *rpb, *t_rpb;
foreach_s(rpb, t_rpb, &mgr->buffer_map_list) {
- rpb->mapped = 0;
radeon_bo_unmap(rpb->bo);
+ rpb->bo->ptr = NULL;
remove_from_list(rpb);
}
make_empty_list(&mgr->buffer_map_list);
-
-
}