diff mbox series

[6/6] video: bochs: Setup framebuffer endian

Message ID 20240516-rework-video-format-v1-6-f69822b742a3@flygoat.com
State New
Delegated to: Anatolij Gustschin
Headers show
Series video: pixel format handling fixes and improvements | expand

Commit Message

Jiaxun Yang May 16, 2024, 10:16 p.m. UTC
So the current situation on endian of bochs framebufer
is a little bit complex. QEMU defaulted to little endian
for both endian hardware except on powerpc, but provided
an endian swich register allows OS to switch endian.

Since we can't guarantee the endian switch register is
functional, my approach is to default to little endian
framebuffer for ISAs except powerpc and perform endian
switch to match this assumption.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 drivers/video/bochs.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/drivers/video/bochs.c b/drivers/video/bochs.c
index 00e673a4db08..c315c5477b14 100644
--- a/drivers/video/bochs.c
+++ b/drivers/video/bochs.c
@@ -65,6 +65,14 @@  static int bochs_init_fb(struct udevice *dev)
 	uc_priv->ysize = ysize;
 	uc_priv->bpix = VIDEO_BPP32;
 
+#if defined(__powerpc__) && defined(__BIG_ENDIAN)
+	uc_priv->format = VIDEO_XRGB8888_BE;
+	writel(0xbebebebe, mmio + 0x604);
+#else
+	uc_priv->format = VIDEO_XRGB8888;
+	writel(0x1e1e1e1e, mmio + 0x604);
+#endif
+
 	/* setup video mode */
 	bochs_write(mmio, INDEX_ENABLE,  0);
 	bochs_write(mmio, INDEX_BANK,  0);