amdgpu: move ttm domain definitions to amdgpu.h
Subsystems (2)
PATCH 1/3 amdgpu: move ttm domain definitions to amdgpu.h
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8 -0
@@ -401,6 +401,14 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring);* TTM. */ +#define AMDGPU_PL_GDS TTM_PL_PRIV0 +#define AMDGPU_PL_GWS TTM_PL_PRIV1 +#define AMDGPU_PL_OA TTM_PL_PRIV2 + +#define AMDGPU_PL_FLAG_GDS TTM_PL_FLAG_PRIV0 +#define AMDGPU_PL_FLAG_GWS TTM_PL_FLAG_PRIV1 +#define AMDGPU_PL_FLAG_OA TTM_PL_FLAG_PRIV2 +#define AMDGPU_TTM_LRU_SIZE 20struct amdgpu_mman_lru {
drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h +0 -8
@@ -31,14 +31,6 @@#define AMDGPU_GWS_SHIFT PAGE_SHIFT#define AMDGPU_OA_SHIFT PAGE_SHIFT -#define AMDGPU_PL_GDS TTM_PL_PRIV0 -#define AMDGPU_PL_GWS TTM_PL_PRIV1 -#define AMDGPU_PL_OA TTM_PL_PRIV2 - -#define AMDGPU_PL_FLAG_GDS TTM_PL_FLAG_PRIV0 -#define AMDGPU_PL_FLAG_GWS TTM_PL_FLAG_PRIV1 -#define AMDGPU_PL_FLAG_OA TTM_PL_FLAG_PRIV2 -struct amdgpu_ring ;struct amdgpu_bo ;
Signature · 6 lines
2.7.4 _______________________________________________ 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): 1471489102-31630-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org
PATCH 2/3 drm/amdgpu: allow pagelist to be NULL for amdgpu_gart_bind
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +1 -1
@@ -287,7 +287,7 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,for (i =0 ; i < pages; i++, p++) {#ifdef CONFIG_AMDGPU_GART_DEBUGFS - adev->gart.pages[p] = pagelist[i]; + adev->gart.pages[p] = pagelist ? pagelist[i] :NULL ;#endif if (adev->gart.ptr) { page_base = dma_addr[i];
Signature · 6 lines
2.7.4 _______________________________________________ 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): 1471489102-31630-2-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/3] drm/amdgpu: allow pagelist to be NULL for amdgpu_gart_bind
This function is never called without a pagelist at the moment.
So there is no justification for this change.
Christian.
Am 18.08.2016 um 04:58 schrieb Flora Cui:
Quoted 10 lines
Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset, · line 293
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +1
-1@@ -287,7 +287,7 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,for (i =0 ; i < pages; i++, p++) {#ifdef CONFIG_AMDGPU_GART_DEBUGFS - adev->gart.pages[p] = pagelist[i]; + adev->gart.pages[p] = pagelist ? pagelist[i] :NULL ;#endif if (adev->gart.ptr) { page_base = dma_addr[i];
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu: minor refine amdgpu ttm codes
In reply to a message not in the archive1. add check for domain in amdgpu_bo_pin_restricted()
2. get domain gpu_offset for common use
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 13 +++++++------ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++------ 2 files changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +7 -6
@@ -520,16 +520,17 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,return -EINVAL ;if (bo->pin_count) { +uint32_t mem_type = bo->tbo.mem.mem_type; + +if (domain !=amdgpu_mem_type_to_domain (mem_type)) +return -EINVAL ; + bo->pin_count++;if (gpu_addr) *gpu_addr =amdgpu_bo_gpu_offset (bo);if (max_offset !=0 ) { -u64 domain_start; -if (domain ==AMDGPU_GEM_DOMAIN_VRAM ) - domain_start = bo->adev->mc.vram_start; -else - domain_start = bo->adev->mc.gtt_start; +u64 domain_start = bo->tbo.bdev->man[mem_type].gpu_offset;WARN_ON_ONCE (max_offset < (amdgpu_bo_gpu_offset (bo) - domain_start)); }
@@ -573,7 +574,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, 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); - }else { + }else if (domain ==AMDGPU_GEM_DOMAIN_GTT ) { bo->adev->gart_pin_size +=amdgpu_bo_size (bo); }
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -6
@@ -257,10 +257,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,switch (old_mem->mem_type) {case TTM_PL_VRAM : - old_start += adev->mc.vram_start; -break ;case TTM_PL_TT : - old_start += adev->mc.gtt_start; + old_start += bo->bdev->man[old_mem->mem_type].gpu_offset;break ;default :DRM_ERROR ("Unknown placement %d\n" , old_mem->mem_type);
@@ -268,10 +266,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo, }switch (new_mem->mem_type) {case TTM_PL_VRAM : - new_start += adev->mc.vram_start; -break ;case TTM_PL_TT : - new_start += adev->mc.gtt_start; + new_start += bo->bdev->man[new_mem->mem_type].gpu_offset;break ;default :DRM_ERROR ("Unknown placement %d\n" , old_mem->mem_type);
Signature · 6 lines
2.7.4 _______________________________________________ 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): 1471489102-31630-3-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org
Michel Dänzer
Reviewed-byRe: [PATCH 3/3] drm/amdgpu: minor refine amdgpu ttm codes
Quoted 2 lines · Flora Cui
1. add check for domain in
amdgpu_bo_pin_restricted()
2. get domaingpu_offsetfor common use
Please split this up into multiple patches, one for each logical change.
Patch 1 is
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
Christian König
NAKNAK, we explicitly moved them to amdgpu_gds.h.
In general when some code needs those defines it should include the appropriate header.
But it would make sense to move them into a (to be created) amdgpu_ttm.h, cause those defines are more TTM related than GDS related.
Regards,
Christiuan.
Am 18.08.2016 um 04:58 schrieb Flora Cui:
Quoted 34 lines
Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +8
-0@@ -401,6 +401,14 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring);* TTM. */ +#define AMDGPU_PL_GDS TTM_PL_PRIV0 +#define AMDGPU_PL_GWS TTM_PL_PRIV1 +#define AMDGPU_PL_OA TTM_PL_PRIV2 + +#define AMDGPU_PL_FLAG_GDS TTM_PL_FLAG_PRIV0 +#define AMDGPU_PL_FLAG_GWS TTM_PL_FLAG_PRIV1 +#define AMDGPU_PL_FLAG_OA TTM_PL_FLAG_PRIV2 +#define AMDGPU_TTM_LRU_SIZE 20struct amdgpu_mman_lru {drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h +0
-1@@ -31,14 +31,6 @@#define AMDGPU_GWS_SHIFT PAGE_SHIFT#define AMDGPU_OA_SHIFT PAGE_SHIFT -#define AMDGPU_PL_GDS TTM_PL_PRIV0
drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h line 36
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h +0
-7-#define AMDGPU_PL_GWS TTM_PL_PRIV1 -#define AMDGPU_PL_OA TTM_PL_PRIV2 - -#define AMDGPU_PL_FLAG_GDS TTM_PL_FLAG_PRIV0 -#define AMDGPU_PL_FLAG_GWS TTM_PL_FLAG_PRIV1 -#define AMDGPU_PL_FLAG_OA TTM_PL_FLAG_PRIV2 -struct amdgpu_ring ;struct amdgpu_bo ;
_______________________________________________
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): f1c6e13e-f5a6-4579-35f5-c250b285d816-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Quoted 7 lines · Christian König
NAK, we explicitly moved them to
amdgpu_gds.h.In general when some code needs those defines it should include the appropriate header.
But it would make sense to move them into a (to be created)
amdgpu_ttm.h, cause those defines are more TTM related than GDS related.
OK. I'll update patch to move them into amdgpu_ttm.h. AMDGPU_PL_... definitions in amdgpu_gds.h is really unfriendly to newly added ones.
Quoted 37 lines
Regards,
Christiuan.Am 18.08.2016 um 04:58 schrieb Flora Cui:
Quoted 32 lines
Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +8
-0@@ -401,6 +401,14 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring);* TTM. */ +#define AMDGPU_PL_GDS TTM_PL_PRIV0 +#define AMDGPU_PL_GWS TTM_PL_PRIV1 +#define AMDGPU_PL_OA TTM_PL_PRIV2 + +#define AMDGPU_PL_FLAG_GDS TTM_PL_FLAG_PRIV0 +#define AMDGPU_PL_FLAG_GWS TTM_PL_FLAG_PRIV1 +#define AMDGPU_PL_FLAG_OA TTM_PL_FLAG_PRIV2 +#define AMDGPU_TTM_LRU_SIZE 20struct amdgpu_mman_lru {drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h +0
-2@@ -31,14 +31,6 @@#define AMDGPU_GWS_SHIFT PAGE_SHIFT#define AMDGPU_OA_SHIFT PAGE_SHIFT -#define AMDGPU_PL_GDS TTM_PL_PRIV0 -#define AMDGPU_PL_GWS TTM_PL_PRIV1
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h line 35
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h +0
-6-#define AMDGPU_PL_OA TTM_PL_PRIV2 - -#define AMDGPU_PL_FLAG_GDS TTM_PL_FLAG_PRIV0 -#define AMDGPU_PL_FLAG_GWS TTM_PL_FLAG_PRIV1 -#define AMDGPU_PL_FLAG_OA TTM_PL_FLAG_PRIV2 -struct amdgpu_ring ;struct amdgpu_bo ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 18.08.2016 um 10:12 schrieb Flora Cui:
Quoted 10 lines · Christian König
Quoted 7 lines
NAK, we explicitly moved them to
amdgpu_gds.h.In general when some code needs those defines it should include the appropriate header.
But it would make sense to move them into a (to be created)
amdgpu_ttm.h, cause those defines are more TTM related than GDS related.OK. I'll update patch to move them into
amdgpu_ttm.h.AMDGPU_PL_... definitions inamdgpu_gds.his really unfriendly to newly added ones.
Yeah, agree. Feel free to move the other TTM defines from amdgpu.h into the new file as well, but be aware that you might need to forward define a few additional structures then.
Christian.
Quoted 45 lines
Quoted 36 lines
Regards,
Christiuan.Am 18.08.2016 um 04:58 schrieb Flora Cui:
Quoted 32 lines
Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +8
-0@@ -401,6 +401,14 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring);* TTM. */ +#define AMDGPU_PL_GDS TTM_PL_PRIV0 +#define AMDGPU_PL_GWS TTM_PL_PRIV1 +#define AMDGPU_PL_OA TTM_PL_PRIV2 + +#define AMDGPU_PL_FLAG_GDS TTM_PL_FLAG_PRIV0 +#define AMDGPU_PL_FLAG_GWS TTM_PL_FLAG_PRIV1 +#define AMDGPU_PL_FLAG_OA TTM_PL_FLAG_PRIV2 +#define AMDGPU_TTM_LRU_SIZE 20struct amdgpu_mman_lru {drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h +0
-2@@ -31,14 +31,6 @@#define AMDGPU_GWS_SHIFT PAGE_SHIFT#define AMDGPU_OA_SHIFT PAGE_SHIFT -#define AMDGPU_PL_GDS TTM_PL_PRIV0 -#define AMDGPU_PL_GWS TTM_PL_PRIV1Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h line 35
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h +0
-6-#define AMDGPU_PL_OA TTM_PL_PRIV2 - -#define AMDGPU_PL_FLAG_GDS TTM_PL_FLAG_PRIV0 -#define AMDGPU_PL_FLAG_GWS TTM_PL_FLAG_PRIV1 -#define AMDGPU_PL_FLAG_OA TTM_PL_FLAG_PRIV2 -struct amdgpu_ring ;struct amdgpu_bo ;
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