If a dimension is not set, have the machine init code set the default values.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- hw/ppc/mac_newworld.c | 9 +++++++++ hw/ppc/mac_oldworld.c | 9 +++++++++ hw/ppc/prep.c | 9 +++++++++ hw/ppc/spapr.c | 9 +++++++++ system/globals-target.c | 6 ------ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 7275563a155..3680d96ed39 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -432,6 +432,15 @@ static void ppc_core99_init(MachineState *machine) pci_vga_init(pci_bus); + if (!graphic_width) { + graphic_width = 800; + } + if (!graphic_height) { + graphic_height = 600; + } + if (!graphic_depth) { + graphic_depth = 32; + } if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) { graphic_depth = 15; } diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index e679d338985..24d9f2e3d5c 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -288,6 +288,15 @@ static void ppc_heathrow_init(MachineState *machine) pci_create_simple(pci_bus, -1, "pci-ohci"); } + if (!graphic_width) { + graphic_width = 800; + } + if (!graphic_height) { + graphic_height = 600; + } + if (!graphic_depth) { + graphic_depth = 32; + } if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) { graphic_depth = 15; } diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index c4efd1d3908..e973b340992 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -412,6 +412,15 @@ static void ibm_40p_init(MachineState *machine) fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size); fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_PREP); + if (!graphic_width) { + graphic_width = 800; + } + if (!graphic_height) { + graphic_height = 600; + } + if (!graphic_depth) { + graphic_depth = 32; + } fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 274f38785f2..0ab39dfea6b 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1177,6 +1177,15 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset) if (machine->boot_config.has_menu && machine->boot_config.menu) { _FDT((fdt_setprop_cell(fdt, chosen, "qemu,boot-menu", true))); } + if (!graphic_width) { + graphic_width = 800; + } + if (!graphic_height) { + graphic_height = 600; + } + if (!graphic_depth) { + graphic_depth = 32; + } _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", graphic_width)); _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", graphic_height)); _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", graphic_depth)); diff --git a/system/globals-target.c b/system/globals-target.c index 17a27a06218..ffa6c308b59 100644 --- a/system/globals-target.c +++ b/system/globals-target.c @@ -9,12 +9,6 @@ #include "qemu/osdep.h" #include "system/system.h" -#if defined(TARGET_SPARC) || defined(TARGET_M68K) int graphic_width; int graphic_height; int graphic_depth; -#else -int graphic_width = 800; -int graphic_height = 600; -int graphic_depth = 32; -#endif -- 2.52.0
