drm/amdgpu: Store CRTC relative amdgpu_crtc->cursor_x/y values
authorMichel Dänzer <michel.daenzer@amd.com>
Thu, 27 Oct 2016 08:11:43 +0000 (17:11 +0900)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 6 Dec 2016 23:08:27 +0000 (18:08 -0500)
We were storing viewport relative coordinates. However, crtc_cursor_set2
and cursor_reset pass amdgpu_crtc->cursor_x/y as the x/y parameters of
cursor_move_locked, which would break if the CRTC isn't located at
(0, 0).

Cc: stable@vger.kernel.org
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c

index 075aa0b..a4a52e6 100644 (file)
@@ -2493,6 +2493,9 @@ static int dce_v10_0_cursor_move_locked(struct drm_crtc *crtc,
        struct amdgpu_device *adev = crtc->dev->dev_private;
        int xorigin = 0, yorigin = 0;
 
+       amdgpu_crtc->cursor_x = x;
+       amdgpu_crtc->cursor_y = y;
+
        /* avivo cursor are offset into the total surface */
        x += crtc->x;
        y += crtc->y;
@@ -2512,9 +2515,6 @@ static int dce_v10_0_cursor_move_locked(struct drm_crtc *crtc,
        WREG32(mmCUR_SIZE + amdgpu_crtc->crtc_offset,
               ((amdgpu_crtc->cursor_width - 1) << 16) | (amdgpu_crtc->cursor_height - 1));
 
-       amdgpu_crtc->cursor_x = x;
-       amdgpu_crtc->cursor_y = y;
-
        return 0;
 }
 
index a671748..4ffeb81 100644 (file)
@@ -2509,6 +2509,9 @@ static int dce_v11_0_cursor_move_locked(struct drm_crtc *crtc,
        struct amdgpu_device *adev = crtc->dev->dev_private;
        int xorigin = 0, yorigin = 0;
 
+       amdgpu_crtc->cursor_x = x;
+       amdgpu_crtc->cursor_y = y;
+
        /* avivo cursor are offset into the total surface */
        x += crtc->x;
        y += crtc->y;
@@ -2528,9 +2531,6 @@ static int dce_v11_0_cursor_move_locked(struct drm_crtc *crtc,
        WREG32(mmCUR_SIZE + amdgpu_crtc->crtc_offset,
               ((amdgpu_crtc->cursor_width - 1) << 16) | (amdgpu_crtc->cursor_height - 1));
 
-       amdgpu_crtc->cursor_x = x;
-       amdgpu_crtc->cursor_y = y;
-
        return 0;
 }
 
index 15d98ef..2b27083 100644 (file)
@@ -1862,6 +1862,9 @@ static int dce_v6_0_cursor_move_locked(struct drm_crtc *crtc,
 
        int w = amdgpu_crtc->cursor_width;
 
+       amdgpu_crtc->cursor_x = x;
+       amdgpu_crtc->cursor_y = y;
+
        /* avivo cursor are offset into the total surface */
        x += crtc->x;
        y += crtc->y;
@@ -1881,8 +1884,6 @@ static int dce_v6_0_cursor_move_locked(struct drm_crtc *crtc,
        WREG32(mmCUR_SIZE + amdgpu_crtc->crtc_offset,
               ((w - 1) << 16) | (amdgpu_crtc->cursor_height - 1));
 
-       amdgpu_crtc->cursor_x = x;
-       amdgpu_crtc->cursor_y = y;
        return 0;
 }
 
index a699896..22a7966 100644 (file)
@@ -2344,6 +2344,9 @@ static int dce_v8_0_cursor_move_locked(struct drm_crtc *crtc,
        struct amdgpu_device *adev = crtc->dev->dev_private;
        int xorigin = 0, yorigin = 0;
 
+       amdgpu_crtc->cursor_x = x;
+       amdgpu_crtc->cursor_y = y;
+
        /* avivo cursor are offset into the total surface */
        x += crtc->x;
        y += crtc->y;
@@ -2363,9 +2366,6 @@ static int dce_v8_0_cursor_move_locked(struct drm_crtc *crtc,
        WREG32(mmCUR_SIZE + amdgpu_crtc->crtc_offset,
               ((amdgpu_crtc->cursor_width - 1) << 16) | (amdgpu_crtc->cursor_height - 1));
 
-       amdgpu_crtc->cursor_x = x;
-       amdgpu_crtc->cursor_y = y;
-
        return 0;
 }