Revert "drm/amdgpu/vg20:Restruct uvd.idle_work to support multiple instance (v2)"
Subsystems (2)
PATCH 1/4 Revert "drm/amdgpu/vg20:Restruct uvd.idle_work to support multiple instance (v2)"
This reverts commit 4f7b8507bb4ba19f994e0d72eedd6029961be402.
We don't need separate idle work handles for UVD 7.2. Both instances are driven by the same clock and power.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 17 ++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h | 7 +------ 2 files changed, 9 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +8 -9
@@ -130,6 +130,8 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)unsigned version_major, version_minor, family_id;int i, j, r; +INIT_DELAYED_WORK (&adev->uvd.inst->idle_work, amdgpu_uvd_idle_work_handler); +switch (adev->asic_type) {#ifdef CONFIG_DRM_AMDGPU_CIK case CHIP_BONAIRE :
@@ -236,8 +238,6 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) bo_size +=AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 );for (j =0 ; j < adev->uvd.num_uvd_inst; j++) { - adev->uvd.inst[j].delayed_work.ip_instance = j; -INIT_DELAYED_WORK (&adev->uvd.inst[j].delayed_work.idle_work, amdgpu_uvd_idle_work_handler); r = amdgpu_bo_create_kernel(adev, bo_size, PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM, &adev->uvd.inst[j].vcpu_bo,
@@ -318,7 +318,7 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)if (adev->uvd.inst[j].vcpu_bo ==NULL )continue ; -cancel_delayed_work_sync (&adev->uvd.inst[j].delayed_work.idle_work); +cancel_delayed_work_sync (&adev->uvd.inst[j].idle_work);/* only valid for physical mode */ if (adev->asic_type <CHIP_POLARIS10 ) {
@@ -1144,10 +1144,9 @@ int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,static void amdgpu_uvd_idle_work_handler (struct work_struct *work) { -struct amdgpu_delayed_work *my_work = (struct amdgpu_delayed_work *)work;struct amdgpu_device *adev = - container_of(work, struct amdgpu_device, uvd.inst[my_work->ip_instance].delayed_work.idle_work.work); -unsigned fences =amdgpu_fence_count_emitted (&adev->uvd.inst[my_work->ip_instance].ring); + container_of(work, struct amdgpu_device, uvd.inst->idle_work.work); +unsigned fences =amdgpu_fence_count_emitted (&adev->uvd.inst->ring);if (fences ==0 ) {if (adev->pm.dpm_enabled) {
@@ -1161,7 +1160,7 @@ static void amdgpu_uvd_idle_work_handler(struct work_struct *work) AMD_CG_STATE_GATE); } }else { -schedule_delayed_work (&adev->uvd.inst[my_work->ip_instance].delayed_work.idle_work,UVD_IDLE_TIMEOUT ); +schedule_delayed_work (&adev->uvd.inst->idle_work,UVD_IDLE_TIMEOUT ); } }
@@ -1173,7 +1172,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)if (amdgpu_sriov_vf (adev))return ; - set_clocks = !cancel_delayed_work_sync (&adev->uvd.inst[ring->me].delayed_work.idle_work); + set_clocks = !cancel_delayed_work_sync (&adev->uvd.inst->idle_work);if (set_clocks) {if (adev->pm.dpm_enabled) {amdgpu_dpm_enable_uvd (adev, true);
@@ -1190,7 +1189,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)void amdgpu_uvd_ring_end_use (struct amdgpu_ring *ring) {if (!amdgpu_sriov_vf (ring->adev)) -schedule_delayed_work (&ring->adev->uvd.inst[ring->me].delayed_work.idle_work,UVD_IDLE_TIMEOUT ); +schedule_delayed_work (&ring->adev->uvd.inst->idle_work,UVD_IDLE_TIMEOUT ); }/**
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h +1 -6
@@ -37,11 +37,6 @@ (AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (((const struct common_firmware_header *)(adev)->uvd.fw->data)->ucode_size_bytes) + \ 8) - AMDGPU_UVD_FIRMWARE_OFFSET) -struct amdgpu_delayed_work { -struct delayed_work idle_work; -unsigned ip_instance; -}; -struct amdgpu_uvd_inst {struct amdgpu_bo *vcpu_bo;void *cpu_addr;
@@ -49,12 +44,12 @@ struct amdgpu_uvd_inst {void *saved_bo;atomic_t handles[AMDGPU_MAX_UVD_HANDLES ];struct drm_file *filp[AMDGPU_MAX_UVD_HANDLES ]; +struct delayed_work idle_work;struct amdgpu_ring ring;struct amdgpu_ring ring_enc[AMDGPU_MAX_UVD_ENC_RINGS ];struct amdgpu_irq_src irq;struct drm_sched_entity entity;struct drm_sched_entity entity_enc; -struct amdgpu_delayed_work delayed_work;uint32_t srbm_soft_reset; };
Signature · 6 lines
2.13.6 _______________________________________________ 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): 20180517223640.23823-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/4 drm/amdgpu: count fences from all uvd instances in idle handler
Current multi-UVD hardware uses a single clock and power source so handle all instances in the idle handler.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +5 -1
@@ -1146,7 +1146,11 @@ static void amdgpu_uvd_idle_work_handler(struct work_struct *work) {struct amdgpu_device *adev = container_of(work, struct amdgpu_device, uvd.inst->idle_work.work); -unsigned fences =amdgpu_fence_count_emitted (&adev->uvd.inst->ring); +unsigned fences =0 , i; + +for (i =0 ; i < adev->uvd.num_uvd_inst; ++i) { + fences +=amdgpu_fence_count_emitted (&adev->uvd.inst[i].ring); + }if (fences ==0 ) {if (adev->pm.dpm_enabled) {
Signature · 6 lines
2.13.6 _______________________________________________ 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): 20180517223640.23823-2-alexander.deucher-5C7GfCeVMHo@public.gmane.org
James Zhu
Reviewed-byRe: [PATCH 2/4] drm/amdgpu: count fences from all uvd instances in idle handler
Quoted 15 lines · Alex Deucher
Current multi-UVD hardware uses a single clock and power source so handle all instances in the idle handler.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0
-0@@ -1146,7 +1146,11 @@ static void amdgpu_uvd_idle_work_handler(struct work_struct *work) { struct amdgpu_device *adev =
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c static void amdgpu_uvd_idle_work_handler(struct work_struct *work) · line 1156
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +5
-1container_of(work, struct amdgpu_device, uvd.inst->idle_work.work); -unsigned fences =amdgpu_fence_count_emitted (&adev->uvd.inst->ring); +unsigned fences =0 , i; + +for (i =0 ; i < adev->uvd.num_uvd_inst; ++i) { + fences +=amdgpu_fence_count_emitted (&adev->uvd.inst[i].ring); + }if (fences ==0 ) {if (adev->pm.dpm_enabled) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amdgpu: Take uvd encode rings into account in idle work (v2)
In reply to a message not in the archiveTake the encode rings into account in the idle work handler.
v2: fix typo: s/num_uvd_inst/num_enc_rings/
--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +4 -1
@@ -1146,10 +1146,13 @@ static void amdgpu_uvd_idle_work_handler(struct work_struct *work) {struct amdgpu_device *adev = container_of(work, struct amdgpu_device, uvd.inst->idle_work.work); -unsigned fences =0 , i; +unsigned fences =0 , i, j;for (i =0 ; i < adev->uvd.num_uvd_inst; ++i) { fences +=amdgpu_fence_count_emitted (&adev->uvd.inst[i].ring); +for (j =0 ; j < adev->uvd.num_enc_rings; ++j) { + fences +=amdgpu_fence_count_emitted (&adev->uvd.inst[i].ring_enc[j]); + } }if (fences ==0 ) {
Signature · 6 lines
2.13.6 _______________________________________________ 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): 20180517223640.23823-3-alexander.deucher-5C7GfCeVMHo@public.gmane.org
James Zhu
Reviewed-byRe: [PATCH 3/4] drm/amdgpu: Take uvd encode rings into account in idle work (v2)
Quoted 18 lines · Alex Deucher
Take the encode rings into account in the idle work handler.
v2: fix typo: s/num_uvd_inst/num_enc_rings/
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0
-1@@ -1146,10 +1146,13 @@ static void amdgpu_uvd_idle_work_handler(struct work_struct *work) {struct amdgpu_device *adev = container_of(work, struct amdgpu_device, uvd.inst->idle_work.work); -unsigned fences =0 , i;
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c static void amdgpu_uvd_idle_work_handler(struct work_struct *work) · line 1158
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +4
-0+unsigned fences =0 , i, j;for (i =0 ; i < adev->uvd.num_uvd_inst; ++i) { fences +=amdgpu_fence_count_emitted (&adev->uvd.inst[i].ring); +for (j =0 ; j < adev->uvd.num_enc_rings; ++j) { + fences +=amdgpu_fence_count_emitted (&adev->uvd.inst[i].ring_enc[j]); + } }if (fences ==0 ) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amdgpu: Take vcn encode rings into account in idle work
In reply to a message not in the archiveTake the encode rings into account in the idle work handler.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +5 -0
@@ -205,6 +205,11 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)struct amdgpu_device *adev = container_of(work, struct amdgpu_device, vcn.idle_work.work);unsigned fences =amdgpu_fence_count_emitted (&adev->vcn.ring_dec); +unsigned i; + +for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { + fences +=amdgpu_fence_count_emitted (&adev->vcn.ring_enc[i]); + }if (fences ==0 ) {if (adev->pm.dpm_enabled) {
Signature · 6 lines
2.13.6 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
James Zhu
Reviewed-byQuoted 102 lines · Alex Deucher
This reverts commit
4f7b8507bb4ba19f994e0d72eedd6029961be402.We don't need separate idle work handles for UVD 7.2. Both instances are driven by the same clock and power.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 17 ++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h | 7 +------ 2 files changed, 9 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +8
-9@@ -130,6 +130,8 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)unsigned version_major, version_minor, family_id;int i, j, r; +INIT_DELAYED_WORK (&adev->uvd.inst->idle_work, amdgpu_uvd_idle_work_handler); +switch (adev->asic_type) {#ifdef CONFIG_DRM_AMDGPU_CIK case CHIP_BONAIRE :@@ -236,8 +238,6 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) bo_size +=AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 );for (j =0 ; j < adev->uvd.num_uvd_inst; j++) { - adev->uvd.inst[j].delayed_work.ip_instance = j; -INIT_DELAYED_WORK (&adev->uvd.inst[j].delayed_work.idle_work, amdgpu_uvd_idle_work_handler); r = amdgpu_bo_create_kernel(adev, bo_size, PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM, &adev->uvd.inst[j].vcpu_bo,@@ -318,7 +318,7 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)if (adev->uvd.inst[j].vcpu_bo ==NULL )continue ; -cancel_delayed_work_sync (&adev->uvd.inst[j].delayed_work.idle_work); +cancel_delayed_work_sync (&adev->uvd.inst[j].idle_work);/* only valid for physical mode */ if (adev->asic_type <CHIP_POLARIS10 ) {@@ -1144,10 +1144,9 @@ int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,static void amdgpu_uvd_idle_work_handler (struct work_struct *work) { -struct amdgpu_delayed_work *my_work = (struct amdgpu_delayed_work *)work;struct amdgpu_device *adev = - container_of(work, struct amdgpu_device, uvd.inst[my_work->ip_instance].delayed_work.idle_work.work); -unsigned fences =amdgpu_fence_count_emitted (&adev->uvd.inst[my_work->ip_instance].ring); + container_of(work, struct amdgpu_device, uvd.inst->idle_work.work); +unsigned fences =amdgpu_fence_count_emitted (&adev->uvd.inst->ring);if (fences ==0 ) {if (adev->pm.dpm_enabled) {@@ -1161,7 +1160,7 @@ static void amdgpu_uvd_idle_work_handler(struct work_struct *work) AMD_CG_STATE_GATE); } }else { -schedule_delayed_work (&adev->uvd.inst[my_work->ip_instance].delayed_work.idle_work,UVD_IDLE_TIMEOUT ); +schedule_delayed_work (&adev->uvd.inst->idle_work,UVD_IDLE_TIMEOUT ); } }@@ -1173,7 +1172,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)if (amdgpu_sriov_vf (adev))return ; - set_clocks = !cancel_delayed_work_sync (&adev->uvd.inst[ring->me].delayed_work.idle_work); + set_clocks = !cancel_delayed_work_sync (&adev->uvd.inst->idle_work);if (set_clocks) {if (adev->pm.dpm_enabled) {amdgpu_dpm_enable_uvd (adev, true);@@ -1190,7 +1189,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)void amdgpu_uvd_ring_end_use (struct amdgpu_ring *ring) {if (!amdgpu_sriov_vf (ring->adev)) -schedule_delayed_work (&ring->adev->uvd.inst[ring->me].delayed_work.idle_work,UVD_IDLE_TIMEOUT ); +schedule_delayed_work (&ring->adev->uvd.inst->idle_work,UVD_IDLE_TIMEOUT ); }/** drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h +0
-5@@ -37,11 +37,6 @@ (AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (((const struct common_firmware_header *)(adev)->uvd.fw->data)->ucode_size_bytes) + \ 8) - AMDGPU_UVD_FIRMWARE_OFFSET) -struct amdgpu_delayed_work { -struct delayed_work idle_work; -unsigned ip_instance; -}; -struct amdgpu_uvd_inst {struct amdgpu_bo *vcpu_bo;void *cpu_addr;@@ -49,12 +44,12 @@ struct amdgpu_uvd_inst {void *saved_bo;atomic_t handles[AMDGPU_MAX_UVD_HANDLES ];struct drm_file *filp[AMDGPU_MAX_UVD_HANDLES ];
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h struct amdgpu_uvd_inst { · line 55
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h +1
-1+struct delayed_work idle_work;struct amdgpu_ring ring;struct amdgpu_ring ring_enc[AMDGPU_MAX_UVD_ENC_RINGS ];struct amdgpu_irq_src irq;struct drm_sched_entity entity;struct drm_sched_entity entity_enc; -struct amdgpu_delayed_work delayed_work;uint32_t srbm_soft_reset; };
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx