From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH 1/9] hw/arm/musicpal: Remove dead code for non-32-bit-RGB surfaces
Date: Mon, 15 Feb 2021 10:32:07 +0000 [thread overview]
Message-ID: <20210215103215.4944-2-peter.maydell@linaro.org> (raw)
In-Reply-To: <20210215103215.4944-1-peter.maydell@linaro.org>
For a long time now the UI layer has guaranteed that the console
surface is always 32 bits per pixel RGB. Remove the legacy dead
code from the milkymist display device which was handling the
possibility that the console surface was some other format.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/musicpal.c | 64 ++++++++++++++++++-----------------------------
1 file changed, 24 insertions(+), 40 deletions(-)
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 6aec84aeed8..9cebece2de0 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -512,53 +512,37 @@ static uint8_t scale_lcd_color(musicpal_lcd_state *s, uint8_t col)
}
}
-#define SET_LCD_PIXEL(depth, type) \
-static inline void glue(set_lcd_pixel, depth) \
- (musicpal_lcd_state *s, int x, int y, type col) \
-{ \
- int dx, dy; \
- DisplaySurface *surface = qemu_console_surface(s->con); \
- type *pixel = &((type *) surface_data(surface))[(y * 128 * 3 + x) * 3]; \
-\
- for (dy = 0; dy < 3; dy++, pixel += 127 * 3) \
- for (dx = 0; dx < 3; dx++, pixel++) \
- *pixel = col; \
+static inline void set_lcd_pixel32(musicpal_lcd_state *s,
+ int x, int y, uint32_t col)
+{
+ int dx, dy;
+ DisplaySurface *surface = qemu_console_surface(s->con);
+ uint32_t *pixel =
+ &((uint32_t *) surface_data(surface))[(y * 128 * 3 + x) * 3];
+
+ for (dy = 0; dy < 3; dy++, pixel += 127 * 3) {
+ for (dx = 0; dx < 3; dx++, pixel++) {
+ *pixel = col;
+ }
+ }
}
-SET_LCD_PIXEL(8, uint8_t)
-SET_LCD_PIXEL(16, uint16_t)
-SET_LCD_PIXEL(32, uint32_t)
static void lcd_refresh(void *opaque)
{
musicpal_lcd_state *s = opaque;
- DisplaySurface *surface = qemu_console_surface(s->con);
int x, y, col;
- switch (surface_bits_per_pixel(surface)) {
- case 0:
- return;
-#define LCD_REFRESH(depth, func) \
- case depth: \
- col = func(scale_lcd_color(s, (MP_LCD_TEXTCOLOR >> 16) & 0xff), \
- scale_lcd_color(s, (MP_LCD_TEXTCOLOR >> 8) & 0xff), \
- scale_lcd_color(s, MP_LCD_TEXTCOLOR & 0xff)); \
- for (x = 0; x < 128; x++) { \
- for (y = 0; y < 64; y++) { \
- if (s->video_ram[x + (y/8)*128] & (1 << (y % 8))) { \
- glue(set_lcd_pixel, depth)(s, x, y, col); \
- } else { \
- glue(set_lcd_pixel, depth)(s, x, y, 0); \
- } \
- } \
- } \
- break;
- LCD_REFRESH(8, rgb_to_pixel8)
- LCD_REFRESH(16, rgb_to_pixel16)
- LCD_REFRESH(32, (is_surface_bgr(surface) ?
- rgb_to_pixel32bgr : rgb_to_pixel32))
- default:
- hw_error("unsupported colour depth %i\n",
- surface_bits_per_pixel(surface));
+ col = rgb_to_pixel32(scale_lcd_color(s, (MP_LCD_TEXTCOLOR >> 16) & 0xff),
+ scale_lcd_color(s, (MP_LCD_TEXTCOLOR >> 8) & 0xff),
+ scale_lcd_color(s, MP_LCD_TEXTCOLOR & 0xff));
+ for (x = 0; x < 128; x++) {
+ for (y = 0; y < 64; y++) {
+ if (s->video_ram[x + (y / 8) * 128] & (1 << (y % 8))) {
+ set_lcd_pixel32(s, x, y, col);
+ } else {
+ set_lcd_pixel32(s, x, y, 0);
+ }
+ }
}
dpy_gfx_update(s->con, 0, 0, 128*3, 64*3);
--
2.20.1
next prev parent reply other threads:[~2021-02-15 10:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-15 10:32 [PATCH 0/9] arm: drop dead code for non-32-bit-RGB surfaces Peter Maydell
2021-02-15 10:32 ` Peter Maydell [this message]
2021-02-15 10:32 ` [PATCH 2/9] hw/display/tc6393xb: Remove dead code for handling non-32bpp surfaces Peter Maydell
2021-02-15 10:32 ` [PATCH 3/9] hw/display/tc6393xb: Expand out macros in template header Peter Maydell
2021-02-15 10:32 ` [PATCH 4/9] hw/display/tc6393xb: Inline tc6393xb_draw_graphic32() at its callsite Peter Maydell
2021-02-15 10:56 ` Philippe Mathieu-Daudé
2021-02-15 10:32 ` [PATCH 5/9] hw/display/omap_lcdc: Expand out macros in template header Peter Maydell
2021-02-15 10:32 ` [PATCH 6/9] hw/display/omap_lcdc: Drop broken bigendian ifdef Peter Maydell
2021-02-15 10:58 ` Philippe Mathieu-Daudé
2021-02-15 10:32 ` [PATCH 7/9] hw/display/omap_lcdc: Fix coding style issues in template header Peter Maydell
2021-02-15 10:58 ` Philippe Mathieu-Daudé
2021-02-15 10:32 ` [PATCH 8/9] hw/display/omap_lcdc: Inline template header into C file Peter Maydell
2021-02-15 10:59 ` Philippe Mathieu-Daudé
2021-02-15 10:32 ` [PATCH 9/9] hw/display/omap_lcdc: Delete unnecessary macro Peter Maydell
2021-02-15 10:59 ` Philippe Mathieu-Daudé
2021-02-16 0:45 ` [PATCH 0/9] arm: drop dead code for non-32-bit-RGB surfaces Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210215103215.4944-2-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=kraxel@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).