Skip to contentSkip to conversation

rutabaga_gfx + gfxstream

PATCH Superseded Gurchetan Singh 3 participants 14 messages Aug 24, 2023 – Aug 25, 2023 Arm/Amlogic Meson SoC support

v12 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

v12 cover rutabaga_gfx + gfxstream

From: Gurchetan Singh <[email protected]>

Prior versions:

Changes since v11:
- Incorporated review feedback

How to build both rutabaga and gfxstream guest/host libs:

https://crosvm.dev/book/appendix/rutabaga_gfx.html

Branch containing this patch series (now on QEMU Gitlab):

https://gitlab.com/gurchetansingh/qemu/-/commits/qemu-gfxstream-v12

Antonio Caggiano (2):
virtio-gpu: CONTEXT_INIT feature
virtio-gpu: blob prep

Dr. David Alan Gilbert (1):
virtio: Add shared memory capability

Gerd Hoffmann (1):
virtio-gpu: hostmem

Gurchetan Singh (5):
gfxstream + rutabaga prep: added need defintions, fields, and options gfxstream + rutabaga: add initial support for gfxstream gfxstream + rutabaga: meson support
gfxstream + rutabaga: enable rutabaga
docs/system: add basic virtio-gpu documentation

 docs/system/device-emulation.rst     |    1 +
 docs/system/devices/virtio-gpu.rst   |  112 +++
 hw/display/meson.build               |   22 +
 hw/display/virtio-gpu-base.c         |    6 +-
 hw/display/virtio-gpu-pci-rutabaga.c |   47 ++
 hw/display/virtio-gpu-pci.c          |   14 +
 hw/display/virtio-gpu-rutabaga.c     | 1119 ++++++++++++++++++++++++++
 hw/display/virtio-gpu.c              |   16 +-
 hw/display/virtio-vga-rutabaga.c     |   50 ++
 hw/display/virtio-vga.c              |   33 +-
 hw/virtio/virtio-pci.c               |   18 +
 include/hw/virtio/virtio-gpu-bswap.h |   15 +
 include/hw/virtio/virtio-gpu.h       |   41 +
 include/hw/virtio/virtio-pci.h       |    4 +
 meson.build                          |    7 +
 meson_options.txt                    |    2 +
 scripts/meson-buildoptions.sh        |    3 +
 softmmu/qdev-monitor.c               |    3 +
 softmmu/vl.c                         |    1 +
 19 files changed, 1495 insertions(+), 19 deletions(-)
 create mode 100644 docs/system/devices/virtio-gpu.rst
 create mode 100644 hw/display/virtio-gpu-pci-rutabaga.c
 create mode 100644 hw/display/virtio-gpu-rutabaga.c
 create mode 100644 hw/display/virtio-vga-rutabaga.c
Signature · 1 line
2.42.0.rc2.253.gd59a3bf2b4-goog
#1 lore raw

PATCH v12 1/9 virtio: Add shared memory capability

From: "Dr. David Alan Gilbert" <[email protected]>

Define a new capability type 'VIRTIO_PCI_CAP_SHARED_MEMORY_CFG' to allow defining shared memory regions with sizes and offsets of 2^32 and more. Multiple instances of the capability are allowed and distinguished by a device-specific 'id'.

---
 hw/virtio/virtio-pci.c         | 18 ++++++++++++++++++
 include/hw/virtio/virtio-pci.h |  4 ++++
 2 files changed, 22 insertions(+)
hw/virtio/virtio-pci.c +18 -0
index edbc0daa18..da8c9ea12d 100644
@@ -1435,6 +1435,24 @@ static int virtio_pci_add_mem_cap(VirtIOPCIProxy *proxy,
     return offset;
 }
 
+int virtio_pci_add_shm_cap(VirtIOPCIProxy *proxy,
+                           uint8_t bar, uint64_t offset, uint64_t length,
+                           uint8_t id)
+{
+    struct virtio_pci_cap64 cap = {
+        .cap.cap_len = sizeof cap,
+        .cap.cfg_type = VIRTIO_PCI_CAP_SHARED_MEMORY_CFG,
+    };
+
+    cap.cap.bar = bar;
+    cap.cap.length = cpu_to_le32(length);
+    cap.length_hi = cpu_to_le32(length >> 32);
+    cap.cap.offset = cpu_to_le32(offset);
+    cap.offset_hi = cpu_to_le32(offset >> 32);
+    cap.cap.id = id;
+    return virtio_pci_add_mem_cap(proxy, &cap.cap);
+}
+
 static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr,
                                        unsigned size)
 {
include/hw/virtio/virtio-pci.h +4 -0
index ab2051b64b..5a3f182f99 100644
@@ -264,4 +264,8 @@ unsigned virtio_pci_optimal_num_queues(unsigned fixed_queues);
 void virtio_pci_set_guest_notifier_fd_handler(VirtIODevice *vdev, VirtQueue *vq,
                                               int n, bool assign,
                                               bool with_irqfd);
+
+int virtio_pci_add_shm_cap(VirtIOPCIProxy *proxy, uint8_t bar, uint64_t offset,
+                           uint64_t length, uint8_t id);
+
 #endif
Signature · 1 line
2.42.0.rc2.253.gd59a3bf2b4-goog
#2 lore raw

PATCH v12 2/9 virtio-gpu: CONTEXT_INIT feature

In reply to Gurchetan Singh

From: Antonio Caggiano <[email protected]>

The feature can be enabled when a backend wants it.

---
 hw/display/virtio-gpu-base.c   | 3 +++
 include/hw/virtio/virtio-gpu.h | 3 +++
 2 files changed, 6 insertions(+)
hw/display/virtio-gpu-base.c +3 -0
index ca1fb7b16f..4f2b0ba1f3 100644
@@ -232,6 +232,9 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, uint64_t features,
     if (virtio_gpu_blob_enabled(g->conf)) {
         features |= (1 << VIRTIO_GPU_F_RESOURCE_BLOB);
     }
+    if (virtio_gpu_context_init_enabled(g->conf)) {
+        features |= (1 << VIRTIO_GPU_F_CONTEXT_INIT);
+    }
 
     return features;
 }
include/hw/virtio/virtio-gpu.h +3 -0
index 390c4642b8..8377c365ef 100644
@@ -93,6 +93,7 @@ enum virtio_gpu_base_conf_flags {
     VIRTIO_GPU_FLAG_EDID_ENABLED,
     VIRTIO_GPU_FLAG_DMABUF_ENABLED,
     VIRTIO_GPU_FLAG_BLOB_ENABLED,
+    VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED,
 };
 
 #define virtio_gpu_virgl_enabled(_cfg) \
@@ -105,6 +106,8 @@ enum virtio_gpu_base_conf_flags {
     (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DMABUF_ENABLED))
 #define virtio_gpu_blob_enabled(_cfg) \
     (_cfg.flags & (1 << VIRTIO_GPU_FLAG_BLOB_ENABLED))
+#define virtio_gpu_context_init_enabled(_cfg) \
+    (_cfg.flags & (1 << VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED))
 
 struct virtio_gpu_base_conf {
     uint32_t max_outputs;
Signature · 1 line
2.42.0.rc2.253.gd59a3bf2b4-goog
#3 lore raw

PATCH v12 3/9 virtio-gpu: hostmem

In reply to Gurchetan Singh

From: Gerd Hoffmann <[email protected]>

Use VIRTIO_GPU_SHM_ID_HOST_VISIBLE as id for virtio-gpu.

---
 hw/display/virtio-gpu-pci.c    | 14 ++++++++++++++
 hw/display/virtio-gpu.c        |  1 +
 hw/display/virtio-vga.c        | 33 ++++++++++++++++++++++++---------
 include/hw/virtio/virtio-gpu.h |  5 +++++
 4 files changed, 44 insertions(+), 9 deletions(-)
hw/display/virtio-gpu-pci.c +14 -0
index 93f214ff58..da6a99f038 100644
@@ -33,6 +33,20 @@ static void virtio_gpu_pci_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
     DeviceState *vdev = DEVICE(g);
     int i;
 
+    if (virtio_gpu_hostmem_enabled(g->conf)) {
+        vpci_dev->msix_bar_idx = 1;
+        vpci_dev->modern_mem_bar_idx = 2;
+        memory_region_init(&g->hostmem, OBJECT(g), "virtio-gpu-hostmem",
+                           g->conf.hostmem);
+        pci_register_bar(&vpci_dev->pci_dev, 4,
+                         PCI_BASE_ADDRESS_SPACE_MEMORY |
+                         PCI_BASE_ADDRESS_MEM_PREFETCH |
+                         PCI_BASE_ADDRESS_MEM_TYPE_64,
+                         &g->hostmem);
+        virtio_pci_add_shm_cap(vpci_dev, 4, 0, g->conf.hostmem,
+                               VIRTIO_GPU_SHM_ID_HOST_VISIBLE);
+    }
+
     virtio_pci_force_virtio_1(vpci_dev);
     if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) {
         return;
hw/display/virtio-gpu.c +1 -0
index bbd5c6561a..48ef0d9fad 100644
@@ -1509,6 +1509,7 @@ static Property virtio_gpu_properties[] = {
                      256 * MiB),
     DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags,
                     VIRTIO_GPU_FLAG_BLOB_ENABLED, false),
+    DEFINE_PROP_SIZE("hostmem", VirtIOGPU, parent_obj.conf.hostmem, 0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
hw/display/virtio-vga.c +24 -9
index e6fb0aa876..c8552ff760 100644
@@ -115,17 +115,32 @@ static void virtio_vga_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
     pci_register_bar(&vpci_dev->pci_dev, 0,
                      PCI_BASE_ADDRESS_MEM_PREFETCH, &vga->vram);
 
-    /*
-     * Configure virtio bar and regions
-     *
-     * We use bar #2 for the mmio regions, to be compatible with stdvga.
-     * virtio regions are moved to the end of bar #2, to make room for
-     * the stdvga mmio registers at the start of bar #2.
-     */
-    vpci_dev->modern_mem_bar_idx = 2;
-    vpci_dev->msix_bar_idx = 4;
     vpci_dev->modern_io_bar_idx = 5;
 
+    if (!virtio_gpu_hostmem_enabled(g->conf)) {
+        /*
+         * Configure virtio bar and regions
+         *
+         * We use bar #2 for the mmio regions, to be compatible with stdvga.
+         * virtio regions are moved to the end of bar #2, to make room for
+         * the stdvga mmio registers at the start of bar #2.
+         */
+        vpci_dev->modern_mem_bar_idx = 2;
+        vpci_dev->msix_bar_idx = 4;
+    } else {
+        vpci_dev->msix_bar_idx = 1;
+        vpci_dev->modern_mem_bar_idx = 2;
+        memory_region_init(&g->hostmem, OBJECT(g), "virtio-gpu-hostmem",
+                           g->conf.hostmem);
+        pci_register_bar(&vpci_dev->pci_dev, 4,
+                         PCI_BASE_ADDRESS_SPACE_MEMORY |
+                         PCI_BASE_ADDRESS_MEM_PREFETCH |
+                         PCI_BASE_ADDRESS_MEM_TYPE_64,
+                         &g->hostmem);
+        virtio_pci_add_shm_cap(vpci_dev, 4, 0, g->conf.hostmem,
+                               VIRTIO_GPU_SHM_ID_HOST_VISIBLE);
+    }
+
     if (!(vpci_dev->flags & VIRTIO_PCI_FLAG_PAGE_PER_VQ)) {
         /*
          * with page-per-vq=off there is no padding space we can use
include/hw/virtio/virtio-gpu.h +5 -0
index 8377c365ef..de4f624e94 100644
@@ -108,12 +108,15 @@ enum virtio_gpu_base_conf_flags {
     (_cfg.flags & (1 << VIRTIO_GPU_FLAG_BLOB_ENABLED))
 #define virtio_gpu_context_init_enabled(_cfg) \
     (_cfg.flags & (1 << VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED))
+#define virtio_gpu_hostmem_enabled(_cfg) \
+    (_cfg.hostmem > 0)
 
 struct virtio_gpu_base_conf {
     uint32_t max_outputs;
     uint32_t flags;
     uint32_t xres;
     uint32_t yres;
+    uint64_t hostmem;
 };
 
 struct virtio_gpu_ctrl_command {
@@ -137,6 +140,8 @@ struct VirtIOGPUBase {
     int renderer_blocked;
     int enable;
 
+    MemoryRegion hostmem;
+
     struct virtio_gpu_scanout scanout[VIRTIO_GPU_MAX_SCANOUTS];
 
     int enabled_output_bitmask;
Signature · 1 line
2.42.0.rc2.253.gd59a3bf2b4-goog
#4 lore raw

PATCH v12 4/9 virtio-gpu: blob prep

In reply to Gurchetan Singh

From: Antonio Caggiano <[email protected]>

This adds preparatory functions needed to:

- decode blob cmds
- tracking iovecs

---
 hw/display/virtio-gpu.c              | 10 +++-------
 include/hw/virtio/virtio-gpu-bswap.h | 15 +++++++++++++++
 include/hw/virtio/virtio-gpu.h       |  5 +++++
 3 files changed, 23 insertions(+), 7 deletions(-)
hw/display/virtio-gpu.c +3 -7
index 48ef0d9fad..3e658f1fef 100644
@@ -33,15 +33,11 @@
 
 #define VIRTIO_GPU_VM_VERSION 1
 
-static struct virtio_gpu_simple_resource*
-virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id);
 static struct virtio_gpu_simple_resource *
 virtio_gpu_find_check_resource(VirtIOGPU *g, uint32_t resource_id,
                                bool require_backing,
                                const char *caller, uint32_t *error);
 
-static void virtio_gpu_cleanup_mapping(VirtIOGPU *g,
-                                       struct virtio_gpu_simple_resource *res);
 static void virtio_gpu_reset_bh(void *opaque);
 
 void virtio_gpu_update_cursor_data(VirtIOGPU *g,
@@ -116,7 +112,7 @@ static void update_cursor(VirtIOGPU *g, struct virtio_gpu_update_cursor *cursor)
                   cursor->resource_id ? 1 : 0);
 }
 
-static struct virtio_gpu_simple_resource *
+struct virtio_gpu_simple_resource *
 virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id)
 {
     struct virtio_gpu_simple_resource *res;
@@ -904,8 +900,8 @@ void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g,
     g_free(iov);
 }
 
-static void virtio_gpu_cleanup_mapping(VirtIOGPU *g,
-                                       struct virtio_gpu_simple_resource *res)
+void virtio_gpu_cleanup_mapping(VirtIOGPU *g,
+                                struct virtio_gpu_simple_resource *res)
 {
     virtio_gpu_cleanup_mapping_iov(g, res->iov, res->iov_cnt);
     res->iov = NULL;
include/hw/virtio/virtio-gpu-bswap.h +15 -0
index 637a0585d0..dd1975e2d4 100644
@@ -70,6 +70,21 @@ virtio_gpu_create_blob_bswap(struct virtio_gpu_resource_create_blob *cblob)
     le64_to_cpus(&cblob->size);
 }
 
+static inline void
+virtio_gpu_map_blob_bswap(struct virtio_gpu_resource_map_blob *mblob)
+{
+    virtio_gpu_ctrl_hdr_bswap(&mblob->hdr);
+    le32_to_cpus(&mblob->resource_id);
+    le64_to_cpus(&mblob->offset);
+}
+
+static inline void
+virtio_gpu_unmap_blob_bswap(struct virtio_gpu_resource_unmap_blob *ublob)
+{
+    virtio_gpu_ctrl_hdr_bswap(&ublob->hdr);
+    le32_to_cpus(&ublob->resource_id);
+}
+
 static inline void
 virtio_gpu_scanout_blob_bswap(struct virtio_gpu_set_scanout_blob *ssb)
 {
include/hw/virtio/virtio-gpu.h +5 -0
index de4f624e94..55973e112f 100644
@@ -257,6 +257,9 @@ void virtio_gpu_base_fill_display_info(VirtIOGPUBase *g,
 void virtio_gpu_base_generate_edid(VirtIOGPUBase *g, int scanout,
                                    struct virtio_gpu_resp_edid *edid);
 /* virtio-gpu.c */
+struct virtio_gpu_simple_resource *
+virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id);
+
 void virtio_gpu_ctrl_response(VirtIOGPU *g,
                               struct virtio_gpu_ctrl_command *cmd,
                               struct virtio_gpu_ctrl_hdr *resp,
@@ -275,6 +278,8 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g,
                                   uint32_t *niov);
 void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g,
                                     struct iovec *iov, uint32_t count);
+void virtio_gpu_cleanup_mapping(VirtIOGPU *g,
+                                struct virtio_gpu_simple_resource *res);
 void virtio_gpu_process_cmdq(VirtIOGPU *g);
 void virtio_gpu_device_realize(DeviceState *qdev, Error **errp);
 void virtio_gpu_reset(VirtIODevice *vdev);
Signature · 1 line
2.42.0.rc2.253.gd59a3bf2b4-goog
#5 lore raw

PATCH v12 5/9 gfxstream + rutabaga prep: added need defintions, fields, and options

In reply to Gurchetan Singh

This modifies the common virtio-gpu.h file have the fields and defintions needed by gfxstream/rutabaga, by VirtioGpuRutabaga.

---
v1: void *rutabaga --> struct rutabaga *rutabaga (Akihiko)
have a separate rutabaga device instead of using GL device (Bernard)

v2: VirtioGpuRutabaga --> VirtIOGPURutabaga (Akihiko)
move MemoryRegionInfo into VirtIOGPURutabaga (Akihiko) remove 'ctx' field (Akihiko)
remove 'rutabaga_active'

v6: remove command from commit message, refer to docs instead (Manos)

v12: Drop unnecessary "struct" (Mark)

 include/hw/virtio/virtio-gpu.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
include/hw/virtio/virtio-gpu.h +28 -0
index 55973e112f..de06bcdba4 100644
@@ -38,6 +38,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPUGL, VIRTIO_GPU_GL)
 #define TYPE_VHOST_USER_GPU "vhost-user-gpu"
 OBJECT_DECLARE_SIMPLE_TYPE(VhostUserGPU, VHOST_USER_GPU)
 
+#define TYPE_VIRTIO_GPU_RUTABAGA "virtio-gpu-rutabaga-device"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPURutabaga, VIRTIO_GPU_RUTABAGA)
+
 struct virtio_gpu_simple_resource {
     uint32_t resource_id;
     uint32_t width;
@@ -94,6 +97,7 @@ enum virtio_gpu_base_conf_flags {
     VIRTIO_GPU_FLAG_DMABUF_ENABLED,
     VIRTIO_GPU_FLAG_BLOB_ENABLED,
     VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED,
+    VIRTIO_GPU_FLAG_RUTABAGA_ENABLED,
 };
 
 #define virtio_gpu_virgl_enabled(_cfg) \
@@ -108,6 +112,8 @@ enum virtio_gpu_base_conf_flags {
     (_cfg.flags & (1 << VIRTIO_GPU_FLAG_BLOB_ENABLED))
 #define virtio_gpu_context_init_enabled(_cfg) \
     (_cfg.flags & (1 << VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED))
+#define virtio_gpu_rutabaga_enabled(_cfg) \
+    (_cfg.flags & (1 << VIRTIO_GPU_FLAG_RUTABAGA_ENABLED))
 #define virtio_gpu_hostmem_enabled(_cfg) \
     (_cfg.hostmem > 0)
 
@@ -232,6 +238,28 @@ struct VhostUserGPU {
     bool backend_blocked;
 };
 
+#define MAX_SLOTS 4096
+
+struct MemoryRegionInfo {
+    int used;
+    MemoryRegion mr;
+    uint32_t resource_id;
+};
+
+struct rutabaga;
+
+struct VirtIOGPURutabaga {
+    VirtIOGPU parent_obj;
+
+    struct MemoryRegionInfo memory_regions[MAX_SLOTS];
+    char *capset_names;
+    char *wayland_socket_path;
+    char *wsi;
+    bool headless;
+    uint32_t num_capsets;
+    struct rutabaga *rutabaga;
+};
+
 #define VIRTIO_GPU_FILL_CMD(out) do {                                   \
         size_t s;                                                       \
         s = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0,          \
Signature · 1 line
2.42.0.rc2.253.gd59a3bf2b4-goog
#6 lore raw

PATCH v12 6/9 gfxstream + rutabaga: add initial support for gfxstream

In reply to Gurchetan Singh

This adds initial support for gfxstream and cross-domain. Both features rely on virtio-gpu blob resources and context types, which are also implemented in this patch.

gfxstream has a long and illustrious history in Android graphics paravirtualization. It has been powering graphics in the Android Studio Emulator for more than a decade, which is the main developer platform.

Originally conceived by Jesse Hall, it was first known as "EmuGL" [a]. The key design characteristic was a 1:1 threading model and auto-generation, which fit nicely with the OpenGLES spec. It also allowed easy layering with ANGLE on the host, which provides the GLES implementations on Windows or MacOS enviroments.

gfxstream has traditionally been maintained by a single engineer, and between 2015 to 2021, the goldfish throne passed to Frank Yang. Historians often remark this glorious reign ("pax gfxstreama" is the academic term) was comparable to that of Augustus and both Queen Elizabeths. Just to name a few accomplishments in a resplendent
panoply: higher versions of GLES, address space graphics, snapshot support and CTS compliant Vulkan [b].

One major drawback was the use of out-of-tree goldfish drivers. Android engineers didn't know much about DRM/KMS and especially TTM so a simple guest to host pipe was conceived.

Luckily, virtio-gpu 3D started to emerge in 2016 due to the work of the Mesa/virglrenderer communities. In 2018, the initial virtio-gpu port of gfxstream was done by Cuttlefish enthusiast Alistair Delva. It was a symbol compatible replacement of virglrenderer [c] and named "AVDVirglrenderer". This implementation forms the basis of the current gfxstream host implementation still in use today.

cross-domain support follows a similar arc. Originally conceived by Wayland aficionado David Reveman and crosvm enjoyer Zach Reizner in 2018, it initially relied on the downstream "virtio-wl" device.

In 2020 and 2021, virtio-gpu was extended to include blob resources and multiple timelines by yours truly, features gfxstream/cross-domain both require to function correctly.

Right now, we stand at the precipice of a truly fantastic possibility:
the Android Emulator powered by upstream QEMU and upstream Linux kernel. gfxstream will then be packaged properfully, and app developers can even fix gfxstream bugs on their own if they encounter them.

It's been quite the ride, my friends. Where will gfxstream head next, nobody really knows. I wouldn't be surprised if it's around for another decade, maintained by a new generation of Android graphics enthusiasts.

Technical details:
- Very simple initial display integration: just used Pixman
- Largely, 1:1 mapping of virtio-gpu hypercalls to rutabaga function calls

Next steps for Android VMs:
- The next step would be improving display integration and UI interfaces with the goal of the QEMU upstream graphics being in an emulator release [d].

Next steps for Linux VMs for display virtualization:
- For widespread distribution, someone needs to package Sommelier or the wayland-proxy-virtwl [e] ideally into Debian main. In addition, newer versions of the Linux kernel come with DRM_VIRTIO_GPU_KMS option, which allows disabling KMS hypercalls. If anyone cares enough, it'll probably be possible to build a custom VM variant that uses this display virtualization strategy.

[a] https://android-review.googlesource.com/c/platform/development/+/34470
[b] https://android-review.googlesource.com/q/topic:%22vulkan-hostconnection-start%22
[c] https://android-review.googlesource.com/c/device/generic/goldfish-opengl/+/761927
[d] https://developer.android.com/studio/releases/emulator
[e] https://github.com/talex5/wayland-proxy-virtwl

---
v1: Incorported various suggestions by Akihiko Odaki and Bernard Berschow
- Removed GET_VIRTIO_GPU_GL / GET_RUTABAGA macros
- Used error_report(..)
- Used g_autofree to fix leaks on error paths
- Removed unnecessary casts
- added virtio-gpu-pci-rutabaga.c + virtio-vga-rutabaga.c files

v2: Incorported various suggestions by Akihiko Odaki, Marc-André Lureau and
Bernard Berschow:
- Parenthesis in CHECK macro
- CHECK_RESULT(result, ..) --> CHECK(!result, ..)
- delay until g->parent_obj.enable = 1
- Additional cast fixes
- initialize directly in virtio_gpu_rutabaga_realize(..)
- add debug callback to hook into QEMU error's APIs

v3: Incorporated feedback from Akihiko Odaki and Alyssa Ross:
- Autodetect Wayland socket when not explicitly specified
- Fix map_blob error paths
- Add comment why we need both res and resource in create blob
- Cast and whitespace fixes
- Big endian check comes before virtio_gpu_rutabaga_init().
- VirtIOVGARUTABAGA --> VirtIOVGARutabaga

v4: Incorporated feedback from Akihiko Odaki and Alyssa Ross:
- Double checked all casts
- Remove unnecessary parenthesis
- Removed resource in create_blob
- Added comment about failure case
- Pass user-provided socket as-is
- Use stack variable rather than heap allocation
- Future-proofed map info API to give access flags as well

v5: Incorporated feedback from Akihiko Odaki:
- Check (ss.scanout_id < VIRTIO_GPU_MAX_SCANOUTS)
- Simplify num_capsets check
- Call cleanup mapping on error paths
- uint64_t --> void* for rutabaga_map(..)
- Removed unnecessary parenthesis
- Removed unnecessary cast
- #define UNIX_PATH_MAX sizeof((struct sockaddr_un) {}.sun_path)
- Reuse result variable

v6: Incorporated feedback from Akihiko Odaki:
- Remove unnecessary #ifndef
- Disable scanout when appropriate
- CHECK capset index within range outside loop
- Add capset_version

v7: Incorporated feedback from Akihiko Odaki:
- aio_bh_schedule_oneshot_full --> aio_bh_schedule_oneshot

v9: Incorportated feedback from Akihiko Odaki:
- Remove extra error_setg(..) after virtio_gpu_rutabaga_init(..)
- Add error_setg(..) after rutabaga_init(..)

v10: Incorportated feedback from Akihiko Odaki:
- error_setg(..) --> error_setg_errno(..) when appropriate
- virtio_gpu_rutabaga_init returns a bool instead of an int

v11: Incorportated feedback from Philippe Mathieu-Daudé:
- C-style /* */ comments and avoid // comments.
- GPL-2.0 --> GPL-2.0-or-later

v12: Incorportated feedback from Mark Cave-Ayland and Akihiko Odaki:
- Single line comment on the header
- Remove unnecessary typedefs
- DECLARE_INSTANCE_CHECKER --> OBJECT_DECLARE_SIMPLE_TYPE
- Add new blank line after "parent_obj" in QOM declarations
- Use DEFINE_TYPES() macro in virtio-gpu-pci-rutabaga.c + virtio-gpu-rutabaga.c, though left virtio-vga-rutabaga.c as-is
- Make owner field of MemoryRegion not null
- Don't access .parent_obj directly

 hw/display/virtio-gpu-pci-rutabaga.c |   47 ++
 hw/display/virtio-gpu-rutabaga.c     | 1119 ++++++++++++++++++++++++++
 hw/display/virtio-vga-rutabaga.c     |   50 ++
 3 files changed, 1216 insertions(+)
 create mode 100644 hw/display/virtio-gpu-pci-rutabaga.c
 create mode 100644 hw/display/virtio-gpu-rutabaga.c
 create mode 100644 hw/display/virtio-vga-rutabaga.c
hw/display/virtio-gpu-pci-rutabaga.c new file +47 -0
new file mode 100644
index 0000000000..c96729e198
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qemu/module.h"
+#include "hw/pci/pci.h"
+#include "hw/qdev-properties.h"
+#include "hw/virtio/virtio.h"
+#include "hw/virtio/virtio-bus.h"
+#include "hw/virtio/virtio-gpu-pci.h"
+#include "qom/object.h"
+
+#define TYPE_VIRTIO_GPU_RUTABAGA_PCI "virtio-gpu-rutabaga-pci"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPURutabagaPCI, VIRTIO_GPU_RUTABAGA_PCI)
+
+struct VirtIOGPURutabagaPCI {
+    VirtIOGPUPCIBase parent_obj;
+
+    VirtIOGPURutabaga vdev;
+};
+
+static void virtio_gpu_rutabaga_initfn(Object *obj)
+{
+    VirtIOGPURutabagaPCI *dev = VIRTIO_GPU_RUTABAGA_PCI(obj);
+
+    virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+                                TYPE_VIRTIO_GPU_RUTABAGA);
+    VIRTIO_GPU_PCI_BASE(obj)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
+}
+
+static const TypeInfo virtio_gpu_rutabaga_pci_info[] = {
+    {
+        .name = TYPE_VIRTIO_GPU_RUTABAGA_PCI,
+        .parent = TYPE_VIRTIO_GPU_PCI_BASE,
+        .instance_size = sizeof(VirtIOGPURutabagaPCI),
+        .instance_init = virtio_gpu_rutabaga_initfn,
+        .interfaces = (InterfaceInfo[]) {
+            { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        }
+    },
+};
+
+DEFINE_TYPES(virtio_gpu_rutabaga_pci_info)
+
+module_obj(TYPE_VIRTIO_GPU_RUTABAGA_PCI);
+module_kconfig(VIRTIO_PCI);
+module_dep("hw-display-virtio-gpu-pci");
hw/display/virtio-gpu-rutabaga.c new file +1119 -0

1,119 lines not on this page · raw message

hw/display/virtio-vga-rutabaga.c new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
2.42.0.rc2.253.gd59a3bf2b4-goog
#7 lore raw

PATCH v12 7/9 gfxstream + rutabaga: meson support

In reply to Gurchetan Singh

- Add meson detection of rutabaga_gfx
- Build virtio-gpu-rutabaga.c + associated vga/pci files when present

---
v3: Fix alignment issues (Akihiko)

 hw/display/meson.build        | 22 ++++++++++++++++++++++
 meson.build                   |  7 +++++++
 meson_options.txt             |  2 ++
 scripts/meson-buildoptions.sh |  3 +++
 4 files changed, 34 insertions(+)
hw/display/meson.build +22 -0
index 413ba4ab24..e362d625dd 100644
@@ -79,6 +79,13 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU')
                          if_true: [files('virtio-gpu-gl.c', 'virtio-gpu-virgl.c'), pixman, virgl])
     hw_display_modules += {'virtio-gpu-gl': virtio_gpu_gl_ss}
   endif
+
+  if rutabaga.found()
+    virtio_gpu_rutabaga_ss = ss.source_set()
+    virtio_gpu_rutabaga_ss.add(when: ['CONFIG_VIRTIO_GPU', rutabaga],
+                               if_true: [files('virtio-gpu-rutabaga.c'), pixman])
+    hw_display_modules += {'virtio-gpu-rutabaga': virtio_gpu_rutabaga_ss}
+  endif
 endif
 
 if config_all_devices.has_key('CONFIG_VIRTIO_PCI')
@@ -95,6 +102,12 @@ if config_all_devices.has_key('CONFIG_VIRTIO_PCI')
                              if_true: [files('virtio-gpu-pci-gl.c'), pixman])
     hw_display_modules += {'virtio-gpu-pci-gl': virtio_gpu_pci_gl_ss}
   endif
+  if rutabaga.found()
+    virtio_gpu_pci_rutabaga_ss = ss.source_set()
+    virtio_gpu_pci_rutabaga_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI', rutabaga],
+                                   if_true: [files('virtio-gpu-pci-rutabaga.c'), pixman])
+    hw_display_modules += {'virtio-gpu-pci-rutabaga': virtio_gpu_pci_rutabaga_ss}
+  endif
 endif
 
 if config_all_devices.has_key('CONFIG_VIRTIO_VGA')
@@ -113,6 +126,15 @@ if config_all_devices.has_key('CONFIG_VIRTIO_VGA')
   virtio_vga_gl_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'),
                                             if_false: files('acpi-vga-stub.c'))
   hw_display_modules += {'virtio-vga-gl': virtio_vga_gl_ss}
+
+  if rutabaga.found()
+    virtio_vga_rutabaga_ss = ss.source_set()
+    virtio_vga_rutabaga_ss.add(when: ['CONFIG_VIRTIO_VGA', rutabaga],
+                               if_true: [files('virtio-vga-rutabaga.c'), pixman])
+    virtio_vga_rutabaga_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'),
+                                                    if_false: files('acpi-vga-stub.c'))
+    hw_display_modules += {'virtio-vga-rutabaga': virtio_vga_rutabaga_ss}
+  endif
 endif
 
 system_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_lcdc.c'))
meson.build +7 -0
index 98e68ef0b1..293f388e53 100644
@@ -1069,6 +1069,12 @@ if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu
                                        dependencies: virgl))
   endif
 endif
+rutabaga = not_found
+if not get_option('rutabaga_gfx').auto() or have_system or have_vhost_user_gpu
+  rutabaga = dependency('rutabaga_gfx_ffi',
+                         method: 'pkg-config',
+                         required: get_option('rutabaga_gfx'))
+endif
 blkio = not_found
 if not get_option('blkio').auto() or have_block
   blkio = dependency('blkio',
@@ -4272,6 +4278,7 @@ summary_info += {'libtasn1':          tasn1}
 summary_info += {'PAM':               pam}
 summary_info += {'iconv support':     iconv}
 summary_info += {'virgl support':     virgl}
+summary_info += {'rutabaga support':  rutabaga}
 summary_info += {'blkio support':     blkio}
 summary_info += {'curl support':      curl}
 summary_info += {'Multipath support': mpathpersist}
meson_options.txt +2 -0
index aaea5ddd77..dea3bf7d9c 100644
@@ -224,6 +224,8 @@ option('vmnet', type : 'feature', value : 'auto',
        description: 'vmnet.framework network backend support')
 option('virglrenderer', type : 'feature', value : 'auto',
        description: 'virgl rendering support')
+option('rutabaga_gfx', type : 'feature', value : 'auto',
+       description: 'rutabaga_gfx support')
 option('png', type : 'feature', value : 'auto',
        description: 'PNG support with libpng')
 option('vnc', type : 'feature', value : 'auto',
scripts/meson-buildoptions.sh +3 -0
index 9da3fe299b..9a95b4f782 100644
@@ -154,6 +154,7 @@ meson_options_help() {
   printf "%s\n" '  rbd             Ceph block device driver'
   printf "%s\n" '  rdma            Enable RDMA-based migration'
   printf "%s\n" '  replication     replication support'
+  printf "%s\n" '  rutabaga-gfx    rutabaga_gfx support'
   printf "%s\n" '  sdl             SDL user interface'
   printf "%s\n" '  sdl-image       SDL Image support for icons'
   printf "%s\n" '  seccomp         seccomp support'
@@ -419,6 +420,8 @@ _meson_option_parse() {
     --disable-replication) printf "%s" -Dreplication=disabled ;;
     --enable-rng-none) printf "%s" -Drng_none=true ;;
     --disable-rng-none) printf "%s" -Drng_none=false ;;
+    --enable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=enabled ;;
+    --disable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=disabled ;;
     --enable-safe-stack) printf "%s" -Dsafe_stack=true ;;
     --disable-safe-stack) printf "%s" -Dsafe_stack=false ;;
     --enable-sanitizers) printf "%s" -Dsanitizers=true ;;
Signature · 1 line
2.42.0.rc2.253.gd59a3bf2b4-goog
#8 lore raw

PATCH v12 8/9 gfxstream + rutabaga: enable rutabaga

In reply to Gurchetan Singh

This change enables rutabaga to receive virtio-gpu-3d hypercalls when it is active.

---
v3: Whitespace fix (Akihiko)
v9: reorder virtio_gpu_have_udmabuf() after checking if rutabaga
is enabled to avoid spurious warnings (Akihiko)

 hw/display/virtio-gpu-base.c | 3 ++-
 hw/display/virtio-gpu.c      | 5 +++--
 softmmu/qdev-monitor.c       | 3 +++
 softmmu/vl.c                 | 1 +
 4 files changed, 9 insertions(+), 3 deletions(-)
hw/display/virtio-gpu-base.c +2 -1
index 4f2b0ba1f3..50c5373b65 100644
@@ -223,7 +223,8 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, uint64_t features,
 {
     VirtIOGPUBase *g = VIRTIO_GPU_BASE(vdev);
 
-    if (virtio_gpu_virgl_enabled(g->conf)) {
+    if (virtio_gpu_virgl_enabled(g->conf) ||
+        virtio_gpu_rutabaga_enabled(g->conf)) {
         features |= (1 << VIRTIO_GPU_F_VIRGL);
     }
     if (virtio_gpu_edid_enabled(g->conf)) {
hw/display/virtio-gpu.c +3 -2
index 3e658f1fef..fe094addef 100644
@@ -1361,8 +1361,9 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
     VirtIOGPU *g = VIRTIO_GPU(qdev);
 
     if (virtio_gpu_blob_enabled(g->parent_obj.conf)) {
-        if (!virtio_gpu_have_udmabuf()) {
-            error_setg(errp, "cannot enable blob resources without udmabuf");
+        if (!virtio_gpu_rutabaga_enabled(g->parent_obj.conf) &&
+            !virtio_gpu_have_udmabuf()) {
+            error_setg(errp, "need rutabaga or udmabuf for blob resources");
             return;
         }
 
softmmu/qdev-monitor.c +3 -0
index 74f4e41338..1b8005ae55 100644
@@ -86,6 +86,9 @@ static const QDevAlias qdev_alias_table[] = {
     { "virtio-gpu-pci", "virtio-gpu", QEMU_ARCH_VIRTIO_PCI },
     { "virtio-gpu-gl-device", "virtio-gpu-gl", QEMU_ARCH_VIRTIO_MMIO },
     { "virtio-gpu-gl-pci", "virtio-gpu-gl", QEMU_ARCH_VIRTIO_PCI },
+    { "virtio-gpu-rutabaga-device", "virtio-gpu-rutabaga",
+      QEMU_ARCH_VIRTIO_MMIO },
+    { "virtio-gpu-rutabaga-pci", "virtio-gpu-rutabaga", QEMU_ARCH_VIRTIO_PCI },
     { "virtio-input-host-device", "virtio-input-host", QEMU_ARCH_VIRTIO_MMIO },
     { "virtio-input-host-ccw", "virtio-input-host", QEMU_ARCH_VIRTIO_CCW },
     { "virtio-input-host-pci", "virtio-input-host", QEMU_ARCH_VIRTIO_PCI },
softmmu/vl.c +1 -0
index b0b96f67fa..2f98eefdf3 100644
@@ -216,6 +216,7 @@ static struct {
     { .driver = "ati-vga",              .flag = &default_vga       },
     { .driver = "vhost-user-vga",       .flag = &default_vga       },
     { .driver = "virtio-vga-gl",        .flag = &default_vga       },
+    { .driver = "virtio-vga-rutabaga",  .flag = &default_vga       },
 };
 
 static QemuOptsList qemu_rtc_opts = {
Signature · 1 line
2.42.0.rc2.253.gd59a3bf2b4-goog
Reviewed-by on v12 8/9
#9 lore raw

Re: [PATCH v12 8/9] gfxstream + rutabaga: enable rutabaga

Hi Gurchetan,

Thank you for this series and for including some of my patches :)

Quoted 37 lines · Gurchetan Singh

This change enables rutabaga to receive virtio-gpu-3d hypercalls when it is active.

---
v3: Whitespace fix (Akihiko)
v9: reorder virtio_gpu_have_udmabuf() after checking if rutabaga
is enabled to avoid spurious warnings (Akihiko)

  hw/display/virtio-gpu-base.c | 3 ++-
  hw/display/virtio-gpu.c      | 5 +++--
  softmmu/qdev-monitor.c       | 3 +++
  softmmu/vl.c                 | 1 +
  4 files changed, 9 insertions(+), 3 deletions(-)
hw/display/virtio-gpu-base.c +2 -1
index 4f2b0ba1f3..50c5373b65 100644
@@ -223,7 +223,8 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, uint64_t features,
  {
      VirtIOGPUBase *g = VIRTIO_GPU_BASE(vdev);
 
-    if (virtio_gpu_virgl_enabled(g->conf)) {
+    if (virtio_gpu_virgl_enabled(g->conf) ||
+        virtio_gpu_rutabaga_enabled(g->conf)) {
          features |= (1 << VIRTIO_GPU_F_VIRGL);
      }
      if (virtio_gpu_edid_enabled(g->conf)) {
hw/display/virtio-gpu.c +0 -0
index 3e658f1fef..fe094addef 100644

hw/display/virtio-gpu.c void virtio_gpu_device_realize(DeviceState *qdev, Error **errp) · line 1366

Quoted 8 lines
hw/display/virtio-gpu.c +3 -2
@@ -1361,8 +1361,9 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
      VirtIOGPU *g = VIRTIO_GPU(qdev);
 
      if (virtio_gpu_blob_enabled(g->parent_obj.conf)) {
-        if (!virtio_gpu_have_udmabuf()) {
-            error_setg(errp, "cannot enable blob resources without udmabuf");
+        if (!virtio_gpu_rutabaga_enabled(g->parent_obj.conf) &&
+            !virtio_gpu_have_udmabuf()) {
+            error_setg(errp, "need rutabaga or udmabuf for blob resources");

Does that mean udmabuf is not required at all when using rutabaga? How does rutabaga handle blob resources?

Quoted 22 lines
hw/display/virtio-gpu.c +0 -0
              return;
          }
 
softmmu/qdev-monitor.c +3 -0
index 74f4e41338..1b8005ae55 100644
@@ -86,6 +86,9 @@ static const QDevAlias qdev_alias_table[] = {
      { "virtio-gpu-pci", "virtio-gpu", QEMU_ARCH_VIRTIO_PCI },
      { "virtio-gpu-gl-device", "virtio-gpu-gl", QEMU_ARCH_VIRTIO_MMIO },
      { "virtio-gpu-gl-pci", "virtio-gpu-gl", QEMU_ARCH_VIRTIO_PCI },
+    { "virtio-gpu-rutabaga-device", "virtio-gpu-rutabaga",
+      QEMU_ARCH_VIRTIO_MMIO },
+    { "virtio-gpu-rutabaga-pci", "virtio-gpu-rutabaga", QEMU_ARCH_VIRTIO_PCI },
      { "virtio-input-host-device", "virtio-input-host", QEMU_ARCH_VIRTIO_MMIO },
      { "virtio-input-host-ccw", "virtio-input-host", QEMU_ARCH_VIRTIO_CCW },
      { "virtio-input-host-pci", "virtio-input-host", QEMU_ARCH_VIRTIO_PCI },
softmmu/vl.c +0 -0
index b0b96f67fa..2f98eefdf3 100644

softmmu/vl.c static struct { · line 222

Quoted 7 lines
softmmu/vl.c +1 -0
@@ -216,6 +216,7 @@ static struct {
      { .driver = "ati-vga",              .flag = &default_vga       },
      { .driver = "vhost-user-vga",       .flag = &default_vga       },
      { .driver = "virtio-vga-gl",        .flag = &default_vga       },
+    { .driver = "virtio-vga-rutabaga",  .flag = &default_vga       },
  };
 
  static QemuOptsList qemu_rtc_opts = {

Patches 5 to 9:

Cheers,
Antonio

#10 lore raw

Re: [PATCH v12 8/9] gfxstream + rutabaga: enable rutabaga

Quoted 49 lines · Antonio Caggiano

Hi Gurchetan,

Thank you for this series and for including some of my patches :)

hw/display/virtio-gpu-base.c virtio_gpu_base_get_features(VirtIODevice *vdev,

Quoted 23 lines · Gurchetan Singh

This change enables rutabaga to receive virtio-gpu-3d hypercalls when it is active.

---
v3: Whitespace fix (Akihiko)
v9: reorder virtio_gpu_have_udmabuf() after checking if rutabaga
is enabled to avoid spurious warnings (Akihiko)

  hw/display/virtio-gpu-base.c | 3 ++-
  hw/display/virtio-gpu.c      | 5 +++--
  softmmu/qdev-monitor.c       | 3 +++
  softmmu/vl.c                 | 1 +
  4 files changed, 9 insertions(+), 3 deletions(-)
hw/display/virtio-gpu-base.c +0 -0
index 4f2b0ba1f3..50c5373b65 100644
@@ -223,7 +223,8 @@ virtio_gpu_base_get_features(VirtIODevice *vdev,

uint64_t features,

hw/display/virtio-gpu.c void virtio_gpu_device_realize(DeviceState *qdev,

Quoted 14 lines
hw/display/virtio-gpu-base.c +2 -1
  {
      VirtIOGPUBase *g = VIRTIO_GPU_BASE(vdev);
 
-    if (virtio_gpu_virgl_enabled(g->conf)) {
+    if (virtio_gpu_virgl_enabled(g->conf) ||
+        virtio_gpu_rutabaga_enabled(g->conf)) {
          features |= (1 << VIRTIO_GPU_F_VIRGL);
      }
      if (virtio_gpu_edid_enabled(g->conf)) {
hw/display/virtio-gpu.c +0 -0
index 3e658f1fef..fe094addef 100644
@@ -1361,8 +1361,9 @@ void virtio_gpu_device_realize(DeviceState *qdev,

Error **errp)

hw/display/virtio-gpu.c void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)

Quoted 5 lines
hw/display/virtio-gpu.c +0 -2
      VirtIOGPU *g = VIRTIO_GPU(qdev);
 
      if (virtio_gpu_blob_enabled(g->parent_obj.conf)) {
-        if (!virtio_gpu_have_udmabuf()) {
-            error_setg(errp, "cannot enable blob resources without
Quoted 9 lines

udmabuf");

hw/display/virtio-gpu.c void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)

Quoted 3 lines
hw/display/virtio-gpu.c +3 -0
+        if (!virtio_gpu_rutabaga_enabled(g->parent_obj.conf) &&
+            !virtio_gpu_have_udmabuf()) {
+            error_setg(errp, "need rutabaga or udmabuf for blob

resources");

Does that mean udmabuf is not required at all when using rutabaga? How does rutabaga handle blob resources?

It's not required, since it's a Linux-only thing. Some use cases do prefer to use guest memory and we do have provisional support for that (see handle field of rutabaga_resource_create_blob). Though more testing is required on the target platform, and likely virtio-gpu spec changes for a full-functional solution.

Quoted 41 lines
Quoted 9 lines
hw/display/virtio-gpu.c +0 -0
              return;
          }
 
softmmu/qdev-monitor.c +0 -0
index 74f4e41338..1b8005ae55 100644

softmmu/qdev-monitor.c static const QDevAlias qdev_alias_table[] = { · line 91

Quoted 6 lines
softmmu/qdev-monitor.c +3 -0
@@ -86,6 +86,9 @@ static const QDevAlias qdev_alias_table[] = {
      { "virtio-gpu-pci", "virtio-gpu", QEMU_ARCH_VIRTIO_PCI },
      { "virtio-gpu-gl-device", "virtio-gpu-gl", QEMU_ARCH_VIRTIO_MMIO },
      { "virtio-gpu-gl-pci", "virtio-gpu-gl", QEMU_ARCH_VIRTIO_PCI },
+    { "virtio-gpu-rutabaga-device", "virtio-gpu-rutabaga",
+      QEMU_ARCH_VIRTIO_MMIO },
+    { "virtio-gpu-rutabaga-pci", "virtio-gpu-rutabaga",

QEMU_ARCH_VIRTIO_PCI },

softmmu/qdev-monitor.c static const QDevAlias qdev_alias_table[] = { · line 92

Quoted 1 line
softmmu/qdev-monitor.c +0 -0
      { "virtio-input-host-device", "virtio-input-host",

QEMU_ARCH_VIRTIO_MMIO },

softmmu/qdev-monitor.c static const QDevAlias qdev_alias_table[] = { · line 93

Quoted 1 line
softmmu/qdev-monitor.c +0 -0
      { "virtio-input-host-ccw", "virtio-input-host",

QEMU_ARCH_VIRTIO_CCW },

softmmu/qdev-monitor.c static const QDevAlias qdev_alias_table[] = { · line 94

Quoted 1 line
softmmu/qdev-monitor.c +0 -0
      { "virtio-input-host-pci", "virtio-input-host",

QEMU_ARCH_VIRTIO_PCI },

softmmu/vl.c static struct { · line 222

Quoted 12 lines
softmmu/vl.c +1 -0
index b0b96f67fa..2f98eefdf3 100644
@@ -216,6 +216,7 @@ static struct {
      { .driver = "ati-vga",              .flag = &default_vga       },
      { .driver = "vhost-user-vga",       .flag = &default_vga       },
      { .driver = "virtio-vga-gl",        .flag = &default_vga       },
+    { .driver = "virtio-vga-rutabaga",  .flag = &default_vga       },
  };
 
  static QemuOptsList qemu_rtc_opts = {

Patches 5 to 9:

Cheers,
Antonio

#11 lore raw

PATCH v12 9/9 docs/system: add basic virtio-gpu documentation

In reply to Gurchetan Singh

This adds basic documentation for virtio-gpu.

---
v2: - Incorporated suggestions by Akihiko Odaki
- Listed the currently supported capset_names (Bernard)

v3: - Incorporated suggestions by Akihiko Odaki and Alyssa Ross

v4: - Incorporated suggestions by Akihiko Odaki

v5: - Removed pci suffix from examples
- Verified that -device virtio-gpu-rutabaga works. Strangely enough, I don't remember changing anything, and I remember it not working. I did rebase to top of tree though.
- Fixed meson examples in crosvm docs

v8: - Remove different links for "rutabaga_gfx" and
"gfxstream-enabled rutabaga" (Akihiko)

v11: - Use GPL-2.0-or-later license (Phillippe)

 docs/system/device-emulation.rst   |   1 +
 docs/system/devices/virtio-gpu.rst | 112 +++++++++++++++++++++++++++++
 2 files changed, 113 insertions(+)
 create mode 100644 docs/system/devices/virtio-gpu.rst
docs/system/device-emulation.rst +1 -0
index 4491c4cbf7..1167f3a9f2 100644
@@ -91,6 +91,7 @@ Emulated Devices
    devices/nvme.rst
    devices/usb.rst
    devices/vhost-user.rst
+   devices/virtio-gpu.rst
    devices/virtio-pmem.rst
    devices/vhost-user-rng.rst
    devices/canokey.rst
docs/system/devices/virtio-gpu.rst new file +112 -0

112 lines not on this page · raw message

Signature · 1 line
2.42.0.rc2.253.gd59a3bf2b4-goog
Reviewed-by Tested-by on the v12 series
#12 lore raw
In reply to Gurchetan Singh
Quoted 52 lines · Gurchetan Singh

From: Gurchetan Singh <[email protected]>

Prior versions:

Changes since v11:
- Incorporated review feedback

How to build both rutabaga and gfxstream guest/host libs:

https://crosvm.dev/book/appendix/rutabaga_gfx.html

Branch containing this patch series (now on QEMU Gitlab):

https://gitlab.com/gurchetansingh/qemu/-/commits/qemu-gfxstream-v12

Antonio Caggiano (2):
virtio-gpu: CONTEXT_INIT feature
virtio-gpu: blob prep

Dr. David Alan Gilbert (1):
virtio: Add shared memory capability

Gerd Hoffmann (1):
virtio-gpu: hostmem

Gurchetan Singh (5):
gfxstream + rutabaga prep: added need defintions, fields, and options gfxstream + rutabaga: add initial support for gfxstream gfxstream + rutabaga: meson support
gfxstream + rutabaga: enable rutabaga
docs/system: add basic virtio-gpu documentation

  docs/system/device-emulation.rst     |    1 +
  docs/system/devices/virtio-gpu.rst   |  112 +++
  hw/display/meson.build               |   22 +
  hw/display/virtio-gpu-base.c         |    6 +-
  hw/display/virtio-gpu-pci-rutabaga.c |   47 ++
  hw/display/virtio-gpu-pci.c          |   14 +
  hw/display/virtio-gpu-rutabaga.c     | 1119 ++++++++++++++++++++++++++
  hw/display/virtio-gpu.c              |   16 +-
  hw/display/virtio-vga-rutabaga.c     |   50 ++
  hw/display/virtio-vga.c              |   33 +-
  hw/virtio/virtio-pci.c               |   18 +
  include/hw/virtio/virtio-gpu-bswap.h |   15 +
  include/hw/virtio/virtio-gpu.h       |   41 +
  include/hw/virtio/virtio-pci.h       |    4 +
  meson.build                          |    7 +
  meson_options.txt                    |    2 +
  scripts/meson-buildoptions.sh        |    3 +
  softmmu/qdev-monitor.c               |    3 +
  softmmu/vl.c                         |    1 +
  19 files changed, 1495 insertions(+), 19 deletions(-)
Quoted 5 lines

create mode 100644 docs/system/devices/virtio-gpu.rst create mode 100644 hw/display/virtio-gpu-pci-rutabaga.c create mode 100644 hw/display/virtio-gpu-rutabaga.c create mode 100644 hw/display/virtio-vga-rutabaga.c

Thanks for keeping working on this. For the entire series:

#13 lore raw
Quoted 59 lines · Akihiko Odaki
Quoted 52 lines · Gurchetan Singh

From: Gurchetan Singh <[email protected]>

Prior versions:

Changes since v11:
- Incorporated review feedback

How to build both rutabaga and gfxstream guest/host libs:

https://crosvm.dev/book/appendix/rutabaga_gfx.html

Branch containing this patch series (now on QEMU Gitlab):

https://gitlab.com/gurchetansingh/qemu/-/commits/qemu-gfxstream-v12

Antonio Caggiano (2):
virtio-gpu: CONTEXT_INIT feature
virtio-gpu: blob prep

Dr. David Alan Gilbert (1):
virtio: Add shared memory capability

Gerd Hoffmann (1):
virtio-gpu: hostmem

Gurchetan Singh (5):
gfxstream + rutabaga prep: added need defintions, fields, and options gfxstream + rutabaga: add initial support for gfxstream gfxstream + rutabaga: meson support
gfxstream + rutabaga: enable rutabaga
docs/system: add basic virtio-gpu documentation

  docs/system/device-emulation.rst     |    1 +
  docs/system/devices/virtio-gpu.rst   |  112 +++
  hw/display/meson.build               |   22 +
  hw/display/virtio-gpu-base.c         |    6 +-
  hw/display/virtio-gpu-pci-rutabaga.c |   47 ++
  hw/display/virtio-gpu-pci.c          |   14 +
  hw/display/virtio-gpu-rutabaga.c     | 1119 ++++++++++++++++++++++++++
  hw/display/virtio-gpu.c              |   16 +-
  hw/display/virtio-vga-rutabaga.c     |   50 ++
  hw/display/virtio-vga.c              |   33 +-
  hw/virtio/virtio-pci.c               |   18 +
  include/hw/virtio/virtio-gpu-bswap.h |   15 +
  include/hw/virtio/virtio-gpu.h       |   41 +
  include/hw/virtio/virtio-pci.h       |    4 +
  meson.build                          |    7 +
  meson_options.txt                    |    2 +
  scripts/meson-buildoptions.sh        |    3 +
  softmmu/qdev-monitor.c               |    3 +
  softmmu/vl.c                         |    1 +
  19 files changed, 1495 insertions(+), 19 deletions(-)
Quoted 5 lines

create mode 100644 docs/system/devices/virtio-gpu.rst create mode 100644 hw/display/virtio-gpu-pci-rutabaga.c create mode 100644 hw/display/virtio-gpu-rutabaga.c create mode 100644 hw/display/virtio-vga-rutabaga.c

Quoted 4 lines

Thanks for keeping working on this. For the entire series:

Awesome, thanks. I'll wait a few days for possible additional comments, otherwise I'll send out v13 with additional r-b tags.