@samitouri / QOSamiQemu / commits / 220487ed13

hw/display/exynos4210_fimd: Assume display surface is 32bpp

For a long time QEMU has guaranteed that the console surface is 32bpp and not anything else. This old display device still has code assuming it might be something else. Remove the code that made put_pixel_toqemu a function pointer indirection, and use put_to_qemufb_pixel32() directly. This removes the last hw_error() in this file. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260508162013.2751001-5-peter.maydell@linaro.org

Peter Maydell committed May 8, 2026 at 17:20 UTC 220487ed13f35c0e56b730b71daf0043b7e614e5
1 file changed +2 -60
hw/display/exynos4210_fimd.c
+2 -60
@@ -24,7 +24,6 @@
24
25 #include "qemu/osdep.h"
26 #include "hw/core/qdev-properties.h"
27 -#include "hw/core/hw-error.h"
27 #include "hw/core/irq.h"
28 #include "hw/core/sysbus.h"
29 #include "exec/cpu-common.h"
@@ -867,37 +866,6 @@ static void draw_line_mapcolor(Exynos4210fimdWindow *w, uint8_t *src,
866 }
867
868 /* Write RGB to QEMU's GraphicConsole framebuffer */
870 -
871 -static int put_to_qemufb_pixel8(const rgba p, uint8_t *d)
872 -{
873 - uint32_t pixel = rgb_to_pixel8(p.r, p.g, p.b);
874 - *(uint8_t *)d = pixel;
875 - return 1;
876 -}
877 -
878 -static int put_to_qemufb_pixel15(const rgba p, uint8_t *d)
879 -{
880 - uint32_t pixel = rgb_to_pixel15(p.r, p.g, p.b);
881 - *(uint16_t *)d = pixel;
882 - return 2;
883 -}
884 -
885 -static int put_to_qemufb_pixel16(const rgba p, uint8_t *d)
886 -{
887 - uint32_t pixel = rgb_to_pixel16(p.r, p.g, p.b);
888 - *(uint16_t *)d = pixel;
889 - return 2;
890 -}
891 -
892 -static int put_to_qemufb_pixel24(const rgba p, uint8_t *d)
893 -{
894 - uint32_t pixel = rgb_to_pixel24(p.r, p.g, p.b);
895 - *(uint8_t *)d++ = (pixel >> 0) & 0xFF;
896 - *(uint8_t *)d++ = (pixel >> 8) & 0xFF;
897 - *(uint8_t *)d++ = (pixel >> 16) & 0xFF;
898 - return 3;
899 -}
900 -
869 static int put_to_qemufb_pixel32(const rgba p, uint8_t *d)
870 {
871 uint32_t pixel = rgb_to_pixel24(p.r, p.g, p.b);
@@ -905,32 +873,6 @@ static int put_to_qemufb_pixel32(const rgba p, uint8_t *d)
873 return 4;
874 }
875
908 -/* Routine to copy pixel from internal buffer to QEMU buffer */
909 -static int (*put_pixel_toqemu)(const rgba p, uint8_t *pixel);
910 -static inline void fimd_update_putpix_qemu(int bpp)
911 -{
912 - switch (bpp) {
913 - case 8:
914 - put_pixel_toqemu = put_to_qemufb_pixel8;
915 - break;
916 - case 15:
917 - put_pixel_toqemu = put_to_qemufb_pixel15;
918 - break;
919 - case 16:
920 - put_pixel_toqemu = put_to_qemufb_pixel16;
921 - break;
922 - case 24:
923 - put_pixel_toqemu = put_to_qemufb_pixel24;
924 - break;
925 - case 32:
926 - put_pixel_toqemu = put_to_qemufb_pixel32;
927 - break;
928 - default:
929 - hw_error("exynos4210.fimd: unsupported BPP (%d)", bpp);
930 - break;
931 - }
932 -}
933 -
876 /* Routine to copy a line from internal frame buffer to QEMU display */
877 static void fimd_copy_line_toqemu(int width, uint8_t *src, uint8_t *dst)
878 {
@@ -938,7 +880,7 @@ static void fimd_copy_line_toqemu(int width, uint8_t *src, uint8_t *dst)
880
881 do {
882 src += get_pixel_ifb(src, &p);
941 - dst += put_pixel_toqemu(p, dst);
883 + dst += put_to_qemufb_pixel32(p, dst);
884 } while (--width);
885 }
886
@@ -1336,7 +1278,7 @@ static bool exynos4210_fimd_update(void *opaque)
1278 int bpp;
1279
1280 bpp = surface_bits_per_pixel(surface);
1339 - fimd_update_putpix_qemu(bpp);
1281 + assert(bpp == 32);
1282 bpp = (bpp + 1) >> 3;
1283 d = surface_data(surface);
1284 for (line = first_line; line <= last_line; line++) {