Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/drivers/video/fbcmap.c -- Colormap handling for frame buffer devices |
| 3 | * |
| 4 | * Created 15 Jun 1997 by Geert Uytterhoeven |
| 5 | * |
| 6 | * 2001 - Documented with DocBook |
| 7 | * - Brad Douglas <brad@neruo.com> |
| 8 | * |
| 9 | * This file is subject to the terms and conditions of the GNU General Public |
| 10 | * License. See the file COPYING in the main directory of this archive for |
| 11 | * more details. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/string.h> |
| 15 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/fb.h> |
| 17 | #include <linux/slab.h> |
Krzysztof Helt | 84902b7 | 2007-10-16 01:29:04 -0700 | [diff] [blame] | 18 | #include <linux/uaccess.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 20 | static u16 red2[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | 0x0000, 0xaaaa |
| 22 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 23 | static u16 green2[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | 0x0000, 0xaaaa |
| 25 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 26 | static u16 blue2[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | 0x0000, 0xaaaa |
| 28 | }; |
| 29 | |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 30 | static u16 red4[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | 0x0000, 0xaaaa, 0x5555, 0xffff |
| 32 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 33 | static u16 green4[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | 0x0000, 0xaaaa, 0x5555, 0xffff |
| 35 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 36 | static u16 blue4[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | 0x0000, 0xaaaa, 0x5555, 0xffff |
| 38 | }; |
| 39 | |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 40 | static u16 red8[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | 0x0000, 0x0000, 0x0000, 0x0000, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa |
| 42 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 43 | static u16 green8[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | 0x0000, 0x0000, 0xaaaa, 0xaaaa, 0x0000, 0x0000, 0x5555, 0xaaaa |
| 45 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 46 | static u16 blue8[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | 0x0000, 0xaaaa, 0x0000, 0xaaaa, 0x0000, 0xaaaa, 0x0000, 0xaaaa |
| 48 | }; |
| 49 | |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 50 | static u16 red16[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | 0x0000, 0x0000, 0x0000, 0x0000, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, |
| 52 | 0x5555, 0x5555, 0x5555, 0x5555, 0xffff, 0xffff, 0xffff, 0xffff |
| 53 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 54 | static u16 green16[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | 0x0000, 0x0000, 0xaaaa, 0xaaaa, 0x0000, 0x0000, 0x5555, 0xaaaa, |
| 56 | 0x5555, 0x5555, 0xffff, 0xffff, 0x5555, 0x5555, 0xffff, 0xffff |
| 57 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 58 | static u16 blue16[] __read_mostly = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | 0x0000, 0xaaaa, 0x0000, 0xaaaa, 0x0000, 0xaaaa, 0x0000, 0xaaaa, |
| 60 | 0x5555, 0xffff, 0x5555, 0xffff, 0x5555, 0xffff, 0x5555, 0xffff |
| 61 | }; |
| 62 | |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 63 | static const struct fb_cmap default_2_colors = { |
| 64 | .len=2, .red=red2, .green=green2, .blue=blue2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 66 | static const struct fb_cmap default_8_colors = { |
| 67 | .len=8, .red=red8, .green=green8, .blue=blue8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 69 | static const struct fb_cmap default_4_colors = { |
| 70 | .len=4, .red=red4, .green=green4, .blue=blue4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | }; |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 72 | static const struct fb_cmap default_16_colors = { |
| 73 | .len=16, .red=red16, .green=green16, .blue=blue16 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 77 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | /** |
| 79 | * fb_alloc_cmap - allocate a colormap |
| 80 | * @cmap: frame buffer colormap structure |
| 81 | * @len: length of @cmap |
| 82 | * @transp: boolean, 1 if there is transparency, 0 otherwise |
Randy Dunlap | 22a9594 | 2010-11-26 05:20:25 +0000 | [diff] [blame] | 83 | * @flags: flags for kmalloc memory allocation |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | * |
| 85 | * Allocates memory for a colormap @cmap. @len is the |
| 86 | * number of entries in the palette. |
| 87 | * |
Alan Curry | db77ec2 | 2006-03-27 01:17:30 -0800 | [diff] [blame] | 88 | * Returns negative errno on error, or zero on success. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | * |
| 90 | */ |
| 91 | |
Dan Carpenter | 1e7c780 | 2010-11-16 12:11:02 +0300 | [diff] [blame] | 92 | int fb_alloc_cmap_gfp(struct fb_cmap *cmap, int len, int transp, gfp_t flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | { |
Dan Carpenter | c353103 | 2010-11-13 13:06:38 +0300 | [diff] [blame] | 94 | int size = len * sizeof(u16); |
Dan Carpenter | 1e7c780 | 2010-11-16 12:11:02 +0300 | [diff] [blame] | 95 | int ret = -ENOMEM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | |
Dan Carpenter | c353103 | 2010-11-13 13:06:38 +0300 | [diff] [blame] | 97 | if (cmap->len != len) { |
| 98 | fb_dealloc_cmap(cmap); |
| 99 | if (!len) |
| 100 | return 0; |
| 101 | |
Dan Carpenter | 1e7c780 | 2010-11-16 12:11:02 +0300 | [diff] [blame] | 102 | cmap->red = kmalloc(size, flags); |
Dan Carpenter | c353103 | 2010-11-13 13:06:38 +0300 | [diff] [blame] | 103 | if (!cmap->red) |
| 104 | goto fail; |
Dan Carpenter | 1e7c780 | 2010-11-16 12:11:02 +0300 | [diff] [blame] | 105 | cmap->green = kmalloc(size, flags); |
Dan Carpenter | c353103 | 2010-11-13 13:06:38 +0300 | [diff] [blame] | 106 | if (!cmap->green) |
| 107 | goto fail; |
Dan Carpenter | 1e7c780 | 2010-11-16 12:11:02 +0300 | [diff] [blame] | 108 | cmap->blue = kmalloc(size, flags); |
Dan Carpenter | c353103 | 2010-11-13 13:06:38 +0300 | [diff] [blame] | 109 | if (!cmap->blue) |
| 110 | goto fail; |
| 111 | if (transp) { |
Dan Carpenter | 1e7c780 | 2010-11-16 12:11:02 +0300 | [diff] [blame] | 112 | cmap->transp = kmalloc(size, flags); |
Dan Carpenter | c353103 | 2010-11-13 13:06:38 +0300 | [diff] [blame] | 113 | if (!cmap->transp) |
| 114 | goto fail; |
| 115 | } else { |
| 116 | cmap->transp = NULL; |
| 117 | } |
| 118 | } |
| 119 | cmap->start = 0; |
| 120 | cmap->len = len; |
Dan Carpenter | 1e7c780 | 2010-11-16 12:11:02 +0300 | [diff] [blame] | 121 | ret = fb_copy_cmap(fb_default_cmap(len), cmap); |
| 122 | if (ret) |
| 123 | goto fail; |
Dan Carpenter | c353103 | 2010-11-13 13:06:38 +0300 | [diff] [blame] | 124 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | |
| 126 | fail: |
Dan Carpenter | c353103 | 2010-11-13 13:06:38 +0300 | [diff] [blame] | 127 | fb_dealloc_cmap(cmap); |
Dan Carpenter | 1e7c780 | 2010-11-16 12:11:02 +0300 | [diff] [blame] | 128 | return ret; |
| 129 | } |
| 130 | |
| 131 | int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp) |
| 132 | { |
| 133 | return fb_alloc_cmap_gfp(cmap, len, transp, GFP_ATOMIC); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | /** |
| 137 | * fb_dealloc_cmap - deallocate a colormap |
| 138 | * @cmap: frame buffer colormap structure |
| 139 | * |
| 140 | * Deallocates a colormap that was previously allocated with |
| 141 | * fb_alloc_cmap(). |
| 142 | * |
| 143 | */ |
| 144 | |
| 145 | void fb_dealloc_cmap(struct fb_cmap *cmap) |
| 146 | { |
| 147 | kfree(cmap->red); |
| 148 | kfree(cmap->green); |
| 149 | kfree(cmap->blue); |
| 150 | kfree(cmap->transp); |
| 151 | |
| 152 | cmap->red = cmap->green = cmap->blue = cmap->transp = NULL; |
| 153 | cmap->len = 0; |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * fb_copy_cmap - copy a colormap |
| 158 | * @from: frame buffer colormap structure |
| 159 | * @to: frame buffer colormap structure |
| 160 | * |
| 161 | * Copy contents of colormap from @from to @to. |
| 162 | */ |
| 163 | |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 164 | int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | { |
| 166 | int tooff = 0, fromoff = 0; |
| 167 | int size; |
| 168 | |
| 169 | if (to->start > from->start) |
| 170 | fromoff = to->start - from->start; |
| 171 | else |
| 172 | tooff = from->start - to->start; |
| 173 | size = to->len - tooff; |
| 174 | if (size > (int) (from->len - fromoff)) |
| 175 | size = from->len - fromoff; |
| 176 | if (size <= 0) |
| 177 | return -EINVAL; |
| 178 | size *= sizeof(u16); |
| 179 | |
| 180 | memcpy(to->red+tooff, from->red+fromoff, size); |
| 181 | memcpy(to->green+tooff, from->green+fromoff, size); |
| 182 | memcpy(to->blue+tooff, from->blue+fromoff, size); |
| 183 | if (from->transp && to->transp) |
| 184 | memcpy(to->transp+tooff, from->transp+fromoff, size); |
| 185 | return 0; |
| 186 | } |
| 187 | |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 188 | int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | { |
| 190 | int tooff = 0, fromoff = 0; |
| 191 | int size; |
| 192 | |
| 193 | if (to->start > from->start) |
| 194 | fromoff = to->start - from->start; |
| 195 | else |
| 196 | tooff = from->start - to->start; |
| 197 | size = to->len - tooff; |
| 198 | if (size > (int) (from->len - fromoff)) |
| 199 | size = from->len - fromoff; |
| 200 | if (size <= 0) |
| 201 | return -EINVAL; |
| 202 | size *= sizeof(u16); |
| 203 | |
| 204 | if (copy_to_user(to->red+tooff, from->red+fromoff, size)) |
| 205 | return -EFAULT; |
| 206 | if (copy_to_user(to->green+tooff, from->green+fromoff, size)) |
| 207 | return -EFAULT; |
| 208 | if (copy_to_user(to->blue+tooff, from->blue+fromoff, size)) |
| 209 | return -EFAULT; |
| 210 | if (from->transp && to->transp) |
| 211 | if (copy_to_user(to->transp+tooff, from->transp+fromoff, size)) |
| 212 | return -EFAULT; |
| 213 | return 0; |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * fb_set_cmap - set the colormap |
| 218 | * @cmap: frame buffer colormap structure |
| 219 | * @info: frame buffer info structure |
| 220 | * |
| 221 | * Sets the colormap @cmap for a screen of device @info. |
| 222 | * |
| 223 | * Returns negative errno on error, or zero on success. |
| 224 | * |
| 225 | */ |
| 226 | |
| 227 | int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info) |
| 228 | { |
Michal Januszewski | 03e259a | 2005-07-27 11:46:08 -0700 | [diff] [blame] | 229 | int i, start, rc = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | u16 *red, *green, *blue, *transp; |
| 231 | u_int hred, hgreen, hblue, htransp = 0xffff; |
| 232 | |
| 233 | red = cmap->red; |
| 234 | green = cmap->green; |
| 235 | blue = cmap->blue; |
| 236 | transp = cmap->transp; |
| 237 | start = cmap->start; |
| 238 | |
Benjamin Herrenschmidt | 7149437 | 2005-05-01 08:59:22 -0700 | [diff] [blame] | 239 | if (start < 0 || (!info->fbops->fb_setcolreg && |
| 240 | !info->fbops->fb_setcmap)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | return -EINVAL; |
Michal Januszewski | 03e259a | 2005-07-27 11:46:08 -0700 | [diff] [blame] | 242 | if (info->fbops->fb_setcmap) { |
| 243 | rc = info->fbops->fb_setcmap(cmap, info); |
| 244 | } else { |
| 245 | for (i = 0; i < cmap->len; i++) { |
| 246 | hred = *red++; |
| 247 | hgreen = *green++; |
| 248 | hblue = *blue++; |
| 249 | if (transp) |
| 250 | htransp = *transp++; |
| 251 | if (info->fbops->fb_setcolreg(start++, |
| 252 | hred, hgreen, hblue, |
| 253 | htransp, info)) |
| 254 | break; |
| 255 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | } |
Michal Januszewski | 03e259a | 2005-07-27 11:46:08 -0700 | [diff] [blame] | 257 | if (rc == 0) |
| 258 | fb_copy_cmap(cmap, &info->cmap); |
| 259 | |
| 260 | return rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) |
| 264 | { |
Michal Januszewski | 03e259a | 2005-07-27 11:46:08 -0700 | [diff] [blame] | 265 | int rc, size = cmap->len * sizeof(u16); |
| 266 | struct fb_cmap umap; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | |
Dan Carpenter | 1e7c780 | 2010-11-16 12:11:02 +0300 | [diff] [blame] | 268 | if (size < 0 || size < cmap->len) |
| 269 | return -E2BIG; |
| 270 | |
Michal Januszewski | 03e259a | 2005-07-27 11:46:08 -0700 | [diff] [blame] | 271 | memset(&umap, 0, sizeof(struct fb_cmap)); |
Dan Carpenter | 1e7c780 | 2010-11-16 12:11:02 +0300 | [diff] [blame] | 272 | rc = fb_alloc_cmap_gfp(&umap, cmap->len, cmap->transp != NULL, |
| 273 | GFP_KERNEL); |
Michal Januszewski | 03e259a | 2005-07-27 11:46:08 -0700 | [diff] [blame] | 274 | if (rc) |
Benjamin Herrenschmidt | 7149437 | 2005-05-01 08:59:22 -0700 | [diff] [blame] | 275 | return rc; |
Michal Januszewski | 03e259a | 2005-07-27 11:46:08 -0700 | [diff] [blame] | 276 | if (copy_from_user(umap.red, cmap->red, size) || |
| 277 | copy_from_user(umap.green, cmap->green, size) || |
| 278 | copy_from_user(umap.blue, cmap->blue, size) || |
| 279 | (cmap->transp && copy_from_user(umap.transp, cmap->transp, size))) { |
Andrea Righi | 1f5e31d | 2009-02-04 15:12:03 -0800 | [diff] [blame] | 280 | rc = -EFAULT; |
| 281 | goto out; |
Benjamin Herrenschmidt | 7149437 | 2005-05-01 08:59:22 -0700 | [diff] [blame] | 282 | } |
Michal Januszewski | 03e259a | 2005-07-27 11:46:08 -0700 | [diff] [blame] | 283 | umap.start = cmap->start; |
Andrea Righi | 1f5e31d | 2009-02-04 15:12:03 -0800 | [diff] [blame] | 284 | if (!lock_fb_info(info)) { |
| 285 | rc = -ENODEV; |
| 286 | goto out; |
| 287 | } |
Chen Gang | 9bb4058 | 2013-08-20 10:33:56 +0800 | [diff] [blame^] | 288 | |
Michal Januszewski | 03e259a | 2005-07-27 11:46:08 -0700 | [diff] [blame] | 289 | rc = fb_set_cmap(&umap, info); |
Andrea Righi | 1f5e31d | 2009-02-04 15:12:03 -0800 | [diff] [blame] | 290 | unlock_fb_info(info); |
| 291 | out: |
Michal Januszewski | 03e259a | 2005-07-27 11:46:08 -0700 | [diff] [blame] | 292 | fb_dealloc_cmap(&umap); |
| 293 | return rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | /** |
| 297 | * fb_default_cmap - get default colormap |
| 298 | * @len: size of palette for a depth |
| 299 | * |
| 300 | * Gets the default colormap for a specific screen depth. @len |
| 301 | * is the size of the palette for a particular screen depth. |
| 302 | * |
| 303 | * Returns pointer to a frame buffer colormap structure. |
| 304 | * |
| 305 | */ |
| 306 | |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 307 | const struct fb_cmap *fb_default_cmap(int len) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | { |
| 309 | if (len <= 2) |
| 310 | return &default_2_colors; |
| 311 | if (len <= 4) |
| 312 | return &default_4_colors; |
| 313 | if (len <= 8) |
| 314 | return &default_8_colors; |
| 315 | return &default_16_colors; |
| 316 | } |
| 317 | |
| 318 | |
| 319 | /** |
| 320 | * fb_invert_cmaps - invert all defaults colormaps |
| 321 | * |
| 322 | * Invert all default colormaps. |
| 323 | * |
| 324 | */ |
| 325 | |
| 326 | void fb_invert_cmaps(void) |
| 327 | { |
| 328 | u_int i; |
| 329 | |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 330 | for (i = 0; i < ARRAY_SIZE(red2); i++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | red2[i] = ~red2[i]; |
| 332 | green2[i] = ~green2[i]; |
| 333 | blue2[i] = ~blue2[i]; |
| 334 | } |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 335 | for (i = 0; i < ARRAY_SIZE(red4); i++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | red4[i] = ~red4[i]; |
| 337 | green4[i] = ~green4[i]; |
| 338 | blue4[i] = ~blue4[i]; |
| 339 | } |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 340 | for (i = 0; i < ARRAY_SIZE(red8); i++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | red8[i] = ~red8[i]; |
| 342 | green8[i] = ~green8[i]; |
| 343 | blue8[i] = ~blue8[i]; |
| 344 | } |
Helge Deller | adf6b20 | 2006-12-08 02:40:27 -0800 | [diff] [blame] | 345 | for (i = 0; i < ARRAY_SIZE(red16); i++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | red16[i] = ~red16[i]; |
| 347 | green16[i] = ~green16[i]; |
| 348 | blue16[i] = ~blue16[i]; |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | |
| 353 | /* |
| 354 | * Visible symbols for modules |
| 355 | */ |
| 356 | |
| 357 | EXPORT_SYMBOL(fb_alloc_cmap); |
| 358 | EXPORT_SYMBOL(fb_dealloc_cmap); |
| 359 | EXPORT_SYMBOL(fb_copy_cmap); |
| 360 | EXPORT_SYMBOL(fb_set_cmap); |
| 361 | EXPORT_SYMBOL(fb_default_cmap); |
| 362 | EXPORT_SYMBOL(fb_invert_cmaps); |