diff mbox series

[v1,5/9] gfxstream + rutabaga prep: added need defintions, fields, and options

Message ID 20230711025649.708-6-gurchetansingh@chromium.org (mailing list archive)
State New, archived
Headers show
Series gfxstream + rutabaga_gfx | expand

Commit Message

Gurchetan Singh July 11, 2023, 2:56 a.m. UTC
This modifies the common virtio-gpu.h file have the fields and
defintions needed by gfxstream/rutabaga, by VirtioGpuRutabaga.

- a colon separated list of capset names, defined in the virtio spec
- a wayland socket path to enable guest Wayland passthrough

The command to run these would be:

-device virtio-vga-rutabaga,capset_names=gfxstream:cross-domain, \
        wayland_socket_path=/run/user/1000/wayland-0,hostmem=8G  \

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
---
v2: void *rutabaga --> struct rutabaga *rutabaga (Akihiko)
    have a separate rutabaga device instead of using GL device (Bernard)

 include/hw/virtio/virtio-gpu.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Akihiko Odaki July 12, 2023, 11:36 a.m. UTC | #1
On 2023/07/11 11:56, Gurchetan Singh wrote:
> This modifies the common virtio-gpu.h file have the fields and
> defintions needed by gfxstream/rutabaga, by VirtioGpuRutabaga.

s/VirtioGpuRutabaga/VirtIOGPURutabaga/g since VirtIOGPU is spelled this 
way everywhere else.

> 
> - a colon separated list of capset names, defined in the virtio spec
> - a wayland socket path to enable guest Wayland passthrough
> 
> The command to run these would be:
> 
> -device virtio-vga-rutabaga,capset_names=gfxstream:cross-domain, \
>          wayland_socket_path=/run/user/1000/wayland-0,hostmem=8G  \
> 
> Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
> ---
> v2: void *rutabaga --> struct rutabaga *rutabaga (Akihiko)
>      have a separate rutabaga device instead of using GL device (Bernard)
> 
>   include/hw/virtio/virtio-gpu.h | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
> 
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index 5927ca1864..5a1b15ccb9 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -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)
>   
> @@ -229,6 +235,21 @@ struct VhostUserGPU {
>       bool backend_blocked;
>   };
>   
> +struct rutabaga;
> +
> +struct VirtioGpuRutabaga {
> +    struct VirtIOGPU parent_obj;
> +
> +    bool rutabaga_active;
> +    char *capset_names;
> +    char *wayland_socket_path;
> +    char *wsi;
> +    bool headless;
> +    uint32_t num_capsets;
> +    struct rutabaga *rutabaga;
> +    AioContext *ctx;
> +};
> +
>   #define VIRTIO_GPU_FILL_CMD(out) do {                                   \
>           size_t s;                                                       \
>           s = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0,          \
diff mbox series

Patch

diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 5927ca1864..5a1b15ccb9 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -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)
 
@@ -229,6 +235,21 @@  struct VhostUserGPU {
     bool backend_blocked;
 };
 
+struct rutabaga;
+
+struct VirtioGpuRutabaga {
+    struct VirtIOGPU parent_obj;
+
+    bool rutabaga_active;
+    char *capset_names;
+    char *wayland_socket_path;
+    char *wsi;
+    bool headless;
+    uint32_t num_capsets;
+    struct rutabaga *rutabaga;
+    AioContext *ctx;
+};
+
 #define VIRTIO_GPU_FILL_CMD(out) do {                                   \
         size_t s;                                                       \
         s = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0,          \