@samitouri / QOSamiQemu / commits / af2f0774cc

hw/ppc: Set graphic display dimensions generically

If a dimension is not set, have the machine init code set the default values. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20260216213121.47122-8-philmd@linaro.org>

Philippe Mathieu-Daudé committed Feb 11, 2026 at 16:00 UTC af2f0774cc43fc3055f8e90a50163095d3cdf998
5 files changed +36 -6
hw/ppc/mac_newworld.c
+9
@@ -432,6 +432,15 @@ static void ppc_core99_init(MachineState *machine)
432
433 pci_vga_init(pci_bus);
434
435 + if (!graphic_width) {
436 + graphic_width = 800;
437 + }
438 + if (!graphic_height) {
439 + graphic_height = 600;
440 + }
441 + if (!graphic_depth) {
442 + graphic_depth = 32;
443 + }
444 if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
445 graphic_depth = 15;
446 }
hw/ppc/mac_oldworld.c
+9
@@ -288,6 +288,15 @@ static void ppc_heathrow_init(MachineState *machine)
288 pci_create_simple(pci_bus, -1, "pci-ohci");
289 }
290
291 + if (!graphic_width) {
292 + graphic_width = 800;
293 + }
294 + if (!graphic_height) {
295 + graphic_height = 600;
296 + }
297 + if (!graphic_depth) {
298 + graphic_depth = 32;
299 + }
300 if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
301 graphic_depth = 15;
302 }
hw/ppc/prep.c
+9
@@ -412,6 +412,15 @@ static void ibm_40p_init(MachineState *machine)
412 fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
413 fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_PREP);
414
415 + if (!graphic_width) {
416 + graphic_width = 800;
417 + }
418 + if (!graphic_height) {
419 + graphic_height = 600;
420 + }
421 + if (!graphic_depth) {
422 + graphic_depth = 32;
423 + }
424 fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
425 fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
426 fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
hw/ppc/spapr.c
+9
@@ -1177,6 +1177,15 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
1177 if (machine->boot_config.has_menu && machine->boot_config.menu) {
1178 _FDT((fdt_setprop_cell(fdt, chosen, "qemu,boot-menu", true)));
1179 }
1180 + if (!graphic_width) {
1181 + graphic_width = 800;
1182 + }
1183 + if (!graphic_height) {
1184 + graphic_height = 600;
1185 + }
1186 + if (!graphic_depth) {
1187 + graphic_depth = 32;
1188 + }
1189 _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", graphic_width));
1190 _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", graphic_height));
1191 _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", graphic_depth));
system/globals-target.c
-6
@@ -9,12 +9,6 @@
9 #include "qemu/osdep.h"
10 #include "system/system.h"
11
12 -#if defined(TARGET_SPARC) || defined(TARGET_M68K)
12 int graphic_width;
13 int graphic_height;
14 int graphic_depth;
16 -#else
17 -int graphic_width = 800;
18 -int graphic_height = 600;
19 -int graphic_depth = 32;
20 -#endif