vga refresh framework changes

- renamed trigger_timer() methods to refresh_display()
- new argument 'redraw' added to force a refresh of the entire screen
  (used in snapshot mode)
- siminterface method refresh_vga() now checks if the Bochs gui init is complete
- use SIM->refresh_vga() in some more cases
This commit is contained in:
Volker Ruppert 2012-10-28 08:23:39 +00:00
parent f122549153
commit 9933ffa3d9
16 changed files with 35 additions and 28 deletions

View File

@ -1486,7 +1486,7 @@ void bx_dbg_show_command(const char* arg)
dbg_printf("Turned OFF all bx_dbg flags\n");
return;
} else if(!strcmp(arg,"vga")){
DEV_vga_refresh();
SIM->refresh_vga();
return;
} else {
dbg_printf("Unrecognized arg: %s (only 'mode', 'int', 'softint', 'extint', 'iret', 'call', 'off', 'dbg-all' and 'dbg-none' are valid)\n", arg);
@ -1822,7 +1822,7 @@ one_more:
SIM->refresh_ci();
// (mch) hack
DEV_vga_refresh();
SIM->refresh_vga();
BX_INSTR_DEBUG_PROMPT();
bx_dbg_print_guard_results();

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2006 The Bochs Project Team
// Copyright (C) 2002-2012 The Bochs Project Team
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -40,7 +40,6 @@
#include "bochs.h"
#include "param_names.h"
#include "cpu/cpu.h"
#include "iodev/iodev.h"
#define LOG_THIS gdbstublog->
#define IFDBG(x) x
@ -473,7 +472,7 @@ static void debug_loop(void)
stub_trace_flag = 0;
bx_cpu.cpu_loop();
DEV_vga_refresh();
SIM->refresh_vga();
if (buffer[1] != 0)
{
@ -506,7 +505,7 @@ static void debug_loop(void)
BX_INFO(("stepping"));
stub_trace_flag = 1;
bx_cpu.cpu_loop();
DEV_vga_refresh();
SIM->refresh_vga();
stub_trace_flag = 0;
BX_INFO(("stopped with %x", last_stop_reason));
buf[0] = 'S';

View File

@ -421,8 +421,7 @@ Bit32u bx_gui_c::set_snapshot_mode(bx_bool mode)
BX_GUI_THIS snapshot_buffer = (Bit8u*)malloc(bufsize);
if (BX_GUI_THIS snapshot_buffer != NULL) {
memset(BX_GUI_THIS snapshot_buffer, 0, bufsize);
DEV_vga_redraw_area(0, 0, BX_GUI_THIS guest_xres, BX_GUI_THIS guest_yres);
DEV_vga_refresh();
DEV_vga_refresh(1);
return bufsize;
}
} else {

View File

@ -1644,7 +1644,7 @@ BxEvent *sdl_notify_callback(void *unused, BxEvent *event)
while (debug_cmd_ready == 0 && bx_user_quit == 0)
{
if (vgaw_refresh != 0) // is the GUI frontend requesting a VGAW refresh?
DEV_vga_refresh();
SIM->refresh_vga();
vgaw_refresh = 0;
#ifdef WIN32
Sleep(100);

View File

@ -135,8 +135,9 @@ public:
virtual int create_disk_image(const char *filename, int sectors, bx_bool overwrite);
virtual void refresh_ci();
virtual void refresh_vga() {
// maybe need to check if something has been initialized yet?
DEV_vga_refresh();
if (init_done) {
DEV_vga_refresh(0);
}
}
virtual void handle_events() {
// maybe need to check if something has been initialized yet?

View File

@ -2666,7 +2666,7 @@ BxEvent *x11_notify_callback (void *unused, BxEvent *event)
while (debug_cmd_ready == 0 && bx_user_quit == 0)
{
if (vgaw_refresh != 0) // is the GUI frontend requesting a VGAW refresh?
DEV_vga_refresh();
SIM->refresh_vga();
vgaw_refresh = 0;
sleep(1);
}

View File

@ -1029,11 +1029,14 @@ void bx_svga_cirrus_c::svga_write(Bit32u address, Bit32u value, unsigned io_len)
VGA_WRITE(address,value,io_len);
}
void bx_svga_cirrus_c::trigger_timer(void *this_ptr)
void bx_svga_cirrus_c::refresh_display(void *this_ptr, bx_bool redraw)
{
if (BX_CIRRUS_THIS s.vga_override && (BX_CIRRUS_THIS s.nvgadev != NULL)) {
BX_CIRRUS_THIS s.nvgadev->trigger_timer(BX_CIRRUS_THIS s.nvgadev);
BX_CIRRUS_THIS s.nvgadev->refresh_display(BX_CIRRUS_THIS s.nvgadev, redraw);
} else {
if (redraw) {
redraw_area(0, 0, BX_CIRRUS_THIS s.last_xres, BX_CIRRUS_THIS s.last_yres);
}
svga_timer_handler(this_ptr);
}
}

View File

@ -69,7 +69,7 @@ public:
virtual void init_vga_extension(void);
virtual void reset(unsigned type);
virtual void trigger_timer(void *this_ptr);
virtual void refresh_display(void *this_ptr, bx_bool redraw);
virtual void redraw_area(unsigned x0, unsigned y0,
unsigned width, unsigned height);
virtual Bit8u mem_read(bx_phy_address addr);

View File

@ -357,11 +357,14 @@ Bit64s bx_vga_c::vga_param_handler(bx_param_c *param, int set, Bit64s val)
return val;
}
void bx_vga_c::trigger_timer(void *this_ptr)
void bx_vga_c::refresh_display(void *this_ptr, bx_bool redraw)
{
if (BX_VGA_THIS s.vga_override && (BX_VGA_THIS s.nvgadev != NULL)) {
BX_VGA_THIS s.nvgadev->trigger_timer(BX_VGA_THIS s.nvgadev);
BX_VGA_THIS s.nvgadev->refresh_display(BX_VGA_THIS s.nvgadev, redraw);
} else {
if (redraw) {
redraw_area(0, 0, BX_VGA_THIS s.last_xres, BX_VGA_THIS s.last_yres);
}
timer_handler(this_ptr);
}
}

View File

@ -105,7 +105,7 @@ public:
unsigned width, unsigned height);
virtual void init_vga_extension(void);
virtual void trigger_timer(void *this_ptr);
virtual void refresh_display(void *this_ptr, bx_bool redraw);
static void timer_handler(void *);
#if BX_USE_VGA_SMF == 0

View File

@ -49,7 +49,7 @@ class bx_nonvga_device_c : public bx_devmodel_c {
public:
virtual void redraw_area(unsigned x0, unsigned y0,
unsigned width, unsigned height) {}
virtual void trigger_timer(void *this_ptr) {}
virtual void refresh_display(void *this_ptr, bx_bool redraw) {}
};
class bx_vgacore_c : public bx_vga_stub_c
@ -66,7 +66,7 @@ public:
static bx_bool mem_write_handler(bx_phy_address addr, unsigned len, void *data, void *param);
virtual Bit8u mem_read(bx_phy_address addr);
virtual void mem_write(bx_phy_address addr, Bit8u value);
virtual void trigger_timer(void *this_ptr) {}
virtual void refresh_display(void *this_ptr, bx_bool redraw) {}
virtual void set_override(bx_bool enabled, void *dev);
virtual void register_state(bx_list_c *parent);
virtual void after_restore_state(void);

View File

@ -400,8 +400,11 @@ void bx_voodoo_c::mode_change_timer_handler(void *this_ptr)
}
}
void bx_voodoo_c::trigger_timer(void *this_ptr)
void bx_voodoo_c::refresh_display(void *this_ptr, bx_bool redraw)
{
if (redraw) {
redraw_area(0, 0, v->fbi.width, v->fbi.height);
}
update_timer_handler(this_ptr);
}

View File

@ -51,7 +51,7 @@ public:
virtual void register_state(void);
virtual void after_restore_state(void);
virtual void trigger_timer(void *this_ptr);
virtual void refresh_display(void *this_ptr, bx_bool redraw);
virtual void redraw_area(unsigned x0, unsigned y0,
unsigned width, unsigned height);

View File

@ -258,8 +258,8 @@ public:
virtual void set_override(bx_bool enabled, void *dev) {
STUBFUNC(vga, set_override);
}
virtual void trigger_timer(void *this_ptr) {
STUBFUNC(vga, trigger_timer);
virtual void refresh_display(void *this_ptr, bx_bool redraw) {
STUBFUNC(vga, refresh_display);
}
};

View File

@ -22,7 +22,6 @@
#include "bochs.h"
#include "cpu/cpu.h"
#include "iodev/iodev.h"
#include <assert.h>
#if BX_WITH_CARBON
@ -452,7 +451,7 @@ void logfunctions::ask(int level, const char *prefix, const char *fmt, va_list a
// are printed on the screen just before a panic. It's also potentially
// dangerous if this function calls ask again... That's why I added
// the reentry check above.
if (SIM->get_init_done()) DEV_vga_refresh();
SIM->refresh_vga();
// ensure the text screen is showing
SIM->set_display_mode(DISP_MODE_CONFIG);

View File

@ -216,8 +216,8 @@ extern "C" {
(bx_devices.pluginVgaDevice->redraw_area(left, top, right, bottom))
#define DEV_vga_get_text_snapshot(rawsnap, height, width) \
(bx_devices.pluginVgaDevice->get_text_snapshot(rawsnap, height, width))
#define DEV_vga_refresh() \
(bx_devices.pluginVgaDevice->trigger_timer(bx_devices.pluginVgaDevice))
#define DEV_vga_refresh(a) \
(bx_devices.pluginVgaDevice->refresh_display(bx_devices.pluginVgaDevice,a))
#define DEV_vga_set_override(a,b) (bx_devices.pluginVgaDevice->set_override(a,b))
///////// PCI macros