drm/amdgpu: cleanup coding style a bit
Subsystems (2)
PATCH 1/3 drm/amdgpu: cleanup coding style a bit
No need to bitcast a boolean and even if we should use "!!" instead.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +10 -10
@@ -328,35 +328,35 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_filecase AMDGPU_HW_IP_GFX : type =AMD_IP_BLOCK_TYPE_GFX ;for (i =0 ; i < adev->gfx.num_gfx_rings; i++) - ring_mask |= ((adev->gfx.gfx_ring[i].ready ?1 :0 ) << i); + ring_mask |= adev->gfx.gfx_ring[i].ready << i; ib_start_alignment =32 ; ib_size_alignment =32 ;break ;case AMDGPU_HW_IP_COMPUTE : type =AMD_IP_BLOCK_TYPE_GFX ;for (i =0 ; i < adev->gfx.num_compute_rings; i++) - ring_mask |= ((adev->gfx.compute_ring[i].ready ?1 :0 ) << i); + ring_mask |= adev->gfx.compute_ring[i].ready << i; ib_start_alignment =32 ; ib_size_alignment =32 ;break ;case AMDGPU_HW_IP_DMA : type =AMD_IP_BLOCK_TYPE_SDMA ;for (i =0 ; i < adev->sdma.num_instances; i++) - ring_mask |= ((adev->sdma.instance[i].ring.ready ?1 :0 ) << i); + ring_mask |= adev->sdma.instance[i].ring.ready << i; ib_start_alignment =256 ; ib_size_alignment =4 ;break ;case AMDGPU_HW_IP_UVD : type =AMD_IP_BLOCK_TYPE_UVD ;for (i =0 ; i < adev->uvd.num_uvd_inst; i++) - ring_mask |= ((adev->uvd.inst[i].ring.ready ?1 :0 ) << i); + ring_mask |= adev->uvd.inst[i].ring.ready << i; ib_start_alignment =64 ; ib_size_alignment =64 ;break ;case AMDGPU_HW_IP_VCE : type =AMD_IP_BLOCK_TYPE_VCE ;for (i =0 ; i < adev->vce.num_rings; i++) - ring_mask |= ((adev->vce.ring[i].ready ?1 :0 ) << i); + ring_mask |= adev->vce.ring[i].ready << i; ib_start_alignment =4 ; ib_size_alignment =1 ;break ;
@@ -365,27 +365,27 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_filefor (i =0 ; i < adev->uvd.num_uvd_inst; i++)for (j =0 ; j < adev->uvd.num_enc_rings; j++) ring_mask |= - ((adev->uvd.inst[i].ring_enc[j].ready ?1 :0 ) << - (j + i * adev->uvd.num_enc_rings)); + adev->uvd.inst[i].ring_enc[j].ready << + (j + i * adev->uvd.num_enc_rings); ib_start_alignment =64 ; ib_size_alignment =64 ;break ;case AMDGPU_HW_IP_VCN_DEC : type =AMD_IP_BLOCK_TYPE_VCN ; - ring_mask = adev->vcn.ring_dec.ready ?1 :0 ; + ring_mask = adev->vcn.ring_dec.ready; ib_start_alignment =16 ; ib_size_alignment =16 ;break ;case AMDGPU_HW_IP_VCN_ENC : type =AMD_IP_BLOCK_TYPE_VCN ;for (i =0 ; i < adev->vcn.num_enc_rings; i++) - ring_mask |= ((adev->vcn.ring_enc[i].ready ?1 :0 ) << i); + ring_mask |= adev->vcn.ring_enc[i].ready << i; ib_start_alignment =64 ; ib_size_alignment =1 ;break ;case AMDGPU_HW_IP_VCN_JPEG : type =AMD_IP_BLOCK_TYPE_VCN ; - ring_mask = adev->vcn.ring_jpeg.ready ?1 :0 ; + ring_mask = adev->vcn.ring_jpeg.ready; ib_start_alignment =16 ; ib_size_alignment =16 ;break ;
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): 20180718125553.72259-1-christian.koenig-5C7GfCeVMHo@public.gmane.org
PATCH 2/3 drm/amdgpu: expose only the first UVD instance for now
Going to completely rework the context to ring mapping with Nayan's GSoC work, but for now just stopping to expose the second UVD instance should do it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 13 +++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c | 9 ++------- 2 files changed, 7 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5 -8
@@ -286,7 +286,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_filestruct drm_crtc *crtc;uint32_t ui32 =0 ;uint64_t ui64 =0 ; -int i, j, found; +int i, found;int ui32_size =sizeof (ui32);if (!info->return_size || !info->return_pointer)
@@ -348,8 +348,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_filebreak ;case AMDGPU_HW_IP_UVD : type =AMD_IP_BLOCK_TYPE_UVD ; -for (i =0 ; i < adev->uvd.num_uvd_inst; i++) - ring_mask |= adev->uvd.inst[i].ring.ready << i; + ring_mask |= adev->uvd.inst[0 ].ring.ready; ib_start_alignment =64 ; ib_size_alignment =64 ;break ;
@@ -362,11 +361,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_filebreak ;case AMDGPU_HW_IP_UVD_ENC : type =AMD_IP_BLOCK_TYPE_UVD ; -for (i =0 ; i < adev->uvd.num_uvd_inst; i++) -for (j =0 ; j < adev->uvd.num_enc_rings; j++) - ring_mask |= - adev->uvd.inst[i].ring_enc[j].ready << - (j + i * adev->uvd.num_enc_rings); +for (i =0 ; i < adev->uvd.num_enc_rings; i++) + ring_mask |= + adev->uvd.inst[0 ].ring_enc[i].ready << i; ib_start_alignment =64 ; ib_size_alignment =64 ;break ;
drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +2 -7
@@ -66,8 +66,6 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, u32 ring, struct amdgpu_ring **out_ring) { - u32 instance; -switch (mapper->hw_ip) {case AMDGPU_HW_IP_GFX : *out_ring = &adev->gfx.gfx_ring[ring];
@@ -79,16 +77,13 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, *out_ring = &adev->sdma.instance[ring].ring;break ;case AMDGPU_HW_IP_UVD : - instance = ring; - *out_ring = &adev->uvd.inst[instance].ring; + *out_ring = &adev->uvd.inst[0 ].ring;break ;case AMDGPU_HW_IP_VCE : *out_ring = &adev->vce.ring[ring];break ;case AMDGPU_HW_IP_UVD_ENC : - instance = ring / adev->uvd.num_enc_rings; - *out_ring = - &adev->uvd.inst[instance].ring_enc[ring%adev->uvd.num_enc_rings]; + *out_ring = &adev->uvd.inst[0 ].ring_enc[ring];break ;case AMDGPU_HW_IP_VCN_DEC : *out_ring = &adev->vcn.ring_dec;
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): 20180718125553.72259-2-christian.koenig-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/3] drm/amdgpu: expose only the first UVD instance for now
Quoted 67 lines · Christian König
Going to completely rework the context to ring mapping with Nayan's GSoC work, but for now just stopping to expose the second UVD instance should do it.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 13 +++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c | 9 ++------- 2 files changed, 7 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5
-8@@ -286,7 +286,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_filestruct drm_crtc *crtc;uint32_t ui32 =0 ;uint64_t ui64 =0 ; -int i, j, found; +int i, found;int ui32_size =sizeof (ui32);if (!info->return_size || !info->return_pointer)@@ -348,8 +348,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_filebreak ;case AMDGPU_HW_IP_UVD : type =AMD_IP_BLOCK_TYPE_UVD ; -for (i =0 ; i < adev->uvd.num_uvd_inst; i++) - ring_mask |= adev->uvd.inst[i].ring.ready << i; + ring_mask |= adev->uvd.inst[0 ].ring.ready; ib_start_alignment =64 ; ib_size_alignment =64 ;break ;@@ -362,11 +361,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_filebreak ;case AMDGPU_HW_IP_UVD_ENC : type =AMD_IP_BLOCK_TYPE_UVD ; -for (i =0 ; i < adev->uvd.num_uvd_inst; i++) -for (j =0 ; j < adev->uvd.num_enc_rings; j++) - ring_mask |= - adev->uvd.inst[i].ring_enc[j].ready << - (j + i * adev->uvd.num_enc_rings); +for (i =0 ; i < adev->uvd.num_enc_rings; i++) + ring_mask |= + adev->uvd.inst[0 ].ring_enc[i].ready << i; ib_start_alignment =64 ; ib_size_alignment =64 ;break ;drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-4@@ -66,8 +66,6 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, u32 ring, struct amdgpu_ring **out_ring) { - u32 instance; -switch (mapper->hw_ip) {case AMDGPU_HW_IP_GFX : *out_ring = &adev->gfx.gfx_ring[ring];@@ -79,16 +77,13 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, *out_ring = &adev->sdma.instance[ring].ring;break ;case AMDGPU_HW_IP_UVD : - instance = ring; - *out_ring = &adev->uvd.inst[instance].ring;
drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c static int amdgpu_identity_map(struct amdgpu_device *adev, · line 86
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +2
-3+ *out_ring = &adev->uvd.inst[0 ].ring;break ;case AMDGPU_HW_IP_VCE : *out_ring = &adev->vce.ring[ring];break ;case AMDGPU_HW_IP_UVD_ENC : - instance = ring / adev->uvd.num_enc_rings; - *out_ring = - &adev->uvd.inst[instance].ring_enc[ring%adev->uvd.num_enc_rings]; + *out_ring = &adev->uvd.inst[0 ].ring_enc[ring];
Hi Christian,
If here uses amdgpu_identity_map, I think only first instance's ring is in use.
In current Vega20 situation, should we change to use amdgpu_lru_map or something else to schedule which instance/ring for use ?
James
drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c static int amdgpu_identity_map(struct amdgpu_device *adev, · line 89
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-0break ;case AMDGPU_HW_IP_VCN_DEC : *out_ring = &adev->vcn.ring_dec;
_______________________________________________
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): e0cd7fc0-d4b6-b903-eda3-e557f3181547-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/3] drm/amdgpu: expose only the first UVD instance for now
Am 18.07.2018 um 15:40 schrieb James Zhu:
Quoted 86 lines · Christian König
Quoted 73 lines
Going to completely rework the context to ring mapping with Nayan's GSoC work, but for now just stopping to expose the second UVD instance should do it.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 13 +++++--------drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c| 9 ++-------2 files changed, 7 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-1@@ -286,7 +286,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file struct drm_crtc *crtc; uint32_t ui32 = 0; uint64_t ui64 = 0; - int i, j, found; + int i, found; int ui32_size = sizeof(ui32); if (!info->return_size || !info->return_pointer)@@ -348,8 +348,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file break;case
AMDGPU_HW_IP_UVD:
type =AMD_IP_BLOCK_TYPE_UVD;
- for (i = 0; i <adev->uvd.num_uvd_inst; i++) -ring_mask|= adev->uvd.inst[i].ring.ready << i; +ring_mask|= adev->uvd.inst[0].ring.ready;ib_start_alignment= 64;ib_size_alignment= 64;
break;drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-0@@ -362,11 +361,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file break;case
AMDGPU_HW_IP_UVD_ENC:
type =AMD_IP_BLOCK_TYPE_UVD;
- for (i = 0; i <adev->uvd.num_uvd_inst; i++) - for (j = 0; j <adev->uvd.num_enc_rings; j++) -ring_mask|=
- adev->uvd.inst[i].ring_enc[j].ready << - (j + i *adev->uvd.num_enc_rings); + for (i = 0; i <adev->uvd.num_enc_rings; i++) +ring_mask|=
+ adev->uvd.inst[0].ring_enc[i].ready << i;ib_start_alignment= 64;ib_size_alignment= 64;
break;drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-2@@ -66,8 +66,6 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, u32 ring, struct amdgpu_ring **out_ring) { - u32 instance; - switch (mapper->hw_ip) {case
AMDGPU_HW_IP_GFX:
*out_ring= &adev->gfx.gfx_ring[ring];drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-0@@ -79,16 +77,13 @@ static int amdgpu_identity_map(structamdgpu_device *adev, *out_ring = &adev->sdma.instance[ring].ring; break;case
AMDGPU_HW_IP_UVD:
- instance = ring;
-*out_ring= &adev->uvd.inst[instance].ring; +*out_ring= &adev->uvd.inst[0].ring; break;Quoted 8 lines
case
AMDGPU_HW_IP_VCE:
*out_ring= &adev->vce.ring[ring];
break;
caseAMDGPU_HW_IP_UVD_ENC:
- instance = ring /adev->uvd.num_enc_rings;
-*out_ring=
- &adev->uvd.inst[instance].ring_enc[ring%adev->uvd.num_enc_rings]; +*out_ring= &adev->uvd.inst[0].ring_enc[ring];Hi Christian,
Quoted 3 lines
If here uses
amdgpu_identity_map, I think only first instance's ring is in use.In current Vega20 situation, should we change to use
amdgpu_lru_mapor something else to schedule which instance/ring for use ?
Yes and no. I'm going to completely remove the queue manager and replace it with Nayan's work on the scheduler.
So no more lru map, but instead a function which picks the best ring based on actual load during context creation.
Regards,
Christian.
Quoted 7 lines
James
Quoted 3 lines
break;
caseAMDGPU_HW_IP_VCN_DEC:
*out_ring=&adev->vcn.ring_dec;
_______________________________________________
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): dadd17b4-fe49-9ed2-34f4-84d08803364a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 2/3] drm/amdgpu: expose only the first UVD instance for now
Quoted 89 lines · Christian König
Am 18.07.2018 um 15:40 schrieb James Zhu:
Quoted 88 lines · Christian König
Quoted 73 lines
Going to completely rework the context to ring mapping with Nayan's GSoC work, but for now just stopping to expose the second UVD instance should do it.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 13 +++++--------drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c| 9 ++-------2 files changed, 7 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-1@@ -286,7 +286,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file struct drm_crtc *crtc; uint32_t ui32 = 0; uint64_t ui64 = 0; - int i, j, found; + int i, found; int ui32_size = sizeof(ui32); if (!info->return_size || !info->return_pointer)@@ -348,8 +348,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file break;case
AMDGPU_HW_IP_UVD:
type =AMD_IP_BLOCK_TYPE_UVD;
- for (i = 0; i <adev->uvd.num_uvd_inst; i++) -ring_mask|= adev->uvd.inst[i].ring.ready << i; +ring_mask|= adev->uvd.inst[0].ring.ready;ib_start_alignment= 64;ib_size_alignment= 64;
break;drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-0@@ -362,11 +361,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file break;case
AMDGPU_HW_IP_UVD_ENC:
type =AMD_IP_BLOCK_TYPE_UVD;
- for (i = 0; i <adev->uvd.num_uvd_inst; i++) - for (j = 0; j <adev->uvd.num_enc_rings; j++) -ring_mask|=
- adev->uvd.inst[i].ring_enc[j].ready << - (j + i *adev->uvd.num_enc_rings); + for (i = 0; i <adev->uvd.num_enc_rings; i++) +ring_mask|=
+ adev->uvd.inst[0].ring_enc[i].ready << i;ib_start_alignment= 64;ib_size_alignment= 64;
break;drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-2@@ -66,8 +66,6 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, u32 ring, struct amdgpu_ring **out_ring) { - u32 instance; - switch (mapper->hw_ip) {case
AMDGPU_HW_IP_GFX:
*out_ring= &adev->gfx.gfx_ring[ring];drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-0@@ -79,16 +77,13 @@ static int amdgpu_identity_map(structamdgpu_device *adev, *out_ring = &adev->sdma.instance[ring].ring; break;case
AMDGPU_HW_IP_UVD:
- instance = ring;
-*out_ring= &adev->uvd.inst[instance].ring; +*out_ring= &adev->uvd.inst[0].ring; break;Quoted 8 lines
case
AMDGPU_HW_IP_VCE:
*out_ring= &adev->vce.ring[ring];
break;
caseAMDGPU_HW_IP_UVD_ENC:
- instance = ring /adev->uvd.num_enc_rings;
-*out_ring=
- &adev->uvd.inst[instance].ring_enc[ring%adev->uvd.num_enc_rings]; +*out_ring= &adev->uvd.inst[0].ring_enc[ring];Hi Christian,
If here uses
amdgpu_identity_map, I think only first instance's ring is in use.
Quoted 8 lines
Quoted 1 line
In current Vega20 situation, should we change to use
amdgpu_lru_mapor something else to schedule which instance/ring for use ?Yes and no. I'm going to completely remove the queue manager and replace it with Nayan's work on the scheduler.
So no more lru map, but instead a function which picks the best ring based on actual load during context creation.
Regards,
Christian.
Got it. So do we totally remove instance and ring concept out of user space scope? This design is good for use, but it lost flexibility on fine resource management. It may be requested by cgroup's use case in the future.
Regards!
James
Quoted 9 lines
Quoted 8 lines
James
Quoted 3 lines
break;
caseAMDGPU_HW_IP_VCN_DEC:
*out_ring=&adev->vcn.ring_dec;
_______________________________________________
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): c05c6514-ae4c-095b-acdd-f5da3c15a255-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/3] drm/amdgpu: expose only the first UVD instance for now
Am 18.07.2018 um 16:22 schrieb James Zhu:
Quoted 94 lines · Christian König
Quoted 91 lines
Am 18.07.2018 um 15:40 schrieb James Zhu:
Quoted 89 lines · Christian König
Quoted 73 lines
Going to completely rework the context to ring mapping with Nayan's GSoC work, but for now just stopping to expose the second UVD instance should do it.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 13 +++++--------drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c| 9 ++-------2 files changed, 7 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-1@@ -286,7 +286,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file struct drm_crtc *crtc; uint32_t ui32 = 0; uint64_t ui64 = 0; - int i, j, found; + int i, found; int ui32_size = sizeof(ui32); if (!info->return_size || !info->return_pointer)@@ -348,8 +348,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file break;case
AMDGPU_HW_IP_UVD:
type =AMD_IP_BLOCK_TYPE_UVD;
- for (i = 0; i <adev->uvd.num_uvd_inst; i++) -ring_mask|= adev->uvd.inst[i].ring.ready << i; +ring_mask|= adev->uvd.inst[0].ring.ready;ib_start_alignment= 64;ib_size_alignment= 64;
break;drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-0@@ -362,11 +361,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file break;case
AMDGPU_HW_IP_UVD_ENC:
type =AMD_IP_BLOCK_TYPE_UVD;
- for (i = 0; i <adev->uvd.num_uvd_inst; i++) - for (j = 0; j <adev->uvd.num_enc_rings; j++) -ring_mask|=
- adev->uvd.inst[i].ring_enc[j].ready << - (j + i *adev->uvd.num_enc_rings); + for (i = 0; i <adev->uvd.num_enc_rings; i++) +ring_mask|=
+ adev->uvd.inst[0].ring_enc[i].ready << i;ib_start_alignment= 64;ib_size_alignment= 64;
break;drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-2@@ -66,8 +66,6 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, u32 ring, struct amdgpu_ring **out_ring) { - u32 instance; - switch (mapper->hw_ip) {case
AMDGPU_HW_IP_GFX:
*out_ring= &adev->gfx.gfx_ring[ring];drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-0@@ -79,16 +77,13 @@ static int amdgpu_identity_map(structamdgpu_device *adev, *out_ring = &adev->sdma.instance[ring].ring; break;case
AMDGPU_HW_IP_UVD:
- instance = ring;
-*out_ring= &adev->uvd.inst[instance].ring; +*out_ring= &adev->uvd.inst[0].ring; break;Quoted 8 lines
case
AMDGPU_HW_IP_VCE:
*out_ring= &adev->vce.ring[ring];
break;
caseAMDGPU_HW_IP_UVD_ENC:
- instance = ring /adev->uvd.num_enc_rings;
-*out_ring=
- &adev->uvd.inst[instance].ring_enc[ring%adev->uvd.num_enc_rings]; +*out_ring= &adev->uvd.inst[0].ring_enc[ring];Hi Christian,
If here uses
amdgpu_identity_map, I think only first instance's ring is in use.In current Vega20 situation, should we change to use
amdgpu_lru_mapor something else to schedule which instance/ring for use ?
Quoted 7 lines
Quoted 6 lines
Yes and no. I'm going to completely remove the queue manager and replace it with Nayan's work on the scheduler.
So no more lru map, but instead a function which picks the best ring based on actual load during context creation.
Regards,
Christian.Got it. So do we totally remove instance and ring concept out of user space scope?
Yes, that's at least the idea.
Quoted 2 lines
This design is good for use, but it lost flexibility on fine resource management. It may be requested by cgroup's use case in the future.
I actually do this to allow simpler cgroup implementation on top of this.
In other words cgroup can still be used to limit certain applications to certain hardware engines and/or sw priorities, etc...
Regards,
Christian.
Quoted 13 lines
Regards!
JamesQuoted 9 lines
Quoted 8 lines
James
Quoted 3 lines
break;
caseAMDGPU_HW_IP_VCN_DEC:
*out_ring=&adev->vcn.ring_dec;
_______________________________________________
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): 35334103-7b93-592c-90e8-0933b83e9fac-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/3] drm/amdgpu: expose only the first UVD instance for now
Quoted 113 lines · Christian König
Am 18.07.2018 um 16:22 schrieb James Zhu:
Quoted 112 lines · Christian König
Quoted 108 lines
Am 18.07.2018 um 15:40 schrieb James Zhu:
Quoted 93 lines · Christian König
Quoted 76 lines
Going to completely rework the context to ring mapping with Nayan's GSoC
work, but for now just stopping to expose the second UVD instance should
do it.Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 13 +++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c | 9 ++------- 2 files changed, 7 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2
-3@@ -286,7 +286,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_filestruct drm_crtc *crtc;uint32_t ui32 =0 ;uint64_t ui64 =0 ; -int i, j, found; +int i, found;int ui32_size =sizeof (ui32);if (!info->return_size || !info->return_pointer)@@ -348,8 +348,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file break;case AMDGPU_HW_IP_UVD : type =AMD_IP_BLOCK_TYPE_UVD ; -for (i =0 ; i < adev->uvd.num_uvd_inst; i++) - ring_mask |= adev->uvd.inst[i].ring.ready << i; + ring_mask |= adev->uvd.inst[0 ].ring.ready; ib_start_alignment =64 ; ib_size_alignment =64 ;break;drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-5@@ -362,11 +361,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file break;case AMDGPU_HW_IP_UVD_ENC : type =AMD_IP_BLOCK_TYPE_UVD ; -for (i =0 ; i < adev->uvd.num_uvd_inst; i++) -for (j =0 ; j < adev->uvd.num_enc_rings; j++) - ring_mask |= - adev->uvd.inst[i].ring_enc[j].ready << - (j + i * adev->uvd.num_enc_rings); +for (i =0 ; i < adev->uvd.num_enc_rings; i++) + ring_mask |= + adev->uvd.inst[0 ].ring_enc[i].ready << i; ib_start_alignment =64 ; ib_size_alignment =64 ;break;drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-2@@ -66,8 +66,6 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, u32 ring, struct amdgpu_ring **out_ring) { -u32 instance; -switch (mapper->hw_ip) {case AMDGPU_HW_IP_GFX :*out_ring = &adev->gfx.gfx_ring[ring];drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-2@@ -79,16 +77,13 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, *out_ring = &adev->sdma.instance[ring].ring;break ;case AMDGPU_HW_IP_UVD : - instance = ring; - *out_ring = &adev->uvd.inst[instance].ring;drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c static int amdgpu_identity_map(struct amdgpu_device · line 87
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +2
-3+ *out_ring = &adev->uvd.inst[0 ].ring;break ;case AMDGPU_HW_IP_VCE : *out_ring = &adev->vce.ring[ring];break ;case AMDGPU_HW_IP_UVD_ENC : - instance = ring / adev->uvd.num_enc_rings; - *out_ring = - &adev->uvd.inst[instance].ring_enc[ring%adev->uvd.num_enc_rings]; + *out_ring = &adev->uvd.inst[0 ].ring_enc[ring];Hi Christian,
Quoted 5 lines
If here uses
amdgpu_identity_map, I think only first instance's ring is in use.In current Vega20 situation, should we change to use
amdgpu_lru_mapor something else to schedule which instance/ring for use ?Yes and no. I'm going to completely remove the queue manager and replace it with Nayan's work on the scheduler.
So no more lru map, but instead a function which picks the best ring based on actual load during context creation.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Regards,
Christian.Got it. So do we totally remove instance and ring concept out of user space scope?
Yes, that's at least the idea.
I think we still may want to expose multiple queues/rings on an instance to allow userspace to make better decisions about parallelism. E.g., if the UMD knows there are two encode rings and it wants to run two encode tasks in parallel, it should be possible. Then the scheduler can deal with scheduling across instances optimally.
Alex
Quoted 30 lines
Quoted 3 lines
This design is good for use, but it lost flexibility on fine resource management. It may be requested by cgroup's use case in the future.
I actually do this to allow simpler cgroup implementation on top of this.
In other words cgroup can still be used to limit certain applications to certain hardware engines and/or sw priorities, etc...
Regards,
Christian.Quoted 15 lines
Regards!
JamesQuoted 11 lines
Quoted 10 lines
James
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-0break ;case AMDGPU_HW_IP_VCN_DEC :*out_ring = &adev->vcn.ring_dec;
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_P7K+mr-VTT27oneuNKF6jL8vP=X0aZgwecMX+B_qMwbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 2/3] drm/amdgpu: expose only the first UVD instance for now
Am 18.07.2018 um 17:58 schrieb Alex Deucher:
Quoted 114 lines
Quoted 112 lines · Christian König
Am 18.07.2018 um 16:22 schrieb James Zhu:
Quoted 110 lines · Christian König
Quoted 97 lines
Am 18.07.2018 um 15:40 schrieb James Zhu:
Quoted 90 lines · Christian König
Quoted 75 lines
Going to completely rework the context to ring mapping with Nayan's GSoC
work, but for now just stopping to expose the second UVD instance should
do it.Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 13 +++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c | 9 ++------- 2 files changed, 7 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2
-3@@ -286,7 +286,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_filestruct drm_crtc *crtc;uint32_t ui32 =0 ;uint64_t ui64 =0 ; -int i, j, found; +int i, found;int ui32_size =sizeof (ui32);if (!info->return_size || !info->return_pointer)@@ -348,8 +348,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file break;case AMDGPU_HW_IP_UVD : type =AMD_IP_BLOCK_TYPE_UVD ; -for (i =0 ; i < adev->uvd.num_uvd_inst; i++) - ring_mask |= adev->uvd.inst[i].ring.ready << i; + ring_mask |= adev->uvd.inst[0 ].ring.ready; ib_start_alignment =64 ; ib_size_alignment =64 ;break;drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-5@@ -362,11 +361,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file break;case AMDGPU_HW_IP_UVD_ENC : type =AMD_IP_BLOCK_TYPE_UVD ; -for (i =0 ; i < adev->uvd.num_uvd_inst; i++) -for (j =0 ; j < adev->uvd.num_enc_rings; j++) - ring_mask |= - adev->uvd.inst[i].ring_enc[j].ready << - (j + i * adev->uvd.num_enc_rings); +for (i =0 ; i < adev->uvd.num_enc_rings; i++) + ring_mask |= + adev->uvd.inst[0 ].ring_enc[i].ready << i; ib_start_alignment =64 ; ib_size_alignment =64 ;break;drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-2@@ -66,8 +66,6 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, u32 ring, struct amdgpu_ring **out_ring) { -u32 instance; -switch (mapper->hw_ip) {case AMDGPU_HW_IP_GFX :*out_ring = &adev->gfx.gfx_ring[ring];drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-2@@ -79,16 +77,13 @@ static int amdgpu_identity_map(struct amdgpu_device *adev, *out_ring = &adev->sdma.instance[ring].ring;break ;case AMDGPU_HW_IP_UVD : - instance = ring; - *out_ring = &adev->uvd.inst[instance].ring;drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c static int amdgpu_identity_map(struct amdgpu_device · line 87
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +2
-3+ *out_ring = &adev->uvd.inst[0 ].ring;break ;case AMDGPU_HW_IP_VCE : *out_ring = &adev->vce.ring[ring];break ;case AMDGPU_HW_IP_UVD_ENC : - instance = ring / adev->uvd.num_enc_rings; - *out_ring = - &adev->uvd.inst[instance].ring_enc[ring%adev->uvd.num_enc_rings]; + *out_ring = &adev->uvd.inst[0 ].ring_enc[ring];Hi Christian,
Quoted 5 lines
If here uses
amdgpu_identity_map, I think only first instance's ring is in use.In current Vega20 situation, should we change to use
amdgpu_lru_mapor something else to schedule which instance/ring for use ?Quoted 8 lines
Yes and no. I'm going to completely remove the queue manager and replace it with Nayan's work on the scheduler.
So no more lru map, but instead a function which picks the best ring based on actual load during context creation.
Regards,
Christian.Got it. So do we totally remove instance and ring concept out of user space scope?
Quoted 7 lines
Quoted 1 line
Yes, that's at least the idea.
I think we still may want to expose multiple queues/rings on an instance to allow userspace to make better decisions about parallelism. E.g., if the UMD knows there are two encode rings and it wants to run two encode tasks in parallel, it should be possible. Then the scheduler can deal with scheduling across instances optimally.
Well it depends.
I currently plan to expose the following engines to userspace independent of available instances for each block.
* 1 GFX ring (unchanged)
* 4 Compute rings (8 previously)
* 1 UVD decode ring (unchanged)
* 1 VCE encode ring (2/3 previously, but that doesn't make sense cause they have different priorities).
When userspace wants to handle multiple streams at the same time it should create multiple context anyway, so even with just 1 ring for each engine we should be on the save side for parallelism.
Christian.
Quoted 29 lines
Alex
Quoted 25 lines
Quoted 2 lines
This design is good for use, but it lost flexibility on fine resource management. It may be requested by cgroup's use case in the future.
I actually do this to allow simpler cgroup implementation on top of this.
In other words cgroup can still be used to limit certain applications to certain hardware engines and/or sw priorities, etc...
Regards,
Christian.Quoted 9 lines
Regards!
JamesQuoted 7 lines
Quoted 7 lines
James
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c +0
-0break ;case AMDGPU_HW_IP_VCN_DEC :*out_ring = &adev->vcn.ring_dec;_______________________________________________
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
PATCH 3/3 drm/amdgpu: patch the IBs for the second UVD instance
In reply to a message not in the archivePatch the IBs for the second UVD instance so that userspace don't need to care about the instance they submit to.
--- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +27 -0
@@ -1219,6 +1219,32 @@ static int uvd_v7_0_ring_test_ring(struct amdgpu_ring *ring)return r; } +/** +* uvd_v7_0_enc_ring_test_ring - test if UVD ENC ring is working +* +* @ring: the engine to test on +* +*/ +static int uvd_v7_0_ring_parse_cs (struct amdgpu_cs_parser *p,uint32_t ib_idx) +{ +struct amdgpu_ib *ib = &p->job->ibs[ib_idx]; +unsigned i; + +/* No patching necessary for the first instance */ +if (!p->ring->me) +return 0 ; + +for (i =0 ; i < ib->length_dw; i +=2 ) { +uint32_t reg =amdgpu_get_ib_value (p, ib_idx, i); + + reg -= p->adev->reg_offset[UVD_HWIP ][0 ][1 ]; + reg += p->adev->reg_offset[UVD_HWIP ][1 ][1 ]; + +amdgpu_set_ib_value (p, ib_idx, i, reg); + } +return 0 ; +} +/** * uvd_v7_0_ring_emit_ib - execute indirect buffer *
@@ -1711,6 +1737,7 @@ static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = { .get_rptr = uvd_v7_0_ring_get_rptr, .get_wptr = uvd_v7_0_ring_get_wptr, .set_wptr = uvd_v7_0_ring_set_wptr, + .parse_cs = uvd_v7_0_ring_parse_cs, .emit_frame_size =6 +/* hdp invalidate */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 6 +
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx