From: Joelle van Dyne <j@getutm.app>
To: qemu-devel@nongnu.org
Cc: "Joelle van Dyne" <j@getutm.app>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
"Dmitry Osipenko" <dmitry.osipenko@collabora.com>
Subject: [PATCH RFC 4/7] virtio-gpu-virgl: update virglrenderer defines
Date: Tue, 2 Dec 2025 20:07:51 -0800 [thread overview]
Message-ID: <20251203040754.94487-5-j@getutm.app> (raw)
In-Reply-To: <20251203040754.94487-1-j@getutm.app>
In order to support additional native texture types, we need to update the
defines in virglrenderer. The changes are backwards compatible and so
builds should work with either the new version or the old version.
Signed-off-by: Joelle van Dyne <j@getutm.app>
---
hw/display/virtio-gpu-virgl.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index d0e6ad4b17..36c670f988 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -24,6 +24,8 @@
#include <virglrenderer.h>
+#define SUPPORTED_VIRGL_INFO_EXT_VERSION (1)
+
struct virtio_gpu_virgl_resource {
struct virtio_gpu_simple_resource base;
MemoryRegion *mr;
@@ -441,12 +443,30 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g,
memset(&ext, 0, sizeof(ext));
ret = virgl_renderer_resource_get_info_ext(ss.resource_id, &ext);
info = ext.base;
+ /* fallback to older version */
native = (ScanoutTextureNative){
.type = ext.d3d_tex2d ? SCANOUT_TEXTURE_NATIVE_TYPE_D3D :
SCANOUT_TEXTURE_NATIVE_TYPE_NONE,
.u.d3d_tex2d = ext.d3d_tex2d,
};
-#else
+#if VIRGL_RENDERER_RESOURCE_INFO_EXT_VERSION >= SUPPORTED_VIRGL_INFO_EXT_VERSION
+ if (ext.version >= VIRGL_RENDERER_RESOURCE_INFO_EXT_VERSION) {
+ switch (ext.native_type) {
+ case VIRGL_NATIVE_HANDLE_NONE:
+ case VIRGL_NATIVE_HANDLE_D3D_TEX2D: {
+ /* already handled above */
+ break;
+ }
+ default: {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "%s: unsupported native texture type %d\n",
+ __func__, ext.native_type);
+ break;
+ }
+ }
+ }
+#endif
+#else /* VIRGL_VERSION_MAJOR < 1 */
memset(&info, 0, sizeof(info));
ret = virgl_renderer_resource_get_info(ss.resource_id, &info);
#endif
@@ -1169,11 +1189,13 @@ int virtio_gpu_virgl_init(VirtIOGPU *g)
virtio_gpu_3d_cbs.get_egl_display = virgl_get_egl_display;
}
#endif
-#ifdef VIRGL_RENDERER_D3D11_SHARE_TEXTURE
if (qemu_egl_angle_native_device) {
+#if defined(VIRGL_RENDERER_NATIVE_SHARE_TEXTURE)
+ flags |= VIRGL_RENDERER_NATIVE_SHARE_TEXTURE;
+#elif defined(VIRGL_RENDERER_D3D11_SHARE_TEXTURE) && defined(WIN32)
flags |= VIRGL_RENDERER_D3D11_SHARE_TEXTURE;
- }
#endif
+ }
#if VIRGL_VERSION_MAJOR >= 1
if (virtio_gpu_venus_enabled(g->parent_obj.conf)) {
flags |= VIRGL_RENDERER_VENUS | VIRGL_RENDERER_RENDER_SERVER;
--
2.41.0
next prev parent reply other threads:[~2025-12-03 4:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-03 4:07 [PATCH RFC 0/7] virtio-gpu-virgl: introduce Venus support for macOS Joelle van Dyne
2025-12-03 4:07 ` [PATCH RFC 1/7] egl-helpers: store handle to native device Joelle van Dyne
2025-12-04 6:29 ` Akihiko Odaki
2025-12-03 4:07 ` [PATCH RFC 2/7] virtio-gpu-virgl: check page alignment of blob mapping Joelle van Dyne
2025-12-04 2:55 ` Akihiko Odaki
2025-12-04 4:01 ` Joelle van Dyne
2025-12-04 5:31 ` Akihiko Odaki
2025-12-11 4:09 ` Mohamed Mediouni
2025-12-03 4:07 ` [PATCH RFC 3/7] console: rename `d3d_tex2d` to `native` Joelle van Dyne
2025-12-04 6:40 ` Akihiko Odaki
2025-12-04 10:53 ` Marc-André Lureau
2025-12-03 4:07 ` Joelle van Dyne [this message]
2025-12-04 7:13 ` [PATCH RFC 4/7] virtio-gpu-virgl: update virglrenderer defines Akihiko Odaki
2025-12-04 10:57 ` Marc-André Lureau
2025-12-03 4:07 ` [PATCH RFC 5/7] virtio-gpu-virgl: support scanout of Metal textures Joelle van Dyne
2025-12-04 3:06 ` Akihiko Odaki
2025-12-03 4:07 ` [PATCH RFC 6/7] console: add cleanup callback for ScanoutTexture Joelle van Dyne
2025-12-04 6:23 ` Akihiko Odaki
2025-12-03 4:07 ` [PATCH RFC 7/7] virtio-gpu-virgl: add support for native blob scanout Joelle van Dyne
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=20251203040754.94487-5-j@getutm.app \
--to=j@getutm.app \
--cc=alex.bennee@linaro.org \
--cc=dmitry.osipenko@collabora.com \
--cc=mst@redhat.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=qemu-devel@nongnu.org \
/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).