1a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz/* 2a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * linux/drivers/video/iplan2p2.c -- Low level frame buffer operations for 3a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * interleaved bitplanes à la Atari (2 4a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * planes, 2 bytes interleave) 5a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * 6a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * Created 5 Apr 1997 by Geert Uytterhoeven 7a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * 8a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * This file is subject to the terms and conditions of the GNU General Public 9a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * License. See the file COPYING in the main directory of this archive for 10a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * more details. 11a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz */ 12a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 13a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz#include <linux/module.h> 14a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz#include <linux/string.h> 15a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz#include <linux/fb.h> 16a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 17a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz#include <asm/setup.h> 18a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 19a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz#include "atafb.h" 20a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 21a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz#define BPL 2 22a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz#include "atafb_utils.h" 23a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 24a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitzvoid atafb_iplan2p2_copyarea(struct fb_info *info, u_long next_line, 25a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz int sy, int sx, int dy, int dx, 26a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz int height, int width) 27a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz{ 28a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz /* bmove() has to distinguish two major cases: If both, source and 29a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * destination, start at even addresses or both are at odd 30a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * addresses, just the first odd and last even column (if present) 31a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * require special treatment (memmove_col()). The rest between 32a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * then can be copied by normal operations, because all adjacent 33a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * bytes are affected and are to be stored in the same order. 34a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * The pathological case is when the move should go from an odd 35a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * address to an even or vice versa. Since the bytes in the plane 36a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * words must be assembled in new order, it seems wisest to make 37a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * all movements by memmove_col(). 38a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz */ 39a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 40a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u8 *src, *dst; 41a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 *s, *d; 42a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz int w, l , i, j; 43a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u_int colsize; 44a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u_int upwards = (dy < sy) || (dy == sy && dx < sx); 45a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 46a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz colsize = height; 47a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (!((sx ^ dx) & 15)) { 48a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz /* odd->odd or even->even */ 49a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 50a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (upwards) { 51a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src = (u8 *)info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL); 52a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst = (u8 *)info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL); 53a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (sx & 15) { 54a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz memmove32_col(dst, src, 0xff00ff, height, next_line - BPL * 2); 55a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src += BPL * 2; 56a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst += BPL * 2; 57a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz width -= 8; 58a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 59a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz w = width >> 4; 60a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (w) { 61a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz s = (u32 *)src; 62a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz d = (u32 *)dst; 63a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz w *= BPL / 2; 64a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz l = next_line - w * 4; 65a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (j = height; j > 0; j--) { 66a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (i = w; i > 0; i--) 67a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz *d++ = *s++; 68a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz s = (u32 *)((u8 *)s + l); 69a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz d = (u32 *)((u8 *)d + l); 70a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 71a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 72a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (width & 15) 73a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz memmove32_col(dst + width / (8 / BPL), src + width / (8 / BPL), 74a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 0xff00ff00, height, next_line - BPL * 2); 75a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } else { 76a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src = (u8 *)info->screen_base + (sy - 1) * next_line + ((sx + width + 8) & ~15) / (8 / BPL); 77a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst = (u8 *)info->screen_base + (dy - 1) * next_line + ((dx + width + 8) & ~15) / (8 / BPL); 78a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 79a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if ((sx + width) & 15) { 80a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src -= BPL * 2; 81a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst -= BPL * 2; 82a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz memmove32_col(dst, src, 0xff00ff00, colsize, -next_line - BPL * 2); 83a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz width -= 8; 84a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 85a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz w = width >> 4; 86a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (w) { 87a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz s = (u32 *)src; 88a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz d = (u32 *)dst; 89a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz w *= BPL / 2; 90a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz l = next_line - w * 4; 91a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (j = height; j > 0; j--) { 92a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (i = w; i > 0; i--) 93a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz *--d = *--s; 94a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz s = (u32 *)((u8 *)s - l); 95a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz d = (u32 *)((u8 *)d - l); 96a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 97a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 98a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (sx & 15) 99a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz memmove32_col(dst - (width - 16) / (8 / BPL), 100a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src - (width - 16) / (8 / BPL), 101a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 0xff00ff, colsize, -next_line - BPL * 2); 102a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 103a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } else { 104a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz /* odd->even or even->odd */ 105a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (upwards) { 106a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 *src32, *dst32; 107a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 pval[4], v, v1, mask; 108a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz int i, j, w, f; 109a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 110a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src = (u8 *)info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL); 111a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst = (u8 *)info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL); 112a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 113a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz mask = 0xff00ff00; 114a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz f = 0; 115a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz w = width; 116a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (sx & 15) { 117a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz f = 1; 118a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz w += 8; 119a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 120a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if ((sx + width) & 15) 121a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz f |= 2; 122a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz w >>= 4; 123a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (i = height; i; i--) { 124a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src32 = (u32 *)src; 125a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst32 = (u32 *)dst; 126a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 127a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (f & 1) { 128a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz pval[0] = (*src32++ << 8) & mask; 129a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } else { 130a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz pval[0] = dst32[0] & mask; 131a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 132a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 133a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (j = w; j > 0; j--) { 134a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz v = *src32++; 135a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz v1 = v & mask; 136a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz *dst32++ = pval[0] | (v1 >> 8); 137a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz pval[0] = (v ^ v1) << 8; 138a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 139a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 140a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (f & 2) { 141a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst32[0] = (dst32[0] & mask) | pval[0]; 142a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 143a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 144a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src += next_line; 145a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst += next_line; 146a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 147a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } else { 148a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 *src32, *dst32; 149a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 pval[4], v, v1, mask; 150a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz int i, j, w, f; 151a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 152a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src = (u8 *)info->screen_base + (sy - 1) * next_line + ((sx + width + 8) & ~15) / (8 / BPL); 153a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst = (u8 *)info->screen_base + (dy - 1) * next_line + ((dx + width + 8) & ~15) / (8 / BPL); 154a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 155a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz mask = 0xff00ff; 156a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz f = 0; 157a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz w = width; 158a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if ((dx + width) & 15) 159a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz f = 1; 160a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (sx & 15) { 161a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz f |= 2; 162a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz w += 8; 163a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 164a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz w >>= 4; 165a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (i = height; i; i--) { 166a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src32 = (u32 *)src; 167a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst32 = (u32 *)dst; 168a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 169a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (f & 1) { 170a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz pval[0] = dst32[-1] & mask; 171a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } else { 172a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz pval[0] = (*--src32 >> 8) & mask; 173a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 174a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 175a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (j = w; j > 0; j--) { 176a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz v = *--src32; 177a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz v1 = v & mask; 178a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz *--dst32 = pval[0] | (v1 << 8); 179a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz pval[0] = (v ^ v1) >> 8; 180a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 181a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 182a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (!(f & 2)) { 183a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst32[-1] = (dst32[-1] & mask) | pval[0]; 184a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 185a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 186a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz src -= next_line; 187a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dst -= next_line; 188a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 189a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 190a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 191a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz} 192a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 193a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitzvoid atafb_iplan2p2_fillrect(struct fb_info *info, u_long next_line, u32 color, 194a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz int sy, int sx, int height, int width) 195a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz{ 196a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 *dest; 197a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz int rows, i; 198a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 cval[4]; 199a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 200a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dest = (u32 *)(info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL)); 201a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (sx & 15) { 202a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u8 *dest8 = (u8 *)dest + 1; 203a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 204a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz expand8_col2mask(color, cval); 205a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 206a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (i = height; i; i--) { 207a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz fill8_col(dest8, cval); 208a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dest8 += next_line; 209a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 210a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dest += BPL / 2; 211a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz width -= 8; 212a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 213a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 214a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz expand16_col2mask(color, cval); 215a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz rows = width >> 4; 216a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (rows) { 217a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 *d = dest; 218a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 off = next_line - rows * BPL * 2; 219a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (i = height; i; i--) { 220a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz d = fill16_col(d, rows, cval); 221a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz d = (u32 *)((long)d + off); 222a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 223a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dest += rows * BPL / 2; 224a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz width &= 15; 225a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 226a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 227a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (width) { 228a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u8 *dest8 = (u8 *)dest; 229a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 230a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz expand8_col2mask(color, cval); 231a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 232a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (i = height; i; i--) { 233a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz fill8_col(dest8, cval); 234a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dest8 += next_line; 235a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 236a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 237a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz} 238a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 239a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitzvoid atafb_iplan2p2_linefill(struct fb_info *info, u_long next_line, 240a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz int dy, int dx, u32 width, 241a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz const u8 *data, u32 bgcolor, u32 fgcolor) 242a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz{ 243a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 *dest; 244a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz const u16 *data16; 245a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz int rows; 246a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u32 fgm[4], bgm[4], m; 247a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 248a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dest = (u32 *)(info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL)); 249a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (dx & 15) { 250a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz fill8_2col((u8 *)dest + 1, fgcolor, bgcolor, *data++); 251a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz dest += BPL / 2; 252a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz width -= 8; 253a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 254a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 255a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (width >= 16) { 256a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz data16 = (const u16 *)data; 257a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz expand16_2col2mask(fgcolor, bgcolor, fgm, bgm); 258a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 259a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz for (rows = width / 16; rows; rows--) { 260a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz u16 d = *data16++; 261a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz m = d | ((u32)d << 16); 262a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz *dest++ = (m & fgm[0]) ^ bgm[0]; 263a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 264a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 265a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz data = (const u8 *)data16; 266a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz width &= 15; 267a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz } 268a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 269a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz if (width) 270a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz fill8_2col((u8 *)dest, fgcolor, bgcolor, *data); 271a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz} 272a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 273a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz#ifdef MODULE 274a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael SchmitzMODULE_LICENSE("GPL"); 275a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 276a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitzint init_module(void) 277a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz{ 278a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz return 0; 279a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz} 280a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 281a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitzvoid cleanup_module(void) 282a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz{ 283a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz} 284a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz#endif /* MODULE */ 285a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 286a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 287a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz /* 288a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz * Visible symbols for modules 289a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz */ 290a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael Schmitz 291a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael SchmitzEXPORT_SYMBOL(atafb_iplan2p2_copyarea); 292a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael SchmitzEXPORT_SYMBOL(atafb_iplan2p2_fillrect); 293a100501212f2e26bb6d70bfb5c55eefd90e22b65Michael SchmitzEXPORT_SYMBOL(atafb_iplan2p2_linefill); 294