Skip to content

Commit 4317c51

Browse files
mcaylandvivier
authored andcommitted
macfb: add qdev property to specify display type
Since the available resolutions and colour depths are determined by the attached display type, add a qdev property to allow the display type to be specified. The main resolutions of interest are high resolution 1152x870 with 8-bit colour and SVGA resolution up to 800x600 with 24-bit colour so update the q800 machine to allow high resolution mode if specified and otherwise fall back to SVGA. Signed-off-by: Mark Cave-Ayland <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Laurent Vivier <[email protected]> Message-Id: <[email protected]> Signed-off-by: Laurent Vivier <[email protected]>
1 parent e6108b9 commit 4317c51

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

hw/display/macfb.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ static uint32_t macfb_sense_read(MacfbState *s)
316316
MacFbSense *macfb_sense;
317317
uint8_t sense;
318318

319-
macfb_sense = &macfb_sense_table[MACFB_DISPLAY_VGA];
319+
assert(s->type < ARRAY_SIZE(macfb_sense_table));
320+
macfb_sense = &macfb_sense_table[s->type];
320321
if (macfb_sense->sense == 0x7) {
321322
/* Extended sense */
322323
sense = 0;
@@ -544,13 +545,17 @@ static Property macfb_sysbus_properties[] = {
544545
DEFINE_PROP_UINT32("width", MacfbSysBusState, macfb.width, 640),
545546
DEFINE_PROP_UINT32("height", MacfbSysBusState, macfb.height, 480),
546547
DEFINE_PROP_UINT8("depth", MacfbSysBusState, macfb.depth, 8),
548+
DEFINE_PROP_UINT8("display", MacfbSysBusState, macfb.type,
549+
MACFB_DISPLAY_VGA),
547550
DEFINE_PROP_END_OF_LIST(),
548551
};
549552

550553
static Property macfb_nubus_properties[] = {
551554
DEFINE_PROP_UINT32("width", MacfbNubusState, macfb.width, 640),
552555
DEFINE_PROP_UINT32("height", MacfbNubusState, macfb.height, 480),
553556
DEFINE_PROP_UINT8("depth", MacfbNubusState, macfb.depth, 8),
557+
DEFINE_PROP_UINT8("display", MacfbNubusState, macfb.type,
558+
MACFB_DISPLAY_VGA),
554559
DEFINE_PROP_END_OF_LIST(),
555560
};
556561

hw/m68k/q800.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,11 @@ static void q800_init(MachineState *machine)
421421
qdev_prop_set_uint32(dev, "width", graphic_width);
422422
qdev_prop_set_uint32(dev, "height", graphic_height);
423423
qdev_prop_set_uint8(dev, "depth", graphic_depth);
424+
if (graphic_width == 1152 && graphic_height == 870 && graphic_depth == 8) {
425+
qdev_prop_set_uint8(dev, "display", MACFB_DISPLAY_APPLE_21_COLOR);
426+
} else {
427+
qdev_prop_set_uint8(dev, "display", MACFB_DISPLAY_VGA);
428+
}
424429
qdev_realize_and_unref(dev, BUS(nubus), &error_fatal);
425430

426431
cs = CPU(cpu);

include/hw/display/macfb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ typedef struct MacfbState {
4646
uint8_t color_palette[256 * 3];
4747
uint32_t width, height; /* in pixels */
4848
uint8_t depth;
49+
uint8_t type;
4950

5051
uint32_t sense;
5152
} MacfbState;

0 commit comments

Comments
 (0)