qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@gmail.com>
To: Gurchetan Singh <gurchetansingh@chromium.org>, qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com, ray.huang@amd.com,
	alex.bennee@linaro.org, shentey@gmail.com, hi@alyssa.is,
	ernunes@redhat.com, manos.pitsidianakis@linaro.org,
	philmd@linaro.org
Subject: Re: [PATCH v11 6/9] gfxstream + rutabaga: add initial support for gfxstream
Date: Wed, 23 Aug 2023 18:59:19 +0900	[thread overview]
Message-ID: <a189be69-6dbb-451e-998c-d6d07e88c453@gmail.com> (raw)
In-Reply-To: <20230823012541.485-7-gurchetansingh@chromium.org>

On 2023/08/23 10:25, Gurchetan Singh wrote:
> 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
> 
> Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
> Tested-by: Alyssa Ross <hi@alyssa.is>
> Tested-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>
> Reviewed-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>
> ---
> 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
> 
>   hw/display/virtio-gpu-pci-rutabaga.c |   50 ++
>   hw/display/virtio-gpu-rutabaga.c     | 1121 ++++++++++++++++++++++++++
>   hw/display/virtio-vga-rutabaga.c     |   53 ++
>   3 files changed, 1224 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
> 
> diff --git a/hw/display/virtio-gpu-pci-rutabaga.c b/hw/display/virtio-gpu-pci-rutabaga.c
> new file mode 100644
> index 0000000000..311eff308a
> --- /dev/null
> +++ b/hw/display/virtio-gpu-pci-rutabaga.c
> @@ -0,0 +1,50 @@
> +/*
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */

For an one-line comment, just do:
/* SPDX-License-Identifier: GPL-2.0-or-later */


  reply	other threads:[~2023-08-23 10:00 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23  1:25 [PATCH v11 0/9] rutabaga_gfx + gfxstream Gurchetan Singh
2023-08-23  1:25 ` [PATCH v11 1/9] virtio: Add shared memory capability Gurchetan Singh
2023-08-23  1:25 ` [PATCH v11 2/9] virtio-gpu: CONTEXT_INIT feature Gurchetan Singh
2023-08-23  1:25 ` [PATCH v11 3/9] virtio-gpu: hostmem Gurchetan Singh
2023-08-23  1:25 ` [PATCH v11 4/9] virtio-gpu: blob prep Gurchetan Singh
2023-08-23  1:25 ` [PATCH v11 5/9] gfxstream + rutabaga prep: added need defintions, fields, and options Gurchetan Singh
2023-08-23  1:25 ` [PATCH v11 6/9] gfxstream + rutabaga: add initial support for gfxstream Gurchetan Singh
2023-08-23  9:59   ` Akihiko Odaki [this message]
2023-09-13 11:57   ` Bernhard Beschow
2023-09-14  4:38     ` Gurchetan Singh
2023-09-14  7:23       ` Bernhard Beschow
2023-09-15  2:38         ` Gurchetan Singh
2023-09-19 18:36           ` Bernhard Beschow
2023-09-19 22:07             ` Akihiko Odaki
2023-09-21 23:44               ` Gurchetan Singh
2023-09-22  2:41                 ` Akihiko Odaki
2023-09-29 15:06                 ` Bernhard Beschow
2023-09-30 10:28                   ` Thomas Huth
2023-10-09 11:18                     ` Markus Armbruster
2023-09-27 11:34             ` Thomas Huth
2023-09-27 12:33               ` Markus Armbruster
2023-08-23  1:25 ` [PATCH v11 7/9] gfxstream + rutabaga: meson support Gurchetan Singh
2023-08-23  1:25 ` [PATCH v11 8/9] gfxstream + rutabaga: enable rutabaga Gurchetan Singh
2023-08-23  1:25 ` [PATCH v11 9/9] docs/system: add basic virtio-gpu documentation Gurchetan Singh
2023-08-23 11:07 ` [PATCH v11 0/9] rutabaga_gfx + gfxstream Alyssa Ross
2023-08-24 23:56   ` Gurchetan Singh
2023-08-25  7:11     ` Alyssa Ross
2023-08-25 19:05       ` Gurchetan Singh
2023-08-25 19:29         ` Alyssa Ross
2023-08-25 19:37           ` Alyssa Ross
2023-08-29  0:43             ` Gurchetan Singh
2023-09-12  8:53               ` Alyssa Ross
2023-09-13  1:14                 ` Gurchetan Singh
2023-09-13 10:10                   ` Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a189be69-6dbb-451e-998c-d6d07e88c453@gmail.com \
    --to=akihiko.odaki@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=ernunes@redhat.com \
    --cc=gurchetansingh@chromium.org \
    --cc=hi@alyssa.is \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=ray.huang@amd.com \
    --cc=shentey@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).