From 593e484dbbf87b5c8860e9f3126c3fd6be149825 Mon Sep 17 00:00:00 2001 From: Icenowy Zheng Date: Wed, 27 Dec 2023 11:57:33 +0800 Subject: [PATCH] drm/verisilicon: finally fix the cursor position Fixes cursor disappearing when using rotated screen. Signed-off-by: Icenowy Zheng --- drivers/gpu/drm/verisilicon/vs_dc.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/verisilicon/vs_dc.c b/drivers/gpu/drm/verisilicon/vs_dc.c index 1fbedb30a..0118ed89f 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;