drm/verisilicon: finally fix the cursor position

Fixes cursor disappearing when using rotated screen.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
This commit is contained in:
Icenowy Zheng
2023-12-27 11:57:33 +08:00
committed by Han Gao/Revy/Rabenda
parent 108fcf335e
commit 593e484dbb

View 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;