From 2ec6a25b1ca31f8af1ac3dfe004bdeb0d96c04bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Thu, 26 Mar 2026 14:29:06 +0100 Subject: [PATCH] modesetting: byte-swap ARGB cursor uploads on big-endian --- hw/xfree86/drivers/modesetting/drmmode_display.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 0ec055921..994a33d7a 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -57,6 +57,12 @@ #include "driver.h" +#if X_BYTE_ORDER == X_BIG_ENDIAN +#define cpu_to_le32(x) bswap_32(x) +#else +#define cpu_to_le32(x) (x) +#endif + static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height); static PixmapPtr drmmode_create_pixmap_header(ScreenPtr pScreen, int width, int height, int depth, int bitsPerPixel, int devKind, @@ -1876,7 +1882,7 @@ drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 *image) i = 0; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) - ptr[i++] = image[y * ms->max_cursor_width + x]; // cpu_to_le32(image[i]); + ptr[i++] = cpu_to_le32(image[y * ms->max_cursor_width + x]); } /* clear the remainder for good measure */ for (; i < ms->max_cursor_width * ms->max_cursor_height; i++)