Skip to contentSkip to conversation

drm/radeon: cleanup UVD address checks

PATCH In review Christian König 2 participants 3 messages Apr 18, 2013

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

PATCH 1/2 drm/radeon: cleanup UVD address checks

From: Christian König <[email protected]>

Message and feedback buffers must be at start of
VRAM, not at start of address space.

---
 drivers/gpu/drm/radeon/radeon_uvd.c |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/radeon/radeon_uvd.c +14 -12
index 30a9460..2fb4d6c 100644
@@ -415,24 +415,26 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p,
 		return -EINVAL;
 	}
 
-	if (cmd == 0) {
-		if (end & 0xFFFFFFFFF0000000) {
-			DRM_ERROR("msg buffer %LX-%LX out of 256MB segment!\n",
-				  start, end);
-			return -EINVAL;
-		}
-
-		r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes);
-		if (r)
-			return r;
+	if ((start >> 28) != (end >> 28)) {
+		DRM_ERROR("reloc %LX-%LX crossing 256MB boundary!\n",
+			  start, end);
+		return -EINVAL;
 	}
 
-	if ((start & 0xFFFFFFFFF0000000) != (end & 0xFFFFFFFFF0000000)) {
-		DRM_ERROR("reloc %LX-%LX crossing 256MB boundary!\n",
+	/* TODO: is this still necessary on NI+ ? */
+	if ((cmd == 0 || cmd == 0x3) &&
+	    (start >> 28) != (p->rdev->uvd.gpu_addr >> 28)) {
+		DRM_ERROR("msg/fb buffer %LX-%LX out of 256MB segment!\n",
 			  start, end);
 		return -EINVAL;
 	}
 
+	if (cmd == 0) {
+		r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes);
+		if (r)
+			return r;
+	}
+
 	return 0;
 }
 
Signature · 6 lines
1.7.10.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/2 drm/radeon: fix alignment of UVD fence

From: Christian König <[email protected]>

---
 drivers/gpu/drm/radeon/radeon_fence.c |    7 +++----
 drivers/gpu/drm/radeon/radeon_uvd.c   |    2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/radeon_fence.c +3 -4
index 82fe183..1a699ce 100644
@@ -776,10 +776,9 @@ int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring)
 
 		} else {
 			/* put fence directly behind firmware */
-			rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr +
-							 rdev->uvd_fw->size;
-			rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr +
-							 rdev->uvd_fw->size;
+			index = ALIGN(rdev->uvd_fw->size, 8);
+			rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index;
+			rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index;
 		}
 
 	} else {
drivers/gpu/drm/radeon/radeon_uvd.c +1 -1
index 2fb4d6c..15580fb 100644
@@ -107,7 +107,7 @@ int radeon_uvd_init(struct radeon_device *rdev)
 
 	platform_device_unregister(pdev);
 
-	bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) +
+	bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 8) +
 		  RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE;
 	r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true,
 			     RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo);
Signature · 6 lines
1.7.10.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
In reply to Christian König
Quoted 6 lines · Christian König

From: Christian König <[email protected]>

Message and feedback buffers must be at start of
VRAM, not at start of address space.

Looks good. Both applied.

Alex

Quoted 54 lines
---
 drivers/gpu/drm/radeon/radeon_uvd.c |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/radeon/radeon_uvd.c +14 -13
index 30a9460..2fb4d6c 100644
@@ -415,24 +415,26 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p,
                return -EINVAL;
        }
 
-       if (cmd == 0) {
-               if (end & 0xFFFFFFFFF0000000) {
-                       DRM_ERROR("msg buffer %LX-%LX out of 256MB segment!\n",
-                                 start, end);
-                       return -EINVAL;
-               }
-
-               r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes);
-               if (r)
-                       return r;
+       if ((start >> 28) != (end >> 28)) {
+               DRM_ERROR("reloc %LX-%LX crossing 256MB boundary!\n",
+                         start, end);
+               return -EINVAL;
        }
 
-       if ((start & 0xFFFFFFFFF0000000) != (end & 0xFFFFFFFFF0000000)) {
-               DRM_ERROR("reloc %LX-%LX crossing 256MB boundary!\n",
+       /* TODO: is this still necessary on NI+ ? */
+       if ((cmd == 0 || cmd == 0x3) &&
+           (start >> 28) != (p->rdev->uvd.gpu_addr >> 28)) {
+               DRM_ERROR("msg/fb buffer %LX-%LX out of 256MB segment!\n",
                          start, end);
                return -EINVAL;
        }
 
+       if (cmd == 0) {
+               r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes);
+               if (r)
+                       return r;
+       }
+
        return 0;
 }
 
--

1.7.10.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel