[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/9] hw/display/tc6393xb: Inline tc6393xb_draw_graphic32() at its
From: |
Peter Maydell |
Subject: |
[PATCH 4/9] hw/display/tc6393xb: Inline tc6393xb_draw_graphic32() at its callsite |
Date: |
Mon, 15 Feb 2021 10:32:10 +0000 |
The function tc6393xb_draw_graphic32() is called in exactly one place,
so just inline the function body at its callsite. This allows us to
drop the template header entirely.
The code move includes a single added space after 'for' to fix
the coding style.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/display/tc6393xb_template.h | 45 ----------------------------------
hw/display/tc6393xb.c | 23 ++++++++++++++---
2 files changed, 19 insertions(+), 49 deletions(-)
delete mode 100644 hw/display/tc6393xb_template.h
diff --git a/hw/display/tc6393xb_template.h b/hw/display/tc6393xb_template.h
deleted file mode 100644
index 7789ffc4399..00000000000
--- a/hw/display/tc6393xb_template.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Toshiba TC6393XB I/O Controller.
- * Found in Sharp Zaurus SL-6000 (tosa) or some
- * Toshiba e-Series PDAs.
- *
- * FB support code. Based on G364 fb emulator
- *
- * Copyright (c) 2007 Hervé Poussineau
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-static void tc6393xb_draw_graphic32(TC6393xbState *s)
-{
- DisplaySurface *surface = qemu_console_surface(s->con);
- int i;
- uint16_t *data_buffer;
- uint8_t *data_display;
-
- data_buffer = s->vram_ptr;
- data_display = surface_data(surface);
- for(i = 0; i < s->scr_height; i++) {
- int j;
- for (j = 0; j < s->scr_width; j++, data_display += 4, data_buffer++) {
- uint16_t color = *data_buffer;
- uint32_t dest_color = rgb_to_pixel32(
- ((color & 0xf800) * 0x108) >> 11,
- ((color & 0x7e0) * 0x41) >> 9,
- ((color & 0x1f) * 0x21) >> 2
- );
- *(uint32_t *)data_display = dest_color;
- }
- }
-}
diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c
index 4cddb1a99ad..1f28223c7be 100644
--- a/hw/display/tc6393xb.c
+++ b/hw/display/tc6393xb.c
@@ -410,12 +410,27 @@ static void tc6393xb_nand_writeb(TC6393xbState *s, hwaddr
addr, uint32_t value)
(uint32_t) addr, value & 0xff);
}
-#define BITS 32
-#include "tc6393xb_template.h"
-
static void tc6393xb_draw_graphic(TC6393xbState *s, int full_update)
{
- tc6393xb_draw_graphic32(s);
+ DisplaySurface *surface = qemu_console_surface(s->con);
+ int i;
+ uint16_t *data_buffer;
+ uint8_t *data_display;
+
+ data_buffer = s->vram_ptr;
+ data_display = surface_data(surface);
+ for (i = 0; i < s->scr_height; i++) {
+ int j;
+ for (j = 0; j < s->scr_width; j++, data_display += 4, data_buffer++) {
+ uint16_t color = *data_buffer;
+ uint32_t dest_color = rgb_to_pixel32(
+ ((color & 0xf800) * 0x108) >> 11,
+ ((color & 0x7e0) * 0x41) >> 9,
+ ((color & 0x1f) * 0x21) >> 2
+ );
+ *(uint32_t *)data_display = dest_color;
+ }
+ }
dpy_gfx_update_full(s->con);
}
--
2.20.1
- [PATCH 0/9] arm: drop dead code for non-32-bit-RGB surfaces, Peter Maydell, 2021/02/15
- [PATCH 1/9] hw/arm/musicpal: Remove dead code for non-32-bit-RGB surfaces, Peter Maydell, 2021/02/15
- [PATCH 3/9] hw/display/tc6393xb: Expand out macros in template header, Peter Maydell, 2021/02/15
- [PATCH 4/9] hw/display/tc6393xb: Inline tc6393xb_draw_graphic32() at its callsite,
Peter Maydell <=
- [PATCH 5/9] hw/display/omap_lcdc: Expand out macros in template header, Peter Maydell, 2021/02/15
- [PATCH 2/9] hw/display/tc6393xb: Remove dead code for handling non-32bpp surfaces, Peter Maydell, 2021/02/15
- [PATCH 6/9] hw/display/omap_lcdc: Drop broken bigendian ifdef, Peter Maydell, 2021/02/15
- [PATCH 7/9] hw/display/omap_lcdc: Fix coding style issues in template header, Peter Maydell, 2021/02/15
- [PATCH 9/9] hw/display/omap_lcdc: Delete unnecessary macro, Peter Maydell, 2021/02/15
- [PATCH 8/9] hw/display/omap_lcdc: Inline template header into C file, Peter Maydell, 2021/02/15