diff options
author | Dave Airlie <[email protected]> | 2011-06-07 11:03:59 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-06-08 11:46:59 +1000 |
commit | 4707ae20ad6cd99bbcaa33747fc7b043c85bb084 (patch) | |
tree | 4f69851ec3c362a1ca1c400e96c5b93e42a0d067 /src/gallium/drivers/r600/r600.h | |
parent | ff298a66d7dffd0e91997a6af4cb3ffb3962f350 (diff) |
r600g: inline r600_bo_reference.
This relies on the reference member being first, so document it.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600.h')
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 15 |
1 files changed, 13 insertions, 2 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 */ |