Skip to contentSkip to conversation

drm/amdgpu: Using uninitialized value new_state.jpeg when calling adev->vcn.pause_dpg_mode

PATCH In review [email protected] 1 participant 2 messages Apr 24, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/4 drm/amdgpu: Using uninitialized value new_state.jpeg when calling adev->vcn.pause_dpg_mode

From: Jesse Zhang <[email protected]>

Initialize the new_state.jpeg before it used

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +5 -0
index 677eb141554e..13125ddd5e86 100644
@@ -410,6 +410,11 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
 			else
 				new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
+			if (amdgpu_fence_count_emitted(adev->jpeg.inst->ring_dec))
+				new_state.jpeg = VCN_DPG_STATE__PAUSE;
+			else
+				new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+
 			adev->vcn.pause_dpg_mode(adev, j, &new_state);
 		}
 
Signature · 1 line
2.25.1
#1 lore raw

[AMD Official Use Only - General]

Please ignore this patch:

For vcn_v1, it override the idle work handler and initialize new_state.jpeg at the function vcn_v1_0_idle_work_handler.

/* Override the work func */
adev->vcn.idle_work.work.func = vcn_v1_0_idle_work_handler;

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Wednesday, April 24, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 3/4] drm/amdgpu: Using uninitialized value new_state.jpeg when calling adev->vcn.pause_dpg_mode

From: Jesse Zhang <[email protected]>

Initialize the new_state.jpeg before it used

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +5 -0
index 677eb141554e..13125ddd5e86 100644
@@ -410,6 +410,11 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
                        else
                                new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
+                       if (amdgpu_fence_count_emitted(adev->jpeg.inst->ring_dec))
+                               new_state.jpeg = VCN_DPG_STATE__PAUSE;
+                       else
+                               new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+
                        adev->vcn.pause_dpg_mode(adev, j, &new_state);
                }
 

--
2.25.1