fbmem.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322
  1. /*
  2. * linux/drivers/video/fbmem.c
  3. *
  4. * Copyright (C) 1994 Martin Schaller
  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
  11. * for more details.
  12. */
  13. #include <linux/config.h>
  14. #include <linux/module.h>
  15. #include <linux/types.h>
  16. #include <linux/errno.h>
  17. #include <linux/sched.h>
  18. #include <linux/smp_lock.h>
  19. #include <linux/kernel.h>
  20. #include <linux/major.h>
  21. #include <linux/slab.h>
  22. #include <linux/mm.h>
  23. #include <linux/mman.h>
  24. #include <linux/tty.h>
  25. #include <linux/init.h>
  26. #include <linux/linux_logo.h>
  27. #include <linux/proc_fs.h>
  28. #include <linux/console.h>
  29. #ifdef CONFIG_KMOD
  30. #include <linux/kmod.h>
  31. #endif
  32. #include <linux/devfs_fs_kernel.h>
  33. #include <linux/err.h>
  34. #include <linux/kernel.h>
  35. #include <linux/device.h>
  36. #include <linux/efi.h>
  37. #if defined(__mc68000__) || defined(CONFIG_APUS)
  38. #include <asm/setup.h>
  39. #endif
  40. #include <asm/io.h>
  41. #include <asm/uaccess.h>
  42. #include <asm/page.h>
  43. #include <asm/pgtable.h>
  44. #include <linux/fb.h>
  45. /*
  46. * Frame buffer device initialization and setup routines
  47. */
  48. #define FBPIXMAPSIZE (1024 * 8)
  49. static struct notifier_block *fb_notifier_list;
  50. struct fb_info *registered_fb[FB_MAX];
  51. int num_registered_fb;
  52. /*
  53. * Helpers
  54. */
  55. int fb_get_color_depth(struct fb_var_screeninfo *var)
  56. {
  57. if (var->green.length == var->blue.length &&
  58. var->green.length == var->red.length &&
  59. !var->green.offset && !var->blue.offset &&
  60. !var->red.offset)
  61. return var->green.length;
  62. else
  63. return (var->green.length + var->red.length +
  64. var->blue.length);
  65. }
  66. EXPORT_SYMBOL(fb_get_color_depth);
  67. /*
  68. * Data padding functions.
  69. */
  70. void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height)
  71. {
  72. int i, j;
  73. for (i = height; i--; ) {
  74. /* s_pitch is a few bytes at the most, memcpy is suboptimal */
  75. for (j = 0; j < s_pitch; j++)
  76. dst[j] = src[j];
  77. src += s_pitch;
  78. dst += d_pitch;
  79. }
  80. }
  81. EXPORT_SYMBOL(fb_pad_aligned_buffer);
  82. void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height,
  83. u32 shift_high, u32 shift_low, u32 mod)
  84. {
  85. u8 mask = (u8) (0xfff << shift_high), tmp;
  86. int i, j;
  87. for (i = height; i--; ) {
  88. for (j = 0; j < idx; j++) {
  89. tmp = dst[j];
  90. tmp &= mask;
  91. tmp |= *src >> shift_low;
  92. dst[j] = tmp;
  93. tmp = *src << shift_high;
  94. dst[j+1] = tmp;
  95. src++;
  96. }
  97. tmp = dst[idx];
  98. tmp &= mask;
  99. tmp |= *src >> shift_low;
  100. dst[idx] = tmp;
  101. if (shift_high < mod) {
  102. tmp = *src << shift_high;
  103. dst[idx+1] = tmp;
  104. }
  105. src++;
  106. dst += d_pitch;
  107. }
  108. }
  109. EXPORT_SYMBOL(fb_pad_unaligned_buffer);
  110. /*
  111. * we need to lock this section since fb_cursor
  112. * may use fb_imageblit()
  113. */
  114. char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size)
  115. {
  116. u32 align = buf->buf_align - 1, offset;
  117. char *addr = buf->addr;
  118. /* If IO mapped, we need to sync before access, no sharing of
  119. * the pixmap is done
  120. */
  121. if (buf->flags & FB_PIXMAP_IO) {
  122. if (info->fbops->fb_sync && (buf->flags & FB_PIXMAP_SYNC))
  123. info->fbops->fb_sync(info);
  124. return addr;
  125. }
  126. /* See if we fit in the remaining pixmap space */
  127. offset = buf->offset + align;
  128. offset &= ~align;
  129. if (offset + size > buf->size) {
  130. /* We do not fit. In order to be able to re-use the buffer,
  131. * we must ensure no asynchronous DMA'ing or whatever operation
  132. * is in progress, we sync for that.
  133. */
  134. if (info->fbops->fb_sync && (buf->flags & FB_PIXMAP_SYNC))
  135. info->fbops->fb_sync(info);
  136. offset = 0;
  137. }
  138. buf->offset = offset + size;
  139. addr += offset;
  140. return addr;
  141. }
  142. #ifdef CONFIG_LOGO
  143. #include <linux/linux_logo.h>
  144. static inline unsigned safe_shift(unsigned d, int n)
  145. {
  146. return n < 0 ? d >> -n : d << n;
  147. }
  148. static void fb_set_logocmap(struct fb_info *info,
  149. const struct linux_logo *logo)
  150. {
  151. struct fb_cmap palette_cmap;
  152. u16 palette_green[16];
  153. u16 palette_blue[16];
  154. u16 palette_red[16];
  155. int i, j, n;
  156. const unsigned char *clut = logo->clut;
  157. palette_cmap.start = 0;
  158. palette_cmap.len = 16;
  159. palette_cmap.red = palette_red;
  160. palette_cmap.green = palette_green;
  161. palette_cmap.blue = palette_blue;
  162. palette_cmap.transp = NULL;
  163. for (i = 0; i < logo->clutsize; i += n) {
  164. n = logo->clutsize - i;
  165. /* palette_cmap provides space for only 16 colors at once */
  166. if (n > 16)
  167. n = 16;
  168. palette_cmap.start = 32 + i;
  169. palette_cmap.len = n;
  170. for (j = 0; j < n; ++j) {
  171. palette_cmap.red[j] = clut[0] << 8 | clut[0];
  172. palette_cmap.green[j] = clut[1] << 8 | clut[1];
  173. palette_cmap.blue[j] = clut[2] << 8 | clut[2];
  174. clut += 3;
  175. }
  176. fb_set_cmap(&palette_cmap, info);
  177. }
  178. }
  179. static void fb_set_logo_truepalette(struct fb_info *info,
  180. const struct linux_logo *logo,
  181. u32 *palette)
  182. {
  183. unsigned char mask[9] = { 0,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff };
  184. unsigned char redmask, greenmask, bluemask;
  185. int redshift, greenshift, blueshift;
  186. int i;
  187. const unsigned char *clut = logo->clut;
  188. /*
  189. * We have to create a temporary palette since console palette is only
  190. * 16 colors long.
  191. */
  192. /* Bug: Doesn't obey msb_right ... (who needs that?) */
  193. redmask = mask[info->var.red.length < 8 ? info->var.red.length : 8];
  194. greenmask = mask[info->var.green.length < 8 ? info->var.green.length : 8];
  195. bluemask = mask[info->var.blue.length < 8 ? info->var.blue.length : 8];
  196. redshift = info->var.red.offset - (8 - info->var.red.length);
  197. greenshift = info->var.green.offset - (8 - info->var.green.length);
  198. blueshift = info->var.blue.offset - (8 - info->var.blue.length);
  199. for ( i = 0; i < logo->clutsize; i++) {
  200. palette[i+32] = (safe_shift((clut[0] & redmask), redshift) |
  201. safe_shift((clut[1] & greenmask), greenshift) |
  202. safe_shift((clut[2] & bluemask), blueshift));
  203. clut += 3;
  204. }
  205. }
  206. static void fb_set_logo_directpalette(struct fb_info *info,
  207. const struct linux_logo *logo,
  208. u32 *palette)
  209. {
  210. int redshift, greenshift, blueshift;
  211. int i;
  212. redshift = info->var.red.offset;
  213. greenshift = info->var.green.offset;
  214. blueshift = info->var.blue.offset;
  215. for (i = 32; i < logo->clutsize; i++)
  216. palette[i] = i << redshift | i << greenshift | i << blueshift;
  217. }
  218. static void fb_set_logo(struct fb_info *info,
  219. const struct linux_logo *logo, u8 *dst,
  220. int depth)
  221. {
  222. int i, j, k, fg = 1;
  223. const u8 *src = logo->data;
  224. u8 d, xor = (info->fix.visual == FB_VISUAL_MONO01) ? 0xff : 0;
  225. if (fb_get_color_depth(&info->var) == 3)
  226. fg = 7;
  227. switch (depth) {
  228. case 4:
  229. for (i = 0; i < logo->height; i++)
  230. for (j = 0; j < logo->width; src++) {
  231. *dst++ = *src >> 4;
  232. j++;
  233. if (j < logo->width) {
  234. *dst++ = *src & 0x0f;
  235. j++;
  236. }
  237. }
  238. break;
  239. case 1:
  240. for (i = 0; i < logo->height; i++) {
  241. for (j = 0; j < logo->width; src++) {
  242. d = *src ^ xor;
  243. for (k = 7; k >= 0; k--) {
  244. *dst++ = ((d >> k) & 1) ? fg : 0;
  245. j++;
  246. }
  247. }
  248. }
  249. break;
  250. }
  251. }
  252. /*
  253. * Three (3) kinds of logo maps exist. linux_logo_clut224 (>16 colors),
  254. * linux_logo_vga16 (16 colors) and linux_logo_mono (2 colors). Depending on
  255. * the visual format and color depth of the framebuffer, the DAC, the
  256. * pseudo_palette, and the logo data will be adjusted accordingly.
  257. *
  258. * Case 1 - linux_logo_clut224:
  259. * Color exceeds the number of console colors (16), thus we set the hardware DAC
  260. * using fb_set_cmap() appropriately. The "needs_cmapreset" flag will be set.
  261. *
  262. * For visuals that require color info from the pseudo_palette, we also construct
  263. * one for temporary use. The "needs_directpalette" or "needs_truepalette" flags
  264. * will be set.
  265. *
  266. * Case 2 - linux_logo_vga16:
  267. * The number of colors just matches the console colors, thus there is no need
  268. * to set the DAC or the pseudo_palette. However, the bitmap is packed, ie,
  269. * each byte contains color information for two pixels (upper and lower nibble).
  270. * To be consistent with fb_imageblit() usage, we therefore separate the two
  271. * nibbles into separate bytes. The "depth" flag will be set to 4.
  272. *
  273. * Case 3 - linux_logo_mono:
  274. * This is similar with Case 2. Each byte contains information for 8 pixels.
  275. * We isolate each bit and expand each into a byte. The "depth" flag will
  276. * be set to 1.
  277. */
  278. static struct logo_data {
  279. int depth;
  280. int needs_directpalette;
  281. int needs_truepalette;
  282. int needs_cmapreset;
  283. const struct linux_logo *logo;
  284. } fb_logo;
  285. int fb_prepare_logo(struct fb_info *info)
  286. {
  287. int depth = fb_get_color_depth(&info->var);
  288. memset(&fb_logo, 0, sizeof(struct logo_data));
  289. if (info->flags & FBINFO_MISC_TILEBLITTING)
  290. return 0;
  291. if (info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
  292. depth = info->var.blue.length;
  293. if (info->var.red.length < depth)
  294. depth = info->var.red.length;
  295. if (info->var.green.length < depth)
  296. depth = info->var.green.length;
  297. }
  298. if (depth >= 8) {
  299. switch (info->fix.visual) {
  300. case FB_VISUAL_TRUECOLOR:
  301. fb_logo.needs_truepalette = 1;
  302. break;
  303. case FB_VISUAL_DIRECTCOLOR:
  304. fb_logo.needs_directpalette = 1;
  305. fb_logo.needs_cmapreset = 1;
  306. break;
  307. case FB_VISUAL_PSEUDOCOLOR:
  308. fb_logo.needs_cmapreset = 1;
  309. break;
  310. }
  311. }
  312. /* Return if no suitable logo was found */
  313. fb_logo.logo = fb_find_logo(depth);
  314. if (!fb_logo.logo || fb_logo.logo->height > info->var.yres) {
  315. fb_logo.logo = NULL;
  316. return 0;
  317. }
  318. /* What depth we asked for might be different from what we get */
  319. if (fb_logo.logo->type == LINUX_LOGO_CLUT224)
  320. fb_logo.depth = 8;
  321. else if (fb_logo.logo->type == LINUX_LOGO_VGA16)
  322. fb_logo.depth = 4;
  323. else
  324. fb_logo.depth = 1;
  325. return fb_logo.logo->height;
  326. }
  327. int fb_show_logo(struct fb_info *info)
  328. {
  329. u32 *palette = NULL, *saved_pseudo_palette = NULL;
  330. unsigned char *logo_new = NULL;
  331. struct fb_image image;
  332. int x;
  333. /* Return if the frame buffer is not mapped or suspended */
  334. if (fb_logo.logo == NULL || info->state != FBINFO_STATE_RUNNING)
  335. return 0;
  336. image.depth = 8;
  337. image.data = fb_logo.logo->data;
  338. if (fb_logo.needs_cmapreset)
  339. fb_set_logocmap(info, fb_logo.logo);
  340. if (fb_logo.needs_truepalette ||
  341. fb_logo.needs_directpalette) {
  342. palette = kmalloc(256 * 4, GFP_KERNEL);
  343. if (palette == NULL)
  344. return 0;
  345. if (fb_logo.needs_truepalette)
  346. fb_set_logo_truepalette(info, fb_logo.logo, palette);
  347. else
  348. fb_set_logo_directpalette(info, fb_logo.logo, palette);
  349. saved_pseudo_palette = info->pseudo_palette;
  350. info->pseudo_palette = palette;
  351. }
  352. if (fb_logo.depth <= 4) {
  353. logo_new = kmalloc(fb_logo.logo->width * fb_logo.logo->height,
  354. GFP_KERNEL);
  355. if (logo_new == NULL) {
  356. kfree(palette);
  357. if (saved_pseudo_palette)
  358. info->pseudo_palette = saved_pseudo_palette;
  359. return 0;
  360. }
  361. image.data = logo_new;
  362. fb_set_logo(info, fb_logo.logo, logo_new, fb_logo.depth);
  363. }
  364. image.width = fb_logo.logo->width;
  365. image.height = fb_logo.logo->height;
  366. image.dy = 0;
  367. for (x = 0; x < num_online_cpus() * (fb_logo.logo->width + 8) &&
  368. x <= info->var.xres-fb_logo.logo->width; x += (fb_logo.logo->width + 8)) {
  369. image.dx = x;
  370. info->fbops->fb_imageblit(info, &image);
  371. }
  372. kfree(palette);
  373. if (saved_pseudo_palette != NULL)
  374. info->pseudo_palette = saved_pseudo_palette;
  375. kfree(logo_new);
  376. return fb_logo.logo->height;
  377. }
  378. #else
  379. int fb_prepare_logo(struct fb_info *info) { return 0; }
  380. int fb_show_logo(struct fb_info *info) { return 0; }
  381. #endif /* CONFIG_LOGO */
  382. static int fbmem_read_proc(char *buf, char **start, off_t offset,
  383. int len, int *eof, void *private)
  384. {
  385. struct fb_info **fi;
  386. int clen;
  387. clen = 0;
  388. for (fi = registered_fb; fi < &registered_fb[FB_MAX] && len < 4000; fi++)
  389. if (*fi)
  390. clen += sprintf(buf + clen, "%d %s\n",
  391. (*fi)->node,
  392. (*fi)->fix.id);
  393. *start = buf + offset;
  394. if (clen > offset)
  395. clen -= offset;
  396. else
  397. clen = 0;
  398. return clen < len ? clen : len;
  399. }
  400. static ssize_t
  401. fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
  402. {
  403. unsigned long p = *ppos;
  404. struct inode *inode = file->f_dentry->d_inode;
  405. int fbidx = iminor(inode);
  406. struct fb_info *info = registered_fb[fbidx];
  407. u32 *buffer, *dst;
  408. u32 __iomem *src;
  409. int c, i, cnt = 0, err = 0;
  410. unsigned long total_size;
  411. if (!info || ! info->screen_base)
  412. return -ENODEV;
  413. if (info->state != FBINFO_STATE_RUNNING)
  414. return -EPERM;
  415. if (info->fbops->fb_read)
  416. return info->fbops->fb_read(file, buf, count, ppos);
  417. total_size = info->screen_size;
  418. if (total_size == 0)
  419. total_size = info->fix.smem_len;
  420. if (p >= total_size)
  421. return 0;
  422. if (count >= total_size)
  423. count = total_size;
  424. if (count + p > total_size)
  425. count = total_size - p;
  426. cnt = 0;
  427. buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count,
  428. GFP_KERNEL);
  429. if (!buffer)
  430. return -ENOMEM;
  431. src = (u32 __iomem *) (info->screen_base + p);
  432. if (info->fbops->fb_sync)
  433. info->fbops->fb_sync(info);
  434. while (count) {
  435. c = (count > PAGE_SIZE) ? PAGE_SIZE : count;
  436. dst = buffer;
  437. for (i = c >> 2; i--; )
  438. *dst++ = fb_readl(src++);
  439. if (c & 3) {
  440. u8 *dst8 = (u8 *) dst;
  441. u8 __iomem *src8 = (u8 __iomem *) src;
  442. for (i = c & 3; i--;)
  443. *dst8++ = fb_readb(src8++);
  444. src = (u32 __iomem *) src8;
  445. }
  446. if (copy_to_user(buf, buffer, c)) {
  447. err = -EFAULT;
  448. break;
  449. }
  450. *ppos += c;
  451. buf += c;
  452. cnt += c;
  453. count -= c;
  454. }
  455. kfree(buffer);
  456. return (err) ? err : cnt;
  457. }
  458. static ssize_t
  459. fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
  460. {
  461. unsigned long p = *ppos;
  462. struct inode *inode = file->f_dentry->d_inode;
  463. int fbidx = iminor(inode);
  464. struct fb_info *info = registered_fb[fbidx];
  465. u32 *buffer, *src;
  466. u32 __iomem *dst;
  467. int c, i, cnt = 0, err;
  468. unsigned long total_size;
  469. if (!info || !info->screen_base)
  470. return -ENODEV;
  471. if (info->state != FBINFO_STATE_RUNNING)
  472. return -EPERM;
  473. if (info->fbops->fb_write)
  474. return info->fbops->fb_write(file, buf, count, ppos);
  475. total_size = info->screen_size;
  476. if (total_size == 0)
  477. total_size = info->fix.smem_len;
  478. if (p > total_size)
  479. return -ENOSPC;
  480. if (count >= total_size)
  481. count = total_size;
  482. err = 0;
  483. if (count + p > total_size) {
  484. count = total_size - p;
  485. err = -ENOSPC;
  486. }
  487. cnt = 0;
  488. buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count,
  489. GFP_KERNEL);
  490. if (!buffer)
  491. return -ENOMEM;
  492. dst = (u32 __iomem *) (info->screen_base + p);
  493. if (info->fbops->fb_sync)
  494. info->fbops->fb_sync(info);
  495. while (count) {
  496. c = (count > PAGE_SIZE) ? PAGE_SIZE : count;
  497. src = buffer;
  498. if (copy_from_user(src, buf, c)) {
  499. err = -EFAULT;
  500. break;
  501. }
  502. for (i = c >> 2; i--; )
  503. fb_writel(*src++, dst++);
  504. if (c & 3) {
  505. u8 *src8 = (u8 *) src;
  506. u8 __iomem *dst8 = (u8 __iomem *) dst;
  507. for (i = c & 3; i--; )
  508. fb_writeb(*src8++, dst8++);
  509. dst = (u32 __iomem *) dst8;
  510. }
  511. *ppos += c;
  512. buf += c;
  513. cnt += c;
  514. count -= c;
  515. }
  516. kfree(buffer);
  517. return (err) ? err : cnt;
  518. }
  519. #ifdef CONFIG_KMOD
  520. static void try_to_load(int fb)
  521. {
  522. request_module("fb%d", fb);
  523. }
  524. #endif /* CONFIG_KMOD */
  525. int
  526. fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
  527. {
  528. int xoffset = var->xoffset;
  529. int yoffset = var->yoffset;
  530. int err;
  531. if (xoffset < 0 || yoffset < 0 || !info->fbops->fb_pan_display ||
  532. xoffset + info->var.xres > info->var.xres_virtual ||
  533. yoffset + info->var.yres > info->var.yres_virtual)
  534. return -EINVAL;
  535. if ((err = info->fbops->fb_pan_display(var, info)))
  536. return err;
  537. info->var.xoffset = var->xoffset;
  538. info->var.yoffset = var->yoffset;
  539. if (var->vmode & FB_VMODE_YWRAP)
  540. info->var.vmode |= FB_VMODE_YWRAP;
  541. else
  542. info->var.vmode &= ~FB_VMODE_YWRAP;
  543. return 0;
  544. }
  545. int
  546. fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
  547. {
  548. int err, flags = info->flags;
  549. if (var->activate & FB_ACTIVATE_INV_MODE) {
  550. struct fb_videomode mode1, mode2;
  551. int ret = 0;
  552. fb_var_to_videomode(&mode1, var);
  553. fb_var_to_videomode(&mode2, &info->var);
  554. /* make sure we don't delete the videomode of current var */
  555. ret = fb_mode_is_equal(&mode1, &mode2);
  556. if (!ret) {
  557. struct fb_event event;
  558. event.info = info;
  559. event.data = &mode1;
  560. ret = notifier_call_chain(&fb_notifier_list,
  561. FB_EVENT_MODE_DELETE, &event);
  562. }
  563. if (!ret)
  564. fb_delete_videomode(&mode1, &info->modelist);
  565. return ret;
  566. }
  567. if ((var->activate & FB_ACTIVATE_FORCE) ||
  568. memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) {
  569. if (!info->fbops->fb_check_var) {
  570. *var = info->var;
  571. return 0;
  572. }
  573. if ((err = info->fbops->fb_check_var(var, info)))
  574. return err;
  575. if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
  576. struct fb_videomode mode;
  577. int err = 0;
  578. info->var = *var;
  579. if (info->fbops->fb_set_par)
  580. info->fbops->fb_set_par(info);
  581. fb_pan_display(info, &info->var);
  582. fb_set_cmap(&info->cmap, info);
  583. fb_var_to_videomode(&mode, &info->var);
  584. if (info->modelist.prev && info->modelist.next &&
  585. !list_empty(&info->modelist))
  586. err = fb_add_videomode(&mode, &info->modelist);
  587. if (!err && (flags & FBINFO_MISC_USEREVENT)) {
  588. struct fb_event event;
  589. info->flags &= ~FBINFO_MISC_USEREVENT;
  590. event.info = info;
  591. notifier_call_chain(&fb_notifier_list,
  592. FB_EVENT_MODE_CHANGE,
  593. &event);
  594. }
  595. }
  596. }
  597. return 0;
  598. }
  599. int
  600. fb_blank(struct fb_info *info, int blank)
  601. {
  602. int ret = -EINVAL;
  603. if (blank > FB_BLANK_POWERDOWN)
  604. blank = FB_BLANK_POWERDOWN;
  605. if (info->fbops->fb_blank)
  606. ret = info->fbops->fb_blank(blank, info);
  607. if (!ret) {
  608. struct fb_event event;
  609. event.info = info;
  610. event.data = &blank;
  611. notifier_call_chain(&fb_notifier_list, FB_EVENT_BLANK, &event);
  612. }
  613. return ret;
  614. }
  615. static int
  616. fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
  617. unsigned long arg)
  618. {
  619. int fbidx = iminor(inode);
  620. struct fb_info *info = registered_fb[fbidx];
  621. struct fb_ops *fb = info->fbops;
  622. struct fb_var_screeninfo var;
  623. struct fb_fix_screeninfo fix;
  624. struct fb_con2fbmap con2fb;
  625. struct fb_cmap_user cmap;
  626. struct fb_event event;
  627. void __user *argp = (void __user *)arg;
  628. int i;
  629. if (!fb)
  630. return -ENODEV;
  631. switch (cmd) {
  632. case FBIOGET_VSCREENINFO:
  633. return copy_to_user(argp, &info->var,
  634. sizeof(var)) ? -EFAULT : 0;
  635. case FBIOPUT_VSCREENINFO:
  636. if (copy_from_user(&var, argp, sizeof(var)))
  637. return -EFAULT;
  638. acquire_console_sem();
  639. info->flags |= FBINFO_MISC_USEREVENT;
  640. i = fb_set_var(info, &var);
  641. info->flags &= ~FBINFO_MISC_USEREVENT;
  642. release_console_sem();
  643. if (i) return i;
  644. if (copy_to_user(argp, &var, sizeof(var)))
  645. return -EFAULT;
  646. return 0;
  647. case FBIOGET_FSCREENINFO:
  648. return copy_to_user(argp, &info->fix,
  649. sizeof(fix)) ? -EFAULT : 0;
  650. case FBIOPUTCMAP:
  651. if (copy_from_user(&cmap, argp, sizeof(cmap)))
  652. return -EFAULT;
  653. return (fb_set_user_cmap(&cmap, info));
  654. case FBIOGETCMAP:
  655. if (copy_from_user(&cmap, argp, sizeof(cmap)))
  656. return -EFAULT;
  657. return fb_cmap_to_user(&info->cmap, &cmap);
  658. case FBIOPAN_DISPLAY:
  659. if (copy_from_user(&var, argp, sizeof(var)))
  660. return -EFAULT;
  661. acquire_console_sem();
  662. i = fb_pan_display(info, &var);
  663. release_console_sem();
  664. if (i)
  665. return i;
  666. if (copy_to_user(argp, &var, sizeof(var)))
  667. return -EFAULT;
  668. return 0;
  669. case FBIO_CURSOR:
  670. return -EINVAL;
  671. case FBIOGET_CON2FBMAP:
  672. if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
  673. return -EFAULT;
  674. if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
  675. return -EINVAL;
  676. con2fb.framebuffer = -1;
  677. event.info = info;
  678. event.data = &con2fb;
  679. notifier_call_chain(&fb_notifier_list,
  680. FB_EVENT_GET_CONSOLE_MAP, &event);
  681. return copy_to_user(argp, &con2fb,
  682. sizeof(con2fb)) ? -EFAULT : 0;
  683. case FBIOPUT_CON2FBMAP:
  684. if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
  685. return - EFAULT;
  686. if (con2fb.console < 0 || con2fb.console > MAX_NR_CONSOLES)
  687. return -EINVAL;
  688. if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX)
  689. return -EINVAL;
  690. #ifdef CONFIG_KMOD
  691. if (!registered_fb[con2fb.framebuffer])
  692. try_to_load(con2fb.framebuffer);
  693. #endif /* CONFIG_KMOD */
  694. if (!registered_fb[con2fb.framebuffer])
  695. return -EINVAL;
  696. event.info = info;
  697. event.data = &con2fb;
  698. return notifier_call_chain(&fb_notifier_list,
  699. FB_EVENT_SET_CONSOLE_MAP,
  700. &event);
  701. case FBIOBLANK:
  702. acquire_console_sem();
  703. info->flags |= FBINFO_MISC_USEREVENT;
  704. i = fb_blank(info, arg);
  705. info->flags &= ~FBINFO_MISC_USEREVENT;
  706. release_console_sem();
  707. return i;
  708. default:
  709. if (fb->fb_ioctl == NULL)
  710. return -EINVAL;
  711. return fb->fb_ioctl(inode, file, cmd, arg, info);
  712. }
  713. }
  714. #ifdef CONFIG_COMPAT
  715. static long
  716. fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  717. {
  718. int fbidx = iminor(file->f_dentry->d_inode);
  719. struct fb_info *info = registered_fb[fbidx];
  720. struct fb_ops *fb = info->fbops;
  721. long ret;
  722. if (fb->fb_compat_ioctl == NULL)
  723. return -ENOIOCTLCMD;
  724. lock_kernel();
  725. ret = fb->fb_compat_ioctl(file, cmd, arg, info);
  726. unlock_kernel();
  727. return ret;
  728. }
  729. #endif
  730. static int
  731. fb_mmap(struct file *file, struct vm_area_struct * vma)
  732. {
  733. int fbidx = iminor(file->f_dentry->d_inode);
  734. struct fb_info *info = registered_fb[fbidx];
  735. struct fb_ops *fb = info->fbops;
  736. unsigned long off;
  737. #if !defined(__sparc__) || defined(__sparc_v9__)
  738. unsigned long start;
  739. u32 len;
  740. #endif
  741. if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
  742. return -EINVAL;
  743. off = vma->vm_pgoff << PAGE_SHIFT;
  744. if (!fb)
  745. return -ENODEV;
  746. if (fb->fb_mmap) {
  747. int res;
  748. lock_kernel();
  749. res = fb->fb_mmap(info, file, vma);
  750. unlock_kernel();
  751. return res;
  752. }
  753. #if defined(__sparc__) && !defined(__sparc_v9__)
  754. /* Should never get here, all fb drivers should have their own
  755. mmap routines */
  756. return -EINVAL;
  757. #else
  758. /* !sparc32... */
  759. lock_kernel();
  760. /* frame buffer memory */
  761. start = info->fix.smem_start;
  762. len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len);
  763. if (off >= len) {
  764. /* memory mapped io */
  765. off -= len;
  766. if (info->var.accel_flags) {
  767. unlock_kernel();
  768. return -EINVAL;
  769. }
  770. start = info->fix.mmio_start;
  771. len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len);
  772. }
  773. unlock_kernel();
  774. start &= PAGE_MASK;
  775. if ((vma->vm_end - vma->vm_start + off) > len)
  776. return -EINVAL;
  777. off += start;
  778. vma->vm_pgoff = off >> PAGE_SHIFT;
  779. /* This is an IO map - tell maydump to skip this VMA */
  780. vma->vm_flags |= VM_IO | VM_RESERVED;
  781. #if defined(__sparc_v9__)
  782. if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
  783. vma->vm_end - vma->vm_start, vma->vm_page_prot))
  784. return -EAGAIN;
  785. #else
  786. #if defined(__mc68000__)
  787. #if defined(CONFIG_SUN3)
  788. pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
  789. #elif defined(CONFIG_MMU)
  790. if (CPU_IS_020_OR_030)
  791. pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
  792. if (CPU_IS_040_OR_060) {
  793. pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
  794. /* Use no-cache mode, serialized */
  795. pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
  796. }
  797. #endif
  798. #elif defined(__powerpc__)
  799. vma->vm_page_prot = phys_mem_access_prot(file, off,
  800. vma->vm_end - vma->vm_start,
  801. vma->vm_page_prot);
  802. #elif defined(__alpha__)
  803. /* Caching is off in the I/O space quadrant by design. */
  804. #elif defined(__i386__) || defined(__x86_64__)
  805. if (boot_cpu_data.x86 > 3)
  806. pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
  807. #elif defined(__mips__)
  808. vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
  809. #elif defined(__hppa__)
  810. pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
  811. #elif defined(__arm__) || defined(__sh__) || defined(__m32r__)
  812. vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
  813. #elif defined(__ia64__)
  814. if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
  815. vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
  816. else
  817. vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
  818. #else
  819. #warning What do we have to do here??
  820. #endif
  821. if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
  822. vma->vm_end - vma->vm_start, vma->vm_page_prot))
  823. return -EAGAIN;
  824. #endif /* !__sparc_v9__ */
  825. return 0;
  826. #endif /* !sparc32 */
  827. }
  828. static int
  829. fb_open(struct inode *inode, struct file *file)
  830. {
  831. int fbidx = iminor(inode);
  832. struct fb_info *info;
  833. int res = 0;
  834. if (fbidx >= FB_MAX)
  835. return -ENODEV;
  836. #ifdef CONFIG_KMOD
  837. if (!(info = registered_fb[fbidx]))
  838. try_to_load(fbidx);
  839. #endif /* CONFIG_KMOD */
  840. if (!(info = registered_fb[fbidx]))
  841. return -ENODEV;
  842. if (!try_module_get(info->fbops->owner))
  843. return -ENODEV;
  844. if (info->fbops->fb_open) {
  845. res = info->fbops->fb_open(info,1);
  846. if (res)
  847. module_put(info->fbops->owner);
  848. }
  849. return res;
  850. }
  851. static int
  852. fb_release(struct inode *inode, struct file *file)
  853. {
  854. int fbidx = iminor(inode);
  855. struct fb_info *info;
  856. lock_kernel();
  857. info = registered_fb[fbidx];
  858. if (info->fbops->fb_release)
  859. info->fbops->fb_release(info,1);
  860. module_put(info->fbops->owner);
  861. unlock_kernel();
  862. return 0;
  863. }
  864. static struct file_operations fb_fops = {
  865. .owner = THIS_MODULE,
  866. .read = fb_read,
  867. .write = fb_write,
  868. .ioctl = fb_ioctl,
  869. #ifdef CONFIG_COMPAT
  870. .compat_ioctl = fb_compat_ioctl,
  871. #endif
  872. .mmap = fb_mmap,
  873. .open = fb_open,
  874. .release = fb_release,
  875. #ifdef HAVE_ARCH_FB_UNMAPPED_AREA
  876. .get_unmapped_area = get_fb_unmapped_area,
  877. #endif
  878. };
  879. static struct class *fb_class;
  880. /**
  881. * register_framebuffer - registers a frame buffer device
  882. * @fb_info: frame buffer info structure
  883. *
  884. * Registers a frame buffer device @fb_info.
  885. *
  886. * Returns negative errno on error, or zero for success.
  887. *
  888. */
  889. int
  890. register_framebuffer(struct fb_info *fb_info)
  891. {
  892. int i;
  893. struct fb_event event;
  894. if (num_registered_fb == FB_MAX)
  895. return -ENXIO;
  896. num_registered_fb++;
  897. for (i = 0 ; i < FB_MAX; i++)
  898. if (!registered_fb[i])
  899. break;
  900. fb_info->node = i;
  901. fb_info->class_device = class_device_create(fb_class, MKDEV(FB_MAJOR, i),
  902. fb_info->device, "fb%d", i);
  903. if (IS_ERR(fb_info->class_device)) {
  904. /* Not fatal */
  905. printk(KERN_WARNING "Unable to create class_device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->class_device));
  906. fb_info->class_device = NULL;
  907. } else
  908. fb_init_class_device(fb_info);
  909. if (fb_info->pixmap.addr == NULL) {
  910. fb_info->pixmap.addr = kmalloc(FBPIXMAPSIZE, GFP_KERNEL);
  911. if (fb_info->pixmap.addr) {
  912. fb_info->pixmap.size = FBPIXMAPSIZE;
  913. fb_info->pixmap.buf_align = 1;
  914. fb_info->pixmap.scan_align = 1;
  915. fb_info->pixmap.access_align = 32;
  916. fb_info->pixmap.flags = FB_PIXMAP_DEFAULT;
  917. }
  918. }
  919. fb_info->pixmap.offset = 0;
  920. if (!fb_info->modelist.prev ||
  921. !fb_info->modelist.next ||
  922. list_empty(&fb_info->modelist)) {
  923. struct fb_videomode mode;
  924. INIT_LIST_HEAD(&fb_info->modelist);
  925. fb_var_to_videomode(&mode, &fb_info->var);
  926. fb_add_videomode(&mode, &fb_info->modelist);
  927. }
  928. registered_fb[i] = fb_info;
  929. devfs_mk_cdev(MKDEV(FB_MAJOR, i),
  930. S_IFCHR | S_IRUGO | S_IWUGO, "fb/%d", i);
  931. event.info = fb_info;
  932. notifier_call_chain(&fb_notifier_list,
  933. FB_EVENT_FB_REGISTERED, &event);
  934. return 0;
  935. }
  936. /**
  937. * unregister_framebuffer - releases a frame buffer device
  938. * @fb_info: frame buffer info structure
  939. *
  940. * Unregisters a frame buffer device @fb_info.
  941. *
  942. * Returns negative errno on error, or zero for success.
  943. *
  944. */
  945. int
  946. unregister_framebuffer(struct fb_info *fb_info)
  947. {
  948. int i;
  949. i = fb_info->node;
  950. if (!registered_fb[i])
  951. return -EINVAL;
  952. devfs_remove("fb/%d", i);
  953. if (fb_info->pixmap.addr && (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
  954. kfree(fb_info->pixmap.addr);
  955. fb_destroy_modelist(&fb_info->modelist);
  956. registered_fb[i]=NULL;
  957. num_registered_fb--;
  958. fb_cleanup_class_device(fb_info);
  959. class_device_destroy(fb_class, MKDEV(FB_MAJOR, i));
  960. return 0;
  961. }
  962. /**
  963. * fb_register_client - register a client notifier
  964. * @nb: notifier block to callback on events
  965. */
  966. int fb_register_client(struct notifier_block *nb)
  967. {
  968. return notifier_chain_register(&fb_notifier_list, nb);
  969. }
  970. /**
  971. * fb_unregister_client - unregister a client notifier
  972. * @nb: notifier block to callback on events
  973. */
  974. int fb_unregister_client(struct notifier_block *nb)
  975. {
  976. return notifier_chain_unregister(&fb_notifier_list, nb);
  977. }
  978. /**
  979. * fb_set_suspend - low level driver signals suspend
  980. * @info: framebuffer affected
  981. * @state: 0 = resuming, !=0 = suspending
  982. *
  983. * This is meant to be used by low level drivers to
  984. * signal suspend/resume to the core & clients.
  985. * It must be called with the console semaphore held
  986. */
  987. void fb_set_suspend(struct fb_info *info, int state)
  988. {
  989. struct fb_event event;
  990. event.info = info;
  991. if (state) {
  992. notifier_call_chain(&fb_notifier_list, FB_EVENT_SUSPEND, &event);
  993. info->state = FBINFO_STATE_SUSPENDED;
  994. } else {
  995. info->state = FBINFO_STATE_RUNNING;
  996. notifier_call_chain(&fb_notifier_list, FB_EVENT_RESUME, &event);
  997. }
  998. }
  999. /**
  1000. * fbmem_init - init frame buffer subsystem
  1001. *
  1002. * Initialize the frame buffer subsystem.
  1003. *
  1004. * NOTE: This function is _only_ to be called by drivers/char/mem.c.
  1005. *
  1006. */
  1007. static int __init
  1008. fbmem_init(void)
  1009. {
  1010. create_proc_read_entry("fb", 0, NULL, fbmem_read_proc, NULL);
  1011. devfs_mk_dir("fb");
  1012. if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
  1013. printk("unable to get major %d for fb devs\n", FB_MAJOR);
  1014. fb_class = class_create(THIS_MODULE, "graphics");
  1015. if (IS_ERR(fb_class)) {
  1016. printk(KERN_WARNING "Unable to create fb class; errno = %ld\n", PTR_ERR(fb_class));
  1017. fb_class = NULL;
  1018. }
  1019. return 0;
  1020. }
  1021. #ifdef MODULE
  1022. module_init(fbmem_init);
  1023. static void __exit
  1024. fbmem_exit(void)
  1025. {
  1026. class_destroy(fb_class);
  1027. unregister_chrdev(FB_MAJOR, "fb");
  1028. }
  1029. module_exit(fbmem_exit);
  1030. MODULE_LICENSE("GPL");
  1031. MODULE_DESCRIPTION("Framebuffer base");
  1032. #else
  1033. subsys_initcall(fbmem_init);
  1034. #endif
  1035. int fb_new_modelist(struct fb_info *info)
  1036. {
  1037. struct fb_event event;
  1038. struct fb_var_screeninfo var = info->var;
  1039. struct list_head *pos, *n;
  1040. struct fb_modelist *modelist;
  1041. struct fb_videomode *m, mode;
  1042. int err = 1;
  1043. list_for_each_safe(pos, n, &info->modelist) {
  1044. modelist = list_entry(pos, struct fb_modelist, list);
  1045. m = &modelist->mode;
  1046. fb_videomode_to_var(&var, m);
  1047. var.activate = FB_ACTIVATE_TEST;
  1048. err = fb_set_var(info, &var);
  1049. fb_var_to_videomode(&mode, &var);
  1050. if (err || !fb_mode_is_equal(m, &mode)) {
  1051. list_del(pos);
  1052. kfree(pos);
  1053. }
  1054. }
  1055. err = 1;
  1056. if (!list_empty(&info->modelist)) {
  1057. event.info = info;
  1058. err = notifier_call_chain(&fb_notifier_list,
  1059. FB_EVENT_NEW_MODELIST,
  1060. &event);
  1061. }
  1062. return err;
  1063. }
  1064. static char *video_options[FB_MAX];
  1065. static int ofonly;
  1066. extern const char *global_mode_option;
  1067. /**
  1068. * fb_get_options - get kernel boot parameters
  1069. * @name: framebuffer name as it would appear in
  1070. * the boot parameter line
  1071. * (video=<name>:<options>)
  1072. * @option: the option will be stored here
  1073. *
  1074. * NOTE: Needed to maintain backwards compatibility
  1075. */
  1076. int fb_get_options(char *name, char **option)
  1077. {
  1078. char *opt, *options = NULL;
  1079. int opt_len, retval = 0;
  1080. int name_len = strlen(name), i;
  1081. if (name_len && ofonly && strncmp(name, "offb", 4))
  1082. retval = 1;
  1083. if (name_len && !retval) {
  1084. for (i = 0; i < FB_MAX; i++) {
  1085. if (video_options[i] == NULL)
  1086. continue;
  1087. opt_len = strlen(video_options[i]);
  1088. if (!opt_len)
  1089. continue;
  1090. opt = video_options[i];
  1091. if (!strncmp(name, opt, name_len) &&
  1092. opt[name_len] == ':')
  1093. options = opt + name_len + 1;
  1094. }
  1095. }
  1096. if (options && !strncmp(options, "off", 3))
  1097. retval = 1;
  1098. if (option)
  1099. *option = options;
  1100. return retval;
  1101. }
  1102. /**
  1103. * video_setup - process command line options
  1104. * @options: string of options
  1105. *
  1106. * Process command line options for frame buffer subsystem.
  1107. *
  1108. * NOTE: This function is a __setup and __init function.
  1109. * It only stores the options. Drivers have to call
  1110. * fb_get_options() as necessary.
  1111. *
  1112. * Returns zero.
  1113. *
  1114. */
  1115. static int __init video_setup(char *options)
  1116. {
  1117. int i, global = 0;
  1118. if (!options || !*options)
  1119. global = 1;
  1120. if (!global && !strncmp(options, "ofonly", 6)) {
  1121. ofonly = 1;
  1122. global = 1;
  1123. }
  1124. if (!global && !strstr(options, "fb:")) {
  1125. global_mode_option = options;
  1126. global = 1;
  1127. }
  1128. if (!global) {
  1129. for (i = 0; i < FB_MAX; i++) {
  1130. if (video_options[i] == NULL) {
  1131. video_options[i] = options;
  1132. break;
  1133. }
  1134. }
  1135. }
  1136. return 0;
  1137. }
  1138. __setup("video=", video_setup);
  1139. /*
  1140. * Visible symbols for modules
  1141. */
  1142. EXPORT_SYMBOL(register_framebuffer);
  1143. EXPORT_SYMBOL(unregister_framebuffer);
  1144. EXPORT_SYMBOL(num_registered_fb);
  1145. EXPORT_SYMBOL(registered_fb);
  1146. EXPORT_SYMBOL(fb_prepare_logo);
  1147. EXPORT_SYMBOL(fb_show_logo);
  1148. EXPORT_SYMBOL(fb_set_var);
  1149. EXPORT_SYMBOL(fb_blank);
  1150. EXPORT_SYMBOL(fb_pan_display);
  1151. EXPORT_SYMBOL(fb_get_buffer_offset);
  1152. EXPORT_SYMBOL(fb_set_suspend);
  1153. EXPORT_SYMBOL(fb_register_client);
  1154. EXPORT_SYMBOL(fb_unregister_client);
  1155. EXPORT_SYMBOL(fb_get_options);
  1156. EXPORT_SYMBOL(fb_new_modelist);
  1157. MODULE_LICENSE("GPL");