qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 21/27] vhost-user-gpu: add vg_send_cursor_pos()


From: marcandre . lureau
Subject: [PATCH 21/27] vhost-user-gpu: add vg_send_cursor_pos()
Date: Fri, 12 Mar 2021 14:01:02 +0400

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 contrib/vhost-user-gpu/vugpu.h          |  3 +++
 contrib/vhost-user-gpu/vhost-user-gpu.c | 28 +++++++++++++++----------
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/contrib/vhost-user-gpu/vugpu.h b/contrib/vhost-user-gpu/vugpu.h
index 02a22bae34..1927fb4f24 100644
--- a/contrib/vhost-user-gpu/vugpu.h
+++ b/contrib/vhost-user-gpu/vugpu.h
@@ -198,4 +198,7 @@ void    vg_send_scanout(VuGpu *g, uint32_t scanout_id);
 void    vg_send_cursor_update(VuGpu *g,
                               const struct virtio_gpu_update_cursor *cursor,
                               const void *data);
+void    vg_send_cursor_pos(VuGpu *g,
+                           const struct virtio_gpu_update_cursor *cursor);
+
 #endif
diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c 
b/contrib/vhost-user-gpu/vhost-user-gpu.c
index 32bcbaa9a1..4972448dbc 100644
--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
+++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
@@ -959,23 +959,29 @@ vg_send_cursor_update(VuGpu *g,
     vg_send_msg(g, &msg, -1);
 }
 
+void
+vg_send_cursor_pos(VuGpu *g, const struct virtio_gpu_update_cursor *cursor)
+{
+    VhostUserGpuMsg msg = {
+        .request = cursor->resource_id ?
+        VHOST_USER_GPU_CURSOR_POS : VHOST_USER_GPU_CURSOR_POS_HIDE,
+        .size = sizeof(VhostUserGpuCursorPos),
+        .payload.cursor_pos = {
+            .scanout_id = cursor->pos.scanout_id,
+            .x = cursor->pos.x,
+            .y = cursor->pos.y,
+        }
+    };
+    vg_send_msg(g, &msg, -1);
+}
+
 static void
 vg_process_cursor_cmd(VuGpu *g, struct virtio_gpu_update_cursor *cursor)
 {
     switch (cursor->hdr.type) {
     case VIRTIO_GPU_CMD_MOVE_CURSOR: {
-        VhostUserGpuMsg msg = {
-            .request = cursor->resource_id ?
-                VHOST_USER_GPU_CURSOR_POS : VHOST_USER_GPU_CURSOR_POS_HIDE,
-            .size = sizeof(VhostUserGpuCursorPos),
-            .payload.cursor_pos = {
-                .scanout_id = cursor->pos.scanout_id,
-                .x = cursor->pos.x,
-                .y = cursor->pos.y,
-            }
-        };
         g_debug("%s: move", G_STRFUNC);
-        vg_send_msg(g, &msg, -1);
+        vg_send_cursor_pos(g, cursor);
         break;
     }
     case VIRTIO_GPU_CMD_UPDATE_CURSOR: {
-- 
2.29.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]