2 * QEMU Epson S1D13744/S1D13745 templates
4 * Copyright (C) 2008 Nokia Corporation
5 * Written by Andrzej Zaborowski <andrew@openedhand.com>
7 * QEMU OMAP3 LCD Panel Emulation templates
9 * Copyright (c) 2008 yajin <yajin@vm-kernel.org>
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 or
14 * (at your option) version 3 of the License.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #define SKIP_PIXEL(to) to += deststep
30 # define PIXEL_TYPE uint8_t
31 # define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to)
32 # define COPY_PIXEL1(to, from) *to ++ = from
33 #elif DEPTH == 15 || DEPTH == 16
34 # define PIXEL_TYPE uint16_t
35 # define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to)
36 # define COPY_PIXEL1(to, from) *to ++ = from
38 # define PIXEL_TYPE uint8_t
39 # define COPY_PIXEL(to, from) \
40 to[0] = from; to[1] = (from) >> 8; to[2] = (from) >> 16; SKIP_PIXEL(to)
41 # define COPY_PIXEL1(to, from) \
42 *to ++ = from; *to ++ = (from) >> 8; *to ++ = (from) >> 16
44 # define PIXEL_TYPE uint32_t
45 # define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to)
46 # define COPY_PIXEL1(to, from) *to ++ = from
48 # error unknown bit depth
51 #ifdef WORDS_BIGENDIAN
56 static void glue(omap3_lcd_panel_draw_line16_, DEPTH)(PIXEL_TYPE *dest,
60 #if !defined(SWAP_WORDS) && DEPTH == 16
61 memcpy(dest, src, width);
65 const uint16_t *end = (const void *) src + width;
67 data = lduw_raw(src ++);
68 b = (data & 0x1f) << 3;
70 g = (data & 0x3f) << 2;
72 r = (data & 0x1f) << 3;
74 COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));
79 static void glue(omap3_lcd_panel_draw_line24a_, DEPTH)(PIXEL_TYPE *dest,
83 #if !defined(SWAP_WORDS) && DEPTH == 32
84 memcpy(dest, src, width);
87 const uint8_t *end = (const void *) src + width;
93 COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));
98 static void glue(omap3_lcd_panel_draw_line24b_, DEPTH)(PIXEL_TYPE *dest,
103 memcpy(dest, src, width);
105 unsigned int r, g, b;
106 const uint8_t *end = (const void *) src + width;
111 COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));
117 static omap3_lcd_panel_fn_t glue(omap3_lcd_panel_draw_fn_, DEPTH)[0x10] = {
124 (omap3_lcd_panel_fn_t)glue(omap3_lcd_panel_draw_line16_, DEPTH),
126 (omap3_lcd_panel_fn_t)glue(omap3_lcd_panel_draw_line24a_, DEPTH),
127 (omap3_lcd_panel_fn_t)glue(omap3_lcd_panel_draw_line24b_, DEPTH),
136 /* 90deg, 180deg and 270deg rotation */
137 static omap3_lcd_panel_fn_t glue(omap3_lcd_panel_draw_fn_r_, DEPTH)[0x10] = {