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,
29 # define PIXEL_TYPE uint8_t
30 # define COPY_PIXEL1(to, from) *to ++ = from
31 #elif DEPTH == 15 || DEPTH == 16
32 # define PIXEL_TYPE uint16_t
33 # define COPY_PIXEL1(to, from) *to ++ = from
35 # define PIXEL_TYPE uint8_t
36 # define COPY_PIXEL1(to, from) \
37 *to ++ = from; *to ++ = (from) >> 8; *to ++ = (from) >> 16
39 # define PIXEL_TYPE uint32_t
40 # define COPY_PIXEL1(to, from) *to ++ = from
42 # error unknown bit depth
45 #ifdef WORDS_BIGENDIAN
50 static void glue(omap3_lcd_panel_draw_line16_, DEPTH)(PIXEL_TYPE *dest,
54 #if !defined(SWAP_WORDS) && DEPTH == 16
55 memcpy(dest, src, width);
59 const uint16_t *end = (const void *) src + width;
61 data = lduw_raw(src ++);
62 b = (data & 0x1f) << 3;
64 g = (data & 0x3f) << 2;
66 r = (data & 0x1f) << 3;
68 COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));
73 static void glue(omap3_lcd_panel_draw_line24a_, DEPTH)(PIXEL_TYPE *dest,
77 #if !defined(SWAP_WORDS) && DEPTH == 32
78 memcpy(dest, src, width);
81 const uint8_t *end = (const void *) src + width;
87 COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));
92 static void glue(omap3_lcd_panel_draw_line24b_, DEPTH)(PIXEL_TYPE *dest,
97 memcpy(dest, src, width);
100 const uint8_t *end = (const void *) src + width;
105 COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));
111 static omap3_lcd_panel_fn_t glue(omap3_lcd_panel_draw_fn_, DEPTH)[0x10] = {
118 (omap3_lcd_panel_fn_t)glue(omap3_lcd_panel_draw_line16_, DEPTH),
120 (omap3_lcd_panel_fn_t)glue(omap3_lcd_panel_draw_line24a_, DEPTH),
121 (omap3_lcd_panel_fn_t)glue(omap3_lcd_panel_draw_line24b_, DEPTH),
130 /* 90deg, 180deg and 270deg rotation */
131 static omap3_lcd_panel_fn_t glue(omap3_lcd_panel_draw_fn_r_, DEPTH)[0x10] = {