aboutsummaryrefslogtreecommitdiff
path: root/include/hw
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2021-10-07 23:12:49 +0100
committerLaurent Vivier <laurent@vivier.eu>2021-10-08 13:31:03 +0200
commitdf8abbbadf743bef6be5543b26f51231285b8923 (patch)
tree465d528aa19546cdbca56ebd877c83d58605b881 /include/hw
parent4317c518618adcd5d41637c849be17e94cecf003 (diff)
macfb: add common monitor modes supported by the MacOS toolbox ROM
The monitor modes table is found by experimenting with the Monitors Control Panel in MacOS and analysing the reads/writes. From this it can be found that the mode is controlled by writes to the DAFB_MODE_CTRL1 and DAFB_MODE_CTRL2 registers. Implement the first block of DAFB registers as a register array including the existing sense register, the newly discovered control registers above, and also the DAFB_MODE_VADDR1 and DAFB_MODE_VADDR2 registers which are used by NetBSD to determine the current video mode. These experiments also show that the offset of the start of video RAM and the stride can change depending upon the monitor mode, so update macfb_draw_graphic() and both the BI_MAC_VADDR and BI_MAC_VROW bootinfo for the q800 machine accordingly. Finally update macfb_common_realize() so that only the resolution and depth supported by the display type can be specified on the command line, and add an error hint showing the list of supported resolutions and depths if the user tries to specify an invalid display mode. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20211007221253.29024-10-mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'include/hw')
-rw-r--r--include/hw/display/macfb.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/hw/display/macfb.h b/include/hw/display/macfb.h
index e95a97ebdc..0aff0d84d2 100644
--- a/include/hw/display/macfb.h
+++ b/include/hw/display/macfb.h
@@ -35,6 +35,19 @@ typedef enum {
MACFB_DISPLAY_SVGA = 14,
} MacfbDisplayType;
+typedef struct MacFbMode {
+ uint8_t type;
+ uint8_t depth;
+ uint32_t mode_ctrl1;
+ uint32_t mode_ctrl2;
+ uint32_t width;
+ uint32_t height;
+ uint32_t stride;
+ uint32_t offset;
+} MacFbMode;
+
+#define MACFB_NUM_REGS 8
+
typedef struct MacfbState {
MemoryRegion mem_vram;
MemoryRegion mem_ctrl;
@@ -48,7 +61,8 @@ typedef struct MacfbState {
uint8_t depth;
uint8_t type;
- uint32_t sense;
+ uint32_t regs[MACFB_NUM_REGS];
+ MacFbMode *mode;
} MacfbState;
#define TYPE_MACFB "sysbus-macfb"