diff mbox series

[2/3] hw/display/artist: allow to disable/enable cursor

Message ID 20220121221619.1069447-3-svens@stackframe.org
State New
Headers show
Series hw/display/artist: cursor & buffer mode fixes | expand

Commit Message

Sven Schnelle Jan. 21, 2022, 10:16 p.m. UTC
Allow to disable/enable the cursor via the cursor control
register.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 hw/display/artist.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Gerd Hoffmann Jan. 25, 2022, 8:11 a.m. UTC | #1
> @@ -1419,7 +1424,7 @@ static int vmstate_artist_post_load(void *opaque, int version_id)
>  
>  static const VMStateDescription vmstate_artist = {
>      .name = "artist",
> -    .version_id = 1,
> +    .version_id = 2,

Which machines use that device?  Usually we try avoid bumping the
version as this is a one-way ticket (migration to newer versions works,
but back to older doesn't).  But for machine typess which are not
versioned this isn't that much of a problem.

>      .minimum_version_id = 1,
>      .post_load = vmstate_artist_post_load,
>      .fields = (VMStateField[]) {
> @@ -1440,6 +1445,7 @@ static const VMStateDescription vmstate_artist = {
>          VMSTATE_UINT32(line_end, ARTISTState),
>          VMSTATE_UINT32(line_xy, ARTISTState),
>          VMSTATE_UINT32(cursor_pos, ARTISTState),
> +        VMSTATE_UINT32(cursor_cntl, ARTISTState),

You need another variant of that macro (VMSTATE_UINT32_V() IIRC) to
declare that field as "new in v2".

take care,
  Gerd
diff mbox series

Patch

diff --git a/hw/display/artist.c b/hw/display/artist.c
index 7956a1a5c3..cfae92d3e8 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -80,6 +80,7 @@  struct ARTISTState {
     uint32_t line_pattern_skip;
 
     uint32_t cursor_pos;
+    uint32_t cursor_cntl;
 
     uint32_t cursor_height;
     uint32_t cursor_width;
@@ -1027,6 +1028,8 @@  static void artist_reg_write(void *opaque, hwaddr addr, uint64_t val,
         break;
 
     case CURSOR_CTRL:
+        combine_write_reg(addr, val, size, &s->cursor_cntl);
+        artist_invalidate_cursor(s);
         break;
 
     case IMAGE_BITMAP_OP:
@@ -1320,7 +1323,9 @@  static void artist_update_display(void *opaque)
                                s->width, s->width * 4, 0, 0, artist_draw_line,
                                s, &first, &last);
 
-    artist_draw_cursor(s);
+    if (s->cursor_cntl & 0x80) {
+        artist_draw_cursor(s);
+    }
 
     dpy_gfx_update(s->con, 0, 0, s->width, s->height);
 }
@@ -1419,7 +1424,7 @@  static int vmstate_artist_post_load(void *opaque, int version_id)
 
 static const VMStateDescription vmstate_artist = {
     .name = "artist",
-    .version_id = 1,
+    .version_id = 2,
     .minimum_version_id = 1,
     .post_load = vmstate_artist_post_load,
     .fields = (VMStateField[]) {
@@ -1440,6 +1445,7 @@  static const VMStateDescription vmstate_artist = {
         VMSTATE_UINT32(line_end, ARTISTState),
         VMSTATE_UINT32(line_xy, ARTISTState),
         VMSTATE_UINT32(cursor_pos, ARTISTState),
+        VMSTATE_UINT32(cursor_cntl, ARTISTState),
         VMSTATE_UINT32(cursor_height, ARTISTState),
         VMSTATE_UINT32(cursor_width, ARTISTState),
         VMSTATE_UINT32(plane_mask, ARTISTState),