Skip to content

Commit e708f2c

Browse files
committed
drm/amdgpu/jpeg5: add queue reset
Add queue reset support for jpeg 5.0.0. Use the new helpers to re-emit the unprocessed state after resetting the queue. Reviewed-by: Sathishkumar S <[email protected]> Tested-by: Sathishkumar S <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent cf07ece commit e708f2c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ static int jpeg_v5_0_0_sw_init(struct amdgpu_ip_block *ip_block)
120120
if (r)
121121
return r;
122122

123-
/* TODO: Add queue reset mask when FW fully supports it */
124123
adev->jpeg.supported_reset =
125124
amdgpu_get_soft_full_reset_mask(&adev->jpeg.inst[0].ring_dec[0]);
125+
if (!amdgpu_sriov_vf(adev))
126+
adev->jpeg.supported_reset = AMDGPU_RESET_TYPE_PER_QUEUE;
126127
r = amdgpu_jpeg_sysfs_reset_mask_init(adev);
127128
if (r)
128129
return r;
@@ -644,6 +645,25 @@ static int jpeg_v5_0_0_process_interrupt(struct amdgpu_device *adev,
644645
return 0;
645646
}
646647

648+
static int jpeg_v5_0_0_ring_reset(struct amdgpu_ring *ring,
649+
unsigned int vmid,
650+
struct amdgpu_fence *timedout_fence)
651+
{
652+
int r;
653+
654+
if (!(ring->adev->jpeg.supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
655+
return -EOPNOTSUPP;
656+
657+
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
658+
r = jpeg_v5_0_0_stop(ring->adev);
659+
if (r)
660+
return r;
661+
r = jpeg_v5_0_0_start(ring->adev);
662+
if (r)
663+
return r;
664+
return amdgpu_ring_reset_helper_end(ring, timedout_fence);
665+
}
666+
647667
static const struct amd_ip_funcs jpeg_v5_0_0_ip_funcs = {
648668
.name = "jpeg_v5_0_0",
649669
.early_init = jpeg_v5_0_0_early_init,
@@ -689,6 +709,7 @@ static const struct amdgpu_ring_funcs jpeg_v5_0_0_dec_ring_vm_funcs = {
689709
.emit_wreg = jpeg_v4_0_3_dec_ring_emit_wreg,
690710
.emit_reg_wait = jpeg_v4_0_3_dec_ring_emit_reg_wait,
691711
.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
712+
.reset = jpeg_v5_0_0_ring_reset,
692713
};
693714

694715
static void jpeg_v5_0_0_set_dec_ring_funcs(struct amdgpu_device *adev)

0 commit comments

Comments
 (0)