diff options
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 15 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_bo.c | 10 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_priv.h | 3 |
3 files changed, 15 insertions, 13 deletions
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 84232b10037..0d37376594b 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -30,6 +30,7 @@ #include <stdint.h> #include <stdio.h> #include <util/u_double_list.h> +#include <util/u_inlines.h> #include <pipe/p_compiler.h> #define RADEON_CTX_MAX_PM4 (64 * 1024 / 4) @@ -103,14 +104,24 @@ struct r600_bo *r600_bo_handle(struct radeon *radeon, unsigned handle, unsigned *array_mode); void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, void *ctx); void r600_bo_unmap(struct radeon *radeon, struct r600_bo *bo); -void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst, - struct r600_bo *src); boolean r600_bo_get_winsys_handle(struct radeon *radeon, struct r600_bo *pb_bo, unsigned stride, struct winsys_handle *whandle); static INLINE unsigned r600_bo_offset(struct r600_bo *bo) { return 0; } +void r600_bo_destroy(struct radeon *radeon, struct r600_bo *bo); + +/* this relies on the pipe_reference being the first member of r600_bo */ +static INLINE void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst, struct r600_bo *src) +{ + struct r600_bo *old = *dst; + + if (pipe_reference((struct pipe_reference *)(*dst), (struct pipe_reference *)src)) { + r600_bo_destroy(radeon, old); + } + *dst = src; +} /* R600/R700 STATES */ diff --git a/src/gallium/winsys/r600/drm/r600_bo.c b/src/gallium/winsys/r600/drm/r600_bo.c index 2bfb8e4e193..8bb216dc7a8 100644 --- a/src/gallium/winsys/r600/drm/r600_bo.c +++ b/src/gallium/winsys/r600/drm/r600_bo.c @@ -180,16 +180,6 @@ void r600_bo_destroy(struct radeon *radeon, struct r600_bo *bo) free(bo); } -void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst, struct r600_bo *src) -{ - struct r600_bo *old = *dst; - - if (pipe_reference(&(*dst)->reference, &src->reference)) { - r600_bo_destroy(radeon, old); - } - *dst = src; -} - boolean r600_bo_get_winsys_handle(struct radeon *radeon, struct r600_bo *bo, unsigned stride, struct winsys_handle *whandle) { diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index d9cb52409cd..da31a42b2a0 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -95,7 +95,8 @@ struct radeon_bo { }; struct r600_bo { - struct pipe_reference reference; + struct pipe_reference reference; /* this must be the first member for the r600_bo_reference inline to work */ + /* DO NOT MOVE THIS ^ */ unsigned size; unsigned tiling_flags; unsigned kernel_pitch; |