* Any plan for command line '-g' option (graphical resolution and depth)?
@ 2025-02-20 9:20 Philippe Mathieu-Daudé
2025-02-20 9:50 ` Paolo Bonzini
2025-02-20 11:13 ` Mark Cave-Ayland
0 siblings, 2 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-02-20 9:20 UTC (permalink / raw)
To: QEMU Developers
Cc: Laurent Vivier, Mark Cave-Ayland, Daniel Henrique Barboza,
Markus Armbruster, Daniel P. Berrangé, Paolo Bonzini,
Peter Maydell, qemu-ppc, Artyom Tarasenko, Alex Bennée
Hi,
QEMU provides the global '-g' CLI option:
$ qemu-system-foo --help
-g WxH[xDEPTH] Set the initial graphical resolution and depth
This option is used to pass resolution/depth information to guest
firmwares in the machines defined in the following files:
hw/ppc/mac_newworld.c
hw/ppc/mac_oldworld.c
hw/ppc/prep.c
hw/ppc/spapr.c
hw/sparc/sun4m.c
hw/sparc64/sun4u.c
Examples:
- hw/ppc/spapr.c:1102:
_FDT(fdt_setprop_cell(fdt, c, "qemu,graphic-width", graphic_width));
- hw/sparc64/sun4u.c:716:
fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_WIDTH, graphic_width);
Obviously we have default values, which are different per architecture!
Clearly these ought to be machine properties.
It is also used to set TYPE_NUBUS_MACFB properties in hw/m68k/q800.c.
Here i suppose we could directly use '-global nubus-macfb.width=value'
etc. although I'm not sure it is the recommended way.
Should we start deprecating '-g' as a whole?
Regards,
Phil.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Any plan for command line '-g' option (graphical resolution and depth)?
2025-02-20 9:20 Any plan for command line '-g' option (graphical resolution and depth)? Philippe Mathieu-Daudé
@ 2025-02-20 9:50 ` Paolo Bonzini
2025-02-20 10:22 ` Philippe Mathieu-Daudé
2025-02-20 11:28 ` Gerd Hoffmann
2025-02-20 11:13 ` Mark Cave-Ayland
1 sibling, 2 replies; 5+ messages in thread
From: Paolo Bonzini @ 2025-02-20 9:50 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, QEMU Developers
Cc: Laurent Vivier, Mark Cave-Ayland, Daniel Henrique Barboza,
Markus Armbruster, Daniel P. Berrangé, Peter Maydell,
qemu-ppc, Artyom Tarasenko, Alex Bennée, Gerd Hoffmann
On 2/20/25 10:20, Philippe Mathieu-Daudé wrote:
> Hi,
>
> QEMU provides the global '-g' CLI option:
>
> $ qemu-system-foo --help
>
> -g WxH[xDEPTH] Set the initial graphical resolution and depth
>
> This option is used to pass resolution/depth information to guest
> firmwares in the machines defined in the following files:
>
> hw/ppc/mac_newworld.c
> hw/ppc/mac_oldworld.c
> hw/ppc/prep.c
> hw/ppc/spapr.c
> hw/sparc/sun4m.c
> hw/sparc64/sun4u.c
>
> Examples:
>
> - hw/ppc/spapr.c:1102:
>
> _FDT(fdt_setprop_cell(fdt, c, "qemu,graphic-width", graphic_width));
>
> - hw/sparc64/sun4u.c:716:
>
> fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_WIDTH, graphic_width);
>
>
> Obviously we have default values, which are different per architecture!
> Clearly these ought to be machine properties.
Yes, we should have an easy way for machine to allow, in addition to -M
graphics=BOOLEAN, the structured property -M
graphics.{width,height,depth,enabled}. Then '-g' can desugar to -M
graphics.width=WW,graphics.height=HH,graphics.depth=BB.
> It is also used to set TYPE_NUBUS_MACFB properties in hw/m68k/q800.c.
> Here i suppose we could directly use '-global nubus-macfb.width=value'
> etc. although I'm not sure it is the recommended way.
>> Should we start deprecating '-g' as a whole?
Only if it's unused/useless. If the option is useful it could also be
used for EDID, for example (adding Gerd).
Global variables are hard to track, and the one-off nature of the option
makes it hard to figure out (without looking at the code) which machine
support it.
However, if the properties were available and introspectable via QOM,
then it wouldn't matter if the -g sugar remains as an isolated "case
QEMU_OPTION_g:" in system/vl.c. For an example see -boot/-smp or
-no-reboot/-no-shutdown.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Any plan for command line '-g' option (graphical resolution and depth)?
2025-02-20 9:50 ` Paolo Bonzini
@ 2025-02-20 10:22 ` Philippe Mathieu-Daudé
2025-02-20 11:28 ` Gerd Hoffmann
1 sibling, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-02-20 10:22 UTC (permalink / raw)
To: Paolo Bonzini, QEMU Developers, Kevin Wolf
Cc: Laurent Vivier, Mark Cave-Ayland, Daniel Henrique Barboza,
Markus Armbruster, Daniel P. Berrangé, Peter Maydell,
qemu-ppc, Artyom Tarasenko, Alex Bennée, Gerd Hoffmann
On 20/2/25 10:50, Paolo Bonzini wrote:
> On 2/20/25 10:20, Philippe Mathieu-Daudé wrote:
>> Hi,
>>
>> QEMU provides the global '-g' CLI option:
>>
>> $ qemu-system-foo --help
>>
>> -g WxH[xDEPTH] Set the initial graphical resolution and depth
>>
>> This option is used to pass resolution/depth information to guest
>> firmwares in the machines defined in the following files:
>>
>> hw/ppc/mac_newworld.c
>> hw/ppc/mac_oldworld.c
>> hw/ppc/prep.c
>> hw/ppc/spapr.c
>> hw/sparc/sun4m.c
>> hw/sparc64/sun4u.c
>>
>> Examples:
>>
>> - hw/ppc/spapr.c:1102:
>>
>> _FDT(fdt_setprop_cell(fdt, c, "qemu,graphic-width", graphic_width));
>>
>> - hw/sparc64/sun4u.c:716:
>>
>> fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_WIDTH, graphic_width);
>>
>>
>> Obviously we have default values, which are different per architecture!
>> Clearly these ought to be machine properties.
>
> Yes, we should have an easy way for machine to allow, in addition to -M
> graphics=BOOLEAN, the structured property -M graphics.
> {width,height,depth,enabled}. Then '-g' can desugar to -M
> graphics.width=WW,graphics.height=HH,graphics.depth=BB.
>
>> It is also used to set TYPE_NUBUS_MACFB properties in hw/m68k/q800.c.
>> Here i suppose we could directly use '-global nubus-macfb.width=value'
>> etc. although I'm not sure it is the recommended way.
>>> Should we start deprecating '-g' as a whole?
>
> Only if it's unused/useless. If the option is useful it could also be
> used for EDID, for example (adding Gerd).
>
> Global variables are hard to track, and the one-off nature of the option
> makes it hard to figure out (without looking at the code) which machine
> support it.
>
> However, if the properties were available and introspectable via QOM,
> then it wouldn't matter if the -g sugar remains as an isolated "case
> QEMU_OPTION_g:" in system/vl.c. For an example see -boot/-smp or -no-
> reboot/-no-shutdown.
OK, I suppose you are pointing me to:
commit e6dba0481363ad343c5f984dd4de3dd06d79ee68
Author: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Date: Fri Dec 11 11:52:43 2020 -0500
qmp: generalize watchdog-set-action to -no-reboot/-no-shutdown
Add a QMP command to allow for the behaviors specified by the
-no-reboot and -no-shutdown command line option to be set at
runtime.
The new command is named set-action and takes optional arguments,
named after an event, that provide a corresponding action to take.
Commit 30e863e5a7a ("qapi/qom: Add ObjectOptions for input-*") already
introduced width/height notions in InputBarrierProperties:
# @width: the width of secondary screen in pixels (default: "1920")
#
# @height: the height of secondary screen in pixels (default: "1080")
Maybe we can extract a QAPI structure including depth.
Anyway I'll have a look, thanks for your guidance!
Phil.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Any plan for command line '-g' option (graphical resolution and depth)?
2025-02-20 9:20 Any plan for command line '-g' option (graphical resolution and depth)? Philippe Mathieu-Daudé
2025-02-20 9:50 ` Paolo Bonzini
@ 2025-02-20 11:13 ` Mark Cave-Ayland
1 sibling, 0 replies; 5+ messages in thread
From: Mark Cave-Ayland @ 2025-02-20 11:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, QEMU Developers
Cc: Laurent Vivier, Daniel Henrique Barboza, Markus Armbruster,
Daniel P. Berrangé, Paolo Bonzini, Peter Maydell, qemu-ppc,
Artyom Tarasenko, Alex Bennée
On 20/02/2025 09:20, Philippe Mathieu-Daudé wrote:
> Hi,
>
> QEMU provides the global '-g' CLI option:
>
> $ qemu-system-foo --help
>
> -g WxH[xDEPTH] Set the initial graphical resolution and depth
>
> This option is used to pass resolution/depth information to guest
> firmwares in the machines defined in the following files:
>
> hw/ppc/mac_newworld.c
> hw/ppc/mac_oldworld.c
> hw/ppc/prep.c
> hw/ppc/spapr.c
> hw/sparc/sun4m.c
> hw/sparc64/sun4u.c
>
> Examples:
>
> - hw/ppc/spapr.c:1102:
>
> _FDT(fdt_setprop_cell(fdt, c, "qemu,graphic-width", graphic_width));
>
> - hw/sparc64/sun4u.c:716:
>
> fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_WIDTH, graphic_width);
>
>
> Obviously we have default values, which are different per architecture!
> Clearly these ought to be machine properties.
At least for VGA it is possible to use VGA via the width and height properties to set
the initial values i.e. on the command line with -device VGA,width=1024,height=768
and then use an EDID parser to get the information in the firmware. But then we hit
the same problem of how to set these properties from the command line on in-built
devices again.
> It is also used to set TYPE_NUBUS_MACFB properties in hw/m68k/q800.c.
> Here i suppose we could directly use '-global nubus-macfb.width=value'
> etc. although I'm not sure it is the recommended way.
This approach should work, however -global feels more like a big hammer as opposed to
a proper solution. In particular it doesn't work if you have e.g. multiple screens
that you want set to different resolutions.
> Should we start deprecating '-g' as a whole?
I think there should be a better way to consolidate the default resolution selection
on display devices (particularly in the case of multiple displays), so yes.
ATB,
Mark.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Any plan for command line '-g' option (graphical resolution and depth)?
2025-02-20 9:50 ` Paolo Bonzini
2025-02-20 10:22 ` Philippe Mathieu-Daudé
@ 2025-02-20 11:28 ` Gerd Hoffmann
1 sibling, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2025-02-20 11:28 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Philippe Mathieu-Daudé, QEMU Developers, Laurent Vivier,
Mark Cave-Ayland, Daniel Henrique Barboza, Markus Armbruster,
Daniel P. Berrangé, Peter Maydell, qemu-ppc,
Artyom Tarasenko, Alex Bennée
Hi,
> Yes, we should have an easy way for machine to allow, in addition to -M
> graphics=BOOLEAN, the structured property -M
> graphics.{width,height,depth,enabled}. Then '-g' can desugar to -M
> graphics.width=WW,graphics.height=HH,graphics.depth=BB.
>
> > It is also used to set TYPE_NUBUS_MACFB properties in hw/m68k/q800.c.
> > Here i suppose we could directly use '-global nubus-macfb.width=value'
> > etc. although I'm not sure it is the recommended way.
> > > Should we start deprecating '-g' as a whole?
>
> Only if it's unused/useless. If the option is useful it could also be used
> for EDID, for example (adding Gerd).
Most but not all display devices have xres + yres properties which are
communicated to the guest some way. In case of the stdvga it's edid
indeed. So, yes, having '-g WxH' set these properties makes sense. The
depth can not be configured though.
take care,
Gerd
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-02-20 11:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20 9:20 Any plan for command line '-g' option (graphical resolution and depth)? Philippe Mathieu-Daudé
2025-02-20 9:50 ` Paolo Bonzini
2025-02-20 10:22 ` Philippe Mathieu-Daudé
2025-02-20 11:28 ` Gerd Hoffmann
2025-02-20 11:13 ` Mark Cave-Ayland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).