[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 47/52] hw/display/bcm2835_fb: Reset resolution, etc c
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 47/52] hw/display/bcm2835_fb: Reset resolution, etc correctly |
Date: |
Fri, 24 Aug 2018 10:33:38 +0100 |
The bcm2835_fb's initial resolution and other parameters are set
via QOM properties. We should reset to those initial values on
device reset, which means we need to save the QOM property
values somewhere that they are not overwritten by guest
changes to the framebuffer configuration.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-id: address@hidden
---
include/hw/display/bcm2835_fb.h | 1 +
hw/display/bcm2835_fb.c | 27 +++++++++++++++------------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/include/hw/display/bcm2835_fb.h b/include/hw/display/bcm2835_fb.h
index 69cbf2d1fd9..374de546121 100644
--- a/include/hw/display/bcm2835_fb.h
+++ b/include/hw/display/bcm2835_fb.h
@@ -47,6 +47,7 @@ typedef struct {
bool lock, invalidate, pending;
BCM2835FBConfig config;
+ BCM2835FBConfig initial_config;
} BCM2835FBState;
void bcm2835_fb_reconfigure(BCM2835FBState *s, BCM2835FBConfig *newconfig);
diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
index 9faabf0d0b4..d95686c74c8 100644
--- a/hw/display/bcm2835_fb.c
+++ b/hw/display/bcm2835_fb.c
@@ -329,11 +329,7 @@ static void bcm2835_fb_reset(DeviceState *dev)
s->pending = false;
- s->config.xres_virtual = s->config.xres;
- s->config.yres_virtual = s->config.yres;
- s->config.xoffset = 0;
- s->config.yoffset = 0;
- s->config.base = s->vcram_base + BCM2835_FB_OFFSET;
+ s->config = s->initial_config;
s->invalidate = true;
s->lock = false;
@@ -357,6 +353,13 @@ static void bcm2835_fb_realize(DeviceState *dev, Error
**errp)
return;
}
+ /* Fill in the parts of initial_config that are not set by QOM properties
*/
+ s->initial_config.xres_virtual = s->initial_config.xres;
+ s->initial_config.yres_virtual = s->initial_config.yres;
+ s->initial_config.xoffset = 0;
+ s->initial_config.yoffset = 0;
+ s->initial_config.base = s->vcram_base + BCM2835_FB_OFFSET;
+
s->dma_mr = MEMORY_REGION(obj);
address_space_init(&s->dma_as, s->dma_mr, NULL);
@@ -370,13 +373,13 @@ static Property bcm2835_fb_props[] = {
DEFINE_PROP_UINT32("vcram-base", BCM2835FBState, vcram_base,
0),/*required*/
DEFINE_PROP_UINT32("vcram-size", BCM2835FBState, vcram_size,
DEFAULT_VCRAM_SIZE),
- DEFINE_PROP_UINT32("xres", BCM2835FBState, config.xres, 640),
- DEFINE_PROP_UINT32("yres", BCM2835FBState, config.yres, 480),
- DEFINE_PROP_UINT32("bpp", BCM2835FBState, config.bpp, 16),
- DEFINE_PROP_UINT32("pixo",
- BCM2835FBState, config.pixo, 1), /* 1=RGB, 0=BGR */
- DEFINE_PROP_UINT32("alpha",
- BCM2835FBState, config.alpha, 2), /* alpha ignored */
+ DEFINE_PROP_UINT32("xres", BCM2835FBState, initial_config.xres, 640),
+ DEFINE_PROP_UINT32("yres", BCM2835FBState, initial_config.yres, 480),
+ DEFINE_PROP_UINT32("bpp", BCM2835FBState, initial_config.bpp, 16),
+ DEFINE_PROP_UINT32("pixo", BCM2835FBState,
+ initial_config.pixo, 1), /* 1=RGB, 0=BGR */
+ DEFINE_PROP_UINT32("alpha", BCM2835FBState,
+ initial_config.alpha, 2), /* alpha ignored */
DEFINE_PROP_END_OF_LIST()
};
--
2.18.0
- [Qemu-devel] [PULL 33/52] hw/ssi/pl022: Allow use as embedded-struct device, (continued)
- [Qemu-devel] [PULL 33/52] hw/ssi/pl022: Allow use as embedded-struct device, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 29/52] hw/misc/tz-msc: Model TrustZone Master Security Controller, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 37/52] hw/ssi/pl022: Correct wrong value for PL022_INT_RT, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 38/52] hw/ssi/pl022: Correct wrong DMACR and ICR handling, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 39/52] hw/arm/mps2-tz: Instantiate SPI controllers, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 43/52] target/arm: Remove a handful of stray tabs, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 40/52] hw/arm/mps2-tz: Fix MPS2 SCC config register values, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 42/52] target/arm: Untabify iwmmxt_helper.c, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 36/52] hw/ssi/pl022: Use DeviceState::realize rather than SysBusDevice::init, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 34/52] hw/ssi/pl022: Set up reset function in class init, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 47/52] hw/display/bcm2835_fb: Reset resolution, etc correctly,
Peter Maydell <=
- [Qemu-devel] [PULL 46/52] hw/display/bcm2835_fb: Drop unused size and pitch fields, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 49/52] hw/display/bcm2835_fb: Fix handling of virtual framebuffer, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 44/52] hw/misc/bcm2835_fb: Move config fields to their own struct, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 51/52] hw/display/bcm2835_fb: Validate bcm2835_fb_mbox_push() config, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 35/52] hw/ssi/pl022: Don't directly call vmstate_register(), Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 41/52] target/arm: Untabify translate.c, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 45/52] hw/misc/bcm2835_property: Track fb settings using BCM2835FBConfig, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 48/52] hw/display/bcm2835_fb: Abstract out calculation of pitch, size, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 52/52] hw/arm/mps2: Fix ID register errors on AN511 and AN385, Peter Maydell, 2018/08/24
- [Qemu-devel] [PULL 50/52] hw/display/bcm2835_fb: Validate config settings, Peter Maydell, 2018/08/24