drm/verisilicon: finally fix the cursor position
authorIcenowy Zheng <uwu@icenowy.me>
Wed, 27 Dec 2023 03:57:33 +0000 (11:57 +0800)
committerJaehoon Chung <jh80.chung@samsung.com>
Wed, 13 Mar 2024 06:59:00 +0000 (15:59 +0900)
Fixes cursor disappearing when using rotated screen.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
(cherry picked from commit 593e484dbbf87b5c8860e9f3126c3fd6be149825)
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/gpu/drm/verisilicon/vs_dc.c

index 1fbedb30a06b1a9e1e623878419ad759b661d556..0118ed89fa1e64ffe1166f234997aba7953607ac 100644 (file)
@@ -741,14 +741,23 @@ static void update_cursor_size(struct drm_plane_state *state, struct dc_hw_curso
 static void update_cursor_plane(struct vs_dc *dc, struct vs_plane *plane)
 {
     struct drm_plane_state *state = plane->base.state;
-    struct drm_framebuffer *drm_fb = state->fb;
     struct dc_hw_cursor cursor;
 
     cursor.address = plane->dma_addr[0];
-    cursor.x = state->crtc_x + drm_fb->hot_x;
-    cursor.y = state->crtc_y + drm_fb->hot_y;
-    cursor.hot_x = drm_fb->hot_x;
-    cursor.hot_y = drm_fb->hot_y;
+    if (state->crtc_x > 0) {
+        cursor.x = state->crtc_x;
+        cursor.hot_x = 0;
+    } else {
+        cursor.hot_x = -state->crtc_x;
+        cursor.x = 0;
+    }
+    if (state->crtc_y > 0) {
+        cursor.y = state->crtc_y;
+        cursor.hot_y = 0;
+    } else {
+        cursor.hot_y = -state->crtc_y;
+        cursor.y = 0;
+    }
     cursor.display_id = to_vs_display_id(dc, state->crtc);
     update_cursor_size(state, &cursor);
     cursor.enable = true;