[PATCH v2 05/10] macfb: set initial value of mode control registers in macfb_common_realize()

Mark Cave-Ayland posted 10 patches 3 years, 11 months ago
Maintainers: Laurent Vivier <laurent@vivier.eu>, Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>
There is a newer version of this series
[PATCH v2 05/10] macfb: set initial value of mode control registers in macfb_common_realize()
Posted by Mark Cave-Ayland 3 years, 11 months ago
If booting Linux directly in the q800 machine using -kernel rather than using a
MacOS toolbox ROM, the mode control registers are never initialised,
causing macfb_mode_write() to fail to determine the current resolution after
migration. Resolve this by always setting the initial values of the mode control
registers based upon the initial macfb properties during realize.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/display/macfb.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 7371986480..2f8e016566 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -655,6 +655,14 @@ static bool macfb_common_realize(DeviceState *dev, MacfbState *s, Error **errp)
         return false;
     }
 
+    /*
+     * Set mode control registers to match the mode found above so that
+     * macfb_mode_write() does the right thing if no MacOS toolbox ROM
+     * is present to initialise them
+     */
+    s->regs[DAFB_MODE_CTRL1 >> 2] = s->mode->mode_ctrl1;
+    s->regs[DAFB_MODE_CTRL2 >> 2] = s->mode->mode_ctrl2;
+
     s->con = graphic_console_init(dev, 0, &macfb_ops, s);
     surface = qemu_console_surface(s->con);
 
-- 
2.20.1
Re: [PATCH v2 05/10] macfb: set initial value of mode control registers in macfb_common_realize()
Posted by Peter Maydell 3 years, 11 months ago
On Wed, 2 Mar 2022 at 21:35, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> If booting Linux directly in the q800 machine using -kernel rather than using a
> MacOS toolbox ROM, the mode control registers are never initialised,
> causing macfb_mode_write() to fail to determine the current resolution after
> migration. Resolve this by always setting the initial values of the mode control
> registers based upon the initial macfb properties during realize.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/display/macfb.c | 8 ++++++++

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Re: [PATCH v2 05/10] macfb: set initial value of mode control registers in macfb_common_realize()
Posted by Laurent Vivier 3 years, 11 months ago
Le 02/03/2022 à 22:27, Mark Cave-Ayland a écrit :
> If booting Linux directly in the q800 machine using -kernel rather than using a
> MacOS toolbox ROM, the mode control registers are never initialised,
> causing macfb_mode_write() to fail to determine the current resolution after
> migration. Resolve this by always setting the initial values of the mode control
> registers based upon the initial macfb properties during realize.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>   hw/display/macfb.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
Reviewed-by: Laurent Vivier <laurent@vivier.eu>