History

drm/amdgpu: cleanup amdgpu_bo_create()

Remove shadow bo related code as vm code is creating shadow bo using proper API. Without shadow bo code, amdgpu_bo_create() is basically a wrapper around amdgpu_bo_do_create(). So rename amdgpu_bo_do_create() to amdgpu_bo_create().

Nirmoy Das committed 5 years ago

Commit cd2454d1 parent adf6f5c1 file · +14 −47Browse files

Unified · Split

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c+14−47
@@ -515,7 +515,18 @@ bool amdgpu_bo_support_uswc(u64 bo_flags) · 514 unmodified lines
515515 #endif
516516 }
517517
518−static int amdgpu_bo_do_create(struct amdgpu_device *adev,
518+/**
519+ * amdgpu_bo_create - create an &amdgpu_bo buffer object
520+ * @adev: amdgpu device object
521+ * @bp: parameters to be used for the buffer object
522+ * @bo_ptr: pointer to the buffer object pointer
523+ *
524+ * Creates an &amdgpu_bo buffer object.
525+ *
526+ * Returns:
527+ * 0 for success or a negative error code on failure.
528+ */
529+int amdgpu_bo_create(struct amdgpu_device *adev,
519530 struct amdgpu_bo_param *bp,
520531 struct amdgpu_bo **bo_ptr)
521532 {
@@ -644,7 +655,7 @@ int amdgpu_bo_create_shadow(struct amdgpu_device *adev, · 122 unmodified lines
644655 bp.resv = bo->tbo.base.resv;
645656 bp.bo_ptr_size = sizeof(struct amdgpu_bo);
646657
647− r = amdgpu_bo_do_create(adev, &bp, &bo->shadow);
658+ r = amdgpu_bo_create(adev, &bp, &bo->shadow);
648659 if (!r) {
649660 bo->shadow->parent = amdgpu_bo_ref(bo);
650661 mutex_lock(&adev->shadow_list_lock);
@@ -655,50 +666,6 @@ int amdgpu_bo_create_shadow(struct amdgpu_device *adev, · 4 unmodified lines
655666 return r;
656667 }
657668
658−/**
659− * amdgpu_bo_create - create an &amdgpu_bo buffer object
660− * @adev: amdgpu device object
661− * @bp: parameters to be used for the buffer object
662− * @bo_ptr: pointer to the buffer object pointer
663− *
664− * Creates an &amdgpu_bo buffer object; and if requested, also creates a
665− * shadow object.
666− * Shadow object is used to backup the original buffer object, and is always
667− * in GTT.
668− *
669− * Returns:
670− * 0 for success or a negative error code on failure.
671− */
672−int amdgpu_bo_create(struct amdgpu_device *adev,
673− struct amdgpu_bo_param *bp,
674− struct amdgpu_bo **bo_ptr)
675−{
676− u64 flags = bp->flags;
677− int r;
678−
679− bp->flags = bp->flags & ~AMDGPU_GEM_CREATE_SHADOW;
680−
681− r = amdgpu_bo_do_create(adev, bp, bo_ptr);
682− if (r)
683− return r;
684−
685− if ((flags & AMDGPU_GEM_CREATE_SHADOW) && !(adev->flags & AMD_IS_APU)) {
686− if (!bp->resv)
687− WARN_ON(dma_resv_lock((*bo_ptr)->tbo.base.resv,
688− NULL));
689−
690− r = amdgpu_bo_create_shadow(adev, bp->size, *bo_ptr);
691−
692− if (!bp->resv)
693− dma_resv_unlock((*bo_ptr)->tbo.base.resv);
694−
695− if (r)
696− amdgpu_bo_unref(bo_ptr);
697− }
698−
699− return r;
700−}
701−
702669 /**
703670 * amdgpu_bo_create_user - create an &amdgpu_bo_user buffer object
704671 * @adev: amdgpu device object
@@ -720,7 +687,7 @@ int amdgpu_bo_create_user(struct amdgpu_device *adev, · 15 unmodified lines
720687
721688 bp->flags = bp->flags & ~AMDGPU_GEM_CREATE_SHADOW;
722689 bp->bo_ptr_size = sizeof(struct amdgpu_bo_user);
723− r = amdgpu_bo_do_create(adev, bp, &bo_ptr);
690+ r = amdgpu_bo_create(adev, bp, &bo_ptr);
724691 if (r)
725692 return r;
726693