From: Phil Dennis-Jordan <phil@philjordan.eu>
To: qemu-devel@nongnu.org, agraf@csgraf.de, pbonzini@redhat.com,
phil@philjordan.eu, marcandre.lureau@redhat.com,
berrange@redhat.com, thuth@redhat.com, philmd@linaro.org,
akihiko.odaki@daynix.com, peter.maydell@linaro.org
Subject: [PATCH v2 5/8] hw/display/apple-gfx: Replaces magic number with queried MMIO length
Date: Wed, 17 Jul 2024 13:03:23 +0200 [thread overview]
Message-ID: <20240717110326.45230-6-phil@philjordan.eu> (raw)
In-Reply-To: <20240717110326.45230-1-phil@philjordan.eu>
Rather than specifying the length of the device's MMIO range as an
unnamed literal constant (which is at least documented as a comment in
the framework headers), we query the PVG framework's API for the
recommended value. This also avoids problems in future, in case the
currently documented value for the default changes.
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
---
hw/display/apple-gfx.m | 16 +++++++++++++++-
hw/display/trace-events | 1 +
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/hw/display/apple-gfx.m b/hw/display/apple-gfx.m
index 3756a9e3ff..6f374455f9 100644
--- a/hw/display/apple-gfx.m
+++ b/hw/display/apple-gfx.m
@@ -283,12 +283,26 @@ static void create_fb(AppleGFXState *s)
s->cursor_show = true;
}
+static size_t apple_gfx_get_default_mmio_range_size(void)
+{
+ size_t mmio_range_size;
+ @autoreleasepool {
+ PGDeviceDescriptor *desc = [PGDeviceDescriptor new];
+ mmio_range_size = desc.mmioLength;
+ [desc release];
+ }
+ return mmio_range_size;
+}
+
void apple_gfx_common_init(Object *obj, AppleGFXState *s, const char* obj_name)
{
Error *local_err = NULL;
int r;
+ size_t mmio_range_size = apple_gfx_get_default_mmio_range_size();
- memory_region_init_io(&s->iomem_gfx, obj, &apple_gfx_ops, s, obj_name, 0x4000);
+ trace_apple_gfx_common_init(obj_name, mmio_range_size);
+ memory_region_init_io(&s->iomem_gfx, obj, &apple_gfx_ops, s, obj_name,
+ mmio_range_size);
/* TODO: PVG framework supports serialising device state: integrate it! */
if (apple_gfx_mig_blocker == NULL) {
diff --git a/hw/display/trace-events b/hw/display/trace-events
index e35582d659..1809a358e3 100644
--- a/hw/display/trace-events
+++ b/hw/display/trace-events
@@ -208,6 +208,7 @@ apple_gfx_mode_change(uint64_t x, uint64_t y) "x=%"PRId64" y=%"PRId64
apple_gfx_cursor_set(uint32_t bpp, uint64_t width, uint64_t height) "bpp=%d width=%"PRId64" height=0x%"PRId64
apple_gfx_cursor_show(uint32_t show) "show=%d"
apple_gfx_cursor_move(void) ""
+apple_gfx_common_init(const char *device_name, size_t mmio_size) "device: %s; MMIO size: %zu bytes"
# apple-gfx-vmapple.m
apple_iosfc_read(uint64_t offset, uint64_t res) "offset=0x%"PRIx64" res=0x%"PRIx64
--
2.39.3 (Apple Git-146)
next prev parent reply other threads:[~2024-07-17 11:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-17 11:03 [PATCH v2 0/8] hw/display/apple-gfx: New macOS PV Graphics device Phil Dennis-Jordan
2024-07-17 11:03 ` [PATCH v2 1/8] hw/display/apple-gfx: Introduce ParavirtualizedGraphics.Framework support Phil Dennis-Jordan
2024-07-17 11:03 ` [PATCH v2 2/8] hw/display/apple-gfx: Adds PCI implementation Phil Dennis-Jordan
2024-07-17 11:03 ` [PATCH v2 3/8] ui/cocoa: Adds non-app runloop on main thread mode Phil Dennis-Jordan
2024-07-17 11:03 ` [PATCH v2 4/8] hw/display/apple-gfx: Implements texture syncing for non-UMA GPUs Phil Dennis-Jordan
2024-07-17 11:03 ` Phil Dennis-Jordan [this message]
2024-07-17 11:03 ` [PATCH v2 6/8] hw/display/apple-gfx: Host GPU picking improvements Phil Dennis-Jordan
2024-07-17 11:03 ` [PATCH v2 7/8] hw/display/apple-gfx: Adds configurable mode list Phil Dennis-Jordan
2024-07-17 11:03 ` [PATCH v2 8/8] MAINTAINERS: Add myself as maintainer for apple-gfx, reviewer for HVF Phil Dennis-Jordan
2024-07-20 14:42 ` [PATCH v2 0/8] hw/display/apple-gfx: New macOS PV Graphics device Akihiko Odaki
2024-07-20 15:16 ` Phil Dennis-Jordan
2024-07-20 16:06 ` Akihiko Odaki
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=20240717110326.45230-6-phil@philjordan.eu \
--to=phil@philjordan.eu \
--cc=agraf@csgraf.de \
--cc=akihiko.odaki@daynix.com \
--cc=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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).