Skip to content

Commit 12e49fe

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/radeon: stop trying to suspend UVD sessions
Saving the current UVD state on suspend and restoring it on resume just doesn't work reliable. Just close cleanup all sessions on suspend. Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent d52cdfa commit 12e49fe

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

drivers/gpu/drm/radeon/radeon.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,6 @@ struct radeon_uvd {
16731673
struct radeon_bo *vcpu_bo;
16741674
void *cpu_addr;
16751675
uint64_t gpu_addr;
1676-
void *saved_bo;
16771676
atomic_t handles[RADEON_MAX_UVD_HANDLES];
16781677
struct drm_file *filp[RADEON_MAX_UVD_HANDLES];
16791678
unsigned img_size[RADEON_MAX_UVD_HANDLES];

drivers/gpu/drm/radeon/radeon_uvd.c

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -204,28 +204,32 @@ void radeon_uvd_fini(struct radeon_device *rdev)
204204

205205
int radeon_uvd_suspend(struct radeon_device *rdev)
206206
{
207-
unsigned size;
208-
void *ptr;
209-
int i;
207+
int i, r;
210208

211209
if (rdev->uvd.vcpu_bo == NULL)
212210
return 0;
213211

214-
for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i)
215-
if (atomic_read(&rdev->uvd.handles[i]))
216-
break;
212+
for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) {
213+
uint32_t handle = atomic_read(&rdev->uvd.handles[i]);
214+
if (handle != 0) {
215+
struct radeon_fence *fence;
217216

218-
if (i == RADEON_MAX_UVD_HANDLES)
219-
return 0;
217+
radeon_uvd_note_usage(rdev);
220218

221-
size = radeon_bo_size(rdev->uvd.vcpu_bo);
222-
size -= rdev->uvd_fw->size;
219+
r = radeon_uvd_get_destroy_msg(rdev,
220+
R600_RING_TYPE_UVD_INDEX, handle, &fence);
221+
if (r) {
222+
DRM_ERROR("Error destroying UVD (%d)!\n", r);
223+
continue;
224+
}
223225

224-
ptr = rdev->uvd.cpu_addr;
225-
ptr += rdev->uvd_fw->size;
226+
radeon_fence_wait(fence, false);
227+
radeon_fence_unref(&fence);
226228

227-
rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL);
228-
memcpy(rdev->uvd.saved_bo, ptr, size);
229+
rdev->uvd.filp[i] = NULL;
230+
atomic_set(&rdev->uvd.handles[i], 0);
231+
}
232+
}
229233

230234
return 0;
231235
}
@@ -246,12 +250,7 @@ int radeon_uvd_resume(struct radeon_device *rdev)
246250
ptr = rdev->uvd.cpu_addr;
247251
ptr += rdev->uvd_fw->size;
248252

249-
if (rdev->uvd.saved_bo != NULL) {
250-
memcpy(ptr, rdev->uvd.saved_bo, size);
251-
kfree(rdev->uvd.saved_bo);
252-
rdev->uvd.saved_bo = NULL;
253-
} else
254-
memset(ptr, 0, size);
253+
memset(ptr, 0, size);
255254

256255
return 0;
257256
}

0 commit comments

Comments
 (0)