From: Laurent Vivier <laurent@vivier.eu>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 08/12] macfb: add common monitor modes supported by the MacOS toolbox ROM
Date: Tue, 5 Oct 2021 17:08:46 +0200 [thread overview]
Message-ID: <15fba2fe-77b0-78f4-ea55-9438ce976c18@vivier.eu> (raw)
In-Reply-To: <66384935-4c8f-8220-8593-bfde37d05e1d@ilande.co.uk>
Le 05/10/2021 à 13:38, Mark Cave-Ayland a écrit :
> On 05/10/2021 10:50, Laurent Vivier wrote:
>
>> Le 04/10/2021 à 23:19, Mark Cave-Ayland a écrit :
>>> 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.
>>>
>>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
>>> ---
>>> hw/display/macfb.c | 124 ++++++++++++++++++++++++++++++++-----
>>> hw/display/trace-events | 1 +
>>> hw/m68k/q800.c | 11 ++--
>>> include/hw/display/macfb.h | 16 ++++-
>>> 4 files changed, 131 insertions(+), 21 deletions(-)
>>>
>>> diff --git a/hw/display/macfb.c b/hw/display/macfb.c
>>> index f98bcdec2d..357fe18be5 100644
>>> --- a/hw/display/macfb.c
>>> +++ b/hw/display/macfb.c
>>>
>> ...
>>> +static MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
>>> + uint16_t width, uint16_t height,
>>> + uint8_t depth)
>>> +{
>>> + MacFbMode *macfb_mode;
>>> + int i;
>>> +
>>> + for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
>>> + macfb_mode = &macfb_mode_table[i];
>>> +
>>> + if (display_type == macfb_mode->type && width == macfb_mode->width &&
>>> + height == macfb_mode->height && depth == macfb_mode->depth) {
>>> + return macfb_mode;
>>> + }
>>> + }
>>> +
>>> + return NULL;
>>> +}
>>> +
>>
>> I misunderstood this part when I reviewed v1...
>>
>> It means you have to provide the monitor type to QEMU to switch from the default mode?
>
> Not as such: both the MacOS toolbox ROM and MacOS itself offer a fixed set of resolutions and depths
> based upon the display type. What I've done for now is default the display type to VGA since it
> offers both 640x480 and 800x600 in 1, 2, 4, 8, 16 and 24-bit colour which should cover the most
> common use of cases of people wanting to boot using the MacOS toolbox ROM.
>
> Even if you specify a default on the command line, MacOS still only cares about the display type and
> will allow you to change the resolution and depth dynamically, remembering the last resolution and
> depth across reboots.
>
> During testing I found that having access to the 1152x870 resolution offered by the Apple 21"
> monitor display type was useful to allow larger screen sizes, although only up to 8-bit depth so I
> added a bit of code that will switch from a VGA display type to a 21" display type if the graphics
> resolution is set to 1152x870x8.
>
> Finally if you boot a Linux kernel directly using -kernel then the provided XxYxD is placed directly
> into the relevant bootinfo fields with a VGA display type, unless a resolution of 1152x870x8 is
> specified in which case the 21" display type is used as above.
>
>> But, as a user, how do we know which modes are allowed with which resolution?
>>
>> Is possible to try to set internally the type here according to the resolution?
>>
>> Could you provide an command line example how to start the q800 with the 1152x870 resolution?
>
> Sure - simply add "-g 1152x870x8" to your command line. If the -g parameter is omitted then the
> display type will default to VGA.
>
Thank you for the explanation.
Perhaps you can add in the error message the list of the available mode and depth?
(it's not a blocker for the series, it can be added later)
As an user, it's hard to know what are the allowed values.
Thanks,
Laurent
next prev parent reply other threads:[~2021-10-05 15:21 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 21:19 [PATCH v2 00/12] macfb: fixes for booting MacOS Mark Cave-Ayland
2021-10-04 21:19 ` [PATCH v2 01/12] macfb: handle errors that occur during realize Mark Cave-Ayland
2021-10-05 15:34 ` Philippe Mathieu-Daudé
2021-10-04 21:19 ` [PATCH v2 02/12] macfb: fix invalid object reference in macfb_common_realize() Mark Cave-Ayland
2021-10-04 21:19 ` [PATCH v2 03/12] macfb: fix overflow of color_palette array Mark Cave-Ayland
2021-10-05 6:34 ` Laurent Vivier
2021-10-04 21:19 ` [PATCH v2 04/12] macfb: use memory_region_init_ram() in macfb_common_realize() for the framebuffer Mark Cave-Ayland
2021-10-04 21:19 ` [PATCH v2 05/12] macfb: add trace events for reading and writing the control registers Mark Cave-Ayland
2021-10-04 21:19 ` [PATCH v2 06/12] macfb: implement mode sense to allow display type to be detected Mark Cave-Ayland
2021-10-04 21:19 ` [PATCH v2 07/12] macfb: add qdev property to specify display type Mark Cave-Ayland
2021-10-04 21:19 ` [PATCH v2 08/12] macfb: add common monitor modes supported by the MacOS toolbox ROM Mark Cave-Ayland
2021-10-05 9:50 ` Laurent Vivier
2021-10-05 11:38 ` Mark Cave-Ayland
2021-10-05 15:08 ` Laurent Vivier [this message]
2021-10-05 15:33 ` Mark Cave-Ayland
2021-10-06 12:24 ` Laurent Vivier
2021-10-06 13:54 ` Mark Cave-Ayland
2021-10-06 15:46 ` Laurent Vivier
2021-10-06 16:09 ` Mark Cave-Ayland
2021-10-06 19:24 ` Laurent Vivier
2021-10-06 21:16 ` Laurent Vivier
2021-10-07 9:19 ` Mark Cave-Ayland
2021-10-04 21:19 ` [PATCH v2 09/12] macfb: fix up 1-bit pixel encoding Mark Cave-Ayland
2021-10-04 21:19 ` [PATCH v2 10/12] macfb: fix 24-bit RGB " Mark Cave-Ayland
2021-10-04 21:19 ` [PATCH v2 11/12] macfb: add vertical blank interrupt Mark Cave-Ayland
2021-10-04 21:19 ` [PATCH v2 12/12] q800: wire macfb IRQ to separate video interrupt on VIA2 Mark Cave-Ayland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15fba2fe-77b0-78f4-ea55-9438ce976c18@vivier.eu \
--to=laurent@vivier.eu \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).