qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 03/18] virtio-gpu: add "iothread" property


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH 03/18] virtio-gpu: add "iothread" property
Date: Mon, 5 Sep 2016 02:20:24 +0400

For now, this just links the device with an iothread, but doesn't make
use of it yet. (the following commits will create context for it,
messages, and then dispatch virtio queues to run the renderer)

Signed-off-by: Marc-André Lureau <address@hidden>
---
 hw/display/virtio-gpu-pci.c    | 2 ++
 hw/display/virtio-gpu.c        | 6 ++++++
 hw/display/virtio-vga.c        | 2 ++
 include/hw/virtio/virtio-gpu.h | 4 ++++
 4 files changed, 14 insertions(+)

diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c
index 34a724c..df583ed 100644
--- a/hw/display/virtio-gpu-pci.c
+++ b/hw/display/virtio-gpu-pci.c
@@ -58,6 +58,8 @@ static void virtio_gpu_initfn(Object *obj)
 
     virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
                                 TYPE_VIRTIO_GPU);
+    object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev), "iothread",
+                              &error_abort);
 }
 
 static const TypeInfo virtio_gpu_pci_info = {
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 7fe6ed8..78b3453 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1177,6 +1177,12 @@ static void virtio_gpu_device_unrealize(DeviceState 
*qdev, Error **errp)
 
 static void virtio_gpu_instance_init(Object *obj)
 {
+    VirtIOGPU *g = VIRTIO_GPU(obj);
+
+    object_property_add_link(obj, "iothread", TYPE_IOTHREAD,
+                             (Object **)&g->iothread,
+                             qdev_prop_allow_set_link_before_realize,
+                             OBJ_PROP_LINK_UNREF_ON_RELEASE, NULL);
 }
 
 static void virtio_gpu_reset(VirtIODevice *vdev)
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index 5b510a1..5ba6daa 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -191,6 +191,8 @@ static void virtio_vga_inst_initfn(Object *obj)
 
     virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
                                 TYPE_VIRTIO_GPU);
+    object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev), "iothread",
+                              &error_abort);
 }
 
 static TypeInfo virtio_vga_info = {
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 20d1cd6..270aaf5 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -20,6 +20,7 @@
 #include "hw/virtio/virtio.h"
 #include "hw/pci/pci.h"
 #include "qemu/log.h"
+#include "sysemu/iothread.h"
 
 #include "standard-headers/linux/virtio_gpu.h"
 #define TYPE_VIRTIO_GPU "virtio-gpu-device"
@@ -109,6 +110,9 @@ typedef struct VirtIOGPU {
     bool use_virgl_renderer;
     bool renderer_inited;
     int renderer_blocked;
+
+    IOThread *iothread;
+
     QEMUTimer *fence_poll;
     QEMUTimer *print_stats;
 
-- 
2.9.0




reply via email to

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