From: Icenowy Zheng Date: Wed, 27 Dec 2023 03:57:33 +0000 (+0800) Subject: drm/verisilicon: finally fix the cursor position X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9ec65a9ada557e3eedd8031ebf8b929a6dfe35b;p=platform%2Fkernel%2Flinux-thead.git drm/verisilicon: finally fix the cursor position Fixes cursor disappearing when using rotated screen. Signed-off-by: Icenowy Zheng (cherry picked from commit 593e484dbbf87b5c8860e9f3126c3fd6be149825) Signed-off-by: Jaehoon Chung --- diff --git a/drivers/gpu/drm/verisilicon/vs_dc.c b/drivers/gpu/drm/verisilicon/vs_dc.c index 1fbedb30a06b..0118ed89fa1e 100644 --- a/drivers/gpu/drm/verisilicon/vs_dc.c +++ b/drivers/gpu/drm/verisilicon/vs_dc.c @@ -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;