From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
qemu-arm@nongnu.org, kvm@vger.kernel.org,
"Peter Maydell" <peter.maydell@linaro.org>,
"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 2/6] hw/display/pl110: Pass frame buffer memory region as link property
Date: Fri, 16 Feb 2024 16:35:13 +0100 [thread overview]
Message-ID: <20240216153517.49422-3-philmd@linaro.org> (raw)
In-Reply-To: <20240216153517.49422-1-philmd@linaro.org>
Add the PL110::'framebuffer-memory' property. Have the different
ARM boards set it. We don't need to call sysbus_address_space()
anymore.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/realview.c | 2 ++
hw/arm/versatilepb.c | 2 ++
hw/arm/vexpress.c | 5 +++++
hw/display/pl110.c | 20 ++++++++++++++++----
4 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index 77300e92e5..b186f965c6 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -239,6 +239,8 @@ static void realview_init(MachineState *machine,
gpio2 = sysbus_create_simple("pl061", 0x10015000, pic[8]);
dev = qdev_new("pl111");
+ object_property_set_link(OBJECT(dev), "framebuffer-memory",
+ OBJECT(sysmem), &error_fatal);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10020000);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[23]);
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index 7e04b23af8..d48235453e 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -300,6 +300,8 @@ static void versatile_init(MachineState *machine, int board_id)
/* The versatile/PB actually has a modified Color LCD controller
that includes hardware cursor support from the PL111. */
dev = qdev_new("pl110_versatile");
+ object_property_set_link(OBJECT(dev), "framebuffer-memory",
+ OBJECT(sysmem), &error_fatal);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10120000);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[16]);
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 671986c21e..de815d84cc 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -299,6 +299,9 @@ static void a9_daughterboard_init(VexpressMachineState *vms,
/* 0x10020000 PL111 CLCD (daughterboard) */
dev = qdev_new("pl111");
+ object_property_set_link(OBJECT(dev), "framebuffer-memory",
+ OBJECT(sysmem), &error_fatal);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10020000);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[44]);
@@ -654,6 +657,8 @@ static void vexpress_common_init(MachineState *machine)
/* VE_COMPACTFLASH: not modelled */
dev = qdev_new("pl111");
+ object_property_set_link(OBJECT(dev), "framebuffer-memory",
+ OBJECT(sysmem), &error_fatal);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, map[VE_CLCD]);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[14]);
diff --git a/hw/display/pl110.c b/hw/display/pl110.c
index 4b83db9322..7f145bbdba 100644
--- a/hw/display/pl110.c
+++ b/hw/display/pl110.c
@@ -10,6 +10,7 @@
#include "qemu/osdep.h"
#include "hw/irq.h"
#include "hw/sysbus.h"
+#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
#include "ui/console.h"
#include "framebuffer.h"
@@ -17,6 +18,7 @@
#include "qemu/timer.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "qapi/error.h"
#include "qom/object.h"
#define PL110_CR_EN 0x001
@@ -74,6 +76,7 @@ struct PL110State {
uint32_t palette[256];
uint32_t raw_palette[128];
qemu_irq irq;
+ MemoryRegion *fbmem;
};
static int vmstate_pl110_post_load(void *opaque, int version_id);
@@ -210,7 +213,6 @@ static int pl110_enabled(PL110State *s)
static void pl110_update_display(void *opaque)
{
PL110State *s = (PL110State *)opaque;
- SysBusDevice *sbd;
DisplaySurface *surface = qemu_console_surface(s->con);
drawfn fn;
int src_width;
@@ -222,8 +224,6 @@ static void pl110_update_display(void *opaque)
return;
}
- sbd = SYS_BUS_DEVICE(s);
-
if (s->cr & PL110_CR_BGR)
bpp_offset = 0;
else
@@ -290,7 +290,7 @@ static void pl110_update_display(void *opaque)
first = 0;
if (s->invalidate) {
framebuffer_update_memory_section(&s->fbsection,
- sysbus_address_space(sbd),
+ s->fbmem,
s->upbase,
s->rows, src_width);
}
@@ -535,11 +535,22 @@ static const GraphicHwOps pl110_gfx_ops = {
.gfx_update = pl110_update_display,
};
+static Property pl110_properties[] = {
+ DEFINE_PROP_LINK("framebuffer-memory", PL110State, fbmem,
+ TYPE_MEMORY_REGION, MemoryRegion *),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void pl110_realize(DeviceState *dev, Error **errp)
{
PL110State *s = PL110(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+ if (!s->fbmem) {
+ error_setg(errp, "'framebuffer-memory' property was not set");
+ return;
+ }
+
memory_region_init_io(&s->iomem, OBJECT(s), &pl110_ops, s, "pl110", 0x1000);
sysbus_init_mmio(sbd, &s->iomem);
sysbus_init_irq(sbd, &s->irq);
@@ -577,6 +588,7 @@ static void pl110_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->vmsd = &vmstate_pl110;
dc->realize = pl110_realize;
+ device_class_set_props(dc, pl110_properties);
}
static const TypeInfo pl110_info = {
--
2.41.0
next prev parent reply other threads:[~2024-02-16 15:36 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 15:35 [PATCH 0/6] hw: Remove sysbus_address_space() Philippe Mathieu-Daudé
2024-02-16 15:35 ` [PATCH 1/6] hw/arm: Inline sysbus_create_simple(PL110 / PL111) Philippe Mathieu-Daudé
2024-02-16 17:14 ` BALATON Zoltan
2024-02-16 19:54 ` Philippe Mathieu-Daudé
2024-02-19 8:39 ` Philippe Mathieu-Daudé
2024-02-19 11:27 ` BALATON Zoltan
2024-02-19 11:49 ` Philippe Mathieu-Daudé
2024-02-19 12:00 ` BALATON Zoltan
2024-02-19 12:33 ` Philippe Mathieu-Daudé
2024-02-19 13:41 ` BALATON Zoltan
2024-02-19 12:48 ` Mark Cave-Ayland
2024-02-19 13:05 ` Peter Maydell
2024-02-19 13:33 ` Mark Cave-Ayland
2024-02-19 13:35 ` Peter Maydell
2024-02-21 10:40 ` Mark Cave-Ayland
2024-02-19 14:05 ` BALATON Zoltan
2024-02-26 17:37 ` Philippe Mathieu-Daudé
2024-02-26 20:04 ` BALATON Zoltan
2024-02-19 14:23 ` Philippe Mathieu-Daudé
2024-02-19 13:57 ` BALATON Zoltan
2024-02-19 14:31 ` Philippe Mathieu-Daudé
2024-02-17 20:40 ` Richard Henderson
2024-02-16 15:35 ` Philippe Mathieu-Daudé [this message]
2024-02-17 20:41 ` [PATCH 2/6] hw/display/pl110: Pass frame buffer memory region as link property Richard Henderson
2024-02-16 15:35 ` [PATCH 3/6] hw/arm/exynos4210: Inline sysbus_create_varargs(EXYNOS4210_FIMD) Philippe Mathieu-Daudé
2024-02-17 20:41 ` Richard Henderson
2024-02-16 15:35 ` [PATCH 4/6] hw/display/exynos4210_fimd: Pass frame buffer memory region as link Philippe Mathieu-Daudé
2024-02-17 20:44 ` Richard Henderson
2024-02-16 15:35 ` [PATCH 5/6] hw/i386/kvmvapic: Inline sysbus_address_space() Philippe Mathieu-Daudé
2024-02-17 20:45 ` Richard Henderson
2024-02-16 15:35 ` [PATCH 6/6] hw/sysbus: Remove now unused sysbus_address_space() Philippe Mathieu-Daudé
2024-02-17 20:45 ` Richard Henderson
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=20240216153517.49422-3-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=berrange@redhat.com \
--cc=eduardo@habkost.net \
--cc=i.mitsyanko@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).