diff options
author | Mark Brown <broonie@kernel.org> | 2015-10-12 13:09:27 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-10-12 13:09:27 -0400 |
commit | 79828b4fa835f73cdaf4bffa48696abdcbea9d02 (patch) | |
tree | 5e0fa7156acb75ba603022bc807df8f2fedb97a8 /drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |
parent | 721b51fcf91898299d96f4b72cb9434cda29dce6 (diff) | |
parent | 8c1a9d6323abf0fb1e5dad96cf3f1c783505ea5a (diff) |
Merge remote-tracking branch 'asoc/fix/rt5645' into asoc-fix-rt5645
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index ae43b58c9733..5839fab374bf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |||
@@ -449,7 +449,7 @@ out: | |||
449 | * vital here, so they are not reported back to userspace. | 449 | * vital here, so they are not reported back to userspace. |
450 | */ | 450 | */ |
451 | static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, | 451 | static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, |
452 | struct amdgpu_bo_va *bo_va) | 452 | struct amdgpu_bo_va *bo_va, uint32_t operation) |
453 | { | 453 | { |
454 | struct ttm_validate_buffer tv, *entry; | 454 | struct ttm_validate_buffer tv, *entry; |
455 | struct amdgpu_bo_list_entry *vm_bos; | 455 | struct amdgpu_bo_list_entry *vm_bos; |
@@ -485,7 +485,9 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, | |||
485 | if (r) | 485 | if (r) |
486 | goto error_unlock; | 486 | goto error_unlock; |
487 | 487 | ||
488 | r = amdgpu_vm_bo_update(adev, bo_va, &bo_va->bo->tbo.mem); | 488 | |
489 | if (operation == AMDGPU_VA_OP_MAP) | ||
490 | r = amdgpu_vm_bo_update(adev, bo_va, &bo_va->bo->tbo.mem); | ||
489 | 491 | ||
490 | error_unlock: | 492 | error_unlock: |
491 | mutex_unlock(&bo_va->vm->mutex); | 493 | mutex_unlock(&bo_va->vm->mutex); |
@@ -580,7 +582,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, | |||
580 | } | 582 | } |
581 | 583 | ||
582 | if (!r && !(args->flags & AMDGPU_VM_DELAY_UPDATE)) | 584 | if (!r && !(args->flags & AMDGPU_VM_DELAY_UPDATE)) |
583 | amdgpu_gem_va_update_vm(adev, bo_va); | 585 | amdgpu_gem_va_update_vm(adev, bo_va, args->operation); |
584 | 586 | ||
585 | drm_gem_object_unreference_unlocked(gobj); | 587 | drm_gem_object_unreference_unlocked(gobj); |
586 | return r; | 588 | return r; |
@@ -613,6 +615,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, | |||
613 | info.alignment = robj->tbo.mem.page_alignment << PAGE_SHIFT; | 615 | info.alignment = robj->tbo.mem.page_alignment << PAGE_SHIFT; |
614 | info.domains = robj->initial_domain; | 616 | info.domains = robj->initial_domain; |
615 | info.domain_flags = robj->flags; | 617 | info.domain_flags = robj->flags; |
618 | amdgpu_bo_unreserve(robj); | ||
616 | if (copy_to_user(out, &info, sizeof(info))) | 619 | if (copy_to_user(out, &info, sizeof(info))) |
617 | r = -EFAULT; | 620 | r = -EFAULT; |
618 | break; | 621 | break; |
@@ -620,17 +623,19 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, | |||
620 | case AMDGPU_GEM_OP_SET_PLACEMENT: | 623 | case AMDGPU_GEM_OP_SET_PLACEMENT: |
621 | if (amdgpu_ttm_tt_has_userptr(robj->tbo.ttm)) { | 624 | if (amdgpu_ttm_tt_has_userptr(robj->tbo.ttm)) { |
622 | r = -EPERM; | 625 | r = -EPERM; |
626 | amdgpu_bo_unreserve(robj); | ||
623 | break; | 627 | break; |
624 | } | 628 | } |
625 | robj->initial_domain = args->value & (AMDGPU_GEM_DOMAIN_VRAM | | 629 | robj->initial_domain = args->value & (AMDGPU_GEM_DOMAIN_VRAM | |
626 | AMDGPU_GEM_DOMAIN_GTT | | 630 | AMDGPU_GEM_DOMAIN_GTT | |
627 | AMDGPU_GEM_DOMAIN_CPU); | 631 | AMDGPU_GEM_DOMAIN_CPU); |
632 | amdgpu_bo_unreserve(robj); | ||
628 | break; | 633 | break; |
629 | default: | 634 | default: |
635 | amdgpu_bo_unreserve(robj); | ||
630 | r = -EINVAL; | 636 | r = -EINVAL; |
631 | } | 637 | } |
632 | 638 | ||
633 | amdgpu_bo_unreserve(robj); | ||
634 | out: | 639 | out: |
635 | drm_gem_object_unreference_unlocked(gobj); | 640 | drm_gem_object_unreference_unlocked(gobj); |
636 | return r; | 641 | return r; |
@@ -651,7 +656,8 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv, | |||
651 | 656 | ||
652 | r = amdgpu_gem_object_create(adev, args->size, 0, | 657 | r = amdgpu_gem_object_create(adev, args->size, 0, |
653 | AMDGPU_GEM_DOMAIN_VRAM, | 658 | AMDGPU_GEM_DOMAIN_VRAM, |
654 | 0, ttm_bo_type_device, | 659 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
660 | ttm_bo_type_device, | ||
655 | &gobj); | 661 | &gobj); |
656 | if (r) | 662 | if (r) |
657 | return -ENOMEM; | 663 | return -ENOMEM; |