drm/amdgpu: consistenly name amdgpu_bo_ functions
Subsystems (3)
PATCH 1/2 drm/amdgpu: consistenly name amdgpu_bo_ functions
Just rename functions, no functional change.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 -- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 10 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 34 ++++++++++++------------ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 10 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +-- 10 files changed, 39 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
@@ -1804,8 +1804,6 @@ void amdgpu_display_update_priority(struct amdgpu_device *adev);void amdgpu_cs_report_moved_bytes (struct amdgpu_device *adev,u64 num_bytes,u64 num_vis_bytes); -void amdgpu_ttm_placement_from_domain (struct amdgpu_bo *abo,u32 domain); -bool amdgpu_ttm_bo_is_amdgpu_bo (struct ttm_buffer_object *bo);void amdgpu_device_vram_location (struct amdgpu_device *adev,struct amdgpu_gmc *mc,u64 base); void amdgpu_device_gart_location(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +4 -4
@@ -334,7 +334,7 @@ static int amdgpu_amdkfd_bo_validate(struct amdgpu_bo *bo, uint32_t domain, "Called with userptr BO"))return -EINVAL ; -amdgpu_ttm_placement_from_domain (bo, domain); +amdgpu_bo_placement_from_domain (bo, domain); ret =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx);if (ret)
@@ -622,7 +622,7 @@ static int init_user_pages(struct kgd_mem *mem, struct mm_struct *mm,pr_err ("%s: Failed to reserve BO\n" , __func__); goto release_out; } -amdgpu_ttm_placement_from_domain (bo, mem->domain); +amdgpu_bo_placement_from_domain (bo, mem->domain); ret =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx);if (ret)pr_err ("%s: failed to validate BO\n" , __func__);
@@ -1680,7 +1680,7 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,if (amdgpu_bo_reserve (bo, true))return -EAGAIN ; -amdgpu_ttm_placement_from_domain (bo,AMDGPU_GEM_DOMAIN_CPU ); +amdgpu_bo_placement_from_domain (bo,AMDGPU_GEM_DOMAIN_CPU ); ret =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx);amdgpu_bo_unreserve (bo);if (ret) {
@@ -1824,7 +1824,7 @@ static int validate_invalid_user_pages(struct amdkfd_process_info *process_info)if (mem->user_pages[0 ]) {amdgpu_ttm_tt_set_user_pages (bo->tbo.ttm, mem->user_pages); -amdgpu_ttm_placement_from_domain (bo, mem->domain); +amdgpu_bo_placement_from_domain (bo, mem->domain); ret =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx);if (ret) {pr_err ("%s: failed to validate BO\n" , __func__);
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +5 -5
@@ -419,7 +419,7 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p, } retry: -amdgpu_ttm_placement_from_domain (bo, domain); +amdgpu_bo_placement_from_domain (bo, domain); r =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx); p->bytes_moved += ctx.bytes_moved;
@@ -478,7 +478,7 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p, update_bytes_moved_vis = !amdgpu_gmc_vram_full_visible (&adev->gmc) &&amdgpu_bo_in_cpu_visible_vram (bo); -amdgpu_ttm_placement_from_domain (bo, other); +amdgpu_bo_placement_from_domain (bo, other); r =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx); p->bytes_moved += ctx.bytes_moved;if (update_bytes_moved_vis)
@@ -532,8 +532,8 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,/* Check if we have user pages and nobody bound the BO already */ if (amdgpu_ttm_tt_userptr_needs_pages (bo->tbo.ttm) && lobj->user_pages) { -amdgpu_ttm_placement_from_domain (bo, -AMDGPU_GEM_DOMAIN_CPU ); +amdgpu_bo_placement_from_domain (bo, +AMDGPU_GEM_DOMAIN_CPU ); r =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx);if (r)return r;
@@ -1653,7 +1653,7 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,if (!((*bo)->flags &AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS )) { (*bo)->flags |=AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS ; -amdgpu_ttm_placement_from_domain (*bo, (*bo)->allowed_domains); +amdgpu_bo_placement_from_domain (*bo, (*bo)->allowed_domains); r =ttm_bo_validate (&(*bo)->tbo, &(*bo)->placement, &ctx);if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
@@ -344,7 +344,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,if (r) goto free_pages; -amdgpu_ttm_placement_from_domain (bo,AMDGPU_GEM_DOMAIN_GTT ); +amdgpu_bo_placement_from_domain (bo,AMDGPU_GEM_DOMAIN_GTT ); r =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx);amdgpu_bo_unreserve (bo);if (r)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +17 -17
@@ -51,7 +51,7 @@* */ -static bool amdgpu_need_backup (struct amdgpu_device *adev) +static bool amdgpu_bo_need_backup (struct amdgpu_device *adev) {if (adev->flags &AMD_IS_APU )return false;
@@ -84,7 +84,7 @@ static void amdgpu_bo_subtract_pin_size(struct amdgpu_bo *bo) } } -static void amdgpu_ttm_bo_destroy (struct ttm_buffer_object *tbo) +static void amdgpu_bo_destroy (struct ttm_buffer_object *tbo) {struct amdgpu_device *adev =amdgpu_ttm_adev (tbo->bdev);struct amdgpu_bo *bo =ttm_to_amdgpu_bo (tbo);
@@ -111,7 +111,7 @@ static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo) }/** -* amdgpu_ttm_bo_is_amdgpu_bo - check if the buffer object is an &amdgpu_bo +* amdgpu_bo_is_amdgpu_bo - check if the buffer object is an &amdgpu_bo * @bo: buffer object to be checked * * Uses destroy function associated with the object to determine if this is
@@ -120,22 +120,22 @@ static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)* Returns: * true if the object belongs to &amdgpu_bo, false if not. */ -bool amdgpu_ttm_bo_is_amdgpu_bo (struct ttm_buffer_object *bo) +bool amdgpu_bo_is_amdgpu_bo (struct ttm_buffer_object *bo) { -if (bo->destroy == &amdgpu_ttm_bo_destroy) +if (bo->destroy == &amdgpu_bo_destroy)return true;return false; }/** -* amdgpu_ttm_placement_from_domain - set buffer's placement +* amdgpu_bo_placement_from_domain - set buffer's placement * @abo: &amdgpu_bo buffer object whose placement is to be set * @domain: requested domain * * Sets buffer's placement according to requested domain and the buffer's * flags. */ -void amdgpu_ttm_placement_from_domain (struct amdgpu_bo *abo,u32 domain) +void amdgpu_bo_placement_from_domain (struct amdgpu_bo *abo,u32 domain) {struct amdgpu_device *adev =amdgpu_ttm_adev (abo->tbo.bdev);struct ttm_placement *placement = &abo->placement;
@@ -488,13 +488,13 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,#endif bo->tbo.bdev = &adev->mman.bdev; -amdgpu_ttm_placement_from_domain (bo, bp->domain); +amdgpu_bo_placement_from_domain (bo, bp->domain);if (bp->type == ttm_bo_type_kernel) bo->tbo.priority =1 ; r =ttm_bo_init_reserved (&adev->mman.bdev, &bo->tbo, size, bp->type, &bo->placement, page_align, &ctx, acc_size, -NULL , bp->resv, &amdgpu_ttm_bo_destroy); +NULL , bp->resv, &amdgpu_bo_destroy);if (unlikely (r !=0 ))return r;
@@ -594,7 +594,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev,if (r)return r; -if ((flags &AMDGPU_GEM_CREATE_SHADOW ) &&amdgpu_need_backup (adev)) { +if ((flags &AMDGPU_GEM_CREATE_SHADOW ) &&amdgpu_bo_need_backup (adev)) {if (!bp->resv)WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv,NULL ));
@@ -682,7 +682,7 @@ int amdgpu_bo_validate(struct amdgpu_bo *bo) domain = bo->preferred_domains; retry: -amdgpu_ttm_placement_from_domain (bo, domain); +amdgpu_bo_placement_from_domain (bo, domain); r =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx);if (unlikely (r == -ENOMEM ) && domain != bo->allowed_domains) { domain = bo->allowed_domains;
@@ -915,7 +915,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,/* force to pin into visible video ram */ if (!(bo->flags &AMDGPU_GEM_CREATE_NO_CPU_ACCESS )) bo->flags |=AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED ; -amdgpu_ttm_placement_from_domain (bo, domain); +amdgpu_bo_placement_from_domain (bo, domain);for (i =0 ; i < bo->placement.num_placement; i++) {unsigned fpfn, lpfn;
@@ -1246,7 +1246,7 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,struct amdgpu_bo *abo;struct ttm_mem_reg *old_mem = &bo->mem; -if (!amdgpu_ttm_bo_is_amdgpu_bo (bo)) +if (!amdgpu_bo_is_amdgpu_bo (bo))return ; abo =ttm_to_amdgpu_bo (bo);
@@ -1263,7 +1263,7 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,return ;/* move_notify is called before move happens */ -trace_amdgpu_ttm_bo_move (abo, new_mem->mem_type, old_mem->mem_type); +trace_amdgpu_bo_move (abo, new_mem->mem_type, old_mem->mem_type); }/**
@@ -1285,7 +1285,7 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)unsigned long offset, size;int r; -if (!amdgpu_ttm_bo_is_amdgpu_bo (bo)) +if (!amdgpu_bo_is_amdgpu_bo (bo))return 0 ; abo =ttm_to_amdgpu_bo (bo);
@@ -1307,8 +1307,8 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)/* hurrah the memory is not visible ! */ atomic64_inc (&adev->num_vram_cpu_page_faults); -amdgpu_ttm_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_VRAM | -AMDGPU_GEM_DOMAIN_GTT ); +amdgpu_bo_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_VRAM | +AMDGPU_GEM_DOMAIN_GTT );/* Avoid costly evictions; only set GTT as a busy placement */ abo->placement.num_busy_placement =1 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +3 -0
@@ -234,6 +234,9 @@ static inline bool amdgpu_bo_explicit_sync(struct amdgpu_bo *bo)return bo->flags &AMDGPU_GEM_CREATE_EXPLICIT_SYNC ; } +bool amdgpu_bo_is_amdgpu_bo (struct ttm_buffer_object *bo); +void amdgpu_bo_placement_from_domain (struct amdgpu_bo *abo,u32 domain); +int amdgpu_bo_create (struct amdgpu_device *adev,struct amdgpu_bo_param *bp,struct amdgpu_bo **bo_ptr);
drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +1 -1
@@ -323,7 +323,7 @@ static int amdgpu_gem_begin_cpu_access(struct dma_buf *dma_buf,return ret;if (!bo->pin_count && (bo->allowed_domains &AMDGPU_GEM_DOMAIN_GTT )) { -amdgpu_ttm_placement_from_domain (bo,AMDGPU_GEM_DOMAIN_GTT ); +amdgpu_bo_placement_from_domain (bo,AMDGPU_GEM_DOMAIN_GTT ); ret =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx); }
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +1 -1
@@ -436,7 +436,7 @@ TRACE_EVENT(amdgpu_cs_bo_status, __entry->total_bo, __entry->total_size) ); -TRACE_EVENT(amdgpu_ttm_bo_move, +TRACE_EVENT(amdgpu_bo_move, TP_PROTO(struct amdgpu_bo* bo, uint32_t new_placement, uint32_t old_placement), TP_ARGS(bo, new_placement, old_placement), TP_STRUCT__entry(
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +5 -5
@@ -248,7 +248,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, }/* Object isn't an AMDGPU object so ignore */ -if (!amdgpu_ttm_bo_is_amdgpu_bo (bo)) { +if (!amdgpu_bo_is_amdgpu_bo (bo)) { placement->placement = &placements; placement->busy_placement = &placements; placement->num_placement =1 ;
@@ -261,7 +261,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,case TTM_PL_VRAM :if (!adev->mman.buffer_funcs_enabled) {/* Move to system memory */ -amdgpu_ttm_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_CPU ); +amdgpu_bo_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_CPU ); }else if (!amdgpu_gmc_vram_full_visible (&adev->gmc) && !(abo->flags &AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED ) &&amdgpu_bo_in_cpu_visible_vram (abo)) {
@@ -271,7 +271,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,* BO will be evicted to GTT rather than causing other * BOs to be evicted from VRAM */ -amdgpu_ttm_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_VRAM | +amdgpu_bo_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT ); abo->placements[0 ].fpfn = adev->gmc.visible_vram_size >>PAGE_SHIFT ; abo->placements[0 ].lpfn =0 ;
@@ -279,12 +279,12 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, abo->placement.num_busy_placement =1 ; }else {/* Move to GTT memory */ -amdgpu_ttm_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_GTT ); +amdgpu_bo_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_GTT ); }break ;case TTM_PL_TT :default : -amdgpu_ttm_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_CPU ); +amdgpu_bo_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_CPU ); } *placement = abo->placement; }
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -2
@@ -476,7 +476,7 @@ static int amdgpu_uvd_cs_pass1(struct amdgpu_uvd_cs_ctx *ctx)if (cmd ==0x0 || cmd ==0x3 ) {/* yes, force it into VRAM */ uint32_t domain =AMDGPU_GEM_DOMAIN_VRAM ; -amdgpu_ttm_placement_from_domain (bo, domain); +amdgpu_bo_placement_from_domain (bo, domain); }amdgpu_uvd_force_into_uvd_segment (bo);
@@ -1017,7 +1017,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,if (!ring->adev->uvd.address_64_bit) {struct ttm_operation_ctx ctx = { true, false }; -amdgpu_ttm_placement_from_domain (bo,AMDGPU_GEM_DOMAIN_VRAM ); +amdgpu_bo_placement_from_domain (bo,AMDGPU_GEM_DOMAIN_VRAM );amdgpu_uvd_force_into_uvd_segment (bo); r =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx);if (r)
Signature · 6 lines
2.14.1 _______________________________________________ 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): 20180718091815.2192-1-christian.koenig-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu: reduce the number of placements for a BO
Make struct amdgpu_bo a bit smaller.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -0
@@ -216,6 +216,8 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) c++; } +BUG_ON (c >=AMDGPU_BO_MAX_PLACEMENTS ); + placement->num_placement = c; placement->placement = places;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2 -1
@@ -32,6 +32,7 @@#include "amdgpu.h" #define AMDGPU_BO_INVALID_OFFSET LONG_MAX +#define AMDGPU_BO_MAX_PLACEMENTS 3struct amdgpu_bo_param {unsigned long size;
@@ -77,7 +78,7 @@ struct amdgpu_bo {/* Protected by tbo.reserved */ u32 preferred_domains;u32 allowed_domains; -struct ttm_place placements[AMDGPU_GEM_DOMAIN_MAX +1 ]; +struct ttm_place placements[AMDGPU_BO_MAX_PLACEMENTS ];struct ttm_placement placement;struct ttm_buffer_object tbo;struct ttm_bo_kmap_obj kmap;
Signature · 6 lines
2.14.1 _______________________________________________ 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): 20180718091815.2192-2-christian.koenig-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH 2/2] drm/amdgpu: reduce the number of placements for a BO
Quoted 3 lines · Christian König
Make struct
amdgpu_boa bit smaller.Signed-off-by Christian König <[email protected]>
Series is:
Quoted 42 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-0@@ -216,6 +216,8 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) c++; } +BUG_ON (c >=AMDGPU_BO_MAX_PLACEMENTS ); + placement->num_placement = c; placement->placement = places;drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2
-2@@ -32,6 +32,7 @@#include "amdgpu.h" #define AMDGPU_BO_INVALID_OFFSET LONG_MAX +#define AMDGPU_BO_MAX_PLACEMENTS 3struct amdgpu_bo_param {unsigned long size;@@ -77,7 +78,7 @@ struct amdgpu_bo {/* Protected by tbo.reserved */ u32 preferred_domains;u32 allowed_domains; -struct ttm_place placements[AMDGPU_GEM_DOMAIN_MAX +1 ]; +struct ttm_place placements[AMDGPU_BO_MAX_PLACEMENTS ];struct ttm_placement placement;struct ttm_buffer_object tbo;struct ttm_bo_kmap_obj kmap; --2.14.1
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