qemu/hw/display
Phil Dennis-Jordan 2352159c97 hw/display/apple-gfx: Introduce ParavirtualizedGraphics.Framework support
MacOS provides a framework (library) that allows any vmm to implement a
paravirtualized 3d graphics passthrough to the host metal stack called
ParavirtualizedGraphics.Framework (PVG). The library abstracts away
almost every aspect of the paravirtualized device model and only provides
and receives callbacks on MMIO access as well as to share memory address
space between the VM and PVG.

This patch implements a QEMU device that drives PVG for the VMApple
variant of it.

Signed-off-by: Alexander Graf <graf@amazon.com>
Co-authored-by: Alexander Graf <graf@amazon.com>

Subsequent changes:

 * Cherry-pick/rebase conflict fixes, API use updates.
 * Moved from hw/vmapple/ (useful outside that machine type)
 * Overhaul of threading model, many thread safety improvements.
 * Asynchronous rendering.
 * Memory and object lifetime fixes.
 * Refactoring to split generic and (vmapple) MMIO variant specific
   code.

Implementation wise, most of the complexity lies in the differing threading
models of ParavirtualizedGraphics.framework, which uses libdispatch and
internal locks, versus QEMU, which heavily uses the BQL, especially during
memory-mapped device I/O. Great care has therefore been taken to prevent
deadlocks by never calling into PVG methods while holding the BQL, and
similarly never acquiring the BQL in a callback from PVG. Different strategies
have been used (libdispatch, blocking and non-blocking BHs, RCU, etc.)
depending on the specific requirements at each framework entry and exit point.

Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Tested-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20241223221645.29911-3-phil@philjordan.eu>
[PMD: Re-ordered imported headers, style fixups]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-12-31 21:21:34 +01:00
..
acpi-vga-stub.c acpi: pc: vga: use AcpiDevAmlIf interface to build VGA device descriptors 2022-11-07 14:00:29 -05:00
acpi-vga.c acpi: pc: vga: use AcpiDevAmlIf interface to build VGA device descriptors 2022-11-07 14:00:29 -05:00
apple-gfx-mmio.m hw/display/apple-gfx: Introduce ParavirtualizedGraphics.Framework support 2024-12-31 21:21:34 +01:00
apple-gfx.h hw/display/apple-gfx: Introduce ParavirtualizedGraphics.Framework support 2024-12-31 21:21:34 +01:00
apple-gfx.m hw/display/apple-gfx: Introduce ParavirtualizedGraphics.Framework support 2024-12-31 21:21:34 +01:00
artist.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
ati.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
ati_2d.c hw/display/ati: allow compiling without PIXMAN 2023-11-07 14:04:25 +04:00
ati_dbg.c ati-vga: Add 30 bit palette access register 2023-11-06 15:58:43 +04:00
ati_int.h ati-vga: Implement fallback for pixman routines 2023-11-06 15:58:45 +04:00
ati_regs.h ati-vga: Add 30 bit palette access register 2023-11-06 15:58:43 +04:00
bcm2835_fb.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
bochs-display.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
cg3.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
cirrus_vga.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
cirrus_vga_internal.h hw/display/cirrus_vga: Move "isa-cirrus-vga" device into a separate file 2018-10-15 09:57:33 +02:00
cirrus_vga_isa.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
cirrus_vga_rop.h cirrus: fix off-by-one in cirrus_bitblt_rop_bkwd_transp_*_16 2017-03-17 10:23:44 +01:00
cirrus_vga_rop2.h cirrus: fix PUTPIXEL macro 2017-03-27 12:14:45 +02:00
dm163.c hw/display: Fix mirrored output in dm163 2024-09-20 08:06:57 +03:00
dpcd.c hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
edid-generate.c edid: Fix clock of Detailed Timing Descriptor 2022-03-04 11:31:46 +01:00
edid-region.c Include exec/memory.h slightly less 2019-08-16 13:31:52 +02:00
exynos4210_fimd.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
framebuffer.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
framebuffer.h framebuffer: set DIRTY_MEMORY_VGA on RAM that is used for the framebuffer 2015-07-24 13:57:45 +02:00
g364fb.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
i2c-ddc.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
jazz_led.c hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
Kconfig hw/display/apple-gfx: Introduce ParavirtualizedGraphics.Framework support 2024-12-31 21:21:34 +01:00
macfb.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
meson.build hw/display/apple-gfx: Introduce ParavirtualizedGraphics.Framework support 2024-12-31 21:21:34 +01:00
next-fb.c hw/display/next-fb: Fix comment typo 2022-12-03 22:07:07 +01:00
omap_lcdc.c hw/arm/omap: Drop useless casts from void * to pointer 2023-01-12 17:15:09 +00:00
pl110.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
pl110_template.h Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
qxl-logger.c hw/display/qxl: Pass requested buffer size to qxl_phys2virt() 2022-11-29 18:15:26 -05:00
qxl-render.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
qxl.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
qxl.h Replace "iothread lock" with "BQL" in comments 2024-01-08 10:45:43 -05:00
ramfb-standalone.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
ramfb-stubs.c ramfb: move stubs out of stubs/ 2024-04-18 11:17:27 +02:00
ramfb.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
sii9022.c hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
sm501.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
ssd0303.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
ssd0323.c hw/display: Constify VMState 2023-12-29 11:17:30 +11:00
tcx.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
trace-events hw/display/apple-gfx: Introduce ParavirtualizedGraphics.Framework support 2024-12-31 21:21:34 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
vga-access.h vga: move access helpers to separate include file 2019-09-19 10:37:46 +02:00
vga-helpers.h vga: optimize horizontal pel panning in 256-color modes 2024-01-18 10:43:14 +01:00
vga-isa.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
vga-mmio.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
vga-pci.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
vga.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
vga_int.h display: remove GraphicHwOps from typedefs.h 2024-05-03 15:47:48 +02:00
vga_regs.h vga: sort-of implement word and double-word access modes 2024-01-18 10:43:14 +01:00
vhost-user-gpu-pci.c modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
vhost-user-gpu.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
vhost-user-vga.c modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
virtio-dmabuf.c hw/display: fix memleak from virtio_add_resource 2023-10-22 05:18:16 -04:00
virtio-gpu-base.c Fix bugs when VM shutdown with virtio-gpu unplugged 2023-12-26 04:51:07 -05:00
virtio-gpu-gl.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
virtio-gpu-pci-gl.c modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
virtio-gpu-pci-rutabaga.c virtio-gpu-rutabaga: Add empty interface to fix arm64 crash 2023-11-06 14:25:30 +04:00
virtio-gpu-pci.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
virtio-gpu-rutabaga.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
virtio-gpu-udmabuf-stubs.c virtio-gpu: splitting one extended mode guest fb into n-scanouts 2021-11-05 12:29:19 +01:00
virtio-gpu-udmabuf.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
virtio-gpu-virgl.c hw/display: factor out the scanout blob to fb conversion 2024-11-18 13:36:39 +01:00
virtio-gpu.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
virtio-vga-gl.c modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
virtio-vga-rutabaga.c gfxstream + rutabaga: add initial support for gfxstream 2023-10-16 11:29:56 +04:00
virtio-vga.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
virtio-vga.h hw/display/virtio-vga: Convert TYPE_VIRTIO_VGA_BASE to 3-phase reset 2022-12-16 15:59:07 +00:00
vmware_vga.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
xenfb.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
xlnx_dp.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00