drm/radeon: cleanup UVD address checks
authorChristian König <christian.koenig@amd.com>
Sun, 14 Apr 2013 10:45:43 +0000 (12:45 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 22 Apr 2013 14:39:10 +0000 (10:39 -0400)
Message and feedback buffers must be at start of
VRAM, not at start of address space.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/radeon_uvd.c

index 30a94609672a2ab7d184125fe79c62a0a7e57b64..2fb4d6cf26b633447571e213cf32943e1711a4b9 100644 (file)
@@ -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;
 }