AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/amdgpu/vcn: fix race condition issue for vcn start
@ 2020-03-03 18:16 James Zhu
  2020-03-03 18:16 ` [PATCH 2/4] drm/amdgpu/vcn: fix race condition issue for dpg unpause mode switch James Zhu
                   ` (7 more replies)
  0 siblings, 8 replies; 27+ messages in thread
From: James Zhu @ 2020-03-03 18:16 UTC (permalink / raw)
  To: amd-gfx; +Cc: jamesz

Fix race condition issue when multiple vcn starts are called.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index f96464e..aa7663f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -63,6 +63,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
 	int i, r;
 
 	INIT_DELAYED_WORK(&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler);
+	mutex_init(&adev->vcn.vcn_pg_lock);
 
 	switch (adev->asic_type) {
 	case CHIP_RAVEN:
@@ -210,6 +211,7 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev)
 	}
 
 	release_firmware(adev->vcn.fw);
+	mutex_destroy(&adev->vcn.vcn_pg_lock);
 
 	return 0;
 }
@@ -321,6 +323,7 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
 	struct amdgpu_device *adev = ring->adev;
 	bool set_clocks = !cancel_delayed_work_sync(&adev->vcn.idle_work);
 
+	mutex_lock(&adev->vcn.vcn_pg_lock);
 	if (set_clocks) {
 		amdgpu_gfx_off_ctrl(adev, false);
 		amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
@@ -345,6 +348,7 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
 
 		adev->vcn.pause_dpg_mode(adev, ring->me, &new_state);
 	}
+	mutex_unlock(&adev->vcn.vcn_pg_lock);
 }
 
 void amdgpu_vcn_ring_end_use(struct amdgpu_ring *ring)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
index 6fe0573..2ae110d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
@@ -200,6 +200,7 @@ struct amdgpu_vcn {
 	struct drm_gpu_scheduler *vcn_dec_sched[AMDGPU_MAX_VCN_INSTANCES];
 	uint32_t		 num_vcn_enc_sched;
 	uint32_t		 num_vcn_dec_sched;
+	struct mutex		 vcn_pg_lock;
 
 	unsigned	harvest_config;
 	int (*pause_dpg_mode)(struct amdgpu_device *adev,
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2020-03-11 15:13 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-03 18:16 [PATCH 1/4] drm/amdgpu/vcn: fix race condition issue for vcn start James Zhu
2020-03-03 18:16 ` [PATCH 2/4] drm/amdgpu/vcn: fix race condition issue for dpg unpause mode switch James Zhu
2020-03-09 16:58   ` [PATCH v3 " James Zhu
2020-03-11 14:16   ` [PATCH v4 " James Zhu
2020-03-03 18:16 ` [PATCH 3/4] drm/amdgpu/vcn2.0: stall DPG when WPTR/RPTR reset James Zhu
2020-03-03 18:16 ` [PATCH 4/4] drm/amdgpu/vcn2.5: " James Zhu
2020-03-10 19:58   ` [PATCH v2 4/4] drm/amdgpu/vcn2.5: add sync " James Zhu
2020-03-10 20:03     ` Leo Liu
2020-03-03 18:44 ` [PATCH 1/4] drm/amdgpu/vcn: fix race condition issue for vcn start Christian König
2020-03-03 19:03   ` James Zhu
2020-03-03 22:48     ` James Zhu
2020-03-04  8:53       ` Christian König
2020-03-04 14:57         ` James Zhu
2020-03-04 15:03           ` Christian König
2020-03-04 15:09             ` James Zhu
2020-03-04 16:34 ` [PATCH v2 " James Zhu
2020-03-05 11:25   ` Christian König
2020-03-05 11:27     ` Christian König
2020-03-05 14:34       ` James Zhu
2020-03-09 16:57 ` [PATCH v3 " James Zhu
2020-03-11 11:30   ` Zhu, James
2020-03-11 11:38     ` Christian König
2020-03-11 14:15       ` James Zhu
2020-03-11 14:15 ` [PATCH v4 " James Zhu
2020-03-11 14:39   ` Christian König
2020-03-11 15:04 ` [PATCH v5 " James Zhu
2020-03-11 15:13   ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox