drm/radeon drop gobj from radeon_cs_reloc
authorChristian König <christian.koenig@amd.com>
Thu, 27 Nov 2014 13:48:40 +0000 (14:48 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 3 Dec 2014 19:26:46 +0000 (14:26 -0500)
It's only used once after initializing and that
ptr can be calculated from the BO as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_cs.c
drivers/gpu/drm/radeon/radeon_vm.c

index 3207bb60715e961b72f083a0fbbb034a3ee0b2a2..4a09ffdda00447150133a2b256bd509e11913e7f 100644 (file)
@@ -1045,7 +1045,6 @@ void cayman_dma_fini(struct radeon_device *rdev);
  * CS.
  */
 struct radeon_cs_reloc {
-       struct drm_gem_object           *gobj;
        struct radeon_bo                *robj;
        struct ttm_validate_buffer      tv;
        uint64_t                        gpu_offset;
index f5e0a696d2fec41215e7cf6cfce42c72dde9769c..7846c3e5faf7a63560d8d9c8fcb621ad1ab2d2f6 100644 (file)
@@ -101,6 +101,7 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
 
        for (i = 0; i < p->nrelocs; i++) {
                struct drm_radeon_cs_reloc *r;
+               struct drm_gem_object *gobj;
                unsigned priority;
 
                duplicate = false;
@@ -117,15 +118,14 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
                        continue;
                }
 
-               p->relocs[i].gobj = drm_gem_object_lookup(ddev, p->filp,
-                                                         r->handle);
-               if (p->relocs[i].gobj == NULL) {
+               gobj = drm_gem_object_lookup(ddev, p->filp, r->handle);
+               if (gobj == NULL) {
                        DRM_ERROR("gem object lookup failed 0x%x\n",
                                  r->handle);
                        return -ENOENT;
                }
                p->relocs_ptr[i] = &p->relocs[i];
-               p->relocs[i].robj = gem_to_radeon_bo(p->relocs[i].gobj);
+               p->relocs[i].robj = gem_to_radeon_bo(gobj);
 
                /* The userspace buffer priorities are from 0 to 15. A higher
                 * number means the buffer is more important.
@@ -439,8 +439,11 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo
 
        if (parser->relocs != NULL) {
                for (i = 0; i < parser->nrelocs; i++) {
-                       if (parser->relocs[i].gobj)
-                               drm_gem_object_unreference_unlocked(parser->relocs[i].gobj);
+                       struct radeon_bo *bo = parser->relocs[i].robj;
+                       if (bo == NULL)
+                               continue;
+
+                       drm_gem_object_unreference_unlocked(&bo->gem_base);
                }
        }
        kfree(parser->track);
index 0b10f3a03ce2f20ac66103c932f4d6a51c8fd743..2b2eb1ce819680978b1aae25ee3abcec62844442 100644 (file)
@@ -138,7 +138,6 @@ struct radeon_cs_reloc *radeon_vm_get_bos(struct radeon_device *rdev,
                return NULL;
 
        /* add the vm page table to the list */
-       list[0].gobj = NULL;
        list[0].robj = vm->page_directory;
        list[0].prefered_domains = RADEON_GEM_DOMAIN_VRAM;
        list[0].allowed_domains = RADEON_GEM_DOMAIN_VRAM;
@@ -152,7 +151,6 @@ struct radeon_cs_reloc *radeon_vm_get_bos(struct radeon_device *rdev,
                if (!vm->page_tables[i].bo)
                        continue;
 
-               list[idx].gobj = NULL;
                list[idx].robj = vm->page_tables[i].bo;
                list[idx].prefered_domains = RADEON_GEM_DOMAIN_VRAM;
                list[idx].allowed_domains = RADEON_GEM_DOMAIN_VRAM;