With CONFIG_VIDEO_DAMAGE, video_sync() only flushes the dirty rectangle
reported for a frame.  Every vidconsole write path reports damage except
the console cursor: console_set_cursor_visible() writes the cursor
straight into the frame buffer without a video_damage() call, so the
cursor was never flushed and stayed invisible until other output dirtied
the same lines.

Report the cursor rectangle when it is drawn.

Fixes: 37db20d0a64 ("video: Support showing a cursor")
Signed-off-by: Valentin Haudiquet <[email protected]>
---
 drivers/video/console_normal.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
index 6dc0a6eaf9d..2c1b6f84180 100644
--- a/drivers/video/console_normal.c
+++ b/drivers/video/console_normal.c
@@ -121,6 +121,8 @@ static int console_set_cursor_visible(struct udevice *dev, 
bool visible,
                return -ENOSYS;
 
        x += index * fontdata->width;
+       video_damage(vid, x, y, VIDCONSOLE_CURSOR_WIDTH,
+                    vc_priv->y_charsize);
        start = vid_priv->fb + y * vid_priv->line_length + x * pbytes;
 
        /* place the cursor 1 pixel before the start of the next char */
-- 
2.53.0

Reply via email to