Big Endian qemu_pixelformat_from_pixman and qemu_default_pixman_format
Hi Gerd,
I'm working on improving the OpenRISC support for QEMU and recently I got in
one problem with qemu_pixelformat_from_pixman(). It seems quite recently the ui/console.c code has started using it for big endian as well but the new change breaks my existing framebuffer patches.
The problem is that for little endian 32bpp qemu_default_pixman_format() will
return PIXMAN_x8r8g8b8 but for big endian 32bpp it returns PIXMAN_b8g8r8a8:pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endian)
{
if (native_endian) {
switch (bpp) {
case 15:
return PIXMAN_x1r5g5b5;
case 16:
return PIXMAN_r5g6b5;
case 24:
return PIXMAN_r8g8b8;
case 32:
return PIXMAN_x8r8g8b8;
}
} else {
switch (bpp) {
case 24:
return PIXMAN_b8g8r8;
case 32:
return PIXMAN_b8g8r8a8;
break;
}
} I was wondering if there is any reason not to return PIXMAN_b8g8r8x8 also for
big endian? In the worst case scenario it would be compatible to the previous code.
If you are OK, I would like to submit this patch:
ui/qemu-pixman.c +0 -0
@@ -80,7 +80,7 @@ pixman_format_code_t qemu_default_pixman_format(int bpp, bool
native_endian)
case 24:
return PIXMAN_b8g8r8;
case 32:
- return PIXMAN_b8g8r8a8;
+ return PIXMAN_b8g8r8x8;
break;
}
}Thanks
Quoted 9 lines · Valentin Manea
Hi Gerd,
I'm working on improving the OpenRISC support for QEMU and recently I got in
one problem withqemu_pixelformat_from_pixman(). It seems quite recently theui/console.ccode has started using it for big endian as well but the new change breaks my existing framebuffer patches.I was wondering if there is any reason not to return
PIXMAN_b8g8r8x8also for
big endian? In the worst case scenario it would be compatible to the previous code.
It's a bug indeed (and it is the one which breaks ppc guest display on x86_64 hosts with SDL).
Quoted 14 lines
If you are OK, I would like to submit this patch:
ui/qemu-pixman.c +1
-1@@ -80,7 +80,7 @@ pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endian)case 24 :return PIXMAN_b8g8r8;case 32 : -return PIXMAN_b8g8r8a8; +return PIXMAN_b8g8r8x8;break ; }
Quoted 1 line
}
Fix is correct.
cheers,
Gerd