[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/26] hw/display/apple-gfx: Asynchronous MMIO writes on x86-64
From: |
Phil Dennis-Jordan |
Subject: |
[PATCH 16/26] hw/display/apple-gfx: Asynchronous MMIO writes on x86-64 |
Date: |
Mon, 15 Jul 2024 23:06:55 +0200 |
This change ensures that the MMIO write calls into the PVG
framework are performed asynchronously on a background dispatch
queue. Without this, we rapidly run into re-entrant MMIO issues.
This problem only seems to exist on x86-64 hosts. Conversely,
doing it async on arm64/vmapple causes other issues, so we're
left with 2 different implementations.
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
---
hw/display/apple-gfx.m | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/hw/display/apple-gfx.m b/hw/display/apple-gfx.m
index 806feb58fa..48463e5a1f 100644
--- a/hw/display/apple-gfx.m
+++ b/hw/display/apple-gfx.m
@@ -67,15 +67,28 @@ static uint64_t apple_gfx_read(void *opaque, hwaddr offset,
unsigned size)
return res;
}
-static void apple_gfx_write(void *opaque, hwaddr offset, uint64_t val,
unsigned size)
+static void apple_gfx_write(void *opaque, hwaddr offset, uint64_t val,
+ unsigned size)
{
AppleGFXState *s = opaque;
trace_apple_gfx_write(offset, val);
+#ifdef __x86_64__
+ id<PGDevice> dev = s->pgdev;
+ dispatch_queue_t bg_queue = NULL;
+
+ bg_queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul);
+ [dev retain];
+ dispatch_async(bg_queue, ^{
+ [dev mmioWriteAtOffset:offset value:val];
+ [dev release];
+ });
+#else
bql_unlock();
[s->pgdev mmioWriteAtOffset:offset value:val];
bql_lock();
+#endif
}
static const MemoryRegionOps apple_gfx_ops = {
--
2.39.3 (Apple Git-146)
- [PATCH 04/26] hw/display/apple-gfx: uses DEFINE_TYPES macro, (continued)
- [PATCH 04/26] hw/display/apple-gfx: uses DEFINE_TYPES macro, Phil Dennis-Jordan, 2024/07/17
- [PATCH 23/26] hw/display/apple-gfx: Host GPU picking improvements, Phil Dennis-Jordan, 2024/07/17
- [PATCH 01/26] hw/vmapple/apple-gfx: Introduce ParavirtualizedGraphics.Framework support, Phil Dennis-Jordan, 2024/07/17
- [PATCH 02/26] hw/vmapple/apple-gfx: BQL renaming update, Phil Dennis-Jordan, 2024/07/17
- [PATCH 05/26] hw/display/apple-gfx: native -> little endian memory ops, Phil Dennis-Jordan, 2024/07/17
- [PATCH 07/26] hw/display/apple-gfx: Makes set_mode thread & memory safe, Phil Dennis-Jordan, 2024/07/17
- [PATCH 20/26] hw/display/apple-gfx: Fixes cursor hotspot handling, Phil Dennis-Jordan, 2024/07/17
- [PATCH 06/26] hw/display/apple-gfx: Removes dead/superfluous code, Phil Dennis-Jordan, 2024/07/17
- [PATCH 17/26] hw/display/apple-gfx: Asynchronous rendering and graphics update, Phil Dennis-Jordan, 2024/07/17
- [PATCH 13/26] hw/display/apple-gfx: Defines PGTask_s struct instead of casting, Phil Dennis-Jordan, 2024/07/17
- [PATCH 16/26] hw/display/apple-gfx: Asynchronous MMIO writes on x86-64,
Phil Dennis-Jordan <=
[PATCH 11/26] hw/display/apple-gfx: Uses ObjC category extension for private property, Phil Dennis-Jordan, 2024/07/17
[PATCH 15/26] hw/display/apple-gfx: Separates generic & vmapple-specific functionality, Phil Dennis-Jordan, 2024/07/17
[PATCH 19/26] ui/cocoa: Adds non-app runloop on main thread mode, Phil Dennis-Jordan, 2024/07/17
[PATCH 12/26] hw/display/apple-gfx: Task memory mapping cleanup, Phil Dennis-Jordan, 2024/07/17
[PATCH 26/26] hw/display/apple-gfx: Removes UI pointer support check, Phil Dennis-Jordan, 2024/07/17
[PATCH 03/26] hw/display/apple-gfx: Moved from hw/vmapple/, Phil Dennis-Jordan, 2024/07/17