Skip to contentSkip to conversation

drm/amdgpu: remove unused member from struct amdgpu_bo

PATCH In review Christian König 3 participants 14 messages Sep 15, 2016 – Sep 29, 2016 8 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 drm/amdgpu: remove unused member from struct amdgpu_bo

From: Christian König <[email protected]>

Not used in a while.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 -
 2 files changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
index ee55763..3b3981d 100644
@@ -446,8 +446,6 @@ struct amdgpu_bo_va {
 #define AMDGPU_GEM_DOMAIN_MAX		0x3
 
 struct amdgpu_bo {
-	/* Protected by gem.mutex */
-	struct list_head		list;
 	/* Protected by tbo.reserved */
 	u32				prefered_domains;
 	u32				allowed_domains;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -1
index d6e6c93..4289c31 100644
@@ -360,7 +360,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
 		return r;
 	}
 	bo->adev = adev;
-	INIT_LIST_HEAD(&bo->list);
 	INIT_LIST_HEAD(&bo->shadow_list);
 	INIT_LIST_HEAD(&bo->va);
 	bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
Signature · 6 lines
2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1473945024-8275-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#2 lore raw

PATCH 2/5 drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c

From: Christian König <[email protected]>

No intented functional change.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 65 +++++++++++++++++++++------------
 1 file changed, 42 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +42 -23
index 428ffb6..1965209 100644
@@ -214,9 +214,11 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 	switch (bo->mem.mem_type) {
 	case TTM_PL_VRAM:
 		if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
-			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
+			amdgpu_ttm_placement_from_domain(rbo,
+							 AMDGPU_GEM_DOMAIN_CPU);
 		} else {
-			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_GTT);
+			amdgpu_ttm_placement_from_domain(rbo,
+							 AMDGPU_GEM_DOMAIN_GTT);
 			for (i = 0; i < rbo->placement.num_placement; ++i) {
 				if (!(rbo->placements[i].flags &
 				      TTM_PL_FLAG_TT))
@@ -524,7 +526,8 @@ memcpy:
 	return 0;
 }
 
-static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
+static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
+				     struct ttm_mem_reg *mem)
 {
 	struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
 	struct amdgpu_device *adev = amdgpu_get_adev(bdev);
@@ -545,7 +548,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
 	case TTM_PL_VRAM:
 		mem->bus.offset = mem->start << PAGE_SHIFT;
 		/* check if it's visible */
-		if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size)
+		if ((mem->bus.offset + mem->bus.size) >
+		    adev->mc.visible_vram_size)
 			return -EINVAL;
 		mem->bus.base = adev->mc.aper_base;
 		mem->bus.is_iomem = true;
@@ -579,7 +583,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
 	return 0;
 }
 
-static void amdgpu_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
+static void amdgpu_ttm_io_mem_free(struct ttm_bo_device *bdev,
+				   struct ttm_mem_reg *mem)
 {
 }
 
@@ -791,7 +796,8 @@ int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
 	bo_mem.mem_type = TTM_PL_TT;
 	spin_lock(&adev->gtt_list_lock);
 	list_for_each_entry_safe(gtt, tmp, &adev->gtt_list, list) {
-		flags = amdgpu_ttm_tt_pte_flags(gtt->adev, &gtt->ttm.ttm, &bo_mem);
+		flags = amdgpu_ttm_tt_pte_flags(gtt->adev, &gtt->ttm.ttm,
+						&bo_mem);
 		r = amdgpu_gart_bind(adev, gtt->offset, gtt->ttm.ttm.num_pages,
 				     gtt->ttm.ttm.pages, gtt->ttm.dma_address,
 				     flags);
@@ -856,7 +862,8 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_bo_device *bdev,
 	}
 	gtt->ttm.ttm.func = &amdgpu_backend_func;
 	gtt->adev = adev;
-	if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags, dummy_read_page)) {
+	if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags,
+			    dummy_read_page)) {
 		kfree(gtt);
 		return NULL;
 	}
@@ -887,7 +894,8 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 
 	if (slave && ttm->sg) {
 		drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
-						 gtt->ttm.dma_address, ttm->num_pages);
+						 gtt->ttm.dma_address,
+						 ttm->num_pages);
 		ttm->state = tt_unbound;
 		return 0;
 	}
@@ -906,13 +914,17 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 	}
 
 	for (i = 0; i < ttm->num_pages; i++) {
-		gtt->ttm.dma_address[i] = pci_map_page(adev->pdev, ttm->pages[i],
+		gtt->ttm.dma_address[i] = pci_map_page(adev->pdev,
+						       ttm->pages[i],
 						       0, PAGE_SIZE,
 						       PCI_DMA_BIDIRECTIONAL);
-		if (pci_dma_mapping_error(adev->pdev, gtt->ttm.dma_address[i])) {
+		if (pci_dma_mapping_error(adev->pdev,
+					  gtt->ttm.dma_address[i])) {
 			while (i--) {
-				pci_unmap_page(adev->pdev, gtt->ttm.dma_address[i],
-					       PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+				pci_unmap_page(adev->pdev,
+					       gtt->ttm.dma_address[i],
+					       PAGE_SIZE,
+					       PCI_DMA_BIDIRECTIONAL);
 				gtt->ttm.dma_address[i] = 0;
 			}
 			ttm_pool_unpopulate(ttm);
@@ -1195,14 +1207,20 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 		 (unsigned)(adev->mc.gtt_size / (1024 * 1024)));
 
 	adev->gds.mem.total_size = adev->gds.mem.total_size << AMDGPU_GDS_SHIFT;
-	adev->gds.mem.gfx_partition_size = adev->gds.mem.gfx_partition_size << AMDGPU_GDS_SHIFT;
-	adev->gds.mem.cs_partition_size = adev->gds.mem.cs_partition_size << AMDGPU_GDS_SHIFT;
+	adev->gds.mem.gfx_partition_size =
+		adev->gds.mem.gfx_partition_size << AMDGPU_GDS_SHIFT;
+	adev->gds.mem.cs_partition_size =
+		adev->gds.mem.cs_partition_size << AMDGPU_GDS_SHIFT;
 	adev->gds.gws.total_size = adev->gds.gws.total_size << AMDGPU_GWS_SHIFT;
-	adev->gds.gws.gfx_partition_size = adev->gds.gws.gfx_partition_size << AMDGPU_GWS_SHIFT;
-	adev->gds.gws.cs_partition_size = adev->gds.gws.cs_partition_size << AMDGPU_GWS_SHIFT;
+	adev->gds.gws.gfx_partition_size =
+		adev->gds.gws.gfx_partition_size << AMDGPU_GWS_SHIFT;
+	adev->gds.gws.cs_partition_size =
+		adev->gds.gws.cs_partition_size << AMDGPU_GWS_SHIFT;
 	adev->gds.oa.total_size = adev->gds.oa.total_size << AMDGPU_OA_SHIFT;
-	adev->gds.oa.gfx_partition_size = adev->gds.oa.gfx_partition_size << AMDGPU_OA_SHIFT;
-	adev->gds.oa.cs_partition_size = adev->gds.oa.cs_partition_size << AMDGPU_OA_SHIFT;
+	adev->gds.oa.gfx_partition_size =
+		adev->gds.oa.gfx_partition_size << AMDGPU_OA_SHIFT;
+	adev->gds.oa.cs_partition_size =
+		adev->gds.oa.cs_partition_size << AMDGPU_OA_SHIFT;
 	/* GDS Memory */
 	r = ttm_bo_init_mm(&adev->mman.bdev, AMDGPU_PL_GDS,
 				adev->gds.mem.total_size >> PAGE_SHIFT);
@@ -1362,10 +1380,9 @@ error_free:
 	return r;
 }
 
-int amdgpu_fill_buffer(struct amdgpu_bo *bo,
-		uint32_t src_data,
-		struct reservation_object *resv,
-		struct fence **fence)
+int amdgpu_fill_buffer(struct amdgpu_bo *bo, uint32_t src_data,
+		       struct reservation_object *resv,
+		       struct fence **fence)
 {
 	struct amdgpu_device *adev = bo->adev;
 	struct amdgpu_job *job;
@@ -1607,5 +1624,7 @@ static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev)
 
 u64 amdgpu_ttm_get_gtt_mem_size(struct amdgpu_device *adev)
 {
-	return ttm_get_kernel_zone_memory_size(adev->mman.mem_global_ref.object);
+	struct ttm_mem_global *glob = adev->mman.mem_global_ref.object;
+
+	return ttm_get_kernel_zone_memory_size(glob);
 }
Signature · 6 lines
2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1473945024-8275-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#4 lore raw

Re: [PATCH 2/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c

Quoted 3 lines · Christian König

From: Christian König <[email protected]>

No intented functional change.

"intended"

In general, with respect to the white space changes, I think the code is more readable as is, but I don't have a strong opinion either way, if you prefer this. One additional comment below.

Quoted 148 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 65 +++++++++++++++++++++------------
 1 file changed, 42 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +39 -22
index 428ffb6..1965209 100644
@@ -214,9 +214,11 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
        switch (bo->mem.mem_type) {
        case TTM_PL_VRAM:
                if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
-                       amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
+                       amdgpu_ttm_placement_from_domain(rbo,
+                                                        AMDGPU_GEM_DOMAIN_CPU);
                } else {
-                       amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_GTT);
+                       amdgpu_ttm_placement_from_domain(rbo,
+                                                        AMDGPU_GEM_DOMAIN_GTT);
                        for (i = 0; i < rbo->placement.num_placement; ++i) {
                                if (!(rbo->placements[i].flags &
                                      TTM_PL_FLAG_TT))
@@ -524,7 +526,8 @@ memcpy:
        return 0;
 }
 
-static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
+static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
+                                    struct ttm_mem_reg *mem)
 {
        struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
        struct amdgpu_device *adev = amdgpu_get_adev(bdev);
@@ -545,7 +548,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
        case TTM_PL_VRAM:
                mem->bus.offset = mem->start << PAGE_SHIFT;
                /* check if it's visible */
-               if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size)
+               if ((mem->bus.offset + mem->bus.size) >
+                   adev->mc.visible_vram_size)
                        return -EINVAL;
                mem->bus.base = adev->mc.aper_base;
                mem->bus.is_iomem = true;
@@ -579,7 +583,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
        return 0;
 }
 
-static void amdgpu_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
+static void amdgpu_ttm_io_mem_free(struct ttm_bo_device *bdev,
+                                  struct ttm_mem_reg *mem)
 {
 }
 
@@ -791,7 +796,8 @@ int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
        bo_mem.mem_type = TTM_PL_TT;
        spin_lock(&adev->gtt_list_lock);
        list_for_each_entry_safe(gtt, tmp, &adev->gtt_list, list) {
-               flags = amdgpu_ttm_tt_pte_flags(gtt->adev, &gtt->ttm.ttm, &bo_mem);
+               flags = amdgpu_ttm_tt_pte_flags(gtt->adev, &gtt->ttm.ttm,
+                                               &bo_mem);
                r = amdgpu_gart_bind(adev, gtt->offset, gtt->ttm.ttm.num_pages,
                                     gtt->ttm.ttm.pages, gtt->ttm.dma_address,
                                     flags);
@@ -856,7 +862,8 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_bo_device *bdev,
        }
        gtt->ttm.ttm.func = &amdgpu_backend_func;
        gtt->adev = adev;
-       if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags, dummy_read_page)) {
+       if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags,
+                           dummy_read_page)) {
                kfree(gtt);
                return NULL;
        }
@@ -887,7 +894,8 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 
        if (slave && ttm->sg) {
                drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
-                                                gtt->ttm.dma_address, ttm->num_pages);
+                                                gtt->ttm.dma_address,
+                                                ttm->num_pages);
                ttm->state = tt_unbound;
                return 0;
        }
@@ -906,13 +914,17 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
        }
 
        for (i = 0; i < ttm->num_pages; i++) {
-               gtt->ttm.dma_address[i] = pci_map_page(adev->pdev, ttm->pages[i],
+               gtt->ttm.dma_address[i] = pci_map_page(adev->pdev,
+                                                      ttm->pages[i],
                                                       0, PAGE_SIZE,
                                                       PCI_DMA_BIDIRECTIONAL);
-               if (pci_dma_mapping_error(adev->pdev, gtt->ttm.dma_address[i])) {
+               if (pci_dma_mapping_error(adev->pdev,
+                                         gtt->ttm.dma_address[i])) {
                        while (i--) {
-                               pci_unmap_page(adev->pdev, gtt->ttm.dma_address[i],
-                                              PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+                               pci_unmap_page(adev->pdev,
+                                              gtt->ttm.dma_address[i],
+                                              PAGE_SIZE,
+                                              PCI_DMA_BIDIRECTIONAL);
                                gtt->ttm.dma_address[i] = 0;
                        }
                        ttm_pool_unpopulate(ttm);
@@ -1195,14 +1207,20 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
                 (unsigned)(adev->mc.gtt_size / (1024 * 1024)));
 
        adev->gds.mem.total_size = adev->gds.mem.total_size << AMDGPU_GDS_SHIFT;
-       adev->gds.mem.gfx_partition_size = adev->gds.mem.gfx_partition_size << AMDGPU_GDS_SHIFT;
-       adev->gds.mem.cs_partition_size = adev->gds.mem.cs_partition_size << AMDGPU_GDS_SHIFT;
+       adev->gds.mem.gfx_partition_size =
+               adev->gds.mem.gfx_partition_size << AMDGPU_GDS_SHIFT;
+       adev->gds.mem.cs_partition_size =
+               adev->gds.mem.cs_partition_size << AMDGPU_GDS_SHIFT;
        adev->gds.gws.total_size = adev->gds.gws.total_size << AMDGPU_GWS_SHIFT;
-       adev->gds.gws.gfx_partition_size = adev->gds.gws.gfx_partition_size << AMDGPU_GWS_SHIFT;
-       adev->gds.gws.cs_partition_size = adev->gds.gws.cs_partition_size << AMDGPU_GWS_SHIFT;
+       adev->gds.gws.gfx_partition_size =
+               adev->gds.gws.gfx_partition_size << AMDGPU_GWS_SHIFT;
+       adev->gds.gws.cs_partition_size =
+               adev->gds.gws.cs_partition_size << AMDGPU_GWS_SHIFT;
        adev->gds.oa.total_size = adev->gds.oa.total_size << AMDGPU_OA_SHIFT;
-       adev->gds.oa.gfx_partition_size = adev->gds.oa.gfx_partition_size << AMDGPU_OA_SHIFT;
-       adev->gds.oa.cs_partition_size = adev->gds.oa.cs_partition_size << AMDGPU_OA_SHIFT;
+       adev->gds.oa.gfx_partition_size =
+               adev->gds.oa.gfx_partition_size << AMDGPU_OA_SHIFT;
+       adev->gds.oa.cs_partition_size =
+               adev->gds.oa.cs_partition_size << AMDGPU_OA_SHIFT;
        /* GDS Memory */
        r = ttm_bo_init_mm(&adev->mman.bdev, AMDGPU_PL_GDS,
                                adev->gds.mem.total_size >> PAGE_SHIFT);
@@ -1362,10 +1380,9 @@ error_free:
        return r;
 }
 
-int amdgpu_fill_buffer(struct amdgpu_bo *bo,
-               uint32_t src_data,
-               struct reservation_object *resv,
-               struct fence **fence)
+int amdgpu_fill_buffer(struct amdgpu_bo *bo, uint32_t src_data,
+                      struct reservation_object *resv,
+                      struct fence **fence)
 {
        struct amdgpu_device *adev = bo->adev;
        struct amdgpu_job *job;

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev) · line 1629

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -1
@@ -1607,5 +1624,7 @@ static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev)
 
 u64 amdgpu_ttm_get_gtt_mem_size(struct amdgpu_device *adev)
 {
-       return ttm_get_kernel_zone_memory_size(adev->mman.mem_global_ref.object);
+       struct ttm_mem_global *glob = adev->mman.mem_global_ref.object;
+
+       return ttm_get_kernel_zone_memory_size(glob);

Was this change intended? There were just a bunch of patches applied that did the opposite.

Alex

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -1
 }
--

2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw

Re: [PATCH 2/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c

In reply to a message not in the archive
Quoted 14 lines · Christian König

From: Christian König <[email protected]>

No intented functional change.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 65 +++++++++++++++++++++------------
 1 file changed, 42 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 428ffb6..1965209 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static void amdgpu_evict_flags(struct ttm_buffer_object *bo, · line 221

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -2
@@ -214,9 +214,11 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 	switch (bo->mem.mem_type) {
 	case TTM_PL_VRAM:
 		if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
-			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
+			amdgpu_ttm_placement_from_domain(rbo,
+							 AMDGPU_GEM_DOMAIN_CPU);
 		} else {
-			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_GTT);
+			amdgpu_ttm_placement_from_domain(rbo,
+							 AMDGPU_GEM_DOMAIN_GTT);

I don't see the point of this kind of change. We save all of 5 columns of horizontal space, but for that we reduce readability by breaking up a single line statement to multiple lines.

It makes more sense when saving a more significant amount of horizontal space or when the statement already spans multiple lines though.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 0a85f244-9e39-f5cf-41c7-41f5954094e7-otUistvHUpPR7s880joybQ@public.gmane.org

#7 lore raw

Re: [PATCH 2/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c

Am 16.09.2016 um 04:17 schrieb Michel Dänzer:

Quoted 29 lines · Christian König
Quoted 14 lines

From: Christian König <[email protected]>

No intented functional change.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 65 +++++++++++++++++++++------------
  1 file changed, 42 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 428ffb6..1965209 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static void amdgpu_evict_flags(struct ttm_buffer_object *bo, · line 221

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -2
@@ -214,9 +214,11 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
  	switch (bo->mem.mem_type) {
  	case TTM_PL_VRAM:
  		if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
-			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
+			amdgpu_ttm_placement_from_domain(rbo,
+							 AMDGPU_GEM_DOMAIN_CPU);
  		} else {
-			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_GTT);
+			amdgpu_ttm_placement_from_domain(rbo,
+							 AMDGPU_GEM_DOMAIN_GTT);

I don't see the point of this kind of change. We save all of 5 columns of horizontal space, but for that we reduce readability by breaking up a single line statement to multiple lines.

Quoted 3 lines

It makes more sense when saving a more significant amount of horizontal space or when the statement already spans multiple lines though.

I was mostly just following what the auto formatter suggested, but now that you say it it's probably not such a good idea in some cases.

Should I just drop those two patches or just fix what Alex and you have noted and send them again? Some of the changes still seem to make sense to me.

Regards,
Christain.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#8 lore raw

PATCH 3/5 drm/amdgpu: fix a bunch of coding style issues in amdgpu_gem.c

In reply to a message not in the archive

From: Christian König <[email protected]>

No intented functional change.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +12 -6
index 88fbed2..70e294b 100644
@@ -58,7 +58,8 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
 		alignment = PAGE_SIZE;
 	}
 
-	if (!(initial_domain & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA))) {
+	if (!(initial_domain & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS |
+				AMDGPU_GEM_DOMAIN_OA))) {
 		/* Maximum bo size is the unpinned gtt size since we use the gtt to
 		 * handle vram to system pool migrations.
 		 */
@@ -116,7 +117,8 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
  * Call from drm_gem_handle_create which appear in both new and open ioctl
  * case.
  */
-int amdgpu_gem_object_open(struct drm_gem_object *obj, struct drm_file *file_priv)
+int amdgpu_gem_object_open(struct drm_gem_object *obj,
+			   struct drm_file *file_priv)
 {
 	struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
 	struct amdgpu_device *adev = rbo->adev;
@@ -408,9 +410,11 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
 	}
 	robj = gem_to_amdgpu_bo(gobj);
 	if (timeout == 0)
-		ret = reservation_object_test_signaled_rcu(robj->tbo.resv, true);
+		ret = reservation_object_test_signaled_rcu(robj->tbo.resv,
+							   true);
 	else
-		ret = reservation_object_wait_timeout_rcu(robj->tbo.resv, true, true, timeout);
+		ret = reservation_object_wait_timeout_rcu(robj->tbo.resv, true,
+							  true, timeout);
 
 	/* ret == 0 means not signaled,
 	 * ret > 0 means signaled
@@ -480,7 +484,8 @@ out:
  * vital here, so they are not reported back to userspace.
  */
 static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
-				    struct amdgpu_bo_va *bo_va, uint32_t operation)
+				    struct amdgpu_bo_va *bo_va,
+				    uint32_t operation)
 {
 	struct ttm_validate_buffer tv, *entry;
 	struct amdgpu_bo_list_entry vm_pd;
@@ -704,7 +709,8 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
 	uint32_t handle;
 	int r;
 
-	args->pitch = amdgpu_align_pitch(adev, args->width, args->bpp, 0) * ((args->bpp + 1) / 8);
+	args->pitch = amdgpu_align_pitch(adev, args->width, args->bpp, 0) *
+		((args->bpp + 1) / 8);
 	args->size = (u64)args->pitch * args->height;
 	args->size = ALIGN(args->size, PAGE_SIZE);
 
Signature · 6 lines
2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1473945024-8275-3-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#10 lore raw

Re: [PATCH 3/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_gem.c

Quoted 4 lines · Christian König

From: Christian König <[email protected]>

No intented functional change.

"intended"

In general, with respect to the white space changes, I think the code is more readable as is, but I don't have a strong opinion either way, if you prefer this.

Quoted 66 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +12 -7
index 88fbed2..70e294b 100644
@@ -58,7 +58,8 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
                alignment = PAGE_SIZE;
        }
 
-       if (!(initial_domain & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA))) {
+       if (!(initial_domain & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS |
+                               AMDGPU_GEM_DOMAIN_OA))) {
                /* Maximum bo size is the unpinned gtt size since we use the gtt to
                 * handle vram to system pool migrations.
                 */
@@ -116,7 +117,8 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
  * Call from drm_gem_handle_create which appear in both new and open ioctl
  * case.
  */
-int amdgpu_gem_object_open(struct drm_gem_object *obj, struct drm_file *file_priv)
+int amdgpu_gem_object_open(struct drm_gem_object *obj,
+                          struct drm_file *file_priv)
 {
        struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
        struct amdgpu_device *adev = rbo->adev;
@@ -408,9 +410,11 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
        }
        robj = gem_to_amdgpu_bo(gobj);
        if (timeout == 0)
-               ret = reservation_object_test_signaled_rcu(robj->tbo.resv, true);
+               ret = reservation_object_test_signaled_rcu(robj->tbo.resv,
+                                                          true);
        else
-               ret = reservation_object_wait_timeout_rcu(robj->tbo.resv, true, true, timeout);
+               ret = reservation_object_wait_timeout_rcu(robj->tbo.resv, true,
+                                                         true, timeout);
 
        /* ret == 0 means not signaled,
         * ret > 0 means signaled
@@ -480,7 +484,8 @@ out:
  * vital here, so they are not reported back to userspace.
  */
 static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
-                                   struct amdgpu_bo_va *bo_va, uint32_t operation)
+                                   struct amdgpu_bo_va *bo_va,
+                                   uint32_t operation)
 {
        struct ttm_validate_buffer tv, *entry;
        struct amdgpu_bo_list_entry vm_pd;
@@ -704,7 +709,8 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
        uint32_t handle;
        int r;
 
-       args->pitch = amdgpu_align_pitch(adev, args->width, args->bpp, 0) * ((args->bpp + 1) / 8);
+       args->pitch = amdgpu_align_pitch(adev, args->width, args->bpp, 0) *
+               ((args->bpp + 1) / 8);
        args->size = (u64)args->pitch * args->height;
        args->size = ALIGN(args->size, PAGE_SIZE);
 
--

2.5.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#11 lore raw

PATCH 4/5 drm/amdgpu: remove adev pointer from struct amdgpu_bo

In reply to a message not in the archive

From: Christian König <[email protected]>

It's completely pointsless to have two pointers to the device in the same structur.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  6 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c     | 10 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c     |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 50 ++++++++++++++++--------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 17 +++-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c    |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c     |  2 +-
 9 files changed, 50 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -1
index 3b3981d..ed91f08 100644
@@ -465,7 +465,6 @@ struct amdgpu_bo {
 	 */
 	struct list_head		va;
 	/* Constant after initialization */
-	struct amdgpu_device		*adev;
 	struct drm_gem_object		gem_base;
 	struct amdgpu_bo		*parent;
 	struct amdgpu_bo		*shadow;
@@ -2144,6 +2143,11 @@ struct amdgpu_device {
 
 };
 
+static inline struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
+{
+	return container_of(bdev, struct amdgpu_device, mman.bdev);
+}
+
 bool amdgpu_device_is_px(struct drm_device *dev);
 int amdgpu_device_init(struct amdgpu_device *adev,
 		       struct drm_device *ddev,
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 -4
index 187c366..5beab71 100644
@@ -355,6 +355,7 @@ static void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev,
 static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
 				 struct amdgpu_bo *bo)
 {
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	u64 initial_bytes_moved;
 	uint32_t domain;
 	int r;
@@ -372,9 +373,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
 
 retry:
 	amdgpu_ttm_placement_from_domain(bo, domain);
-	initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
+	initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
 	r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
-	p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
+	p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
 		initial_bytes_moved;
 
 	if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
@@ -400,6 +401,7 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
 
 		struct amdgpu_bo_list_entry *candidate = p->evictable;
 		struct amdgpu_bo *bo = candidate->robj;
+		struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 		u64 initial_bytes_moved;
 		uint32_t other;
 
@@ -420,9 +422,9 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
 
 		/* Good we can try to move this BO somewhere else */
 		amdgpu_ttm_placement_from_domain(bo, other);
-		initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
+		initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
 		r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
-		p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
+		p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
 			initial_bytes_moved;
 
 		if (unlikely(r))
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 -2
index 70e294b..480ae7e 100644
@@ -121,7 +121,7 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,
 			   struct drm_file *file_priv)
 {
 	struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
-	struct amdgpu_device *adev = rbo->adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
 	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
 	struct amdgpu_vm *vm = &fpriv->vm;
 	struct amdgpu_bo_va *bo_va;
@@ -144,7 +144,7 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,
 			     struct drm_file *file_priv)
 {
 	struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-	struct amdgpu_device *adev = bo->adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
 	struct amdgpu_vm *vm = &fpriv->vm;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +2 -2
index 32fa7b7..4731231 100644
@@ -285,7 +285,7 @@ free_rmn:
 int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
 {
 	unsigned long end = addr + amdgpu_bo_size(bo) - 1;
-	struct amdgpu_device *adev = bo->adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	struct amdgpu_mn *rmn;
 	struct amdgpu_mn_node *node = NULL;
 	struct list_head bos;
@@ -340,7 +340,7 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
  */
 void amdgpu_mn_unregister(struct amdgpu_bo *bo)
 {
-	struct amdgpu_device *adev = bo->adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	struct amdgpu_mn *rmn;
 	struct list_head *head;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +27 -23

161 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2 -1
index 8255034..c9b2c01 100644
@@ -71,12 +71,13 @@ static inline unsigned amdgpu_mem_type_to_domain(u32 mem_type)
  */
 static inline int amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
 {
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	int r;
 
 	r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL);
 	if (unlikely(r != 0)) {
 		if (r != -ERESTARTSYS)
-			dev_err(bo->adev->dev, "%p reserve failed\n", bo);
+			dev_err(adev->dev, "%p reserve failed\n", bo);
 		return r;
 	}
 	return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -13
index 1965209..d246a1f 100644
@@ -51,16 +51,6 @@
 static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
 static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev);
 
-static struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
-{
-	struct amdgpu_mman *mman;
-	struct amdgpu_device *adev;
-
-	mman = container_of(bdev, struct amdgpu_mman, bdev);
-	adev = container_of(mman, struct amdgpu_device, mman);
-	return adev;
-}
-
 
 /*
  * Global memory.
@@ -195,6 +185,7 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
 static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 				struct ttm_placement *placement)
 {
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
 	struct amdgpu_bo *rbo;
 	static struct ttm_place placements = {
 		.fpfn = 0,
@@ -213,7 +204,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 	rbo = container_of(bo, struct amdgpu_bo, tbo);
 	switch (bo->mem.mem_type) {
 	case TTM_PL_VRAM:
-		if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
+		if (adev->mman.buffer_funcs_ring->ready == false) {
 			amdgpu_ttm_placement_from_domain(rbo,
 							 AMDGPU_GEM_DOMAIN_CPU);
 		} else {
@@ -231,7 +222,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 				 * allocating address space for the BO.
 				 */
 				rbo->placements[i].lpfn =
-					rbo->adev->mc.gtt_size >> PAGE_SHIFT;
+					adev->mc.gtt_size >> PAGE_SHIFT;
 			}
 		}
 		break;
@@ -1384,7 +1375,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, uint32_t src_data,
 		       struct reservation_object *resv,
 		       struct fence **fence)
 {
-	struct amdgpu_device *adev = bo->adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	struct amdgpu_job *job;
 	struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
index e6842b0..87bcac3 100644
@@ -931,7 +931,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
 	if (r)
 		return r;
 
-	if (!bo->adev->uvd.address_64_bit) {
+	if (!ring->adev->uvd.address_64_bit) {
 		amdgpu_ttm_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_VRAM);
 		amdgpu_uvd_force_into_uvd_segment(bo);
 	}
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index d3a2d1f..5dba9f7 100644
@@ -1175,7 +1175,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 
 	flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
 	gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
-		adev == bo_va->bo->adev) ? flags : 0;
+		adev == amdgpu_get_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
 
 	spin_lock(&vm->status_lock);
 	if (!list_empty(&bo_va->vm_status))
Signature · 6 lines
2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1473945024-8275-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#13 lore raw

Re: [PATCH 4/5] drm/amdgpu: remove adev pointer from struct amdgpu_bo

Quoted 31 lines · Christian König

From: Christian König <[email protected]>

It's completely pointsless to have two pointers to the device in the same structur.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  6 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c     | 10 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c     |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 50 ++++++++++++++++--------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 17 +++-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c    |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c     |  2 +-
 9 files changed, 50 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 3b3981d..ed91f08 100644
@@ -465,7 +465,6 @@ struct amdgpu_bo {
         */
        struct list_head                va;
        /* Constant after initialization */
-       struct amdgpu_device            *adev;
        struct drm_gem_object           gem_base;
        struct amdgpu_bo                *parent;
        struct amdgpu_bo                *shadow;

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 2149

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -0
@@ -2144,6 +2143,11 @@ struct amdgpu_device {
 
 };
 
+static inline struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
+{
+       return container_of(bdev, struct amdgpu_device, mman.bdev);
+}

Maybe call this amdgpu_ttm_get_adev() to make it clear to to get the adev from a ttm bo device?

Alex

Quoted 373 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
+
 bool amdgpu_device_is_px(struct drm_device *dev);
 int amdgpu_device_init(struct amdgpu_device *adev,
                       struct drm_device *ddev,
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 -4
index 187c366..5beab71 100644
@@ -355,6 +355,7 @@ static void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev,
 static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
                                 struct amdgpu_bo *bo)
 {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
        u64 initial_bytes_moved;
        uint32_t domain;
        int r;
@@ -372,9 +373,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
 
 retry:
        amdgpu_ttm_placement_from_domain(bo, domain);
-       initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
+       initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
        r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
-       p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
+       p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
                initial_bytes_moved;
 
        if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
@@ -400,6 +401,7 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
 
                struct amdgpu_bo_list_entry *candidate = p->evictable;
                struct amdgpu_bo *bo = candidate->robj;
+               struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
                u64 initial_bytes_moved;
                uint32_t other;
 
@@ -420,9 +422,9 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
 
                /* Good we can try to move this BO somewhere else */
                amdgpu_ttm_placement_from_domain(bo, other);
-               initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
+               initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
                r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
-               p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
+               p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
                        initial_bytes_moved;
 
                if (unlikely(r))
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 -2
index 70e294b..480ae7e 100644
@@ -121,7 +121,7 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,
                           struct drm_file *file_priv)
 {
        struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
-       struct amdgpu_device *adev = rbo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
        struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
        struct amdgpu_vm *vm = &fpriv->vm;
        struct amdgpu_bo_va *bo_va;
@@ -144,7 +144,7 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,
                             struct drm_file *file_priv)
 {
        struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
        struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
        struct amdgpu_vm *vm = &fpriv->vm;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +2 -2
index 32fa7b7..4731231 100644
@@ -285,7 +285,7 @@ free_rmn:
 int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
 {
        unsigned long end = addr + amdgpu_bo_size(bo) - 1;
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
        struct amdgpu_mn *rmn;
        struct amdgpu_mn_node *node = NULL;
        struct list_head bos;
@@ -340,7 +340,7 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
  */
 void amdgpu_mn_unregister(struct amdgpu_bo *bo)
 {
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
        struct amdgpu_mn *rmn;
        struct list_head *head;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +27 -23
index 4289c31..5cbe803 100644
@@ -90,18 +90,19 @@ static void amdgpu_update_memory_usage(struct amdgpu_device *adev,
 
 static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
 {
+       struct amdgpu_device *adev = amdgpu_get_adev(tbo->bdev);
        struct amdgpu_bo *bo;
 
        bo = container_of(tbo, struct amdgpu_bo, tbo);
 
-       amdgpu_update_memory_usage(bo->adev, &bo->tbo.mem, NULL);
+       amdgpu_update_memory_usage(adev, &bo->tbo.mem, NULL);
 
        drm_gem_object_release(&bo->gem_base);
        amdgpu_bo_unref(&bo->parent);
        if (!list_empty(&bo->shadow_list)) {
-               mutex_lock(&bo->adev->shadow_list_lock);
+               mutex_lock(&adev->shadow_list_lock);
                list_del_init(&bo->shadow_list);
-               mutex_unlock(&bo->adev->shadow_list_lock);
+               mutex_unlock(&adev->shadow_list_lock);
        }
        kfree(bo->metadata);
        kfree(bo);
@@ -212,8 +213,10 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
 
 void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain)
 {
-       amdgpu_ttm_placement_init(rbo->adev, &rbo->placement,
-                                 rbo->placements, domain, rbo->flags);
+       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
+
+       amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
+                                 domain, rbo->flags);
 }
 
 static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,
@@ -359,7 +362,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
                kfree(bo);
                return r;
        }
-       bo->adev = adev;
        INIT_LIST_HEAD(&bo->shadow_list);
        INIT_LIST_HEAD(&bo->va);
        bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
@@ -624,6 +626,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                             u64 min_offset, u64 max_offset,
                             u64 *gpu_addr)
 {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
        int r, i;
        unsigned fpfn, lpfn;
 
@@ -659,12 +662,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                if ((bo->placements[i].flags & TTM_PL_FLAG_VRAM) &&
                    !(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) &&
                    (!max_offset || max_offset >
-                    bo->adev->mc.visible_vram_size)) {
+                    adev->mc.visible_vram_size)) {
                        if (WARN_ON_ONCE(min_offset >
-                                        bo->adev->mc.visible_vram_size))
+                                        adev->mc.visible_vram_size))
                                return -EINVAL;
                        fpfn = min_offset >> PAGE_SHIFT;
-                       lpfn = bo->adev->mc.visible_vram_size >> PAGE_SHIFT;
+                       lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
                } else {
                        fpfn = min_offset >> PAGE_SHIFT;
                        lpfn = max_offset >> PAGE_SHIFT;
@@ -679,12 +682,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 
        r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
        if (unlikely(r)) {
-               dev_err(bo->adev->dev, "%p pin failed\n", bo);
+               dev_err(adev->dev, "%p pin failed\n", bo);
                goto error;
        }
        r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
        if (unlikely(r)) {
-               dev_err(bo->adev->dev, "%p bind failed\n", bo);
+               dev_err(adev->dev, "%p bind failed\n", bo);
                goto error;
        }
 
@@ -692,11 +695,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
        if (gpu_addr != NULL)
                *gpu_addr = amdgpu_bo_gpu_offset(bo);
        if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
-               bo->adev->vram_pin_size += amdgpu_bo_size(bo);
+               adev->vram_pin_size += amdgpu_bo_size(bo);
                if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
-                       bo->adev->invisible_pin_size += amdgpu_bo_size(bo);
+                       adev->invisible_pin_size += amdgpu_bo_size(bo);
        } else if (domain == AMDGPU_GEM_DOMAIN_GTT) {
-               bo->adev->gart_pin_size += amdgpu_bo_size(bo);
+               adev->gart_pin_size += amdgpu_bo_size(bo);
        }
 
 error:
@@ -710,10 +713,11 @@ int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain, u64 *gpu_addr)
 
 int amdgpu_bo_unpin(struct amdgpu_bo *bo)
 {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
        int r, i;
 
        if (!bo->pin_count) {
-               dev_warn(bo->adev->dev, "%p unpin not necessary\n", bo);
+               dev_warn(adev->dev, "%p unpin not necessary\n", bo);
                return 0;
        }
        bo->pin_count--;
@@ -725,16 +729,16 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
        }
        r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
        if (unlikely(r)) {
-               dev_err(bo->adev->dev, "%p validate failed for unpin\n", bo);
+               dev_err(adev->dev, "%p validate failed for unpin\n", bo);
                goto error;
        }
 
        if (bo->tbo.mem.mem_type == TTM_PL_VRAM) {
-               bo->adev->vram_pin_size -= amdgpu_bo_size(bo);
+               adev->vram_pin_size -= amdgpu_bo_size(bo);
                if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
-                       bo->adev->invisible_pin_size -= amdgpu_bo_size(bo);
+                       adev->invisible_pin_size -= amdgpu_bo_size(bo);
        } else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
-               bo->adev->gart_pin_size -= amdgpu_bo_size(bo);
+               adev->gart_pin_size -= amdgpu_bo_size(bo);
        }
 
 error:
@@ -859,6 +863,7 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
 void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
                           struct ttm_mem_reg *new_mem)
 {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
        struct amdgpu_bo *rbo;
        struct ttm_mem_reg *old_mem = &bo->mem;
 
@@ -866,21 +871,21 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
                return;
 
        rbo = container_of(bo, struct amdgpu_bo, tbo);
-       amdgpu_vm_bo_invalidate(rbo->adev, rbo);
+       amdgpu_vm_bo_invalidate(adev, rbo);
 
        /* update statistics */
        if (!new_mem)
                return;
 
        /* move_notify is called before move happens */
-       amdgpu_update_memory_usage(rbo->adev, &bo->mem, new_mem);
+       amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
 
        trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type, old_mem->mem_type);
 }
 
 int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
 {
-       struct amdgpu_device *adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
        struct amdgpu_bo *abo;
        unsigned long offset, size, lpfn;
        int i, r;
@@ -889,7 +894,6 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
                return 0;
 
        abo = container_of(bo, struct amdgpu_bo, tbo);
-       adev = abo->adev;
        if (bo->mem.mem_type != TTM_PL_VRAM)
                return 0;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2 -1
index 8255034..c9b2c01 100644
@@ -71,12 +71,13 @@ static inline unsigned amdgpu_mem_type_to_domain(u32 mem_type)
  */
 static inline int amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
 {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
        int r;
 
        r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL);
        if (unlikely(r != 0)) {
                if (r != -ERESTARTSYS)
-                       dev_err(bo->adev->dev, "%p reserve failed\n", bo);
+                       dev_err(adev->dev, "%p reserve failed\n", bo);
                return r;
        }
        return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -13
index 1965209..d246a1f 100644
@@ -51,16 +51,6 @@
 static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
 static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev);
 
-static struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
-{
-       struct amdgpu_mman *mman;
-       struct amdgpu_device *adev;
-
-       mman = container_of(bdev, struct amdgpu_mman, bdev);
-       adev = container_of(mman, struct amdgpu_device, mman);
-       return adev;
-}
-
 
 /*
  * Global memory.
@@ -195,6 +185,7 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
 static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
                                struct ttm_placement *placement)
 {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
        struct amdgpu_bo *rbo;
        static struct ttm_place placements = {
                .fpfn = 0,
@@ -213,7 +204,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
        rbo = container_of(bo, struct amdgpu_bo, tbo);
        switch (bo->mem.mem_type) {
        case TTM_PL_VRAM:
-               if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
+               if (adev->mman.buffer_funcs_ring->ready == false) {
                        amdgpu_ttm_placement_from_domain(rbo,
                                                         AMDGPU_GEM_DOMAIN_CPU);
                } else {
@@ -231,7 +222,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
                                 * allocating address space for the BO.
                                 */
                                rbo->placements[i].lpfn =
-                                       rbo->adev->mc.gtt_size >> PAGE_SHIFT;
+                                       adev->mc.gtt_size >> PAGE_SHIFT;
                        }
                }
                break;
@@ -1384,7 +1375,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, uint32_t src_data,
                       struct reservation_object *resv,
                       struct fence **fence)
 {
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
        struct amdgpu_job *job;
        struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
index e6842b0..87bcac3 100644
@@ -931,7 +931,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
        if (r)
                return r;
 
-       if (!bo->adev->uvd.address_64_bit) {
+       if (!ring->adev->uvd.address_64_bit) {
                amdgpu_ttm_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_VRAM);
                amdgpu_uvd_force_into_uvd_segment(bo);
        }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -2
index d3a2d1f..5dba9f7 100644
@@ -1175,7 +1175,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 
        flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
        gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
-               adev == bo_va->bo->adev) ? flags : 0;
+               adev == amdgpu_get_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
 
        spin_lock(&vm->status_lock);
        if (!list_empty(&bo_va->vm_status))
--

2.5.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_M4VrN-N=Fh2kvZpedqTRVkxePjDBCySk9icaD77R87ag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#15 lore raw

Re: [PATCH 4/5] drm/amdgpu: remove adev pointer from struct amdgpu_bo

Am 15.09.2016 um 20:30 schrieb Alex Deucher:

Quoted 34 lines
Quoted 32 lines · Christian König

From: Christian König <[email protected]>

It's completely pointsless to have two pointers to the device in the same structur.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  6 +++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c     | 10 +++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    |  4 +--
  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c     |  4 +--
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 50 ++++++++++++++++--------------
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  3 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 17 +++-------
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c    |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c     |  2 +-
  9 files changed, 50 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 3b3981d..ed91f08 100644
@@ -465,7 +465,6 @@ struct amdgpu_bo {
          */
         struct list_head                va;
         /* Constant after initialization */
-       struct amdgpu_device            *adev;
         struct drm_gem_object           gem_base;
         struct amdgpu_bo                *parent;
         struct amdgpu_bo                *shadow;
@@ -2144,6 +2143,11 @@ struct amdgpu_device {
 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 2149

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -0
  };
 
+static inline struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
+{
+       return container_of(bdev, struct amdgpu_device, mman.bdev);
+}

Maybe call this amdgpu_ttm_get_adev() to make it clear to to get the adev from a ttm bo device?

Do you have a strong opinion on this? I thought about that as well, but I find it a bit long then. Especially a few lines would then become longer than 80 characters again.

I just send the patch out with a bunch of other cleanups as well, please take another look.

Christian.

Quoted 376 lines

Alex

Quoted 373 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
+
  bool amdgpu_device_is_px(struct drm_device *dev);
  int amdgpu_device_init(struct amdgpu_device *adev,
                        struct drm_device *ddev,
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 -4
index 187c366..5beab71 100644
@@ -355,6 +355,7 @@ static void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev,
  static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
                                  struct amdgpu_bo *bo)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         u64 initial_bytes_moved;
         uint32_t domain;
         int r;
@@ -372,9 +373,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
 
  retry:
         amdgpu_ttm_placement_from_domain(bo, domain);
-       initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
+       initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
         r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
-       p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
+       p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
                 initial_bytes_moved;
 
         if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
@@ -400,6 +401,7 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
 
                 struct amdgpu_bo_list_entry *candidate = p->evictable;
                 struct amdgpu_bo *bo = candidate->robj;
+               struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
                 u64 initial_bytes_moved;
                 uint32_t other;
 
@@ -420,9 +422,9 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
 
                 /* Good we can try to move this BO somewhere else */
                 amdgpu_ttm_placement_from_domain(bo, other);
-               initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
+               initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
                 r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
-               p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
+               p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
                         initial_bytes_moved;
 
                 if (unlikely(r))
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 -2
index 70e294b..480ae7e 100644
@@ -121,7 +121,7 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,
                            struct drm_file *file_priv)
  {
         struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
-       struct amdgpu_device *adev = rbo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
         struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
         struct amdgpu_vm *vm = &fpriv->vm;
         struct amdgpu_bo_va *bo_va;
@@ -144,7 +144,7 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,
                              struct drm_file *file_priv)
  {
         struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
         struct amdgpu_vm *vm = &fpriv->vm;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +2 -2
index 32fa7b7..4731231 100644
@@ -285,7 +285,7 @@ free_rmn:
  int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
  {
         unsigned long end = addr + amdgpu_bo_size(bo) - 1;
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         struct amdgpu_mn *rmn;
         struct amdgpu_mn_node *node = NULL;
         struct list_head bos;
@@ -340,7 +340,7 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
   */
  void amdgpu_mn_unregister(struct amdgpu_bo *bo)
  {
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         struct amdgpu_mn *rmn;
         struct list_head *head;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +27 -23
index 4289c31..5cbe803 100644
@@ -90,18 +90,19 @@ static void amdgpu_update_memory_usage(struct amdgpu_device *adev,
 
  static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(tbo->bdev);
         struct amdgpu_bo *bo;
 
         bo = container_of(tbo, struct amdgpu_bo, tbo);
 
-       amdgpu_update_memory_usage(bo->adev, &bo->tbo.mem, NULL);
+       amdgpu_update_memory_usage(adev, &bo->tbo.mem, NULL);
 
         drm_gem_object_release(&bo->gem_base);
         amdgpu_bo_unref(&bo->parent);
         if (!list_empty(&bo->shadow_list)) {
-               mutex_lock(&bo->adev->shadow_list_lock);
+               mutex_lock(&adev->shadow_list_lock);
                 list_del_init(&bo->shadow_list);
-               mutex_unlock(&bo->adev->shadow_list_lock);
+               mutex_unlock(&adev->shadow_list_lock);
         }
         kfree(bo->metadata);
         kfree(bo);
@@ -212,8 +213,10 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
 
  void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain)
  {
-       amdgpu_ttm_placement_init(rbo->adev, &rbo->placement,
-                                 rbo->placements, domain, rbo->flags);
+       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
+
+       amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
+                                 domain, rbo->flags);
  }
 
  static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,
@@ -359,7 +362,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
                 kfree(bo);
                 return r;
         }
-       bo->adev = adev;
         INIT_LIST_HEAD(&bo->shadow_list);
         INIT_LIST_HEAD(&bo->va);
         bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
@@ -624,6 +626,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                              u64 min_offset, u64 max_offset,
                              u64 *gpu_addr)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         int r, i;
         unsigned fpfn, lpfn;
 
@@ -659,12 +662,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                 if ((bo->placements[i].flags & TTM_PL_FLAG_VRAM) &&
                     !(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) &&
                     (!max_offset || max_offset >
-                    bo->adev->mc.visible_vram_size)) {
+                    adev->mc.visible_vram_size)) {
                         if (WARN_ON_ONCE(min_offset >
-                                        bo->adev->mc.visible_vram_size))
+                                        adev->mc.visible_vram_size))
                                 return -EINVAL;
                         fpfn = min_offset >> PAGE_SHIFT;
-                       lpfn = bo->adev->mc.visible_vram_size >> PAGE_SHIFT;
+                       lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
                 } else {
                         fpfn = min_offset >> PAGE_SHIFT;
                         lpfn = max_offset >> PAGE_SHIFT;
@@ -679,12 +682,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 
         r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
         if (unlikely(r)) {
-               dev_err(bo->adev->dev, "%p pin failed\n", bo);
+               dev_err(adev->dev, "%p pin failed\n", bo);
                 goto error;
         }
         r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
         if (unlikely(r)) {
-               dev_err(bo->adev->dev, "%p bind failed\n", bo);
+               dev_err(adev->dev, "%p bind failed\n", bo);
                 goto error;
         }
 
@@ -692,11 +695,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
         if (gpu_addr != NULL)
                 *gpu_addr = amdgpu_bo_gpu_offset(bo);
         if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
-               bo->adev->vram_pin_size += amdgpu_bo_size(bo);
+               adev->vram_pin_size += amdgpu_bo_size(bo);
                 if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
-                       bo->adev->invisible_pin_size += amdgpu_bo_size(bo);
+                       adev->invisible_pin_size += amdgpu_bo_size(bo);
         } else if (domain == AMDGPU_GEM_DOMAIN_GTT) {
-               bo->adev->gart_pin_size += amdgpu_bo_size(bo);
+               adev->gart_pin_size += amdgpu_bo_size(bo);
         }
 
  error:
@@ -710,10 +713,11 @@ int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain, u64 *gpu_addr)
 
  int amdgpu_bo_unpin(struct amdgpu_bo *bo)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         int r, i;
 
         if (!bo->pin_count) {
-               dev_warn(bo->adev->dev, "%p unpin not necessary\n", bo);
+               dev_warn(adev->dev, "%p unpin not necessary\n", bo);
                 return 0;
         }
         bo->pin_count--;
@@ -725,16 +729,16 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
         }
         r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
         if (unlikely(r)) {
-               dev_err(bo->adev->dev, "%p validate failed for unpin\n", bo);
+               dev_err(adev->dev, "%p validate failed for unpin\n", bo);
                 goto error;
         }
 
         if (bo->tbo.mem.mem_type == TTM_PL_VRAM) {
-               bo->adev->vram_pin_size -= amdgpu_bo_size(bo);
+               adev->vram_pin_size -= amdgpu_bo_size(bo);
                 if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
-                       bo->adev->invisible_pin_size -= amdgpu_bo_size(bo);
+                       adev->invisible_pin_size -= amdgpu_bo_size(bo);
         } else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
-               bo->adev->gart_pin_size -= amdgpu_bo_size(bo);
+               adev->gart_pin_size -= amdgpu_bo_size(bo);
         }
 
  error:
@@ -859,6 +863,7 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
  void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
                            struct ttm_mem_reg *new_mem)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
         struct amdgpu_bo *rbo;
         struct ttm_mem_reg *old_mem = &bo->mem;
 
@@ -866,21 +871,21 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
                 return;
 
         rbo = container_of(bo, struct amdgpu_bo, tbo);
-       amdgpu_vm_bo_invalidate(rbo->adev, rbo);
+       amdgpu_vm_bo_invalidate(adev, rbo);
 
         /* update statistics */
         if (!new_mem)
                 return;
 
         /* move_notify is called before move happens */
-       amdgpu_update_memory_usage(rbo->adev, &bo->mem, new_mem);
+       amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
 
         trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type, old_mem->mem_type);
  }
 
  int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
  {
-       struct amdgpu_device *adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
         struct amdgpu_bo *abo;
         unsigned long offset, size, lpfn;
         int i, r;
@@ -889,7 +894,6 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
                 return 0;
 
         abo = container_of(bo, struct amdgpu_bo, tbo);
-       adev = abo->adev;
         if (bo->mem.mem_type != TTM_PL_VRAM)
                 return 0;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2 -1
index 8255034..c9b2c01 100644
@@ -71,12 +71,13 @@ static inline unsigned amdgpu_mem_type_to_domain(u32 mem_type)
   */
  static inline int amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         int r;
 
         r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL);
         if (unlikely(r != 0)) {
                 if (r != -ERESTARTSYS)
-                       dev_err(bo->adev->dev, "%p reserve failed\n", bo);
+                       dev_err(adev->dev, "%p reserve failed\n", bo);
                 return r;
         }
         return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -13
index 1965209..d246a1f 100644
@@ -51,16 +51,6 @@
  static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
  static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev);
 
-static struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
-{
-       struct amdgpu_mman *mman;
-       struct amdgpu_device *adev;
-
-       mman = container_of(bdev, struct amdgpu_mman, bdev);
-       adev = container_of(mman, struct amdgpu_device, mman);
-       return adev;
-}
-
 
  /*
   * Global memory.
@@ -195,6 +185,7 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
  static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
                                 struct ttm_placement *placement)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
         struct amdgpu_bo *rbo;
         static struct ttm_place placements = {
                 .fpfn = 0,
@@ -213,7 +204,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
         rbo = container_of(bo, struct amdgpu_bo, tbo);
         switch (bo->mem.mem_type) {
         case TTM_PL_VRAM:
-               if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
+               if (adev->mman.buffer_funcs_ring->ready == false) {
                         amdgpu_ttm_placement_from_domain(rbo,
                                                          AMDGPU_GEM_DOMAIN_CPU);
                 } else {
@@ -231,7 +222,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
                                  * allocating address space for the BO.
                                  */
                                 rbo->placements[i].lpfn =
-                                       rbo->adev->mc.gtt_size >> PAGE_SHIFT;
+                                       adev->mc.gtt_size >> PAGE_SHIFT;
                         }
                 }
                 break;
@@ -1384,7 +1375,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, uint32_t src_data,
                        struct reservation_object *resv,
                        struct fence **fence)
  {
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         struct amdgpu_job *job;
         struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
index e6842b0..87bcac3 100644
@@ -931,7 +931,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
         if (r)
                 return r;
 
-       if (!bo->adev->uvd.address_64_bit) {
+       if (!ring->adev->uvd.address_64_bit) {
                 amdgpu_ttm_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_VRAM);
                 amdgpu_uvd_force_into_uvd_segment(bo);
         }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -2
index d3a2d1f..5dba9f7 100644
@@ -1175,7 +1175,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 
         flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
         gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
-               adev == bo_va->bo->adev) ? flags : 0;
+               adev == amdgpu_get_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
 
         spin_lock(&vm->status_lock);
         if (!list_empty(&bo_va->vm_status))
--

2.5.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 9a954630-b832-f596-ff48-90b24fc3600c-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#17 lore raw

Re: [PATCH 4/5] drm/amdgpu: remove adev pointer from struct amdgpu_bo

Quoted 51 lines · Christian König

Am 15.09.2016 um 20:30 schrieb Alex Deucher:

Quoted 40 lines
Quoted 37 lines · Christian König

From: Christian König <[email protected]>

It's completely pointsless to have two pointers to the device in the same structur.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  6 +++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c     | 10 +++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    |  4 +--
  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c     |  4 +--
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 50
++++++++++++++++--------------
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  3 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 17 +++-------
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c    |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c     |  2 +-
  9 files changed, 50 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 3b3981d..ed91f08 100644
@@ -465,7 +465,6 @@ struct amdgpu_bo {
          */
         struct list_head                va;
         /* Constant after initialization */
-       struct amdgpu_device            *adev;
         struct drm_gem_object           gem_base;
         struct amdgpu_bo                *parent;
         struct amdgpu_bo                *shadow;
@@ -2144,6 +2143,11 @@ struct amdgpu_device {
 
  };
 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 2149

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -0
+static inline struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device
 *bdev)
+{
+       return container_of(bdev, struct amdgpu_device, mman.bdev);
+}

Maybe call this amdgpu_ttm_get_adev() to make it clear to to get the adev from a ttm bo device?

Quoted 3 lines

Do you have a strong opinion on this? I thought about that as well, but I find it a bit long then. Especially a few lines would then become longer than 80 characters again.

My main concern is if we ever add another accessor for an adev embedded in something else. How about amdgpu_ttm_to_adev() or amdgpu_ttm_adev()?

Alex

Quoted 431 lines

I just send the patch out with a bunch of other cleanups as well, please take another look.

Christian.

Quoted 424 lines

Alex

Quoted 421 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
+
  bool amdgpu_device_is_px(struct drm_device *dev);
  int amdgpu_device_init(struct amdgpu_device *adev,

struct drm_device *ddev,

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -0
index 187c366..5beab71 100644
@@ -355,6 +355,7 @@ static void amdgpu_cs_report_moved_bytes(struct
 amdgpu_device *adev,
  static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
                                  struct amdgpu_bo *bo)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         u64 initial_bytes_moved;
         uint32_t domain;
         int r;
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -2
@@ -372,9 +373,9 @@ static int amdgpu_cs_bo_validate(struct
 amdgpu_cs_parser *p,
 
  retry:
         amdgpu_ttm_placement_from_domain(bo, domain);
-       initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
+       initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
         r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
-       p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
+       p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
                 initial_bytes_moved;
 
         if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -0
@@ -400,6 +401,7 @@ static bool amdgpu_cs_try_evict(struct
 amdgpu_cs_parser *p,
 
                 struct amdgpu_bo_list_entry *candidate = p->evictable;
                 struct amdgpu_bo *bo = candidate->robj;
+               struct amdgpu_device *adev =
 amdgpu_get_adev(bo->tbo.bdev);
                 u64 initial_bytes_moved;
                 uint32_t other;
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -2
@@ -420,9 +422,9 @@ static bool amdgpu_cs_try_evict(struct
 amdgpu_cs_parser *p,
 
                 /* Good we can try to move this BO somewhere else */
                 amdgpu_ttm_placement_from_domain(bo, other);
-               initial_bytes_moved =
 atomic64_read(&bo->adev->num_bytes_moved);
+               initial_bytes_moved =
 atomic64_read(&adev->num_bytes_moved);
                 r = ttm_bo_validate(&bo->tbo, &bo->placement, true,
 false);
-               p->bytes_moved +=

atomic64_read(&bo->adev->num_bytes_moved) -

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -0
+               p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
                         initial_bytes_moved;
 
                 if (unlikely(r))
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
index 70e294b..480ae7e 100644
@@ -121,7 +121,7 @@ int amdgpu_gem_object_open(struct drm_gem_object
 *obj,
                            struct drm_file *file_priv)
  {
         struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
-       struct amdgpu_device *adev = rbo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
         struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
         struct amdgpu_vm *vm = &fpriv->vm;
         struct amdgpu_bo_va *bo_va;
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
@@ -144,7 +144,7 @@ void amdgpu_gem_object_close(struct drm_gem_object
 *obj,
                              struct drm_file *file_priv)
  {
         struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
         struct amdgpu_vm *vm = &fpriv->vm;
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +2 -2
index 32fa7b7..4731231 100644
@@ -285,7 +285,7 @@ free_rmn:
  int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
  {
         unsigned long end = addr + amdgpu_bo_size(bo) - 1;
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         struct amdgpu_mn *rmn;
         struct amdgpu_mn_node *node = NULL;
         struct list_head bos;
@@ -340,7 +340,7 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned
 long addr)
   */
  void amdgpu_mn_unregister(struct amdgpu_bo *bo)
  {
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         struct amdgpu_mn *rmn;
         struct list_head *head;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -3
index 4289c31..5cbe803 100644
@@ -90,18 +90,19 @@ static void amdgpu_update_memory_usage(struct
 amdgpu_device *adev,
 
  static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(tbo->bdev);
         struct amdgpu_bo *bo;
 
         bo = container_of(tbo, struct amdgpu_bo, tbo);
 
-       amdgpu_update_memory_usage(bo->adev, &bo->tbo.mem, NULL);
+       amdgpu_update_memory_usage(adev, &bo->tbo.mem, NULL);
 
         drm_gem_object_release(&bo->gem_base);
         amdgpu_bo_unref(&bo->parent);
         if (!list_empty(&bo->shadow_list)) {
-               mutex_lock(&bo->adev->shadow_list_lock);
+               mutex_lock(&adev->shadow_list_lock);
                 list_del_init(&bo->shadow_list);
-               mutex_unlock(&bo->adev->shadow_list_lock);
+               mutex_unlock(&adev->shadow_list_lock);
         }
         kfree(bo->metadata);
         kfree(bo);
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -2
@@ -212,8 +213,10 @@ static void amdgpu_ttm_placement_init(struct
 amdgpu_device *adev,
 
  void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32
 domain)
  {
-       amdgpu_ttm_placement_init(rbo->adev, &rbo->placement,
-                                 rbo->placements, domain, rbo->flags);
+       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
+
+       amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
+                                 domain, rbo->flags);
  }

static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -1
@@ -359,7 +362,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device
 *adev,
                 kfree(bo);
                 return r;
         }
-       bo->adev = adev;
         INIT_LIST_HEAD(&bo->shadow_list);
         INIT_LIST_HEAD(&bo->va);
         bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -3
@@ -624,6 +626,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo,
 u32 domain,
                              u64 min_offset, u64 max_offset,
                              u64 *gpu_addr)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         int r, i;
         unsigned fpfn, lpfn;
@@ -659,12 +662,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo,
 u32 domain,
                 if ((bo->placements[i].flags & TTM_PL_FLAG_VRAM) &&
                     !(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) &&
                     (!max_offset || max_offset >
-                    bo->adev->mc.visible_vram_size)) {
+                    adev->mc.visible_vram_size)) {
                         if (WARN_ON_ONCE(min_offset >
-                                        bo->adev->mc.visible_vram_size))
+                                        adev->mc.visible_vram_size))
                                 return -EINVAL;
                         fpfn = min_offset >> PAGE_SHIFT;
-                       lpfn = bo->adev->mc.visible_vram_size >>
 PAGE_SHIFT;
+                       lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
                 } else {
                         fpfn = min_offset >> PAGE_SHIFT;
                         lpfn = max_offset >> PAGE_SHIFT;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5 -5
@@ -679,12 +682,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo,
 u32 domain,
 
         r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
         if (unlikely(r)) {
-               dev_err(bo->adev->dev, "%p pin failed\n", bo);
+               dev_err(adev->dev, "%p pin failed\n", bo);
                 goto error;
         }
         r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
         if (unlikely(r)) {
-               dev_err(bo->adev->dev, "%p bind failed\n", bo);
+               dev_err(adev->dev, "%p bind failed\n", bo);
                 goto error;
         }
@@ -692,11 +695,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo,
 u32 domain,
         if (gpu_addr != NULL)
                 *gpu_addr = amdgpu_bo_gpu_offset(bo);
         if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
-               bo->adev->vram_pin_size += amdgpu_bo_size(bo);
+               adev->vram_pin_size += amdgpu_bo_size(bo);
                 if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
-                       bo->adev->invisible_pin_size +=
 amdgpu_bo_size(bo);
+                       adev->invisible_pin_size += amdgpu_bo_size(bo);
         } else if (domain == AMDGPU_GEM_DOMAIN_GTT) {
-               bo->adev->gart_pin_size += amdgpu_bo_size(bo);
+               adev->gart_pin_size += amdgpu_bo_size(bo);
         }

error:

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -1
@@ -710,10 +713,11 @@ int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain,
 u64 *gpu_addr)
 
  int amdgpu_bo_unpin(struct amdgpu_bo *bo)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         int r, i;
 
         if (!bo->pin_count) {
-               dev_warn(bo->adev->dev, "%p unpin not necessary\n", bo);
+               dev_warn(adev->dev, "%p unpin not necessary\n", bo);
                 return 0;
         }
         bo->pin_count--;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -4
@@ -725,16 +729,16 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
         }
         r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
         if (unlikely(r)) {
-               dev_err(bo->adev->dev, "%p validate failed for unpin\n",
 bo);
+               dev_err(adev->dev, "%p validate failed for unpin\n", bo);
                 goto error;
         }
 
         if (bo->tbo.mem.mem_type == TTM_PL_VRAM) {
-               bo->adev->vram_pin_size -= amdgpu_bo_size(bo);
+               adev->vram_pin_size -= amdgpu_bo_size(bo);
                 if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
-                       bo->adev->invisible_pin_size -=
 amdgpu_bo_size(bo);
+                       adev->invisible_pin_size -= amdgpu_bo_size(bo);
         } else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
-               bo->adev->gart_pin_size -= amdgpu_bo_size(bo);
+               adev->gart_pin_size -= amdgpu_bo_size(bo);
         }

error:

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -3
@@ -859,6 +863,7 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void
 *buffer,
  void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
                            struct ttm_mem_reg *new_mem)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
         struct amdgpu_bo *rbo;
         struct ttm_mem_reg *old_mem = &bo->mem;
@@ -866,21 +871,21 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object
 *bo,
                 return;
 
         rbo = container_of(bo, struct amdgpu_bo, tbo);
-       amdgpu_vm_bo_invalidate(rbo->adev, rbo);
+       amdgpu_vm_bo_invalidate(adev, rbo);
 
         /* update statistics */
         if (!new_mem)
                 return;
 
         /* move_notify is called before move happens */
-       amdgpu_update_memory_usage(rbo->adev, &bo->mem, new_mem);
+       amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
 
         trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type,
 old_mem->mem_type);
  }
 
  int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
  {
-       struct amdgpu_device *adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
         struct amdgpu_bo *abo;
         unsigned long offset, size, lpfn;
         int i, r;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -1
@@ -889,7 +894,6 @@ int amdgpu_bo_fault_reserve_notify(struct
 ttm_buffer_object *bo)
                 return 0;
 
         abo = container_of(bo, struct amdgpu_bo, tbo);
-       adev = abo->adev;
         if (bo->mem.mem_type != TTM_PL_VRAM)
                 return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2 -1
index 8255034..c9b2c01 100644
@@ -71,12 +71,13 @@ static inline unsigned amdgpu_mem_type_to_domain(u32
 mem_type)
   */
  static inline int amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         int r;
 
         r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL);
         if (unlikely(r != 0)) {
                 if (r != -ERESTARTSYS)
-                       dev_err(bo->adev->dev, "%p reserve failed\n",
 bo);
+                       dev_err(adev->dev, "%p reserve failed\n", bo);
                 return r;
         }
         return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -10
index 1965209..d246a1f 100644
@@ -51,16 +51,6 @@
  static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
  static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev);
 
-static struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
-{
-       struct amdgpu_mman *mman;
-       struct amdgpu_device *adev;
-
-       mman = container_of(bdev, struct amdgpu_mman, bdev);
-       adev = container_of(mman, struct amdgpu_device, mman);
-       return adev;
-}
-
 
  /*
   * Global memory.
@@ -195,6 +185,7 @@ static int amdgpu_init_mem_type(struct ttm_bo_device
 *bdev, uint32_t type,
  static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
                                 struct ttm_placement *placement)
  {
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
         struct amdgpu_bo *rbo;
         static struct ttm_place placements = {
                 .fpfn = 0,
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -213,7 +204,7 @@ static void amdgpu_evict_flags(struct
 ttm_buffer_object *bo,
         rbo = container_of(bo, struct amdgpu_bo, tbo);
         switch (bo->mem.mem_type) {
         case TTM_PL_VRAM:
-               if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
+               if (adev->mman.buffer_funcs_ring->ready == false) {
                         amdgpu_ttm_placement_from_domain(rbo,
 
AMDGPU_GEM_DOMAIN_CPU);
                 } else {
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -231,7 +222,7 @@ static void amdgpu_evict_flags(struct
 ttm_buffer_object *bo,
                                  * allocating address space for the BO.
                                  */
                                 rbo->placements[i].lpfn =
-                                       rbo->adev->mc.gtt_size >>
 PAGE_SHIFT;
+                                       adev->mc.gtt_size >> PAGE_SHIFT;
                         }
                 }
                 break;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -1384,7 +1375,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
 uint32_t src_data,
                        struct reservation_object *resv,
                        struct fence **fence)
  {
-       struct amdgpu_device *adev = bo->adev;
+       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
         struct amdgpu_job *job;
         struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
index e6842b0..87bcac3 100644
@@ -931,7 +931,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring
 *ring, struct amdgpu_bo *bo,
         if (r)
                 return r;
 
-       if (!bo->adev->uvd.address_64_bit) {
+       if (!ring->adev->uvd.address_64_bit) {
                 amdgpu_ttm_placement_from_domain(bo,
 AMDGPU_GEM_DOMAIN_VRAM);
                 amdgpu_uvd_force_into_uvd_segment(bo);
         }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index d3a2d1f..5dba9f7 100644
@@ -1175,7 +1175,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 
         flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
         gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
-               adev == bo_va->bo->adev) ? flags : 0;
+               adev == amdgpu_get_adev(bo_va->bo->tbo.bdev)) ? flags :
 0;
 
         spin_lock(&vm->status_lock);
         if (!list_empty(&bo_va->vm_status))

--
2.5.0

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#18 lore raw

PATCH 5/5 drm/amdgpu: rename all rbo variable to abo

In reply to a message not in the archive

From: Christian König <[email protected]>

Just to cleanup some radeon leftovers.

sed -i "s/rbo/abo/g" drivers/gpu/drm/amd/amdgpu/*.c sed -i "s/rbo/abo/g" drivers/gpu/drm/amd/amdgpu/*.h

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h         |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 42 +++++++++++++--------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c      | 44 ++++++++++++++---------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c     | 20 ++++++-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  | 16 +++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 24 ++++++++--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c     |  8 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c      | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c      | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c       | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c       | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c    | 12 ++++----
 12 files changed, 157 insertions(+), 157 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -2
index ed91f08..c30635a 100644
@@ -701,7 +701,7 @@ struct amdgpu_flip_work {
 	int				crtc_id;
 	uint64_t			base;
 	struct drm_pending_vblank_event *event;
-	struct amdgpu_bo		*old_rbo;
+	struct amdgpu_bo		*old_abo;
 	struct fence			*excl;
 	unsigned			shared_count;
 	struct fence			**shared;
@@ -2436,7 +2436,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data);
 int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,
 		       u32 ip_instance, u32 ring,
 		       struct amdgpu_ring **out_ring);
-void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain);
+void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *abo, u32 domain);
 bool amdgpu_ttm_bo_is_amdgpu_bo(struct ttm_buffer_object *bo);
 int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages);
 int amdgpu_ttm_tt_set_userptr(struct ttm_tt *ttm, uint64_t addr,
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +21 -21

100 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +22 -22

119 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +10 -10
index 480ae7e..6ae87e8 100644
@@ -120,23 +120,23 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
 int amdgpu_gem_object_open(struct drm_gem_object *obj,
 			   struct drm_file *file_priv)
 {
-	struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
-	struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
+	struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);
+	struct amdgpu_device *adev = amdgpu_get_adev(abo->tbo.bdev);
 	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
 	struct amdgpu_vm *vm = &fpriv->vm;
 	struct amdgpu_bo_va *bo_va;
 	int r;
-	r = amdgpu_bo_reserve(rbo, false);
+	r = amdgpu_bo_reserve(abo, false);
 	if (r)
 		return r;
 
-	bo_va = amdgpu_vm_bo_find(vm, rbo);
+	bo_va = amdgpu_vm_bo_find(vm, abo);
 	if (!bo_va) {
-		bo_va = amdgpu_vm_bo_add(adev, vm, rbo);
+		bo_va = amdgpu_vm_bo_add(adev, vm, abo);
 	} else {
 		++bo_va->ref_count;
 	}
-	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_unreserve(abo);
 	return 0;
 }
 
@@ -552,7 +552,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
 	struct drm_gem_object *gobj;
 	struct amdgpu_device *adev = dev->dev_private;
 	struct amdgpu_fpriv *fpriv = filp->driver_priv;
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	struct amdgpu_bo_va *bo_va;
 	struct ttm_validate_buffer tv, tv_pd;
 	struct ww_acquire_ctx ticket;
@@ -592,10 +592,10 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
 	gobj = drm_gem_object_lookup(filp, args->handle);
 	if (gobj == NULL)
 		return -ENOENT;
-	rbo = gem_to_amdgpu_bo(gobj);
+	abo = gem_to_amdgpu_bo(gobj);
 	INIT_LIST_HEAD(&list);
 	INIT_LIST_HEAD(&duplicates);
-	tv.bo = &rbo->tbo;
+	tv.bo = &abo->tbo;
 	tv.shared = true;
 	list_add(&tv.head, &list);
 
@@ -609,7 +609,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
 		return r;
 	}
 
-	bo_va = amdgpu_vm_bo_find(&fpriv->vm, rbo);
+	bo_va = amdgpu_vm_bo_find(&fpriv->vm, abo);
 	if (!bo_va) {
 		ttm_eu_backoff_reservation(&ticket, &list);
 		drm_gem_object_unreference_unlocked(gobj);
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +8 -8
index 5cbe803..c57d55d 100644
@@ -211,12 +211,12 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
 	placement->busy_placement = places;
 }
 
-void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain)
+void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *abo, u32 domain)
 {
-	struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
+	struct amdgpu_device *adev = amdgpu_get_adev(abo->tbo.bdev);
 
-	amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
-				  domain, rbo->flags);
+	amdgpu_ttm_placement_init(adev, &abo->placement, abo->placements,
+				  domain, abo->flags);
 }
 
 static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,
@@ -864,14 +864,14 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
 			   struct ttm_mem_reg *new_mem)
 {
 	struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	struct ttm_mem_reg *old_mem = &bo->mem;
 
 	if (!amdgpu_ttm_bo_is_amdgpu_bo(bo))
 		return;
 
-	rbo = container_of(bo, struct amdgpu_bo, tbo);
-	amdgpu_vm_bo_invalidate(adev, rbo);
+	abo = container_of(bo, struct amdgpu_bo, tbo);
+	amdgpu_vm_bo_invalidate(adev, abo);
 
 	/* update statistics */
 	if (!new_mem)
@@ -880,7 +880,7 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
 	/* move_notify is called before move happens */
 	amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
 
-	trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type, old_mem->mem_type);
+	trace_amdgpu_ttm_bo_move(abo, new_mem->mem_type, old_mem->mem_type);
 }
 
 int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +12 -12
index d246a1f..6d0ed39f 100644
@@ -186,7 +186,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 				struct ttm_placement *placement)
 {
 	struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	static struct ttm_place placements = {
 		.fpfn = 0,
 		.lpfn = 0,
@@ -201,45 +201,45 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 		placement->num_busy_placement = 1;
 		return;
 	}
-	rbo = container_of(bo, struct amdgpu_bo, tbo);
+	abo = container_of(bo, struct amdgpu_bo, tbo);
 	switch (bo->mem.mem_type) {
 	case TTM_PL_VRAM:
 		if (adev->mman.buffer_funcs_ring->ready == false) {
-			amdgpu_ttm_placement_from_domain(rbo,
+			amdgpu_ttm_placement_from_domain(abo,
 							 AMDGPU_GEM_DOMAIN_CPU);
 		} else {
-			amdgpu_ttm_placement_from_domain(rbo,
+			amdgpu_ttm_placement_from_domain(abo,
 							 AMDGPU_GEM_DOMAIN_GTT);
-			for (i = 0; i < rbo->placement.num_placement; ++i) {
-				if (!(rbo->placements[i].flags &
+			for (i = 0; i < abo->placement.num_placement; ++i) {
+				if (!(abo->placements[i].flags &
 				      TTM_PL_FLAG_TT))
 					continue;
 
-				if (rbo->placements[i].lpfn)
+				if (abo->placements[i].lpfn)
 					continue;
 
 				/* set an upper limit to force directly
 				 * allocating address space for the BO.
 				 */
-				rbo->placements[i].lpfn =
+				abo->placements[i].lpfn =
 					adev->mc.gtt_size >> PAGE_SHIFT;
 			}
 		}
 		break;
 	case TTM_PL_TT:
 	default:
-		amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
+		amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_CPU);
 	}
-	*placement = rbo->placement;
+	*placement = abo->placement;
 }
 
 static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)
 {
-	struct amdgpu_bo *rbo = container_of(bo, struct amdgpu_bo, tbo);
+	struct amdgpu_bo *abo = container_of(bo, struct amdgpu_bo, tbo);
 
 	if (amdgpu_ttm_tt_get_usermm(bo->ttm))
 		return -EPERM;
-	return drm_vma_node_verify_access(&rbo->gem_base.vma_node, filp);
+	return drm_vma_node_verify_access(&abo->gem_base.vma_node, filp);
 }
 
 static void amdgpu_move_null(struct ttm_buffer_object *bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +4 -4
index 87bcac3..d67eada 100644
@@ -351,12 +351,12 @@ void amdgpu_uvd_free_handles(struct amdgpu_device *adev, struct drm_file *filp)
 	}
 }
 
-static void amdgpu_uvd_force_into_uvd_segment(struct amdgpu_bo *rbo)
+static void amdgpu_uvd_force_into_uvd_segment(struct amdgpu_bo *abo)
 {
 	int i;
-	for (i = 0; i < rbo->placement.num_placement; ++i) {
-		rbo->placements[i].fpfn = 0 >> PAGE_SHIFT;
-		rbo->placements[i].lpfn = (256 * 1024 * 1024) >> PAGE_SHIFT;
+	for (i = 0; i < abo->placement.num_placement; ++i) {
+		abo->placements[i].fpfn = 0 >> PAGE_SHIFT;
+		abo->placements[i].lpfn = (256 * 1024 * 1024) >> PAGE_SHIFT;
 	}
 }
 
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +18 -18
index 2af166e..5af418f 100644
@@ -2102,7 +2102,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
 	struct amdgpu_framebuffer *amdgpu_fb;
 	struct drm_framebuffer *target_fb;
 	struct drm_gem_object *obj;
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	uint64_t fb_location, tiling_flags;
 	uint32_t fb_format, fb_pitch_pixels;
 	u32 fb_swap = REG_SET_FIELD(0, GRPH_SWAP_CNTL, GRPH_ENDIAN_SWAP, ENDIAN_NONE);
@@ -2129,23 +2129,23 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
 	 * just update base pointers
 	 */
 	obj = amdgpu_fb->obj;
-	rbo = gem_to_amdgpu_bo(obj);
-	r = amdgpu_bo_reserve(rbo, false);
+	abo = gem_to_amdgpu_bo(obj);
+	r = amdgpu_bo_reserve(abo, false);
 	if (unlikely(r != 0))
 		return r;
 
 	if (atomic) {
-		fb_location = amdgpu_bo_gpu_offset(rbo);
+		fb_location = amdgpu_bo_gpu_offset(abo);
 	} else {
-		r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+		r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
 		if (unlikely(r != 0)) {
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unreserve(abo);
 			return -EINVAL;
 		}
 	}
 
-	amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+	amdgpu_bo_unreserve(abo);
 
 	pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
 
@@ -2319,12 +2319,12 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
 
 	if (!atomic && fb && fb != crtc->primary->fb) {
 		amdgpu_fb = to_amdgpu_framebuffer(fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r != 0))
 			return r;
-		amdgpu_bo_unpin(rbo);
-		amdgpu_bo_unreserve(rbo);
+		amdgpu_bo_unpin(abo);
+		amdgpu_bo_unreserve(abo);
 	}
 
 	/* Bytes per pixel may have changed */
@@ -2802,16 +2802,16 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc)
 	if (crtc->primary->fb) {
 		int r;
 		struct amdgpu_framebuffer *amdgpu_fb;
-		struct amdgpu_bo *rbo;
+		struct amdgpu_bo *abo;
 
 		amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r))
-			DRM_ERROR("failed to reserve rbo before unpin\n");
+			DRM_ERROR("failed to reserve abo before unpin\n");
 		else {
-			amdgpu_bo_unpin(rbo);
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unpin(abo);
+			amdgpu_bo_unreserve(abo);
 		}
 	}
 	/* disable the GRPH */
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +18 -18
index 6747f8f..256de46 100644
@@ -2085,7 +2085,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
 	struct amdgpu_framebuffer *amdgpu_fb;
 	struct drm_framebuffer *target_fb;
 	struct drm_gem_object *obj;
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	uint64_t fb_location, tiling_flags;
 	uint32_t fb_format, fb_pitch_pixels;
 	u32 fb_swap = REG_SET_FIELD(0, GRPH_SWAP_CNTL, GRPH_ENDIAN_SWAP, ENDIAN_NONE);
@@ -2112,23 +2112,23 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
 	 * just update base pointers
 	 */
 	obj = amdgpu_fb->obj;
-	rbo = gem_to_amdgpu_bo(obj);
-	r = amdgpu_bo_reserve(rbo, false);
+	abo = gem_to_amdgpu_bo(obj);
+	r = amdgpu_bo_reserve(abo, false);
 	if (unlikely(r != 0))
 		return r;
 
 	if (atomic) {
-		fb_location = amdgpu_bo_gpu_offset(rbo);
+		fb_location = amdgpu_bo_gpu_offset(abo);
 	} else {
-		r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+		r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
 		if (unlikely(r != 0)) {
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unreserve(abo);
 			return -EINVAL;
 		}
 	}
 
-	amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+	amdgpu_bo_unreserve(abo);
 
 	pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
 
@@ -2302,12 +2302,12 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
 
 	if (!atomic && fb && fb != crtc->primary->fb) {
 		amdgpu_fb = to_amdgpu_framebuffer(fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r != 0))
 			return r;
-		amdgpu_bo_unpin(rbo);
-		amdgpu_bo_unreserve(rbo);
+		amdgpu_bo_unpin(abo);
+		amdgpu_bo_unreserve(abo);
 	}
 
 	/* Bytes per pixel may have changed */
@@ -2820,16 +2820,16 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc)
 	if (crtc->primary->fb) {
 		int r;
 		struct amdgpu_framebuffer *amdgpu_fb;
-		struct amdgpu_bo *rbo;
+		struct amdgpu_bo *abo;
 
 		amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r))
-			DRM_ERROR("failed to reserve rbo before unpin\n");
+			DRM_ERROR("failed to reserve abo before unpin\n");
 		else {
-			amdgpu_bo_unpin(rbo);
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unpin(abo);
+			amdgpu_bo_unreserve(abo);
 		}
 	}
 	/* disable the GRPH */
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +18 -18
index 0a807d2..0a1db00 100644
@@ -1493,7 +1493,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
 	struct amdgpu_framebuffer *amdgpu_fb;
 	struct drm_framebuffer *target_fb;
 	struct drm_gem_object *obj;
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	uint64_t fb_location, tiling_flags;
 	uint32_t fb_format, fb_pitch_pixels, pipe_config;
 	u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE);
@@ -1520,23 +1520,23 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
 	 * just update base pointers
 	 */
 	obj = amdgpu_fb->obj;
-	rbo = gem_to_amdgpu_bo(obj);
-	r = amdgpu_bo_reserve(rbo, false);
+	abo = gem_to_amdgpu_bo(obj);
+	r = amdgpu_bo_reserve(abo, false);
 	if (unlikely(r != 0))
 		return r;
 
 	if (atomic)
-		fb_location = amdgpu_bo_gpu_offset(rbo);
+		fb_location = amdgpu_bo_gpu_offset(abo);
 	else {
-		r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+		r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
 		if (unlikely(r != 0)) {
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unreserve(abo);
 			return -EINVAL;
 		}
 	}
 
-	amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+	amdgpu_bo_unreserve(abo);
 
 	switch (target_fb->pixel_format) {
 	case DRM_FORMAT_C8:
@@ -1688,12 +1688,12 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
 
 	if (!atomic && fb && fb != crtc->primary->fb) {
 		amdgpu_fb = to_amdgpu_framebuffer(fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r != 0))
 			return r;
-		amdgpu_bo_unpin(rbo);
-		amdgpu_bo_unreserve(rbo);
+		amdgpu_bo_unpin(abo);
+		amdgpu_bo_unreserve(abo);
 	}
 
 	/* Bytes per pixel may have changed */
@@ -2139,16 +2139,16 @@ static void dce_v6_0_crtc_disable(struct drm_crtc *crtc)
 	if (crtc->primary->fb) {
 		int r;
 		struct amdgpu_framebuffer *amdgpu_fb;
-		struct amdgpu_bo *rbo;
+		struct amdgpu_bo *abo;
 
 		amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r))
-			DRM_ERROR("failed to reserve rbo before unpin\n");
+			DRM_ERROR("failed to reserve abo before unpin\n");
 		else {
-			amdgpu_bo_unpin(rbo);
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unpin(abo);
+			amdgpu_bo_unreserve(abo);
 		}
 	}
 	/* disable the GRPH */
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +18 -18
index 06d836f..4d313aa 100644
@@ -1990,7 +1990,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
 	struct amdgpu_framebuffer *amdgpu_fb;
 	struct drm_framebuffer *target_fb;
 	struct drm_gem_object *obj;
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	uint64_t fb_location, tiling_flags;
 	uint32_t fb_format, fb_pitch_pixels;
 	u32 fb_swap = (GRPH_ENDIAN_NONE << GRPH_SWAP_CNTL__GRPH_ENDIAN_SWAP__SHIFT);
@@ -2017,23 +2017,23 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
 	 * just update base pointers
 	 */
 	obj = amdgpu_fb->obj;
-	rbo = gem_to_amdgpu_bo(obj);
-	r = amdgpu_bo_reserve(rbo, false);
+	abo = gem_to_amdgpu_bo(obj);
+	r = amdgpu_bo_reserve(abo, false);
 	if (unlikely(r != 0))
 		return r;
 
 	if (atomic) {
-		fb_location = amdgpu_bo_gpu_offset(rbo);
+		fb_location = amdgpu_bo_gpu_offset(abo);
 	} else {
-		r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+		r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
 		if (unlikely(r != 0)) {
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unreserve(abo);
 			return -EINVAL;
 		}
 	}
 
-	amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+	amdgpu_bo_unreserve(abo);
 
 	pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
 
@@ -2188,12 +2188,12 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
 
 	if (!atomic && fb && fb != crtc->primary->fb) {
 		amdgpu_fb = to_amdgpu_framebuffer(fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r != 0))
 			return r;
-		amdgpu_bo_unpin(rbo);
-		amdgpu_bo_unreserve(rbo);
+		amdgpu_bo_unpin(abo);
+		amdgpu_bo_unreserve(abo);
 	}
 
 	/* Bytes per pixel may have changed */
@@ -2663,16 +2663,16 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc)
 	if (crtc->primary->fb) {
 		int r;
 		struct amdgpu_framebuffer *amdgpu_fb;
-		struct amdgpu_bo *rbo;
+		struct amdgpu_bo *abo;
 
 		amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r))
-			DRM_ERROR("failed to reserve rbo before unpin\n");
+			DRM_ERROR("failed to reserve abo before unpin\n");
 		else {
-			amdgpu_bo_unpin(rbo);
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unpin(abo);
+			amdgpu_bo_unreserve(abo);
 		}
 	}
 	/* disable the GRPH */
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +6 -6
index 85f14a6..c93e18e 100644
@@ -227,16 +227,16 @@ static void dce_virtual_crtc_disable(struct drm_crtc *crtc)
 	if (crtc->primary->fb) {
 		int r;
 		struct amdgpu_framebuffer *amdgpu_fb;
-		struct amdgpu_bo *rbo;
+		struct amdgpu_bo *abo;
 
 		amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r))
-			DRM_ERROR("failed to reserve rbo before unpin\n");
+			DRM_ERROR("failed to reserve abo before unpin\n");
 		else {
-			amdgpu_bo_unpin(rbo);
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unpin(abo);
+			amdgpu_bo_unreserve(abo);
 		}
 	}
 
Signature · 6 lines
2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1473945024-8275-5-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by
#20 lore raw

Re: [PATCH 5/5] drm/amdgpu: rename all rbo variable to abo

Quoted 8 lines · Christian König

From: Christian König <[email protected]>

Just to cleanup some radeon leftovers.

sed -i "s/rbo/abo/g" drivers/gpu/drm/amd/amdgpu/*.c sed -i "s/rbo/abo/g" drivers/gpu/drm/amd/amdgpu/*.h

Quoted 848 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h         |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 42 +++++++++++++--------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c      | 44 ++++++++++++++---------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c     | 20 ++++++-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  | 16 +++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 24 ++++++++--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c     |  8 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c      | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c      | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c       | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c       | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c    | 12 ++++----
 12 files changed, 157 insertions(+), 157 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -2
index ed91f08..c30635a 100644
@@ -701,7 +701,7 @@ struct amdgpu_flip_work {
        int                             crtc_id;
        uint64_t                        base;
        struct drm_pending_vblank_event *event;
-       struct amdgpu_bo                *old_rbo;
+       struct amdgpu_bo                *old_abo;
        struct fence                    *excl;
        unsigned                        shared_count;
        struct fence                    **shared;
@@ -2436,7 +2436,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data);
 int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,
                       u32 ip_instance, u32 ring,
                       struct amdgpu_ring **out_ring);
-void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain);
+void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *abo, u32 domain);
 bool amdgpu_ttm_bo_is_amdgpu_bo(struct ttm_buffer_object *bo);
 int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages);
 int amdgpu_ttm_tt_set_userptr(struct ttm_tt *ttm, uint64_t addr,
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +21 -21
index 93fd761..783e1d8 100644
@@ -154,17 +154,17 @@ static void amdgpu_unpin_work_func(struct work_struct *__work)
        int r;
 
        /* unpin of the old buffer */
-       r = amdgpu_bo_reserve(work->old_rbo, false);
+       r = amdgpu_bo_reserve(work->old_abo, false);
        if (likely(r == 0)) {
-               r = amdgpu_bo_unpin(work->old_rbo);
+               r = amdgpu_bo_unpin(work->old_abo);
                if (unlikely(r != 0)) {
                        DRM_ERROR("failed to unpin buffer after flip\n");
                }
-               amdgpu_bo_unreserve(work->old_rbo);
+               amdgpu_bo_unreserve(work->old_abo);
        } else
                DRM_ERROR("failed to reserve buffer after flip\n");
 
-       amdgpu_bo_unref(&work->old_rbo);
+       amdgpu_bo_unref(&work->old_abo);
        kfree(work->shared);
        kfree(work);
 }
@@ -181,7 +181,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
        struct amdgpu_framebuffer *new_amdgpu_fb;
        struct drm_gem_object *obj;
        struct amdgpu_flip_work *work;
-       struct amdgpu_bo *new_rbo;
+       struct amdgpu_bo *new_abo;
        unsigned long flags;
        u64 tiling_flags;
        u64 base;
@@ -204,28 +204,28 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
        obj = old_amdgpu_fb->obj;
 
        /* take a reference to the old object */
-       work->old_rbo = gem_to_amdgpu_bo(obj);
-       amdgpu_bo_ref(work->old_rbo);
+       work->old_abo = gem_to_amdgpu_bo(obj);
+       amdgpu_bo_ref(work->old_abo);
 
        new_amdgpu_fb = to_amdgpu_framebuffer(fb);
        obj = new_amdgpu_fb->obj;
-       new_rbo = gem_to_amdgpu_bo(obj);
+       new_abo = gem_to_amdgpu_bo(obj);
 
        /* pin the new buffer */
-       r = amdgpu_bo_reserve(new_rbo, false);
+       r = amdgpu_bo_reserve(new_abo, false);
        if (unlikely(r != 0)) {
-               DRM_ERROR("failed to reserve new rbo buffer before flip\n");
+               DRM_ERROR("failed to reserve new abo buffer before flip\n");
                goto cleanup;
        }
 
-       r = amdgpu_bo_pin_restricted(new_rbo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, &base);
+       r = amdgpu_bo_pin_restricted(new_abo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, &base);
        if (unlikely(r != 0)) {
                r = -EINVAL;
-               DRM_ERROR("failed to pin new rbo buffer before flip\n");
+               DRM_ERROR("failed to pin new abo buffer before flip\n");
                goto unreserve;
        }
 
-       r = reservation_object_get_fences_rcu(new_rbo->tbo.resv, &work->excl,
+       r = reservation_object_get_fences_rcu(new_abo->tbo.resv, &work->excl,
                                              &work->shared_count,
                                              &work->shared);
        if (unlikely(r != 0)) {
@@ -233,8 +233,8 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
                goto unpin;
        }
 
-       amdgpu_bo_get_tiling_flags(new_rbo, &tiling_flags);
-       amdgpu_bo_unreserve(new_rbo);
+       amdgpu_bo_get_tiling_flags(new_abo, &tiling_flags);
+       amdgpu_bo_unreserve(new_abo);
 
        work->base = base;
 
@@ -269,19 +269,19 @@ vblank_cleanup:
        drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_id);
 
 pflip_cleanup:
-       if (unlikely(amdgpu_bo_reserve(new_rbo, false) != 0)) {
-               DRM_ERROR("failed to reserve new rbo in error path\n");
+       if (unlikely(amdgpu_bo_reserve(new_abo, false) != 0)) {
+               DRM_ERROR("failed to reserve new abo in error path\n");
                goto cleanup;
        }
 unpin:
-       if (unlikely(amdgpu_bo_unpin(new_rbo) != 0)) {
-               DRM_ERROR("failed to unpin new rbo in error path\n");
+       if (unlikely(amdgpu_bo_unpin(new_abo) != 0)) {
+               DRM_ERROR("failed to unpin new abo in error path\n");
        }
 unreserve:
-       amdgpu_bo_unreserve(new_rbo);
+       amdgpu_bo_unreserve(new_abo);
 
 cleanup:
-       amdgpu_bo_unref(&work->old_rbo);
+       amdgpu_bo_unref(&work->old_abo);
        fence_put(work->excl);
        for (i = 0; i < work->shared_count; ++i)
                fence_put(work->shared[i]);
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +22 -22
index 95a4cdd..f491092 100644
@@ -111,14 +111,14 @@ int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int bpp, bool tile
 
 static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)
 {
-       struct amdgpu_bo *rbo = gem_to_amdgpu_bo(gobj);
+       struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
        int ret;
 
-       ret = amdgpu_bo_reserve(rbo, false);
+       ret = amdgpu_bo_reserve(abo, false);
        if (likely(ret == 0)) {
-               amdgpu_bo_kunmap(rbo);
-               amdgpu_bo_unpin(rbo);
-               amdgpu_bo_unreserve(rbo);
+               amdgpu_bo_kunmap(abo);
+               amdgpu_bo_unpin(abo);
+               amdgpu_bo_unreserve(abo);
        }
        drm_gem_object_unreference_unlocked(gobj);
 }
@@ -129,7 +129,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 {
        struct amdgpu_device *adev = rfbdev->adev;
        struct drm_gem_object *gobj = NULL;
-       struct amdgpu_bo *rbo = NULL;
+       struct amdgpu_bo *abo = NULL;
        bool fb_tiled = false; /* useful for testing */
        u32 tiling_flags = 0;
        int ret;
@@ -156,30 +156,30 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
                       aligned_size);
                return -ENOMEM;
        }
-       rbo = gem_to_amdgpu_bo(gobj);
+       abo = gem_to_amdgpu_bo(gobj);
 
        if (fb_tiled)
                tiling_flags = AMDGPU_TILING_SET(ARRAY_MODE, GRPH_ARRAY_2D_TILED_THIN1);
 
-       ret = amdgpu_bo_reserve(rbo, false);
+       ret = amdgpu_bo_reserve(abo, false);
        if (unlikely(ret != 0))
                goto out_unref;
 
        if (tiling_flags) {
-               ret = amdgpu_bo_set_tiling_flags(rbo,
+               ret = amdgpu_bo_set_tiling_flags(abo,
                                                 tiling_flags);
                if (ret)
                        dev_err(adev->dev, "FB failed to set tiling flags\n");
        }
 
 
-       ret = amdgpu_bo_pin_restricted(rbo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, NULL);
+       ret = amdgpu_bo_pin_restricted(abo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, NULL);
        if (ret) {
-               amdgpu_bo_unreserve(rbo);
+               amdgpu_bo_unreserve(abo);
                goto out_unref;
        }
-       ret = amdgpu_bo_kmap(rbo, NULL);
-       amdgpu_bo_unreserve(rbo);
+       ret = amdgpu_bo_kmap(abo, NULL);
+       amdgpu_bo_unreserve(abo);
        if (ret) {
                goto out_unref;
        }
@@ -201,7 +201,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
        struct drm_framebuffer *fb = NULL;
        struct drm_mode_fb_cmd2 mode_cmd;
        struct drm_gem_object *gobj = NULL;
-       struct amdgpu_bo *rbo = NULL;
+       struct amdgpu_bo *abo = NULL;
        int ret;
        unsigned long tmp;
 
@@ -220,7 +220,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
                return ret;
        }
 
-       rbo = gem_to_amdgpu_bo(gobj);
+       abo = gem_to_amdgpu_bo(gobj);
 
        /* okay we have an object now allocate the framebuffer */
        info = drm_fb_helper_alloc_fbi(helper);
@@ -243,7 +243,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
        /* setup helper */
        rfbdev->helper.fb = fb;
 
-       memset_io(rbo->kptr, 0x0, amdgpu_bo_size(rbo));
+       memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
 
        strcpy(info->fix.id, "amdgpudrmfb");
 
@@ -252,11 +252,11 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
        info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
        info->fbops = &amdgpufb_ops;
 
-       tmp = amdgpu_bo_gpu_offset(rbo) - adev->mc.vram_start;
+       tmp = amdgpu_bo_gpu_offset(abo) - adev->mc.vram_start;
        info->fix.smem_start = adev->mc.aper_base + tmp;
-       info->fix.smem_len = amdgpu_bo_size(rbo);
-       info->screen_base = rbo->kptr;
-       info->screen_size = amdgpu_bo_size(rbo);
+       info->fix.smem_len = amdgpu_bo_size(abo);
+       info->screen_base = abo->kptr;
+       info->screen_size = amdgpu_bo_size(abo);
 
        drm_fb_helper_fill_var(info, &rfbdev->helper, sizes->fb_width, sizes->fb_height);
 
@@ -273,7 +273,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 
        DRM_INFO("fb mappable at 0x%lX\n",  info->fix.smem_start);
        DRM_INFO("vram apper at 0x%lX\n",  (unsigned long)adev->mc.aper_base);
-       DRM_INFO("size %lu\n", (unsigned long)amdgpu_bo_size(rbo));
+       DRM_INFO("size %lu\n", (unsigned long)amdgpu_bo_size(abo));
        DRM_INFO("fb depth is %d\n", fb->depth);
        DRM_INFO("   pitch is %d\n", fb->pitches[0]);
 
@@ -283,7 +283,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 out_destroy_fbi:
        drm_fb_helper_release_fbi(helper);
 out_unref:
-       if (rbo) {
+       if (abo) {
 
        }
        if (fb && ret) {
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +10 -10
index 480ae7e..6ae87e8 100644
@@ -120,23 +120,23 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
 int amdgpu_gem_object_open(struct drm_gem_object *obj,
                           struct drm_file *file_priv)
 {
-       struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
-       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
+       struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);
+       struct amdgpu_device *adev = amdgpu_get_adev(abo->tbo.bdev);
        struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
        struct amdgpu_vm *vm = &fpriv->vm;
        struct amdgpu_bo_va *bo_va;
        int r;
-       r = amdgpu_bo_reserve(rbo, false);
+       r = amdgpu_bo_reserve(abo, false);
        if (r)
                return r;
 
-       bo_va = amdgpu_vm_bo_find(vm, rbo);
+       bo_va = amdgpu_vm_bo_find(vm, abo);
        if (!bo_va) {
-               bo_va = amdgpu_vm_bo_add(adev, vm, rbo);
+               bo_va = amdgpu_vm_bo_add(adev, vm, abo);
        } else {
                ++bo_va->ref_count;
        }
-       amdgpu_bo_unreserve(rbo);
+       amdgpu_bo_unreserve(abo);
        return 0;
 }
 
@@ -552,7 +552,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
        struct drm_gem_object *gobj;
        struct amdgpu_device *adev = dev->dev_private;
        struct amdgpu_fpriv *fpriv = filp->driver_priv;
-       struct amdgpu_bo *rbo;
+       struct amdgpu_bo *abo;
        struct amdgpu_bo_va *bo_va;
        struct ttm_validate_buffer tv, tv_pd;
        struct ww_acquire_ctx ticket;
@@ -592,10 +592,10 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
        gobj = drm_gem_object_lookup(filp, args->handle);
        if (gobj == NULL)
                return -ENOENT;
-       rbo = gem_to_amdgpu_bo(gobj);
+       abo = gem_to_amdgpu_bo(gobj);
        INIT_LIST_HEAD(&list);
        INIT_LIST_HEAD(&duplicates);
-       tv.bo = &rbo->tbo;
+       tv.bo = &abo->tbo;
        tv.shared = true;
        list_add(&tv.head, &list);
 
@@ -609,7 +609,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
                return r;
        }
 
-       bo_va = amdgpu_vm_bo_find(&fpriv->vm, rbo);
+       bo_va = amdgpu_vm_bo_find(&fpriv->vm, abo);
        if (!bo_va) {
                ttm_eu_backoff_reservation(&ticket, &list);
                drm_gem_object_unreference_unlocked(gobj);
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +8 -8
index 5cbe803..c57d55d 100644
@@ -211,12 +211,12 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
        placement->busy_placement = places;
 }
 
-void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain)
+void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *abo, u32 domain)
 {
-       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
+       struct amdgpu_device *adev = amdgpu_get_adev(abo->tbo.bdev);
 
-       amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
-                                 domain, rbo->flags);
+       amdgpu_ttm_placement_init(adev, &abo->placement, abo->placements,
+                                 domain, abo->flags);
 }
 
 static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,
@@ -864,14 +864,14 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
                           struct ttm_mem_reg *new_mem)
 {
        struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
-       struct amdgpu_bo *rbo;
+       struct amdgpu_bo *abo;
        struct ttm_mem_reg *old_mem = &bo->mem;
 
        if (!amdgpu_ttm_bo_is_amdgpu_bo(bo))
                return;
 
-       rbo = container_of(bo, struct amdgpu_bo, tbo);
-       amdgpu_vm_bo_invalidate(adev, rbo);
+       abo = container_of(bo, struct amdgpu_bo, tbo);
+       amdgpu_vm_bo_invalidate(adev, abo);
 
        /* update statistics */
        if (!new_mem)
@@ -880,7 +880,7 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
        /* move_notify is called before move happens */
        amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
 
-       trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type, old_mem->mem_type);
+       trace_amdgpu_ttm_bo_move(abo, new_mem->mem_type, old_mem->mem_type);
 }
 
 int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +12 -12
index d246a1f..6d0ed39f 100644
@@ -186,7 +186,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
                                struct ttm_placement *placement)
 {
        struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
-       struct amdgpu_bo *rbo;
+       struct amdgpu_bo *abo;
        static struct ttm_place placements = {
                .fpfn = 0,
                .lpfn = 0,
@@ -201,45 +201,45 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
                placement->num_busy_placement = 1;
                return;
        }
-       rbo = container_of(bo, struct amdgpu_bo, tbo);
+       abo = container_of(bo, struct amdgpu_bo, tbo);
        switch (bo->mem.mem_type) {
        case TTM_PL_VRAM:
                if (adev->mman.buffer_funcs_ring->ready == false) {
-                       amdgpu_ttm_placement_from_domain(rbo,
+                       amdgpu_ttm_placement_from_domain(abo,
                                                         AMDGPU_GEM_DOMAIN_CPU);
                } else {
-                       amdgpu_ttm_placement_from_domain(rbo,
+                       amdgpu_ttm_placement_from_domain(abo,
                                                         AMDGPU_GEM_DOMAIN_GTT);
-                       for (i = 0; i < rbo->placement.num_placement; ++i) {
-                               if (!(rbo->placements[i].flags &
+                       for (i = 0; i < abo->placement.num_placement; ++i) {
+                               if (!(abo->placements[i].flags &
                                      TTM_PL_FLAG_TT))
                                        continue;
 
-                               if (rbo->placements[i].lpfn)
+                               if (abo->placements[i].lpfn)
                                        continue;
 
                                /* set an upper limit to force directly
                                 * allocating address space for the BO.
                                 */
-                               rbo->placements[i].lpfn =
+                               abo->placements[i].lpfn =
                                        adev->mc.gtt_size >> PAGE_SHIFT;
                        }
                }
                break;
        case TTM_PL_TT:
        default:
-               amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
+               amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_CPU);
        }
-       *placement = rbo->placement;
+       *placement = abo->placement;
 }
 
 static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)
 {
-       struct amdgpu_bo *rbo = container_of(bo, struct amdgpu_bo, tbo);
+       struct amdgpu_bo *abo = container_of(bo, struct amdgpu_bo, tbo);
 
        if (amdgpu_ttm_tt_get_usermm(bo->ttm))
                return -EPERM;
-       return drm_vma_node_verify_access(&rbo->gem_base.vma_node, filp);
+       return drm_vma_node_verify_access(&abo->gem_base.vma_node, filp);
 }
 
 static void amdgpu_move_null(struct ttm_buffer_object *bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +4 -4
index 87bcac3..d67eada 100644
@@ -351,12 +351,12 @@ void amdgpu_uvd_free_handles(struct amdgpu_device *adev, struct drm_file *filp)
        }
 }
 
-static void amdgpu_uvd_force_into_uvd_segment(struct amdgpu_bo *rbo)
+static void amdgpu_uvd_force_into_uvd_segment(struct amdgpu_bo *abo)
 {
        int i;
-       for (i = 0; i < rbo->placement.num_placement; ++i) {
-               rbo->placements[i].fpfn = 0 >> PAGE_SHIFT;
-               rbo->placements[i].lpfn = (256 * 1024 * 1024) >> PAGE_SHIFT;
+       for (i = 0; i < abo->placement.num_placement; ++i) {
+               abo->placements[i].fpfn = 0 >> PAGE_SHIFT;
+               abo->placements[i].lpfn = (256 * 1024 * 1024) >> PAGE_SHIFT;
        }
 }
 
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +18 -18
index 2af166e..5af418f 100644
@@ -2102,7 +2102,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
        struct amdgpu_framebuffer *amdgpu_fb;
        struct drm_framebuffer *target_fb;
        struct drm_gem_object *obj;
-       struct amdgpu_bo *rbo;
+       struct amdgpu_bo *abo;
        uint64_t fb_location, tiling_flags;
        uint32_t fb_format, fb_pitch_pixels;
        u32 fb_swap = REG_SET_FIELD(0, GRPH_SWAP_CNTL, GRPH_ENDIAN_SWAP, ENDIAN_NONE);
@@ -2129,23 +2129,23 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
         * just update base pointers
         */
        obj = amdgpu_fb->obj;
-       rbo = gem_to_amdgpu_bo(obj);
-       r = amdgpu_bo_reserve(rbo, false);
+       abo = gem_to_amdgpu_bo(obj);
+       r = amdgpu_bo_reserve(abo, false);
        if (unlikely(r != 0))
                return r;
 
        if (atomic) {
-               fb_location = amdgpu_bo_gpu_offset(rbo);
+               fb_location = amdgpu_bo_gpu_offset(abo);
        } else {
-               r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+               r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
                if (unlikely(r != 0)) {
-                       amdgpu_bo_unreserve(rbo);
+                       amdgpu_bo_unreserve(abo);
                        return -EINVAL;
                }
        }
 
-       amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-       amdgpu_bo_unreserve(rbo);
+       amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+       amdgpu_bo_unreserve(abo);
 
        pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
 
@@ -2319,12 +2319,12 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
 
        if (!atomic && fb && fb != crtc->primary->fb) {
                amdgpu_fb = to_amdgpu_framebuffer(fb);
-               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-               r = amdgpu_bo_reserve(rbo, false);
+               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+               r = amdgpu_bo_reserve(abo, false);
                if (unlikely(r != 0))
                        return r;
-               amdgpu_bo_unpin(rbo);
-               amdgpu_bo_unreserve(rbo);
+               amdgpu_bo_unpin(abo);
+               amdgpu_bo_unreserve(abo);
        }
 
        /* Bytes per pixel may have changed */
@@ -2802,16 +2802,16 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc)
        if (crtc->primary->fb) {
                int r;
                struct amdgpu_framebuffer *amdgpu_fb;
-               struct amdgpu_bo *rbo;
+               struct amdgpu_bo *abo;
 
                amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-               r = amdgpu_bo_reserve(rbo, false);
+               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+               r = amdgpu_bo_reserve(abo, false);
                if (unlikely(r))
-                       DRM_ERROR("failed to reserve rbo before unpin\n");
+                       DRM_ERROR("failed to reserve abo before unpin\n");
                else {
-                       amdgpu_bo_unpin(rbo);
-                       amdgpu_bo_unreserve(rbo);
+                       amdgpu_bo_unpin(abo);
+                       amdgpu_bo_unreserve(abo);
                }
        }
        /* disable the GRPH */
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +18 -18
index 6747f8f..256de46 100644
@@ -2085,7 +2085,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
        struct amdgpu_framebuffer *amdgpu_fb;
        struct drm_framebuffer *target_fb;
        struct drm_gem_object *obj;
-       struct amdgpu_bo *rbo;
+       struct amdgpu_bo *abo;
        uint64_t fb_location, tiling_flags;
        uint32_t fb_format, fb_pitch_pixels;
        u32 fb_swap = REG_SET_FIELD(0, GRPH_SWAP_CNTL, GRPH_ENDIAN_SWAP, ENDIAN_NONE);
@@ -2112,23 +2112,23 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
         * just update base pointers
         */
        obj = amdgpu_fb->obj;
-       rbo = gem_to_amdgpu_bo(obj);
-       r = amdgpu_bo_reserve(rbo, false);
+       abo = gem_to_amdgpu_bo(obj);
+       r = amdgpu_bo_reserve(abo, false);
        if (unlikely(r != 0))
                return r;
 
        if (atomic) {
-               fb_location = amdgpu_bo_gpu_offset(rbo);
+               fb_location = amdgpu_bo_gpu_offset(abo);
        } else {
-               r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+               r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
                if (unlikely(r != 0)) {
-                       amdgpu_bo_unreserve(rbo);
+                       amdgpu_bo_unreserve(abo);
                        return -EINVAL;
                }
        }
 
-       amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-       amdgpu_bo_unreserve(rbo);
+       amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+       amdgpu_bo_unreserve(abo);
 
        pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
 
@@ -2302,12 +2302,12 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
 
        if (!atomic && fb && fb != crtc->primary->fb) {
                amdgpu_fb = to_amdgpu_framebuffer(fb);
-               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-               r = amdgpu_bo_reserve(rbo, false);
+               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+               r = amdgpu_bo_reserve(abo, false);
                if (unlikely(r != 0))
                        return r;
-               amdgpu_bo_unpin(rbo);
-               amdgpu_bo_unreserve(rbo);
+               amdgpu_bo_unpin(abo);
+               amdgpu_bo_unreserve(abo);
        }
 
        /* Bytes per pixel may have changed */
@@ -2820,16 +2820,16 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc)
        if (crtc->primary->fb) {
                int r;
                struct amdgpu_framebuffer *amdgpu_fb;
-               struct amdgpu_bo *rbo;
+               struct amdgpu_bo *abo;
 
                amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-               r = amdgpu_bo_reserve(rbo, false);
+               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+               r = amdgpu_bo_reserve(abo, false);
                if (unlikely(r))
-                       DRM_ERROR("failed to reserve rbo before unpin\n");
+                       DRM_ERROR("failed to reserve abo before unpin\n");
                else {
-                       amdgpu_bo_unpin(rbo);
-                       amdgpu_bo_unreserve(rbo);
+                       amdgpu_bo_unpin(abo);
+                       amdgpu_bo_unreserve(abo);
                }
        }
        /* disable the GRPH */
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +18 -18
index 0a807d2..0a1db00 100644
@@ -1493,7 +1493,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
        struct amdgpu_framebuffer *amdgpu_fb;
        struct drm_framebuffer *target_fb;
        struct drm_gem_object *obj;
-       struct amdgpu_bo *rbo;
+       struct amdgpu_bo *abo;
        uint64_t fb_location, tiling_flags;
        uint32_t fb_format, fb_pitch_pixels, pipe_config;
        u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE);
@@ -1520,23 +1520,23 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
         * just update base pointers
         */
        obj = amdgpu_fb->obj;
-       rbo = gem_to_amdgpu_bo(obj);
-       r = amdgpu_bo_reserve(rbo, false);
+       abo = gem_to_amdgpu_bo(obj);
+       r = amdgpu_bo_reserve(abo, false);
        if (unlikely(r != 0))
                return r;
 
        if (atomic)
-               fb_location = amdgpu_bo_gpu_offset(rbo);
+               fb_location = amdgpu_bo_gpu_offset(abo);
        else {
-               r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+               r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
                if (unlikely(r != 0)) {
-                       amdgpu_bo_unreserve(rbo);
+                       amdgpu_bo_unreserve(abo);
                        return -EINVAL;
                }
        }
 
-       amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-       amdgpu_bo_unreserve(rbo);
+       amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+       amdgpu_bo_unreserve(abo);
 
        switch (target_fb->pixel_format) {
        case DRM_FORMAT_C8:
@@ -1688,12 +1688,12 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
 
        if (!atomic && fb && fb != crtc->primary->fb) {
                amdgpu_fb = to_amdgpu_framebuffer(fb);
-               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-               r = amdgpu_bo_reserve(rbo, false);
+               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+               r = amdgpu_bo_reserve(abo, false);
                if (unlikely(r != 0))
                        return r;
-               amdgpu_bo_unpin(rbo);
-               amdgpu_bo_unreserve(rbo);
+               amdgpu_bo_unpin(abo);
+               amdgpu_bo_unreserve(abo);
        }
 
        /* Bytes per pixel may have changed */
@@ -2139,16 +2139,16 @@ static void dce_v6_0_crtc_disable(struct drm_crtc *crtc)
        if (crtc->primary->fb) {
                int r;
                struct amdgpu_framebuffer *amdgpu_fb;
-               struct amdgpu_bo *rbo;
+               struct amdgpu_bo *abo;
 
                amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-               r = amdgpu_bo_reserve(rbo, false);
+               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+               r = amdgpu_bo_reserve(abo, false);
                if (unlikely(r))
-                       DRM_ERROR("failed to reserve rbo before unpin\n");
+                       DRM_ERROR("failed to reserve abo before unpin\n");
                else {
-                       amdgpu_bo_unpin(rbo);
-                       amdgpu_bo_unreserve(rbo);
+                       amdgpu_bo_unpin(abo);
+                       amdgpu_bo_unreserve(abo);
                }
        }
        /* disable the GRPH */
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +18 -18
index 06d836f..4d313aa 100644
@@ -1990,7 +1990,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
        struct amdgpu_framebuffer *amdgpu_fb;
        struct drm_framebuffer *target_fb;
        struct drm_gem_object *obj;
-       struct amdgpu_bo *rbo;
+       struct amdgpu_bo *abo;
        uint64_t fb_location, tiling_flags;
        uint32_t fb_format, fb_pitch_pixels;
        u32 fb_swap = (GRPH_ENDIAN_NONE << GRPH_SWAP_CNTL__GRPH_ENDIAN_SWAP__SHIFT);
@@ -2017,23 +2017,23 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
         * just update base pointers
         */
        obj = amdgpu_fb->obj;
-       rbo = gem_to_amdgpu_bo(obj);
-       r = amdgpu_bo_reserve(rbo, false);
+       abo = gem_to_amdgpu_bo(obj);
+       r = amdgpu_bo_reserve(abo, false);
        if (unlikely(r != 0))
                return r;
 
        if (atomic) {
-               fb_location = amdgpu_bo_gpu_offset(rbo);
+               fb_location = amdgpu_bo_gpu_offset(abo);
        } else {
-               r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+               r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
                if (unlikely(r != 0)) {
-                       amdgpu_bo_unreserve(rbo);
+                       amdgpu_bo_unreserve(abo);
                        return -EINVAL;
                }
        }
 
-       amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-       amdgpu_bo_unreserve(rbo);
+       amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+       amdgpu_bo_unreserve(abo);
 
        pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
 
@@ -2188,12 +2188,12 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
 
        if (!atomic && fb && fb != crtc->primary->fb) {
                amdgpu_fb = to_amdgpu_framebuffer(fb);
-               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-               r = amdgpu_bo_reserve(rbo, false);
+               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+               r = amdgpu_bo_reserve(abo, false);
                if (unlikely(r != 0))
                        return r;
-               amdgpu_bo_unpin(rbo);
-               amdgpu_bo_unreserve(rbo);
+               amdgpu_bo_unpin(abo);
+               amdgpu_bo_unreserve(abo);
        }
 
        /* Bytes per pixel may have changed */
@@ -2663,16 +2663,16 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc)
        if (crtc->primary->fb) {
                int r;
                struct amdgpu_framebuffer *amdgpu_fb;
-               struct amdgpu_bo *rbo;
+               struct amdgpu_bo *abo;
 
                amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-               r = amdgpu_bo_reserve(rbo, false);
+               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+               r = amdgpu_bo_reserve(abo, false);
                if (unlikely(r))
-                       DRM_ERROR("failed to reserve rbo before unpin\n");
+                       DRM_ERROR("failed to reserve abo before unpin\n");
                else {
-                       amdgpu_bo_unpin(rbo);
-                       amdgpu_bo_unreserve(rbo);
+                       amdgpu_bo_unpin(abo);
+                       amdgpu_bo_unreserve(abo);
                }
        }
        /* disable the GRPH */
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +6 -7
index 85f14a6..c93e18e 100644
@@ -227,16 +227,16 @@ static void dce_virtual_crtc_disable(struct drm_crtc *crtc)
        if (crtc->primary->fb) {
                int r;
                struct amdgpu_framebuffer *amdgpu_fb;
-               struct amdgpu_bo *rbo;
+               struct amdgpu_bo *abo;
 
                amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-               r = amdgpu_bo_reserve(rbo, false);
+               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+               r = amdgpu_bo_reserve(abo, false);
                if (unlikely(r))
-                       DRM_ERROR("failed to reserve rbo before unpin\n");
+                       DRM_ERROR("failed to reserve abo before unpin\n");
                else {
-                       amdgpu_bo_unpin(rbo);
-                       amdgpu_bo_unreserve(rbo);
+                       amdgpu_bo_unpin(abo);
+                       amdgpu_bo_unreserve(abo);
                }
        }
 
--

2.5.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#21 lore raw
In reply to a message not in the archive
Quoted 5 lines · Christian König

From: Christian König <[email protected]>

Not used in a while.

Quoted 33 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 -
 2 files changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
index ee55763..3b3981d 100644
@@ -446,8 +446,6 @@ struct amdgpu_bo_va {
 #define AMDGPU_GEM_DOMAIN_MAX          0x3
 
 struct amdgpu_bo {
-       /* Protected by gem.mutex */
-       struct list_head                list;
        /* Protected by tbo.reserved */
        u32                             prefered_domains;
        u32                             allowed_domains;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -2
index d6e6c93..4289c31 100644
@@ -360,7 +360,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
                return r;
        }
        bo->adev = adev;
-       INIT_LIST_HEAD(&bo->list);
        INIT_LIST_HEAD(&bo->shadow_list);
        INIT_LIST_HEAD(&bo->va);
        bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
--

2.5.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx