[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 0/9] virtio-gpu: Support Venus Vulkan driver
From: |
Alex Bennée |
Subject: |
Re: [PATCH v3 0/9] virtio-gpu: Support Venus Vulkan driver |
Date: |
Mon, 30 Jan 2023 17:00:02 +0000 |
User-agent: |
mu4e 1.9.18; emacs 29.0.60 |
Antonio Caggiano <antonio.caggiano@collabora.com> writes:
> This series of patches enables support for the Venus VirtIO-GPU Vulkan
> driver by adding some features required by the driver:
>
> - CONTEXT_INIT
> - HOSTMEM
> - RESOURCE_UUID
> - BLOB_RESOURCES
>
> In addition to these features, Venus capset support was required
> together with the implementation for Virgl blob resource commands.
I managed to apply to current master but I needed a bunch of patches to
get it to compile with my old virgl:
--8<---------------cut here---------------start------------->8---
modified hw/display/virtio-gpu-virgl.c
@@ -744,10 +744,12 @@ static int virgl_make_context_current(void *opaque, int
scanout_idx,
qctx);
}
+#if VIRGL_RENDERER_CALLBACKS_VERSION >= 4
static void *virgl_get_egl_display(void *opaque)
{
return eglGetCurrentDisplay();
}
+#endif
static struct virgl_renderer_callbacks virtio_gpu_3d_cbs = {
.version = 4,
@@ -755,7 +757,9 @@ static struct virgl_renderer_callbacks virtio_gpu_3d_cbs = {
.create_gl_context = virgl_create_context,
.destroy_gl_context = virgl_destroy_context,
.make_current = virgl_make_context_current,
+#if VIRGL_RENDERER_CALLBACKS_VERSION >= 4
.get_egl_display = virgl_get_egl_display,
+#endif
};
static void virtio_gpu_print_stats(void *opaque)
@@ -813,7 +817,7 @@ int virtio_gpu_virgl_init(VirtIOGPU *g)
{
int ret;
- ret = virgl_renderer_init(g, VIRGL_RENDERER_VENUS, &virtio_gpu_3d_cbs);
+ ret = virgl_renderer_init(g, 0 /* VIRGL_RENDERER_VENUS */,
&virtio_gpu_3d_cbs);
if (ret != 0) {
error_report("virgl could not be initialized: %d", ret);
return ret;
modified hw/display/virtio-gpu.c
@@ -873,9 +873,12 @@ void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g,
static void virtio_gpu_cleanup_mapping(VirtIOGPU *g,
struct virtio_gpu_simple_resource *res)
{
+
+#ifdef HAVE_VIRGL_RESOURCE_BLOB
if (res->mapped) {
virtio_gpu_virgl_resource_unmap(g, res);
}
+#endif
virtio_gpu_cleanup_mapping_iov(g, res->iov, res->iov_cnt);
res->iov = NULL;
--8<---------------cut here---------------end--------------->8---
However when I run it with:
gdb --args ./qemu-system-aarch64 \
-cpu max,pauth-impdef=on \
-machine type=virt,virtualization=on,gic-version=3 \
-serial mon:stdio \
-netdev user,id=unet,hostfwd=tcp::2222-:22 \
-device virtio-net-pci,netdev=unet,id=virt-net,disable-legacy=on \
-device virtio-scsi-pci,id=virt-scsi,disable-legacy=on \
-blockdev
driver=raw,node-name=hd,discard=unmap,file.driver=host_device,file.filename=/dev/zen-disk/debian-bullseye-arm64
\
-device scsi-hd,drive=hd,id=virt-scsi-hd \
-kernel $HOME/lsrc/linux.git/builds/arm64/arch/arm64/boot/Image \
-append "root=/dev/sda2" \
-smp 4 -m 4096 \
-object memory-backend-memfd,id=mem,size=4G,share=on \
-numa node,memdev=mem \
-device qemu-xhci \
-device usb-tablet \
-device usb-kbd -global virtio-mmio.force-legacy=false \
-display gtk,gl=on -device virtio-gpu-pci
something must be broken because it asserts:
qemu-system-aarch64: ../../hw/core/qdev.c:282: qdev_realize: Assertion
`!dev->realized && !dev->parent_bus' failed.
Thread 1 "qemu-system-aar" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff5309537 in __GI_abort () at abort.c:79
#2 0x00007ffff530940f in __assert_fail_base (fmt=0x7ffff54816a8 "%s%s%s:%u:
%s%sAssertion `%s' failed.\n%n", assertion=0x5555562da640 "!dev->realized &&
!dev->parent_bus",
file=0x5555562da6a7 "../../hw/core/qdev.c", line=282, function=<optimized
out>) at assert.c:92
#3 0x00007ffff5318662 in __GI___assert_fail
(assertion=assertion@entry=0x5555562da640 "!dev->realized && !dev->parent_bus",
file=file@entry=0x5555562da6a7 "../../hw/core/qd
ev.c", line=line@entry=282, function=function@entry=0x5555562da868
<__PRETTY_FUNCTION__.14> "qdev_realize") at assert.c:101
#4 0x0000555555f64b6f in qdev_realize (dev=dev@entry=0x555558251370,
bus=<optimized out>, errp=errp@entry=0x7fffffffd670) at ../../hw/core/qdev.c:282
#5 0x0000555555bbecaa in virtio_gpu_pci_base_realize
(vpci_dev=0x555558248fa0, errp=0x7fffffffd670) at
../../hw/display/virtio-gpu-pci.c:52
#6 0x0000555555a6048d in pci_qdev_realize (qdev=0x555558248fa0,
errp=<optimized out>) at ../../hw/pci/pci.c:2043
#7 0x0000555555f6416e in device_set_realized (obj=<optimized out>,
value=<optimized out>, errp=0x7fffffffd880) at ../../hw/core/qdev.c:510
#8 0x0000555555f67ea6 in property_set_bool (obj=0x555558248fa0, v=<optimized
out>, name=<optimized out>, opaque=0x555556c35ab0, errp=0x7fffffffd880) at
../../qom/object.c:2
285
#9 0x0000555555f6aee4 in object_property_set (obj=obj@entry=0x555558248fa0,
name=name@entry=0x555556231289 "realized", v=v@entry=0x5555582545a0,
errp=errp@entry=0x7fffffffd
880) at ../../qom/object.c:1420
#10 0x0000555555f6e290 in object_property_set_qobject
(obj=obj@entry=0x555558248fa0, name=name@entry=0x555556231289 "realized",
value=value@entry=0x555558253390, errp=errp@e
ntry=0x7fffffffd880) at ../../qom/qom-qobject.c:28
#11 0x0000555555f6b505 in object_property_set_bool (obj=0x555558248fa0,
name=name@entry=0x555556231289 "realized", value=value@entry=true,
errp=errp@entry=0x7fffffffd880) at
../../qom/object.c:1489
#12 0x0000555555f64aee in qdev_realize (dev=<optimized out>,
bus=bus@entry=0x555557696f70, errp=errp@entry=0x7fffffffd880) at
../../hw/core/qdev.c:292
#13 0x0000555555b36d26 in qdev_device_add_from_qdict
(opts=opts@entry=0x555557d52d40, from_json=from_json@entry=false,
errp=0x7fffffffd880, errp@entry=0x555556b02790 <error_
fatal>) at ../../softmmu/qdev-monitor.c:714
#14 0x0000555555b36e42 in qdev_device_add (opts=0x555556c31d20,
errp=errp@entry=0x555556b02790 <error_fatal>) at
../../softmmu/qdev-monitor.c:733
#15 0x0000555555b38c4f in device_init_func (opaque=<optimized out>,
opts=<optimized out>, errp=0x555556b02790 <error_fatal>) at
../../softmmu/vl.c:1143
#16 0x00005555560e6382 in qemu_opts_foreach (list=<optimized out>,
func=func@entry=0x555555b38c40 <device_init_func>, opaque=opaque@entry=0x0,
errp=0x555556b02790 <error_fat
al>) at ../../util/qemu-option.c:1135
#17 0x0000555555b3b4ae in qemu_create_cli_devices () at
../../softmmu/vl.c:2539
#18 qmp_x_exit_preconfig (errp=<optimized out>) at ../../softmmu/vl.c:2607
#19 0x0000555555b3ee5d in qmp_x_exit_preconfig (errp=<optimized out>) at
../../softmmu/vl.c:2601
#20 qemu_init (argc=<optimized out>, argv=<optimized out>) at
../../softmmu/vl.c:3613
#21 0x00005555558b3fa9 in main (argc=<optimized out>, argv=<optimized out>)
at
(gdb) p dev
$1 = (DeviceState *) 0x555558251370
(gdb) p *$
$2 = {parent_obj = {class = 0x555556e36b10, free = 0x0, properties =
0x555558204c60, ref = 2, parent = 0x555558248fa0}, id = 0x0, canonical_path =
0x0, realized = false, pending_deleted_event = false,
pending_deleted_expires_ms = 0, opts = 0x0, hotplugged = 0,
allow_unplug_during_migration = false, parent_bus = 0x5555582512e0, gpios =
{lh_first = 0x0}, clocks = {lh_first = 0x0}, child_bus = {lh_first = 0x0},
num_child_bus = 0, instance_id_alias = -1, alias_required_for_version = 0,
reset = {count = 0, hold_phase_pending = false, exit_phase_in_progress =
false}, unplug_blockers = 0x0}
(gdb) p dev->realized
$3 = false
(gdb) p dev->parent_bus
$4 = (BusState *) 0x5555582512e0
(gdb) p *$
$5 = {obj = {class = 0x555556e192e0, free = 0x0, properties = 0x555558204aa0
= {[0x555558259d90 "hotplug-handler"] = 0x555558259ec0, [0x55555825a1e0
"child[0]"] = 0x55555825a180, [0x555558259d70 "realized"] = 0x555558259fe0},
ref = 2, parent = 0x555558248fa0}, parent = 0x555558248fa0, name =
0x55555825a040 "virtio-bus", hotplug_handler = 0x0, max_index = 1, realized =
false, full = false, num_children = 1, children = {tqh_first = 0x55555825a120,
tqh_circ = {tql_next = 0x55555825a120, tql_prev = 0x55555825a140}}, sibling =
{le_next = 0x0, le_prev = 0x555558249010}, reset = {count = 0,
hold_phase_pending = false, exit_phase_in_progress = false}}
(gdb)
>
> Antonio Caggiano (7):
> virtio-gpu: Handle resource blob commands
> virtio-gpu: CONTEXT_INIT feature
> virtio-gpu: Unrealize
> virtio-gpu: Resource UUID
> virtio-gpu: Support Venus capset
> virtio-gpu: Initialize Venus
> virtio-gpu: Get EGL Display callback
>
> Dr. David Alan Gilbert (1):
> virtio: Add shared memory capability
>
> Gerd Hoffmann (1):
> virtio-gpu: hostmem
>
> hw/display/trace-events | 1 +
> hw/display/virtio-gpu-base.c | 7 +-
> hw/display/virtio-gpu-pci.c | 15 ++
> hw/display/virtio-gpu-virgl.c | 230 +++++++++++++++++++-
> hw/display/virtio-gpu.c | 67 +++++-
> hw/display/virtio-vga.c | 33 ++-
> hw/virtio/virtio-pci.c | 18 ++
> include/hw/virtio/virtio-gpu-bswap.h | 18 ++
> include/hw/virtio/virtio-gpu.h | 21 ++
> include/hw/virtio/virtio-pci.h | 4 +
> include/standard-headers/linux/virtio_gpu.h | 2 +
> meson.build | 9 +
> 12 files changed, 403 insertions(+), 22 deletions(-)
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
- Re: [PATCH v3 0/9] virtio-gpu: Support Venus Vulkan driver,
Alex Bennée <=