diff options
author | Dave Airlie <airlied@redhat.com> | 2009-08-01 17:19:43 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-08-01 17:20:38 +1000 |
commit | 4507863058a10d00c982975daf396f83caee0fe2 (patch) | |
tree | 648e7dd7ba266525d0af64767d5f34915c71eaf6 /libdrm/radeon/radeon_bo_gem.c | |
parent | 322cf6cf736b22b62656ac0431936b3cdb784038 (diff) |
libdrm_radeon: add tiling support
Diffstat (limited to 'libdrm/radeon/radeon_bo_gem.c')
-rw-r--r-- | libdrm/radeon/radeon_bo_gem.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/libdrm/radeon/radeon_bo_gem.c b/libdrm/radeon/radeon_bo_gem.c index 9b0d867b..3c3b3e5b 100644 --- a/libdrm/radeon/radeon_bo_gem.c +++ b/libdrm/radeon/radeon_bo_gem.c @@ -56,6 +56,8 @@ struct bo_manager_gem { struct radeon_bo_manager base; }; +static int bo_wait(struct radeon_bo *bo); + static struct radeon_bo *bo_open(struct radeon_bo_manager *bom, uint32_t handle, uint32_t size, @@ -207,6 +209,44 @@ static int bo_wait(struct radeon_bo *bo) return ret; } +static int bo_set_tiling(struct radeon_bo *bo, uint32_t tiling_flags, + uint32_t pitch) +{ + struct drm_radeon_gem_set_tiling args; + int r; + + args.handle = bo->handle; + args.tiling_flags = tiling_flags; + args.pitch = pitch; + + r = drmCommandWriteRead(bo->bom->fd, + DRM_RADEON_GEM_SET_TILING, + &args, + sizeof(args)); + return r; +} + +static int bo_get_tiling(struct radeon_bo *bo, uint32_t *tiling_flags, + uint32_t *pitch) +{ + struct drm_radeon_gem_set_tiling args; + int r; + + args.handle = bo->handle; + + r = drmCommandWriteRead(bo->bom->fd, + DRM_RADEON_GEM_GET_TILING, + &args, + sizeof(args)); + + if (r) + return r; + + *tiling_flags = args.tiling_flags; + *pitch = args.pitch; + return r; +} + static struct radeon_bo_funcs bo_gem_funcs = { bo_open, bo_ref, @@ -215,6 +255,8 @@ static struct radeon_bo_funcs bo_gem_funcs = { bo_unmap, bo_wait, NULL, + bo_set_tiling, + bo_get_tiling, }; struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd) @@ -248,7 +290,6 @@ uint32_t radeon_gem_name_bo(struct radeon_bo *bo) int radeon_gem_get_kernel_name(struct radeon_bo *bo, uint32_t *name) { - struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo; struct drm_gem_flink flink; int r; @@ -263,7 +304,6 @@ int radeon_gem_get_kernel_name(struct radeon_bo *bo, uint32_t *name) int radeon_gem_set_domain(struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain) { - struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo; struct drm_radeon_gem_set_domain args; int r; |