diff options
author | Dave Airlie <airlied@redhat.com> | 2009-08-16 07:05:45 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-08-16 22:28:56 -0400 |
commit | cefb87efc9aa0288849149484870d5ab989fbd59 (patch) | |
tree | 0df20514740f6a816da3700989183bb253ada0c1 /drivers/gpu/drm/radeon/radeon_gem.c | |
parent | de1b28989edff519d0548ebaa3f94fd3d1524cf2 (diff) |
drm/radeon/kms: implement bo busy check + current domain
This implements the busy ioctl along with a current domain check.
returns 0 or -EBUSY
puts the current domain no matter what the answer.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_gem.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gem.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index cded5180c75..d4ceff13bbb 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -262,7 +262,27 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
262 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | 262 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, |
263 | struct drm_file *filp) | 263 | struct drm_file *filp) |
264 | { | 264 | { |
265 | /* FIXME: implement */ | 265 | struct drm_radeon_gem_busy *args = data; |
266 | struct drm_gem_object *gobj; | ||
267 | struct radeon_object *robj; | ||
268 | int r; | ||
269 | uint32_t cur_placement; | ||
270 | |||
271 | gobj = drm_gem_object_lookup(dev, filp, args->handle); | ||
272 | if (gobj == NULL) { | ||
273 | return -EINVAL; | ||
274 | } | ||
275 | robj = gobj->driver_private; | ||
276 | r = radeon_object_busy_domain(robj, &cur_placement); | ||
277 | if (cur_placement == TTM_PL_VRAM) | ||
278 | args->domain = RADEON_GEM_DOMAIN_VRAM; | ||
279 | if (cur_placement == TTM_PL_FLAG_TT) | ||
280 | args->domain = RADEON_GEM_DOMAIN_GTT; | ||
281 | if (cur_placement == TTM_PL_FLAG_SYSTEM) | ||
282 | args->domain = RADEON_GEM_DOMAIN_CPU; | ||
283 | mutex_lock(&dev->struct_mutex); | ||
284 | drm_gem_object_unreference(gobj); | ||
285 | mutex_unlock(&dev->struct_mutex); | ||
266 | return 0; | 286 | return 0; |
267 | } | 287 | } |
268 | 288 | ||