aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2022-05-11 12:59:47 +0200
committerHelge Deller <deller@gmx.de>2022-05-16 15:58:22 +0200
commitcaca6e618d5577e45be2bcdc1e626a8b747fb56b (patch)
treea35c35c3bc384b36d9af51ba718f57ea487c3cd9 /hw
parenta377b574eb2cbcbff3fc579529e0f1b2fbda8af8 (diff)
downloadqemu-caca6e618d5577e45be2bcdc1e626a8b747fb56b.zip
qemu-caca6e618d5577e45be2bcdc1e626a8b747fb56b.tar.gz
qemu-caca6e618d5577e45be2bcdc1e626a8b747fb56b.tar.bz2
artist: Emulate screen blanking
The misc_video and misc_ctrl registers control the visibility of the screen. Start with the screen turned on, and hide or show the screen based on the control registers. Signed-off-by: Helge Deller <deller@gmx.de> Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw')
-rw-r--r--hw/display/artist.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/hw/display/artist.c b/hw/display/artist.c
index b8930b7..49dad2b 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -201,6 +201,8 @@ static const char *artist_reg_name(uint64_t addr)
}
#undef REG_NAME
+static void artist_invalidate(void *opaque);
+
/* artist has a fixed line length of 2048 bytes. */
#define ADDR_TO_Y(addr) extract32(addr, 11, 11)
#define ADDR_TO_X(addr) extract32(addr, 0, 11)
@@ -903,6 +905,7 @@ static void artist_reg_write(void *opaque, hwaddr addr, uint64_t val,
{
ARTISTState *s = opaque;
int width, height;
+ uint64_t oldval;
trace_artist_reg_write(size, addr, artist_reg_name(addr & ~3ULL), val);
@@ -1061,7 +1064,18 @@ static void artist_reg_write(void *opaque, hwaddr addr, uint64_t val,
break;
case MISC_VIDEO:
+ oldval = s->misc_video;
combine_write_reg(addr, val, size, &s->misc_video);
+ /* Invalidate and hide screen if graphics signal is turned off. */
+ if (((oldval & 0x0A000000) == 0x0A000000) &&
+ ((val & 0x0A000000) != 0x0A000000)) {
+ artist_invalidate(s);
+ }
+ /* Invalidate and redraw screen if graphics signal is turned back on. */
+ if (((oldval & 0x0A000000) != 0x0A000000) &&
+ ((val & 0x0A000000) == 0x0A000000)) {
+ artist_invalidate(s);
+ }
break;
case MISC_CTRL:
@@ -1263,6 +1277,12 @@ static void artist_draw_cursor(ARTISTState *s)
}
}
+static bool artist_screen_enabled(ARTISTState *s)
+{
+ /* We could check for (s->misc_ctrl & 0x00800000) too... */
+ return ((s->misc_video & 0x0A000000) == 0x0A000000);
+}
+
static void artist_draw_line(void *opaque, uint8_t *d, const uint8_t *src,
int width, int pitch)
{
@@ -1270,6 +1290,12 @@ static void artist_draw_line(void *opaque, uint8_t *d, const uint8_t *src,
uint32_t *cmap, *data = (uint32_t *)d;
int x;
+ if (!artist_screen_enabled(s)) {
+ /* clear screen */
+ memset(data, 0, s->width * sizeof(uint32_t));
+ return;
+ }
+
cmap = (uint32_t *)(s->vram_buffer[ARTIST_BUFFER_CMAP].data + 0x400);
for (x = 0; x < s->width; x++) {
@@ -1384,6 +1410,10 @@ static void artist_realizefn(DeviceState *dev, Error **errp)
s->image_bitmap_op = 0x23000300;
s->plane_mask = 0xff;
+ /* enable screen */
+ s->misc_video |= 0x0A000000;
+ s->misc_ctrl |= 0x00800000;
+
s->con = graphic_console_init(dev, 0, &artist_ops, s);
qemu_console_resize(s->con, s->width, s->height);
}