diff options
Diffstat (limited to 'libdrm/radeon')
-rw-r--r-- | libdrm/radeon/radeon_bo.h | 12 | ||||
-rw-r--r-- | libdrm/radeon/radeon_bo_gem.c | 16 |
2 files changed, 28 insertions, 0 deletions
diff --git a/libdrm/radeon/radeon_bo.h b/libdrm/radeon/radeon_bo.h index 09ad068d..1e2e6c20 100644 --- a/libdrm/radeon/radeon_bo.h +++ b/libdrm/radeon/radeon_bo.h @@ -73,6 +73,7 @@ struct radeon_bo_funcs { uint32_t pitch); int (*bo_get_tiling)(struct radeon_bo *bo, uint32_t *tiling_flags, uint32_t *pitch); + int (*bo_is_busy)(struct radeon_bo *bo, uint32_t *domain); }; struct radeon_bo_manager { @@ -166,6 +167,15 @@ static inline int _radeon_bo_wait(struct radeon_bo *bo, return bo->bom->funcs->bo_wait(bo); } +static inline int _radeon_bo_is_busy(struct radeon_bo *bo, + uint32_t *domain, + const char *file, + const char *func, + int line) +{ + return bo->bom->funcs->bo_is_busy(bo, domain); +} + static inline int radeon_bo_set_tiling(struct radeon_bo *bo, uint32_t tiling_flags, uint32_t pitch) { @@ -199,5 +209,7 @@ static inline int radeon_bo_is_static(struct radeon_bo *bo) _radeon_bo_debug(bo, opcode, __FILE__, __FUNCTION__, __LINE__) #define radeon_bo_wait(bo) \ _radeon_bo_wait(bo, __FILE__, __func__, __LINE__) +#define radeon_bo_is_busy(bo, domain) \ + _radeon_bo_is_busy(bo, domain, __FILE__, __func__, __LINE__) #endif diff --git a/libdrm/radeon/radeon_bo_gem.c b/libdrm/radeon/radeon_bo_gem.c index cf59a359..76d80e7e 100644 --- a/libdrm/radeon/radeon_bo_gem.c +++ b/libdrm/radeon/radeon_bo_gem.c @@ -209,6 +209,21 @@ static int bo_wait(struct radeon_bo *bo) return ret; } +static int bo_is_busy(struct radeon_bo *bo, uint32_t *domain) +{ + struct drm_radeon_gem_busy args; + int ret; + + args.handle = bo->handle; + args.domain = 0; + + ret = drmCommandWriteRead(bo->bom->fd, DRM_RADEON_GEM_BUSY, + &args, sizeof(args)); + + *domain = args.domain; + return ret; +} + static int bo_set_tiling(struct radeon_bo *bo, uint32_t tiling_flags, uint32_t pitch) { @@ -257,6 +272,7 @@ static struct radeon_bo_funcs bo_gem_funcs = { NULL, bo_set_tiling, bo_get_tiling, + bo_is_busy, }; struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd) |