mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
hw/display/pl110: Pass frame buffer memory region as link property
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> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20240226173805.289-3-philmd@linaro.org>
This commit is contained in:
parent
49aff03e1b
commit
c2093660d9
5 changed files with 27 additions and 4 deletions
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue