Commit 91f0c245 authored by Christian König's avatar Christian König

drm/radeon: use DMA_RESV_USAGE_KERNEL

Always wait for kernel fences before kmap and not only for UVD kmaps.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220407085946.744568-7-christian.koenig@amd.com
parent c35fcfa3
...@@ -219,7 +219,12 @@ int radeon_bo_create(struct radeon_device *rdev, ...@@ -219,7 +219,12 @@ int radeon_bo_create(struct radeon_device *rdev,
int radeon_bo_kmap(struct radeon_bo *bo, void **ptr) int radeon_bo_kmap(struct radeon_bo *bo, void **ptr)
{ {
bool is_iomem; bool is_iomem;
int r; long r;
r = dma_resv_wait_timeout(bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL,
false, MAX_SCHEDULE_TIMEOUT);
if (r < 0)
return r;
if (bo->kptr) { if (bo->kptr) {
if (ptr) { if (ptr) {
......
...@@ -470,24 +470,16 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, ...@@ -470,24 +470,16 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
int32_t *msg, msg_type, handle; int32_t *msg, msg_type, handle;
unsigned img_size = 0; unsigned img_size = 0;
void *ptr; void *ptr;
long r; int i, r;
int i;
if (offset & 0x3F) { if (offset & 0x3F) {
DRM_ERROR("UVD messages must be 64 byte aligned!\n"); DRM_ERROR("UVD messages must be 64 byte aligned!\n");
return -EINVAL; return -EINVAL;
} }
r = dma_resv_wait_timeout(bo->tbo.base.resv, DMA_RESV_USAGE_WRITE,
false, MAX_SCHEDULE_TIMEOUT);
if (r <= 0) {
DRM_ERROR("Failed waiting for UVD message (%ld)!\n", r);
return r ? r : -ETIME;
}
r = radeon_bo_kmap(bo, &ptr); r = radeon_bo_kmap(bo, &ptr);
if (r) { if (r) {
DRM_ERROR("Failed mapping the UVD message (%ld)!\n", r); DRM_ERROR("Failed mapping the UVD message (%d)!\n", r);
return r; return r;
} }
......
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