Commit 8f8202f7 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: stop trying to suspend UVD sessions v2

Saving the current UVD state on suspend and restoring it on resume
just doesn't work reliable. Just close cleanup all sessions on suspend.

Ported from radeon commit "12e49fea".

v2: rebased
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
parent e61235db
...@@ -1666,7 +1666,6 @@ struct amdgpu_uvd { ...@@ -1666,7 +1666,6 @@ struct amdgpu_uvd {
struct amdgpu_bo *vcpu_bo; struct amdgpu_bo *vcpu_bo;
void *cpu_addr; void *cpu_addr;
uint64_t gpu_addr; uint64_t gpu_addr;
void *saved_bo;
atomic_t handles[AMDGPU_MAX_UVD_HANDLES]; atomic_t handles[AMDGPU_MAX_UVD_HANDLES];
struct drm_file *filp[AMDGPU_MAX_UVD_HANDLES]; struct drm_file *filp[AMDGPU_MAX_UVD_HANDLES];
struct delayed_work idle_work; struct delayed_work idle_work;
......
...@@ -221,31 +221,32 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) ...@@ -221,31 +221,32 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev)
int amdgpu_uvd_suspend(struct amdgpu_device *adev) int amdgpu_uvd_suspend(struct amdgpu_device *adev)
{ {
unsigned size; struct amdgpu_ring *ring = &adev->uvd.ring;
void *ptr; int i, r;
const struct common_firmware_header *hdr;
int i;
if (adev->uvd.vcpu_bo == NULL) if (adev->uvd.vcpu_bo == NULL)
return 0; return 0;
for (i = 0; i < AMDGPU_MAX_UVD_HANDLES; ++i) for (i = 0; i < AMDGPU_MAX_UVD_HANDLES; ++i) {
if (atomic_read(&adev->uvd.handles[i])) uint32_t handle = atomic_read(&adev->uvd.handles[i]);
break; if (handle != 0) {
struct fence *fence;
if (i == AMDGPU_MAX_UVD_HANDLES)
return 0;
hdr = (const struct common_firmware_header *)adev->uvd.fw->data; amdgpu_uvd_note_usage(adev);
size = amdgpu_bo_size(adev->uvd.vcpu_bo); r = amdgpu_uvd_get_destroy_msg(ring, handle, &fence);
size -= le32_to_cpu(hdr->ucode_size_bytes); if (r) {
DRM_ERROR("Error destroying UVD (%d)!\n", r);
continue;
}
ptr = adev->uvd.cpu_addr; fence_wait(fence, false);
ptr += le32_to_cpu(hdr->ucode_size_bytes); fence_put(fence);
adev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); adev->uvd.filp[i] = NULL;
memcpy(adev->uvd.saved_bo, ptr, size); atomic_set(&adev->uvd.handles[i], 0);
}
}
return 0; return 0;
} }
...@@ -270,11 +271,6 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev) ...@@ -270,11 +271,6 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
ptr = adev->uvd.cpu_addr; ptr = adev->uvd.cpu_addr;
ptr += le32_to_cpu(hdr->ucode_size_bytes); ptr += le32_to_cpu(hdr->ucode_size_bytes);
if (adev->uvd.saved_bo != NULL) {
memcpy(ptr, adev->uvd.saved_bo, size);
kfree(adev->uvd.saved_bo);
adev->uvd.saved_bo = NULL;
} else
memset(ptr, 0, size); memset(ptr, 0, size);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment