virtio-gpu: enable Venus/Vulkan without OpenGL display
v5 cover virtio-gpu: enable Venus/Vulkan without OpenGL display
Decouple Venus from CONFIG_OPENGL so it works on hosts with no GL display (e.g. macOS with MoltenVK). 2D display commands fall back to pixman; 3D/Vulkan goes through the render server as usual.
v4 -> v5:
- Reorder patches: move header definitions (patch 2) before Venus decouple (patch 3) to fix bisect breakage (Kuan-Wei Chiu)
v3 -> v4:
- Rebased onto current master (conflict resolved in virtio-gpu.c with new upstream drm feature check)
- Split Linux header changes into dedicated patch (checkpatch)
- Fix line-over-80 warnings
- Resent as new top-level thread (Alex Bennée)
v2 -> v3:
- Rebased onto current master
- Fixed line-over-80 warnings
v1 -> v2:
- Remove hvf_get_map_granule() safety check (moved to hvf-map-granule)
- Extract GRAPHIC_FLAGS_VK into its own patch
- Fold standard-headers addition into blob_alignment patch
Lucas Amaral (4):
ui: introduce GRAPHIC_FLAGS_VK for Vulkan scanout
virtio-gpu: add VIRTIO_GPU_F_BLOB_ALIGNMENT header definitions
virtio-gpu: decouple Venus from CONFIG_OPENGL
virtio-gpu: advertise VIRTIO_GPU_F_BLOB_ALIGNMENT
hw/display/meson.build | 8 +- hw/display/virtio-gpu-base.c | 15 +++- hw/display/virtio-gpu-gl.c | 6 +- hw/display/virtio-gpu-virgl.c | 85 ++++++++++++++++++--- hw/display/virtio-gpu.c | 8 ++ include/standard-headers/linux/virtio_gpu.h | 6 ++ include/ui/console.h | 2 + ui/console.c | 7 ++ 8 files changed, 121 insertions(+), 16 deletions(-)
Signature · 1 line
2.52.0
PATCH v5 1/4 ui: introduce GRAPHIC_FLAGS_VK for Vulkan scanout
Define GRAPHIC_FLAGS_VK (bit 2) in the console flags for future Vulkan scanout support. The compatibility check currently returns an error indicating the feature is not yet implemented.
This prepares the display framework for direct Vulkan scanout alongside the existing GL and DMABUF paths.
--- include/ui/console.h | 2 ++ ui/console.c | 7 +++++++ 2 files changed, 9 insertions(+)
include/ui/console.h +2 -0
@@ -361,6 +361,8 @@ enum {GRAPHIC_FLAGS_GL =1 <<0 ,/* require a console/display with DMABUF import */ GRAPHIC_FLAGS_DMABUF =1 <<1 , +/* TODO: require a console/display with Vulkan scanout */ + GRAPHIC_FLAGS_VK = 1 << 2, }; typedef struct GraphicHwOps {
ui/console.c +7 -0
@@ -594,6 +594,13 @@ static bool console_compatible_with(QemuConsole *con,return false; } +if (flags &GRAPHIC_FLAGS_VK ) { +/* TODO: check for Vulkan scanout support in display backend */ +error_setg (errp, +"Vulkan scanout not yet implemented" ); +return false; + } +return true; }
Signature · 1 line
2.52.0
Re: [PATCH v5 1/4] ui: introduce GRAPHIC_FLAGS_VK for Vulkan scanout
Quoted 18 lines · Lucas Amaral
Define
GRAPHIC_FLAGS_VK(bit 2) in the console flags for future Vulkan scanout support. The compatibility check currently returns an error indicating the feature is not yet implemented.This prepares the display framework for direct Vulkan scanout alongside the existing GL and DMABUF paths.
Signed-off-by Lucas Amaral <[email protected]>--- include/ui/console.h | 2 ++ ui/console.c | 7 +++++++ 2 files changed, 9 insertions(+)include/ui/console.h +0
-0
include/ui/console.h enum { · line 364
Quoted 4 lines
include/ui/console.h +1
-0@@ -361,6 +361,8 @@ enum {GRAPHIC_FLAGS_GL =1 <<0 ,/* require a console/display with DMABUF import */ GRAPHIC_FLAGS_DMABUF = 1 << 1, +/* TODO: require a console/display with Vulkan scanout */
You can drop the TODO: here
Quoted 22 lines
include/ui/console.h +1
-0+ GRAPHIC_FLAGS_VK = 1 << 2, }; typedef struct GraphicHwOps {ui/console.c +7
-0@@ -594,6 +594,13 @@ static bool console_compatible_with(QemuConsole *con,return false; } +if (flags &GRAPHIC_FLAGS_VK ) { +/* TODO: check for Vulkan scanout support in display backend */ +error_setg (errp, +"Vulkan scanout not yet implemented" ); +return false; + } +return true; }
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v5 2/4 virtio-gpu: add VIRTIO_GPU_F_BLOB_ALIGNMENT header definitions
In reply to Lucas AmaralDefine VIRTIO_GPU_F_BLOB_ALIGNMENT (feature bit 5) and the blob_alignment field in virtio_gpu_config per the OASIS virtio specification.
--- include/standard-headers/linux/virtio_gpu.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/standard-headers/linux/virtio_gpu.h +6 -0
@@ -64,6 +64,11 @@* context_init and multiple timelines */ #define VIRTIO_GPU_F_CONTEXT_INIT 4 +/* +* VIRTIO_GPU_F_BLOB_ALIGNMENT: device advertises blob_alignment +* in virtio_gpu_config (OASIS virtio-spec feature bit 5) +*/ +#define VIRTIO_GPU_F_BLOB_ALIGNMENT 5enum virtio_gpu_ctrl_type {VIRTIO_GPU_UNDEFINED =0 ,
@@ -365,6 +370,7 @@ struct virtio_gpu_config {uint32_t events_clear;uint32_t num_scanouts;uint32_t num_capsets; +uint32_t blob_alignment; };/* simple formats for fbcon/X use */
Signature · 1 line
2.52.0
Re: [PATCH v5 2/4] virtio-gpu: add VIRTIO_GPU_F_BLOB_ALIGNMENT header definitions
Quoted 14 lines · Lucas Amaral
Define
VIRTIO_GPU_F_BLOB_ALIGNMENT(feature bit 5) and theblob_alignmentfield invirtio_gpu_configper the OASIS virtio specification.Signed-off-by Lucas Amaral <[email protected]>--- include/standard-headers/linux/virtio_gpu.h | 6 ++++++ 1 file changed, 6 insertions(+)include/standard-headers/linux/virtio_gpu.h +0
-0
include/standard-headers/linux/virtio_gpu.h line 71
Quoted 8 lines
include/standard-headers/linux/virtio_gpu.h +5
-0@@ -64,6 +64,11 @@* context_init and multiple timelines */ #define VIRTIO_GPU_F_CONTEXT_INIT 4 +/* +* VIRTIO_GPU_F_BLOB_ALIGNMENT: device advertises blob_alignment +* in virtio_gpu_config (OASIS virtio-spec feature bit 5) +*/ +#define VIRTIO_GPU_F_BLOB_ALIGNMENT 5
What kernel version does this symbol get added in? I can't see it in 7.0
Headers should be imported with the scripts/update-linux-headers.sh script, see 49f6b93d075 (linux-headers: Update to Linux v6.19-rc1) for an example.
Quoted 11 lines
include/standard-headers/linux/virtio_gpu.h +1
-0enum virtio_gpu_ctrl_type {VIRTIO_GPU_UNDEFINED =0 ,@@ -365,6 +370,7 @@ struct virtio_gpu_config {uint32_t events_clear;uint32_t num_scanouts;uint32_t num_capsets; +uint32_t blob_alignment; };/* simple formats for fbcon/X use */
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v5 3/4 virtio-gpu: decouple Venus from CONFIG_OPENGL
In reply to Lucas AmaralVenus (virtio-gpu Vulkan context) currently requires an OpenGL display backend due to build-time and runtime coupling. On macOS, no OpenGL display backend exists.
Remove the opengl.found() build requirement for the virtio-gpu-gl module; virglrenderer provides Venus independently of OpenGL.
Gate GL-specific code paths behind CONFIG_OPENGL and display_opengl:
- Only advertise VIRGL/VIRGL2 capsets when display_opengl is set
- Only pass VIRGL_RENDERER_NO_VIRGL when !display_opengl with Venus
- Null out GL context callbacks when no GL display is available
- Route 2D display commands to the software renderer (pixman) when Venus runs without GL (venus no-GL mode)
- Allow Venus to bypass the OpenGL display check at device realize
--- hw/display/meson.build | 8 ++-- hw/display/virtio-gpu-base.c | 15 ++++++- hw/display/virtio-gpu-gl.c | 6 ++- hw/display/virtio-gpu-virgl.c | 85 ++++++++++++++++++++++++++++++----- 4 files changed, 98 insertions(+), 16 deletions(-)
hw/display/meson.build +4 -4
@@ -76,9 +76,9 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU') virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-user-gpu.c')) hw_display_modules += {'virtio-gpu': virtio_gpu_ss} - if virgl.found() and opengl.found() + if virgl.found() virtio_gpu_gl_ss = ss.source_set() - virtio_gpu_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', virgl, opengl], + virtio_gpu_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', virgl], if_true: [files('virtio-gpu-gl.c', 'virtio-gpu-virgl.c'), pixman, virgl]) hw_display_modules += {'virtio-gpu-gl': virtio_gpu_gl_ss} endif
@@ -99,9 +99,9 @@ if config_all_devices.has_key('CONFIG_VIRTIO_PCI') if_true: files('vhost-user-gpu-pci.c')) hw_display_modules += {'virtio-gpu-pci': virtio_gpu_pci_ss} - if virgl.found() and opengl.found() + if virgl.found() virtio_gpu_pci_gl_ss = ss.source_set() - virtio_gpu_pci_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI', virgl, opengl], + virtio_gpu_pci_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI', virgl], if_true: [files('virtio-gpu-pci-gl.c'), pixman]) hw_display_modules += {'virtio-gpu-pci-gl': virtio_gpu_pci_gl_ss} endif
hw/display/virtio-gpu-base.c +14 -1
@@ -18,6 +18,7 @@#include "qapi/error.h" #include "qemu/error-report.h" #include "hw/display/edid.h" +#include "system/system.h" #include "trace.h" #include "qapi/qapi-types-virtio.h"
@@ -157,7 +158,18 @@ virtio_gpu_get_flags(void *opaque)VirtIOGPUBase *g = opaque;int flags =GRAPHIC_FLAGS_NONE ; -if (virtio_gpu_virgl_enabled (g->conf)) { +if (virtio_gpu_venus_enabled (g->conf)) { +/* TODO: set GRAPHIC_FLAGS_VK for direct Vulkan scanout */ + } + +/* +* TODO: virtio_gpu_virgl_enabled() checks VIRTIO_GPU_FLAG_VIRGL_ENABLED +* which is set for both OpenGL (VIRGL) and Vulkan (Venus) backends. +* This condition should ideally use a dedicated OpenGL-only flag. For +* now, display_opengl correctly gates GL scanout since Venus leaves it +* at 0. +*/ +if (virtio_gpu_virgl_enabled (g->conf) && display_opengl) { flags |=GRAPHIC_FLAGS_GL ; }
@@ -273,6 +285,7 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, uint64_t features, }if (virtio_gpu_blob_enabled (g->conf)) { features |= (1 <<VIRTIO_GPU_F_RESOURCE_BLOB ); + features |= (1 <<VIRTIO_GPU_F_BLOB_ALIGNMENT ); }if (virtio_gpu_context_init_enabled (g->conf)) { features |= (1 <<VIRTIO_GPU_F_CONTEXT_INIT );
hw/display/virtio-gpu-gl.c +5 -1
@@ -124,7 +124,9 @@ static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp)return ; } -if (!display_opengl) { +if (virtio_gpu_venus_enabled (g->parent_obj.conf)) { +/* Venus uses Vulkan in the render server, no GL needed */ + }else if (!display_opengl) {error_setg (errp,"The display backend does not have OpenGL support enabled" ); error_append_hint(errp,
@@ -245,4 +247,6 @@ static void virtio_register_types(void) type_init(virtio_register_types) module_dep("hw-display-virtio-gpu"); +#ifdef CONFIG_OPENGL module_dep ("ui-opengl" ); +#endif
hw/display/virtio-gpu-virgl.c +75 -10
137 lines not on this page · raw message
Signature · 1 line
2.52.0
Re: [PATCH v5 3/4] virtio-gpu: decouple Venus from CONFIG_OPENGL
Quoted 16 lines · Lucas Amaral
Venus (virtio-gpu Vulkan context) currently requires an OpenGL display backend due to build-time and runtime coupling. On macOS, no OpenGL display backend exists.
Remove the
opengl.found()build requirement for the virtio-gpu-gl module; virglrenderer provides Venus independently of OpenGL.Gate GL-specific code paths behind
CONFIG_OPENGLanddisplay_opengl:
- Only advertise VIRGL/VIRGL2 capsets whendisplay_openglis set
- Only passVIRGL_RENDERER_NO_VIRGLwhen !display_opengl with Venus
- Null out GL context callbacks when no GL display is available
- Route 2D display commands to the software renderer (pixman) when Venus runs without GL (venus no-GL mode)
- Allow Venus to bypass the OpenGL display check at device realizeSigned-off-by Lucas Amaral <[email protected]>
<snip>
Quoted 13 lines
hw/display/virtio-gpu-base.c +8
-1@@ -157,7 +158,18 @@ virtio_gpu_get_flags(void *opaque)VirtIOGPUBase *g = opaque;int flags =GRAPHIC_FLAGS_NONE ; -if (virtio_gpu_virgl_enabled (g->conf)) { +if (virtio_gpu_venus_enabled (g->conf)) { +/* TODO: set GRAPHIC_FLAGS_VK for direct Vulkan scanout */ + } + +/* +* TODO: virtio_gpu_virgl_enabled() checks VIRTIO_GPU_FLAG_VIRGL_ENABLED +* which is set for both OpenGL (VIRGL) and Vulkan (Venus) backends. +* This condition should ideally use a dedicated OpenGL-only
Quoted 1 line
flag.
Isn't this entirely in QEMU's control? The Venus flag is checked when needed and set by:
DEFINE_PROP_BIT("venus", VirtIOGPU, parent_obj.conf.flags,
VIRTIO_GPU_FLAG_VENUS_ENABLED, false),
So do we just need to define:
DEFINE_PROP_BIT("virgl", VirtIOGPU, parent_obj.conf.flags,
VIRTIO_GPU_FLAG_VIRGL_ENABLED, true),
and allow the user to squash it and drop the:
g->parent_obj.conf.flags |= (1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED);
I guess we need to drop the prop bit definition on platforms that can't support OpenGL?
Quoted 187 lines
For
hw/display/virtio-gpu-base.c +5
-0+* now, display_opengl correctly gates GL scanout since Venus leaves it +* at 0. +*/ +if (virtio_gpu_virgl_enabled (g->conf) && display_opengl) { flags |=GRAPHIC_FLAGS_GL ; }@@ -273,6 +285,7 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, uint64_t features, }if (virtio_gpu_blob_enabled (g->conf)) { features |= (1 <<VIRTIO_GPU_F_RESOURCE_BLOB ); + features |= (1 <<VIRTIO_GPU_F_BLOB_ALIGNMENT ); }if (virtio_gpu_context_init_enabled (g->conf)) { features |= (1 <<VIRTIO_GPU_F_CONTEXT_INIT );hw/display/virtio-gpu-gl.c +5
-1@@ -124,7 +124,9 @@ static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp)return ; } -if (!display_opengl) { +if (virtio_gpu_venus_enabled (g->parent_obj.conf)) { +/* Venus uses Vulkan in the render server, no GL needed */ + }else if (!display_opengl) {error_setg (errp,"The display backend does not have OpenGL support enabled" ); error_append_hint(errp,@@ -245,4 +247,6 @@ static void virtio_register_types(void) type_init(virtio_register_types) module_dep("hw-display-virtio-gpu"); +#ifdef CONFIG_OPENGL module_dep ("ui-opengl" ); +#endif hw/display/virtio-gpu-virgl.c +75
-10@@ -19,8 +19,10 @@#include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-gpu-bswap.h" #include "hw/virtio/virtio-gpu-pixman.h" - +#include "system/system.h" +#ifdef CONFIG_OPENGL #include "ui/egl-helpers.h" +#endif #include <virglrenderer.h> @@ -50,6 +52,16 @@ struct virtio_gpu_virgl_resource {void *map_fixed; }; +/* +* Venus no-GL mode: Venus is enabled but no OpenGL display is available. +* Display commands use software (pixman) rendering; Venus/3D commands +* go through the virglrenderer render server. +*/ +static bool virtio_gpu_venus_nogl (VirtIOGPU *g) +{ +return virtio_gpu_venus_enabled (g->parent_obj.conf) && !display_opengl; +} +static struct virtio_gpu_virgl_resource *virtio_gpu_virgl_find_resource (VirtIOGPU *g,uint32_t resource_id) {@@ -63,7 +75,7 @@ virtio_gpu_virgl_find_resource(VirtIOGPU *g, uint32_t resource_id) return container_of(res, struct virtio_gpu_virgl_resource, base); } -#if VIRGL_RENDERER_CALLBACKS_VERSION >=4 +#if VIRGL_RENDERER_CALLBACKS_VERSION >=4 && defined(CONFIG_OPENGL )static void * virgl_get_egl_display(G_GNUC_UNUSED void *cookie) {@@ -1032,6 +1044,45 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,VIRTIO_GPU_FILL_CMD (cmd->cmd_hdr); +/* +* Venus no-GL mode: route 2D display commands to the base software +* renderer (pixman). The guest kernel always uses 2D commands for +* display framebuffers even with VIRGL enabled; Venus/3D commands +* go through the virglrenderer render server as usual. +*/ +if (virtio_gpu_venus_nogl (g)) { +switch (cmd->cmd_hdr.type) { +case VIRTIO_GPU_CMD_RESOURCE_CREATE_2D : +case VIRTIO_GPU_CMD_SET_SCANOUT : +case VIRTIO_GPU_CMD_RESOURCE_FLUSH : +case VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D : +case VIRTIO_GPU_CMD_GET_DISPLAY_INFO : +case VIRTIO_GPU_CMD_GET_EDID : +virtio_gpu_simple_process_cmd (g, cmd); +return ; +case VIRTIO_GPU_CMD_RESOURCE_UNREF : +case VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING : +case VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING : { +/* +* Both 2D (simple) and blob (virgl) resources share g->reslist. +* Check if virglrenderer owns the resource to pick +* the right handler. +*/ +struct virtio_gpu_resource_unref hdr; +struct virgl_renderer_resource_info info; +VIRTIO_GPU_FILL_CMD (hdr); +if (virgl_renderer_resource_get_info (hdr.resource_id, &info)) { +/* Not in virglrenderer — it's a 2D software resource */ +virtio_gpu_simple_process_cmd (g, cmd); +return ; + } +break ;/* virglrenderer owns it — fall through */ + } +default : +break ; + } + } +virgl_renderer_force_ctx_0 ();switch (cmd->cmd_hdr.type) {case VIRTIO_GPU_CMD_CTX_CREATE :@@ -1433,6 +1484,7 @@ static int virtio_gpu_virgl_init(VirtIOGPU *g)uint32_t flags =0 ;VirtIOGPUGL *gl =VIRTIO_GPU_GL (g); +#ifdef CONFIG_OPENGL #if VIRGL_RENDERER_CALLBACKS_VERSION >= 4 if (qemu_egl_display) { virtio_gpu_3d_cbs.version = 4;@@ -1450,9 +1502,14 @@ static int virtio_gpu_virgl_init(VirtIOGPU *g) flags |=VIRGL_RENDERER_D3D11_SHARE_TEXTURE ; }#endif +#endif /* CONFIG_OPENGL */ #if VIRGL_VERSION_MAJOR >=1 if (virtio_gpu_venus_enabled (g->parent_obj.conf)) { - flags |=VIRGL_RENDERER_VENUS |VIRGL_RENDERER_RENDER_SERVER ; + flags |=VIRGL_RENDERER_VENUS + |VIRGL_RENDERER_RENDER_SERVER ; +if (!display_opengl) { + flags |=VIRGL_RENDERER_NO_VIRGL ; + } }if (virtio_gpu_drm_enabled (g->parent_obj.conf)) { flags |=VIRGL_RENDERER_DRM ;@@ -1475,6 +1532,12 @@ static int virtio_gpu_virgl_init(VirtIOGPU *g) }#endif +if (!display_opengl) { + virtio_gpu_3d_cbs.create_gl_context =NULL ; + virtio_gpu_3d_cbs.destroy_gl_context =NULL ; + virtio_gpu_3d_cbs.make_current =NULL ; + } + ret =virgl_renderer_init (g, flags, &virtio_gpu_3d_cbs);if (ret !=0 ) {error_report ("virgl could not be initialized: %d" , ret);@@ -1546,14 +1609,16 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g) capset_ids =g_array_new (false, false,sizeof (uint32_t )); -/* VIRGL is always supported. */ -virtio_gpu_virgl_add_capset (capset_ids,VIRTIO_GPU_CAPSET_VIRGL ); +/* OpenGL: VIRGL/VIRGL2 require a GL display backend */ +if (display_opengl) { +virtio_gpu_virgl_add_capset (capset_ids,VIRTIO_GPU_CAPSET_VIRGL ); -virgl_renderer_get_cap_set (VIRTIO_GPU_CAPSET_VIRGL2 , - &capset_max_ver, - &capset_max_size); -if (capset_max_ver) { -virtio_gpu_virgl_add_capset (capset_ids,VIRTIO_GPU_CAPSET_VIRGL2 ); +virgl_renderer_get_cap_set (VIRTIO_GPU_CAPSET_VIRGL2 , + &capset_max_ver, + &capset_max_size); +if (capset_max_ver) { +virtio_gpu_virgl_add_capset (capset_ids,VIRTIO_GPU_CAPSET_VIRGL2 ); + } }if (virtio_gpu_venus_enabled (g->parent_obj.conf)) {
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Re: [PATCH v5 3/4] virtio-gpu: decouple Venus from CONFIG_OPENGL
Quoted 11 lines · Alex Bennée
Isn't this entirely in QEMU's control? The Venus flag is checked when needed and set by:
DEFINE_PROP_BIT("venus", VirtIOGPU, parent_obj.conf.flags,
VIRTIO_GPU_FLAG_VENUS_ENABLED, false),So do we just need to define:
DEFINE_PROP_BIT("virgl", VirtIOGPU, parent_obj.conf.flags,
VIRTIO_GPU_FLAG_VIRGL_ENABLED, true),
Quoted 6 lines
and allow the user to squash it and drop the:
g->parent_obj.conf.flags |= (1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED);I guess we need to drop the prop bit definition on platforms that can't support OpenGL?
Agreed -- making "virgl=on" a real OpenGL-only property bit, distinct from "venus=on" and no longer implicitly forced on whenever virglrenderer is initialized, is the right shape. Both TODOs in virtio_gpu_get_flags() resolve cleanly: the GL scanout test becomes a pure property check (no display_opengl runtime crutch), and the GRAPHIC_FLAGS_VK slot for Venus direct Vulkan scanout becomes a one-liner once a Vulkan-scanout path exists.
My hesitation on folding it into this series is scope:VIRTIO_GPU_FLAG_VIRGL_ENABLED is currently forced on whenever virglrenderer is initialized (including Venus-only configs), so the cleanup touches property defaults and existing user expectations (virgl=on,venus=on vs venus=on only) -- probably wants its own changelog and review, somewhat outside the no-GL plumbing this series is about. I'd prefer to land this series as-is and follow up with a dedicated "split virgl/venus property bits" series afterwards.
That said, if you'd rather see the split as a prep patch at the front of v6, happy to do it that way -- your call.
Thanks,
Lucas
Re: [PATCH v5 3/4] virtio-gpu: decouple Venus from CONFIG_OPENGL
Quoted 28 lines · Lucas Amaral
Quoted 11 lines · Alex Bennée
Isn't this entirely in QEMU's control? The Venus flag is checked when needed and set by:
DEFINE_PROP_BIT("venus", VirtIOGPU, parent_obj.conf.flags,
VIRTIO_GPU_FLAG_VENUS_ENABLED, false),So do we just need to define:
DEFINE_PROP_BIT("virgl", VirtIOGPU, parent_obj.conf.flags,
VIRTIO_GPU_FLAG_VIRGL_ENABLED, true),Quoted 6 lines
and allow the user to squash it and drop the:
g->parent_obj.conf.flags |= (1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED);I guess we need to drop the prop bit definition on platforms that can't support OpenGL?
Agreed -- making "virgl=on" a real OpenGL-only property bit, distinct from "venus=on" and no longer implicitly forced on whenever virglrenderer is initialized, is the right shape. Both TODOs in
virtio_gpu_get_flags()resolve cleanly: the GL scanout test becomes a pure property check (nodisplay_openglruntime crutch), and theGRAPHIC_FLAGS_VKslot for Venus direct Vulkan scanout becomes a one-liner once a Vulkan-scanout path exists.
Quoted 3 lines
My hesitation on folding it into this series is scope:
VIRTIO_GPU_FLAG_VIRGL_ENABLEDis currently forced on whenever virglrenderer is initialized (including Venus-only configs)
Venus-only configs being MacOS right? On Linux the default would for virgl to be on unless the user explicitly turns it off (we can expand the GPU functional tests to make sure this works).
Quoted 10 lines
, so the
cleanup touches property defaults and existing user expectations (virgl=on,venus=on vs venus=on only) -- probably wants its own changelog and review, somewhat outside the no-GL plumbing this series is about. I'd prefer to land this series as-is and follow up with a dedicated "split virgl/venus property bits" series afterwards.That said, if you'd rather see the split as a prep patch at the front of v6, happy to do it that way -- your call.
Yes - have it as a prep patch in the series.
Quoted 3 lines
Thanks,
Lucas
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v5 4/4 virtio-gpu: advertise VIRTIO_GPU_F_BLOB_ALIGNMENT
In reply to Lucas AmaralSet blob_alignment to the host page size so the guest kernel can align blob BAR offsets accordingly, avoiding alignment mismatches with the VMM's memory mapping API (e.g., hv_vm_map on macOS).
Guest-side kernel support (drm_mm alignment) is pending upstream Linux merge.
--- hw/display/virtio-gpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/display/virtio-gpu.c +8 -0
@@ -1532,6 +1532,14 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)#endif } +/* +* TODO: guest-side F_BLOB_ALIGNMENT support pending upstream Linux merge +* (Sergio Lopez's patches, Nov 2025). Until merged, the guest won't +* negotiate this feature. The host advertises it per OASIS virtio spec. +*/ + g->parent_obj.virtio_config.blob_alignment = +cpu_to_le32 (qemu_real_host_page_size ()); + if (!virtio_gpu_base_device_realize(qdev, virtio_gpu_handle_ctrl_cb, virtio_gpu_handle_cursor_cb,
Signature · 1 line
2.52.0
Re: [PATCH v5 4/4] virtio-gpu: advertise VIRTIO_GPU_F_BLOB_ALIGNMENT
Quoted 18 lines · Lucas Amaral
Set
blob_alignmentto the host page size so the guest kernel can align blob BAR offsets accordingly, avoiding alignment mismatches with the VMM's memory mapping API (e.g.,hv_vm_mapon macOS).Guest-side kernel support (
drm_mmalignment) is pending upstream Linux merge.Signed-off-by Lucas Amaral <[email protected]>--- hw/display/virtio-gpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)hw/display/virtio-gpu.c +0
-0@@ -1532,6 +1532,14 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)#endif
hw/display/virtio-gpu.c void virtio_gpu_device_realize(DeviceState *qdev, Error **errp) · line 1542
Quoted 10 lines
hw/display/virtio-gpu.c +8
-0} +/* +* TODO: guest-side F_BLOB_ALIGNMENT support pending upstream Linux merge +* (Sergio Lopez's patches, Nov 2025). Until merged, the guest won't +* negotiate this feature. The host advertises it per OASIS virtio spec. +*/ + g->parent_obj.virtio_config.blob_alignment = +cpu_to_le32 (qemu_real_host_page_size ()); +
Is it merged yet?
Quoted 3 lines
hw/display/virtio-gpu.c +0
-0if (!virtio_gpu_base_device_realize(qdev, virtio_gpu_handle_ctrl_cb, virtio_gpu_handle_cursor_cb,
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Re: [PATCH v5 4/4] virtio-gpu: advertise VIRTIO_GPU_F_BLOB_ALIGNMENT
Quoted 22 lines · Alex Bennée
Quoted 20 lines · Lucas Amaral
Set
blob_alignmentto the host page size so the guest kernel can align blob BAR offsets accordingly, avoiding alignment mismatches with the VMM's memory mapping API (e.g.,hv_vm_mapon macOS).Guest-side kernel support (
drm_mmalignment) is pending upstream Linux merge.Signed-off-by Lucas Amaral <[email protected]>--- hw/display/virtio-gpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)hw/display/virtio-gpu.c +0
-0@@ -1532,6 +1532,14 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)#endif }
Quoted 10 lines
hw/display/virtio-gpu.c void virtio_gpu_device_realize(DeviceState *qdev, Error **errp) · line 1542
Quoted 8 lines
hw/display/virtio-gpu.c +8
-0+/* +* TODO: guest-side F_BLOB_ALIGNMENT support pending upstream Linux merge +* (Sergio Lopez's patches, Nov 2025). Until merged, the guest won't +* negotiate this feature. The host advertises it per OASIS virtio spec. +*/ + g->parent_obj.virtio_config.blob_alignment = +cpu_to_le32 (qemu_real_host_page_size ()); +Is it merged yet?
Not merged, I actually missed the v2 patches Sergio sent couple weeks ago [1], thanks for bringing it up. In general, it's enough to have the field defined in the virtio spec, there should be no need to wait for the kernel patch to land.
[1]
https://lore.kernel.org/dri-devel/[email protected]/
Signature · 2 lines
Best regards, Dmitry
Re: [PATCH v5 4/4] virtio-gpu: advertise VIRTIO_GPU_F_BLOB_ALIGNMENT
Quoted 34 lines · Dmitry Osipenko
Quoted 22 lines · Alex Bennée
Quoted 20 lines · Lucas Amaral
Set
blob_alignmentto the host page size so the guest kernel can align blob BAR offsets accordingly, avoiding alignment mismatches with the VMM's memory mapping API (e.g.,hv_vm_mapon macOS).Guest-side kernel support (
drm_mmalignment) is pending upstream Linux merge.Signed-off-by Lucas Amaral <[email protected]>--- hw/display/virtio-gpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)hw/display/virtio-gpu.c +0
-0@@ -1532,6 +1532,14 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)#endif }Quoted 10 lines
hw/display/virtio-gpu.c void virtio_gpu_device_realize(DeviceState *qdev, Error **errp) · line 1542
Quoted 8 lines
hw/display/virtio-gpu.c +8
-0+/* +* TODO: guest-side F_BLOB_ALIGNMENT support pending upstream Linux merge +* (Sergio Lopez's patches, Nov 2025). Until merged, the guest won't +* negotiate this feature. The host advertises it per OASIS virtio spec. +*/ + g->parent_obj.virtio_config.blob_alignment = +cpu_to_le32 (qemu_real_host_page_size ()); +Is it merged yet?
Quoted 7 lines
Not merged, I actually missed the v2 patches Sergio sent couple weeks ago [1], thanks for bringing it up. In general, it's enough to have the field defined in the virtio spec, there should be no need to wait for the kernel patch to land.
Kernel patches landed to misc-next tree last week [1].
[1] https://gitlab.freedesktop.org/drm/misc/kernel/-/commits/drm-misc-next
Signature · 2 lines
Best regards, Dmitry
Ping.
https://patchew.org/QEMU/[email protected]/
Marc-André gave Reviewed-by on patch 1/4 in v2. Patches 2-4 awaiting review. Series still applies cleanly on current master.
Thanks,
Lucas
Ping (second). This series has been on the list since March 17 with no review on v5. Marc-André gave Reviewed-by on patch 1/4 in v2. Patches still apply cleanly on current master.
https://patchew.org/QEMU/[email protected]/
Thanks,
Lucas
Quoted 2 lines · Lucas Amaral
Ping (second). This series has been on the list since March 17 with no review on v5. Marc-André gave Reviewed-by on patch 1/4 in v2.
I don't see the r-b on the patch.
Quoted 6 lines
Patches still apply cleanly on current master.
https://patchew.org/QEMU/[email protected]/
Thanks,
Lucas
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 1 line · Alex Bennée
I don't see the r-b on the patch.
It's on the v2 thread for the same patch (then 1/3, unchanged content in v5 patch 1/4):
https://patchew.org/QEMU/[email protected]/[email protected]/
I'm not familiar with the convention here -- should the Reviewed-by be re-stated in the cover letter of each respin, or carried only in the patch trailer of the next version? Will do whichever is standard in v6.
Thanks,
Lucas
Quoted 7 lines · Lucas Amaral
Quoted 1 line · Alex Bennée
I don't see the r-b on the patch.
It's on the v2 thread for the same patch (then 1/3, unchanged content in v5 patch 1/4):
Quoted 6 lines
https://patchew.org/QEMU/[email protected]/[email protected]/
I'm not familiar with the convention here -- should the Reviewed-by be re-stated in the cover letter of each respin, or carried only in the patch trailer of the next version? Will do whichever is standard in v6.
Generally you apply the tags to your commits so they are carried into the next version:
There is tooling that can do this automatically for you, for example b4 will gather review tags and apply them when it pulls a series.
Quoted 3 lines
Thanks,
Lucas
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro