[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] g364fb: use RAM memory region for framebuffer
From: |
Mark Cave-Ayland |
Subject: |
[PATCH 1/2] g364fb: use RAM memory region for framebuffer |
Date: |
Fri, 25 Jun 2021 08:38:43 +0100 |
Since the migration stream is already broken, we can use this opportunity to
change the framebuffer so that it is migrated as a RAM memory region rather
than as an array of bytes.
In particular this helps the output of the analyze-migration.py tool which
no longer contains a huge array representing the framebuffer contents.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/display/g364fb.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
index 8f1725432c..163d7f5391 100644
--- a/hw/display/g364fb.c
+++ b/hw/display/g364fb.c
@@ -22,6 +22,7 @@
#include "hw/hw.h"
#include "hw/irq.h"
#include "hw/qdev-properties.h"
+#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
#include "ui/console.h"
@@ -125,7 +126,7 @@ static void g364fb_draw_graphic8(G364State *s)
xcursor = ycursor = -65;
}
- vram = s->vram + s->top_of_screen;
+ vram = memory_region_get_ram_ptr(&s->mem_vram) + s->top_of_screen;
/* XXX: out of range in vram? */
data_display = dd = surface_data(surface);
snap = memory_region_snapshot_and_clear_dirty(&s->mem_vram, 0,
s->vram_size,
@@ -274,6 +275,8 @@ static inline void g364fb_invalidate_display(void *opaque)
static void g364fb_reset(G364State *s)
{
+ uint8_t *vram = memory_region_get_ram_ptr(&s->mem_vram);
+
qemu_irq_lower(s->irq);
memset(s->color_palette, 0, sizeof(s->color_palette));
@@ -283,7 +286,7 @@ static void g364fb_reset(G364State *s)
s->ctla = 0;
s->top_of_screen = 0;
s->width = s->height = 0;
- memset(s->vram, 0, s->vram_size);
+ memset(vram, 0, s->vram_size);
g364fb_invalidate_display(s);
}
@@ -454,7 +457,6 @@ static const VMStateDescription vmstate_g364fb = {
.minimum_version_id = 1,
.post_load = g364fb_post_load,
.fields = (VMStateField[]) {
- VMSTATE_VBUFFER_UINT32(vram, G364State, 1, NULL, vram_size),
VMSTATE_BUFFER_UNSAFE(color_palette, G364State, 0, 256 * 3),
VMSTATE_BUFFER_UNSAFE(cursor_palette, G364State, 0, 9),
VMSTATE_UINT16_ARRAY(cursor, G364State, 512),
@@ -474,15 +476,12 @@ static const GraphicHwOps g364fb_ops = {
static void g364fb_init(DeviceState *dev, G364State *s)
{
- s->vram = g_malloc0(s->vram_size);
-
s->con = graphic_console_init(dev, 0, &g364fb_ops, s);
memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &g364fb_ctrl_ops, s,
"ctrl", 0x180000);
- memory_region_init_ram_ptr(&s->mem_vram, NULL, "vram",
- s->vram_size, s->vram);
- vmstate_register_ram(&s->mem_vram, dev);
+ memory_region_init_ram(&s->mem_vram, NULL, "g364fb.vram", s->vram_size,
+ &error_fatal);
memory_region_set_log(&s->mem_vram, true, DIRTY_MEMORY_VGA);
}
--
2.20.1