drm/radeon: Simplify cursor x/yorigin calculation.
authorMichel Dänzer <michel.daenzer@amd.com>
Fri, 30 Sep 2011 15:16:51 +0000 (17:16 +0200)
committerDave Airlie <airlied@redhat.com>
Mon, 3 Oct 2011 17:37:35 +0000 (18:37 +0100)
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon_cursor.c

index c495575b2e1ccfce50447bb7351c232332d82d33..bac8ee7990a7c53fc5da51e970b177c1d112b318 100644 (file)
@@ -209,13 +209,9 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
        int w = radeon_crtc->cursor_width;
 
        if (x < 0)
-               xorigin = -x;
+               xorigin = min(-x, CURSOR_WIDTH - 1);
        if (y < 0)
-               yorigin = -y;
-       if (xorigin >= CURSOR_WIDTH)
-               xorigin = CURSOR_WIDTH - 1;
-       if (yorigin >= CURSOR_HEIGHT)
-               yorigin = CURSOR_HEIGHT - 1;
+               yorigin = min(-y, CURSOR_HEIGHT - 1);
 
        if (ASIC_IS_AVIVO(rdev)) {
                int i = 0;