summaryrefslogtreecommitdiff
path: root/hw/vigs/vigs_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/vigs/vigs_device.c')
-rw-r--r--hw/vigs/vigs_device.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/hw/vigs/vigs_device.c b/hw/vigs/vigs_device.c
index b71a57bfc2..7d0919a8cb 100644
--- a/hw/vigs/vigs_device.c
+++ b/hw/vigs/vigs_device.c
@@ -43,6 +43,7 @@
#include "qemu/main-loop.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
+#include "sysemu/sysemu.h"
#define PCI_VENDOR_ID_VIGS 0x19B2
#define PCI_DEVICE_ID_VIGS 0x1011
@@ -82,6 +83,9 @@ typedef struct VIGSState
uint32_t reg_con;
uint32_t reg_int;
+
+ // for VBLANK emulation
+ QEMUTimer *vblank_timer;
} VIGSState;
#define TYPE_VIGS_DEVICE "vigs"
@@ -342,6 +346,24 @@ static struct vigs_capture_ops capture_ops =
.process_captured = vigs_process_captured,
};
+static void vblank_update(void *opaque) {
+ VIGSState *s = opaque;
+ uint64_t last_update;
+
+ if (s->reg_con & VIGS_REG_CON_VBLANK_ENABLE) {
+ s->reg_int |= VIGS_REG_INT_VBLANK_PENDING;
+ vigs_update_irq(s);
+ }
+
+ last_update = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
+ timer_mod(s->vblank_timer, last_update + GUI_REFRESH_INTERVAL_DEFAULT);
+}
+
+static void vigs_vblank_timer_init(VIGSState *s) {
+ s->vblank_timer = timer_new_ms(QEMU_CLOCK_REALTIME, vblank_update, s);
+ timer_mod(s->vblank_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
+}
+
static int vigs_device_init(PCIDevice *dev)
{
VIGSState *s = DO_UPCAST(VIGSState, dev, dev);
@@ -503,6 +525,12 @@ static int vigs_device_init(PCIDevice *dev)
}
}
+ // XXX: VBLANK emulation
+ if (display_type == DT_NONE || display_type == DT_NOGRAPHIC) {
+ VIGS_LOG_INFO("VIGS vblank emulation enabled");
+ vigs_vblank_timer_init(s);
+ }
+
VIGS_LOG_INFO("VIGS initialized");
VIGS_LOG_DEBUG("vram_size = %u", s->vram_size);