aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_gem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_gem.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index fe48f229043e..d0b4f7d1140d 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -394,10 +394,9 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,
394 return r; 394 return r;
395} 395}
396 396
397static int radeon_mode_mmap(struct drm_file *filp, 397int radeon_mode_dumb_mmap(struct drm_file *filp,
398 struct drm_device *dev, 398 struct drm_device *dev,
399 uint32_t handle, bool dumb, 399 uint32_t handle, uint64_t *offset_p)
400 uint64_t *offset_p)
401{ 400{
402 struct drm_gem_object *gobj; 401 struct drm_gem_object *gobj;
403 struct radeon_bo *robj; 402 struct radeon_bo *robj;
@@ -406,14 +405,6 @@ static int radeon_mode_mmap(struct drm_file *filp,
406 if (gobj == NULL) { 405 if (gobj == NULL) {
407 return -ENOENT; 406 return -ENOENT;
408 } 407 }
409
410 /*
411 * We don't allow dumb mmaps on objects created using another
412 * interface.
413 */
414 WARN_ONCE(dumb && !(gobj->dumb || gobj->import_attach),
415 "Illegal dumb map of GPU buffer.\n");
416
417 robj = gem_to_radeon_bo(gobj); 408 robj = gem_to_radeon_bo(gobj);
418 if (radeon_ttm_tt_has_userptr(robj->tbo.ttm)) { 409 if (radeon_ttm_tt_has_userptr(robj->tbo.ttm)) {
419 drm_gem_object_unreference_unlocked(gobj); 410 drm_gem_object_unreference_unlocked(gobj);
@@ -424,20 +415,12 @@ static int radeon_mode_mmap(struct drm_file *filp,
424 return 0; 415 return 0;
425} 416}
426 417
427int radeon_mode_dumb_mmap(struct drm_file *filp,
428 struct drm_device *dev,
429 uint32_t handle, uint64_t *offset_p)
430{
431 return radeon_mode_mmap(filp, dev, handle, true, offset_p);
432}
433
434int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, 418int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data,
435 struct drm_file *filp) 419 struct drm_file *filp)
436{ 420{
437 struct drm_radeon_gem_mmap *args = data; 421 struct drm_radeon_gem_mmap *args = data;
438 422
439 return radeon_mode_mmap(filp, dev, args->handle, false, 423 return radeon_mode_dumb_mmap(filp, dev, args->handle, &args->addr_ptr);
440 &args->addr_ptr);
441} 424}
442 425
443int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, 426int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
@@ -593,7 +576,7 @@ error_unreserve:
593error_free: 576error_free:
594 drm_free_large(vm_bos); 577 drm_free_large(vm_bos);
595 578
596 if (r) 579 if (r && r != -ERESTARTSYS)
597 DRM_ERROR("Couldn't update BO_VA (%d)\n", r); 580 DRM_ERROR("Couldn't update BO_VA (%d)\n", r);
598} 581}
599 582
@@ -763,7 +746,6 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,
763 return -ENOMEM; 746 return -ENOMEM;
764 747
765 r = drm_gem_handle_create(file_priv, gobj, &handle); 748 r = drm_gem_handle_create(file_priv, gobj, &handle);
766 gobj->dumb = true;
767 /* drop reference from allocate - handle holds it now */ 749 /* drop reference from allocate - handle holds it now */
768 drm_gem_object_unreference_unlocked(gobj); 750 drm_gem_object_unreference_unlocked(gobj);
769 if (r) { 751 if (r) {