diff mbox

[1/2] drm/radeon: cleanup UVD address checks

Message ID 1366274551-4967-1-git-send-email-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König April 18, 2013, 8:42 a.m. UTC
From: Christian König <christian.koenig@amd.com>

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>
---
 drivers/gpu/drm/radeon/radeon_uvd.c |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

Comments

Alex Deucher April 18, 2013, 1:48 p.m. UTC | #1
On Thu, Apr 18, 2013 at 4:42 AM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> 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>

Looks good.  Both applied.

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_uvd.c |   26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
> index 30a9460..2fb4d6c 100644
> --- a/drivers/gpu/drm/radeon/radeon_uvd.c
> +++ b/drivers/gpu/drm/radeon/radeon_uvd.c
> @@ -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
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index 30a9460..2fb4d6c 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -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;
 }