]> Git Repo - linux.git/blobdiff - drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
drm/amdgpu/pm: document pp_od_clk_voltage
[linux.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_gem.c
index 55a840ae6d68e6d056563f6b24756d65abd8c8a9..7d3dc229fa47d43b469ac87cb31427e4f6d50079 100644 (file)
@@ -36,8 +36,6 @@ void amdgpu_gem_object_free(struct drm_gem_object *gobj)
        struct amdgpu_bo *robj = gem_to_amdgpu_bo(gobj);
 
        if (robj) {
-               if (robj->gem_base.import_attach)
-                       drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
                amdgpu_mn_unregister(robj);
                amdgpu_bo_unref(&robj);
        }
@@ -45,22 +43,30 @@ void amdgpu_gem_object_free(struct drm_gem_object *gobj)
 
 int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
                             int alignment, u32 initial_domain,
-                            u64 flags, bool kernel,
+                            u64 flags, enum ttm_bo_type type,
                             struct reservation_object *resv,
                             struct drm_gem_object **obj)
 {
        struct amdgpu_bo *bo;
+       struct amdgpu_bo_param bp;
        int r;
 
+       memset(&bp, 0, sizeof(bp));
        *obj = NULL;
        /* At least align on page size */
        if (alignment < PAGE_SIZE) {
                alignment = PAGE_SIZE;
        }
 
+       bp.size = size;
+       bp.byte_align = alignment;
+       bp.type = type;
+       bp.resv = resv;
+       bp.preferred_domain = initial_domain;
 retry:
-       r = amdgpu_bo_create(adev, size, alignment, kernel, initial_domain,
-                            flags, NULL, resv, &bo);
+       bp.flags = flags;
+       bp.domain = initial_domain;
+       r = amdgpu_bo_create(adev, &bp, &bo);
        if (r) {
                if (r != -ERESTARTSYS) {
                        if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
@@ -223,12 +229,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
                return -EINVAL;
 
        /* reject invalid gem domains */
-       if (args->in.domains & ~(AMDGPU_GEM_DOMAIN_CPU |
-                                AMDGPU_GEM_DOMAIN_GTT |
-                                AMDGPU_GEM_DOMAIN_VRAM |
-                                AMDGPU_GEM_DOMAIN_GDS |
-                                AMDGPU_GEM_DOMAIN_GWS |
-                                AMDGPU_GEM_DOMAIN_OA))
+       if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
                return -EINVAL;
 
        /* create a gem object to contain this object in */
@@ -779,6 +780,8 @@ static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, void *data)
        struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj);
        struct seq_file *m = data;
 
+       struct dma_buf_attachment *attachment;
+       struct dma_buf *dma_buf;
        unsigned domain;
        const char *placement;
        unsigned pin_count;
@@ -807,6 +810,15 @@ static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, void *data)
        pin_count = READ_ONCE(bo->pin_count);
        if (pin_count)
                seq_printf(m, " pin count %d", pin_count);
+
+       dma_buf = READ_ONCE(bo->gem_base.dma_buf);
+       attachment = READ_ONCE(bo->gem_base.import_attach);
+
+       if (attachment)
+               seq_printf(m, " imported from %p", dma_buf);
+       else if (dma_buf)
+               seq_printf(m, " exported as %p", dma_buf);
+
        seq_printf(m, "\n");
 
        return 0;
This page took 0.037163 seconds and 4 git commands to generate.