Skip to contentSkip to conversation

virtio-gpu: skip update cursor in post_load if we don't have one

PATCH In review Gerd Hoffmann 3 participants 4 messages Jul 10, 2017 – Jul 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-gpu: skip update cursor in post_load if we don't have one

If the cursor resource id isn't set the guest didn't define a cursor. Skip the cursor update in post_load in that that case.

---
 hw/display/virtio-gpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/display/virtio-gpu.c +3 -1
index 58dc0b2737..eef11083d7 100644
@@ -1092,7 +1092,9 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
 
         dpy_gfx_replace_surface(scanout->con, scanout->ds);
         dpy_gfx_update(scanout->con, 0, 0, scanout->width, scanout->height);
-        update_cursor(g, &scanout->cursor);
+        if (scanout->cursor.resource_id) {
+            update_cursor(g, &scanout->cursor);
+        }
         res->scanout_bitmask |= (1 << i);
     }
 
Signature · 1 line
2.9.3
#1 lore raw
Quoted 3 lines · Gerd Hoffmann

If the cursor resource id isn't set the guest didn't define a cursor. Skip the cursor update in post_load in that that case.

update_cursor() deals with resource_id == 0 already, but it also update the cursor position. What's the issue calling update_cursor() here?

Quoted 23 lines
---
 hw/display/virtio-gpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/display/virtio-gpu.c +3 -1
index 58dc0b2737..eef11083d7 100644
@@ -1092,7 +1092,9 @@ static int virtio_gpu_load(QEMUFile *f, void
 *opaque, size_t size,
 
         dpy_gfx_replace_surface(scanout->con, scanout->ds);
         dpy_gfx_update(scanout->con, 0, 0, scanout->width,
 scanout->height);
-        update_cursor(g, &scanout->cursor);
+        if (scanout->cursor.resource_id) {
+            update_cursor(g, &scanout->cursor);
+        }
         res->scanout_bitmask |= (1 << i);
     }
Quoted 5 lines

--
2.9.3

--

Marc-André Lureau

#2 lore raw
Quoted 11 lines · Marc-André Lureau
Quoted 3 lines · Gerd Hoffmann

If the cursor resource id isn't set the guest didn't define a cursor.
Skip the cursor update in post_load in that that case.

update_cursor() deals with resource_id == 0 already, but it also update the cursor position. What's the issue calling update_cursor() here?

Calling set_cursor(), then vnc client being confused by rich cursor.

Quoted 32 lines
Quoted 24 lines

---
 hw/display/virtio-gpu.c | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
hw/display/virtio-gpu.c +3 -1
index 58dc0b2737..eef11083d7 100644
@@ -1092,7 +1092,9 @@ static int virtio_gpu_load(QEMUFile *f, void
 *opaque, size_t size,
 
          dpy_gfx_replace_surface(scanout->con, scanout->ds);
          dpy_gfx_update(scanout->con, 0, 0, scanout->width,
 scanout->height);
-        update_cursor(g, &scanout->cursor);
+        if (scanout->cursor.resource_id) {
+            update_cursor(g, &scanout->cursor);
+        }
          res->scanout_bitmask |= (1 << i);

     }

Quoted 5 lines

--
2.9.3

--
Marc-André Lureau

Tested-by on v1 1/1
#3 lore raw
In reply to Gerd Hoffmann
Quoted 5 lines · Gerd Hoffmann

If the cursor resource id isn't set the guest didn't define a cursor. Skip the cursor update in post_load in that that case.

It's work!!

Thanks.

Quoted 19 lines
---
 hw/display/virtio-gpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/display/virtio-gpu.c +3 -1
index 58dc0b2737..eef11083d7 100644
@@ -1092,7 +1092,9 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
 
         dpy_gfx_replace_surface(scanout->con, scanout->ds);
         dpy_gfx_update(scanout->con, 0, 0, scanout->width, scanout->height);
-        update_cursor(g, &scanout->cursor);
+        if (scanout->cursor.resource_id) {
+            update_cursor(g, &scanout->cursor);
+        }
         res->scanout_bitmask |= (1 << i);
     }