All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: BALATON Zoltan <balaton@eik.bme.hu>, qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	marcandre.lureau@redhat.com, "Thomas Huth" <thuth@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [RFC PATCH] cirrus-vga: Add property to set frame buffer endianness and make it default to little endian
Date: Mon, 30 Mar 2026 13:22:36 -0300	[thread overview]
Message-ID: <87mrzpgucz.fsf@suse.de> (raw)
In-Reply-To: <20260330140655.31EC55968DE@zero.eik.bme.hu>

BALATON Zoltan <balaton@eik.bme.hu> writes:

> I've tried this but it does not seem to work and leaves default to
> auto. Could somebody tell how this should work?
>

This patch sets the hw_compat to "off" so when new code migrates to/from
an old machine type, it will set the endianness to LE due to the
conditional you added.

  ./qemu-system-x86_64 -display none -nodefaults -vga cirrus -M pc-q35-10.2
  s->big_endian_fb: 2 --> s->vga.big_endian_fb: 0

overriding works:

  ./qemu-system-x86_64 -display none -nodefaults -vga cirrus -M pc-q35-10.2 -global cirrus-vga.x-big-endian-fb=on
  s->big_endian_fb: 1 --> s->vga.big_endian_fb: 1
  
  ./qemu-system-x86_64 -display none -nodefaults -vga cirrus -M pc-q35-10.2 -global cirrus-vga.x-big-endian-fb=off
  s->big_endian_fb: 2 --> s->vga.big_endian_fb: 0

The default value is a separate thing, this patch sets it to "auto" so
unless the hw_compat or the user overrides it, that's what you get.

  ./qemu-system-x86_64 -display none -nodefaults -vga cirrus
  s->big_endian_fb: 0
  (s->vga.big_endian_fb: 0, unchanged)
  
  ./qemu-system-x86_64 -display none -nodefaults -vga cirrus -global cirrus-vga.x-big-endian-fb=on
  s->big_endian_fb: 1 --> s->vga.big_endian_fb: 1
  
  ./qemu-system-x86_64 -display none -nodefaults -vga cirrus -global cirrus-vga.x-big-endian-fb=off
  s->big_endian_fb: 2 --> s->vga.big_endian_fb: 0

Maybe what you want is to say the old behavior is auto? Then set the
default to off.

> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>  hw/core/machine.c                | 2 ++
>  hw/display/cirrus_vga.c          | 6 ++++++
>  hw/display/cirrus_vga_internal.h | 2 ++
>  hw/display/cirrus_vga_isa.c      | 2 ++
>  4 files changed, 12 insertions(+)
>
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index 0aa77a57e9..e573ef46bc 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -41,6 +41,8 @@
>  GlobalProperty hw_compat_10_2[] = {
>      { "scsi-block", "migrate-pr", "off" },
>      { "isa-cirrus-vga", "global-vmstate", "true" },
> +    { "isa-cirrus-vga", "x-big-endian-fb", "off" },
> +    { "cirrus-vga", "x-big-endian-fb", "off" },
>  };
>  const size_t hw_compat_10_2_len = G_N_ELEMENTS(hw_compat_10_2);
>  
> diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
> index 629b34fc68..e379f125ae 100644
> --- a/hw/display/cirrus_vga.c
> +++ b/hw/display/cirrus_vga.c
> @@ -2930,6 +2930,10 @@ void cirrus_init_common(CirrusVGAState *s, Object *owner,
>      s->vga.cursor_invalidate = cirrus_cursor_invalidate;
>      s->vga.cursor_draw_line = cirrus_cursor_draw_line;
>  
> +    if (s->big_endian_fb != ON_OFF_AUTO_AUTO) {
> +        s->vga.big_endian_fb = (s->big_endian_fb == ON_OFF_AUTO_ON);
> +    }
> +
>      qemu_register_reset(cirrus_reset, s);
>  }
>  
> @@ -2987,6 +2991,8 @@ static const Property pci_vga_cirrus_properties[] = {
>                         cirrus_vga.vga.vram_size_mb, 4),
>      DEFINE_PROP_BOOL("blitter", struct PCICirrusVGAState,
>                       cirrus_vga.enable_blitter, true),
> +    DEFINE_PROP_ON_OFF_AUTO("x-big-endian-fb", struct PCICirrusVGAState,
> +                            cirrus_vga.big_endian_fb, ON_OFF_AUTO_AUTO),
>  };
>  
>  static void cirrus_vga_class_init(ObjectClass *klass, const void *data)
> diff --git a/hw/display/cirrus_vga_internal.h b/hw/display/cirrus_vga_internal.h
> index a78ebbd920..7c07201f18 100644
> --- a/hw/display/cirrus_vga_internal.h
> +++ b/hw/display/cirrus_vga_internal.h
> @@ -26,6 +26,7 @@
>  #ifndef CIRRUS_VGA_INTERNAL_H
>  #define CIRRUS_VGA_INTERNAL_H
>  
> +#include "hw/core/qdev-properties.h"
>  #include "vga_int.h"
>  
>  /* IDs */
> @@ -94,6 +95,7 @@ typedef struct CirrusVGAState {
>      int real_vram_size; /* XXX: suppress that */
>      int device_id;
>      int bustype;
> +    OnOffAuto big_endian_fb;
>  } CirrusVGAState;
>  
>  void cirrus_init_common(CirrusVGAState *s, Object *owner,
> diff --git a/hw/display/cirrus_vga_isa.c b/hw/display/cirrus_vga_isa.c
> index 76034a8860..c2b0b61476 100644
> --- a/hw/display/cirrus_vga_isa.c
> +++ b/hw/display/cirrus_vga_isa.c
> @@ -75,6 +75,8 @@ static const Property isa_cirrus_vga_properties[] = {
>                       cirrus_vga.enable_blitter, true),
>      DEFINE_PROP_BOOL("global-vmstate", struct ISACirrusVGAState,
>                       cirrus_vga.vga.global_vmstate, false),
> +    DEFINE_PROP_ON_OFF_AUTO("x-big-endian-fb", struct PCICirrusVGAState,

s/PCICirrusVGAState/ISACirrusVGAState/

> +                            cirrus_vga.big_endian_fb, ON_OFF_AUTO_AUTO),
>  };
>  
>  static void isa_cirrus_vga_class_init(ObjectClass *klass, const void
>  *data)


  parent reply	other threads:[~2026-03-30 16:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 14:06 [RFC PATCH] cirrus-vga: Add property to set frame buffer endianness and make it default to little endian BALATON Zoltan
2026-03-30 15:05 ` Gerd Hoffmann
2026-03-31 10:04   ` BALATON Zoltan
2026-03-30 16:22 ` Fabiano Rosas [this message]
2026-03-30 18:07   ` Philippe Mathieu-Daudé
2026-03-30 20:36   ` BALATON Zoltan

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=87mrzpgucz.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=balaton@eik.bme.hu \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.