Skip to contentSkip to conversation

cirrus-vga: Make frame buffer endianness little endian by default

PATCH Superseded BALATON Zoltan 1 participant 1 message Mar 30

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cirrus-vga: Make frame buffer endianness little endian by default

VGA is usually little endian but in QEMU frame buffer defaults to target endianness. Add a property to allow users to override the default in case this change breaks something and make cirrus-vga little endian by default to match the real chip. This should be safe as cirrus-vga is not used by default on any machines.

---
 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(+)
hw/core/machine.c +2 -0
index 0aa77a57e9..76d3f78a51 100644
@@ -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", "auto" },
+    { "cirrus-vga", "x-big-endian-fb", "auto" },
 };
 const size_t hw_compat_10_2_len = G_N_ELEMENTS(hw_compat_10_2);
 
hw/display/cirrus_vga.c +6 -0
index 629b34fc68..d56ca01e6d 100644
@@ -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_OFF),
 };
 
 static void cirrus_vga_class_init(ObjectClass *klass, const void *data)
hw/display/cirrus_vga_internal.h +2 -0
index a78ebbd920..4813c40de3 100644
@@ -26,6 +26,7 @@
 #ifndef CIRRUS_VGA_INTERNAL_H
 #define CIRRUS_VGA_INTERNAL_H
 
+#include "qapi/qapi-types-common.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,
hw/display/cirrus_vga_isa.c +2 -0
index 76034a8860..798e838764 100644
@@ -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,
+                            cirrus_vga.big_endian_fb, ON_OFF_AUTO_OFF),
 };
 
 static void isa_cirrus_vga_class_init(ObjectClass *klass, const void *data)
Signature · 1 line
2.41.3