4 * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G
5 * integrated graphics chips.
7 * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org>
10 * This driver consists of two parts. The first part (intelfbdrv.c) provides
11 * the basic fbdev interfaces, is derived in part from the radeonfb and
12 * vesafb drivers, and is covered by the GPL. The second part (intelfbhw.c)
13 * provides the code to program the hardware. Most of it is derived from
14 * the i810/i830 XFree86 driver. The HW-specific code is covered here
15 * under a dual license (GPL and MIT/XFree86 license).
21 /* $DHD: intelfb/intelfbdrv.c,v 1.20 2003/06/27 15:17:40 dawes Exp $ */
25 * 01/2003 - Initial driver (0.1.0), no mode switching, no acceleration.
26 * This initial version is a basic core that works a lot like
27 * the vesafb driver. It must be built-in to the kernel,
28 * and the initial video mode must be set with vga=XXX at
29 * boot time. (David Dawes)
31 * 01/2003 - Version 0.2.0: Mode switching added, colormap support
32 * implemented, Y panning, and soft screen blanking implemented.
33 * No acceleration yet. (David Dawes)
35 * 01/2003 - Version 0.3.0: fbcon acceleration support added. Module
36 * option handling added. (David Dawes)
38 * 01/2003 - Version 0.4.0: fbcon HW cursor support added. (David Dawes)
40 * 01/2003 - Version 0.4.1: Add auto-generation of built-in modes.
43 * 02/2003 - Version 0.4.2: Add check for active non-CRT devices, and
44 * mode validation checks. (David Dawes)
46 * 02/2003 - Version 0.4.3: Check when the VC is in graphics mode so that
47 * acceleration is disabled while an XFree86 server is running.
50 * 02/2003 - Version 0.4.4: Monitor DPMS support. (David Dawes)
52 * 02/2003 - Version 0.4.5: Basic XFree86 + fbdev working. (David Dawes)
54 * 02/2003 - Version 0.5.0: Modify to work with the 2.5.32 kernel as well
55 * as 2.4.x kernels. (David Dawes)
57 * 02/2003 - Version 0.6.0: Split out HW-specifics into a separate file.
60 * 02/2003 - Version 0.7.0: Test on 852GM/855GM. Acceleration and HW
61 * cursor are disabled on this platform. (David Dawes)
63 * 02/2003 - Version 0.7.1: Test on 845G. Acceleration is disabled
64 * on this platform. (David Dawes)
66 * 02/2003 - Version 0.7.2: Test on 830M. Acceleration and HW
67 * cursor are disabled on this platform. (David Dawes)
69 * 02/2003 - Version 0.7.3: Fix 8-bit modes for mobile platforms
72 * 02/2003 - Version 0.7.4: Add checks for FB and FBCON_HAS_CFB* configured
73 * in the kernel, and add mode bpp verification and default
74 * bpp selection based on which FBCON_HAS_CFB* are configured.
77 * 02/2003 - Version 0.7.5: Add basic package/install scripts based on the
78 * DRI packaging scripts. (David Dawes)
80 * 04/2003 - Version 0.7.6: Fix typo that affects builds with SMP-enabled
81 * kernels. (David Dawes, reported by Anupam).
83 * 06/2003 - Version 0.7.7:
84 * Fix Makefile.kernel build problem (Tsutomu Yasuda).
85 * Fix mis-placed #endif (2.4.21 kernel).
87 * 09/2004 - Version 0.9.0 - by Sylvain Meyer
88 * Port to linux 2.6 kernel fbdev
89 * Fix HW accel and HW cursor on i845G
90 * Use of agpgart for fb memory reservation
93 * 10/2004 - Version 0.9.1
94 * Use module_param instead of old MODULE_PARM
97 * 11/2004 - Version 0.9.2
98 * Add vram option to reserve more memory than stolen by BIOS
99 * Fix intelfbhw_pan_display typo
100 * Add __initdata annotations
110 #include <linux/config.h>
111 #include <linux/module.h>
112 #include <linux/kernel.h>
113 #include <linux/errno.h>
114 #include <linux/string.h>
115 #include <linux/mm.h>
116 #include <linux/tty.h>
117 #include <linux/slab.h>
118 #include <linux/delay.h>
119 #include <linux/fb.h>
120 #include <linux/console.h>
121 #include <linux/selection.h>
122 #include <linux/ioport.h>
123 #include <linux/init.h>
124 #include <linux/pci.h>
125 #include <linux/vmalloc.h>
126 #include <linux/kd.h>
127 #include <linux/vt_kern.h>
128 #include <linux/pagemap.h>
129 #include <linux/version.h>
134 #include <asm/mtrr.h>
138 #include "intelfbdrv.h"
139 #include "intelfbhw.h"
142 * Limiting the class to PCI_CLASS_DISPLAY_VGA prevents function 1 of the
143 * mobile chipsets from being registered.
145 #if DETECT_VGA_CLASS_ONLY
146 #define INTELFB_CLASS_MASK ~0 << 8
148 #define INTELFB_CLASS_MASK 0
151 static struct pci_device_id intelfb_pci_table
[] __devinitdata
= {
152 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_830M
, PCI_ANY_ID
, PCI_ANY_ID
, PCI_CLASS_DISPLAY_VGA
<< 8, INTELFB_CLASS_MASK
, INTEL_830M
},
153 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_845G
, PCI_ANY_ID
, PCI_ANY_ID
, PCI_CLASS_DISPLAY_VGA
<< 8, INTELFB_CLASS_MASK
, INTEL_845G
},
154 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_85XGM
, PCI_ANY_ID
, PCI_ANY_ID
, PCI_CLASS_DISPLAY_VGA
<< 8, INTELFB_CLASS_MASK
, INTEL_85XGM
},
155 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_865G
, PCI_ANY_ID
, PCI_ANY_ID
, PCI_CLASS_DISPLAY_VGA
<< 8, INTELFB_CLASS_MASK
, INTEL_865G
},
156 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_915G
, PCI_ANY_ID
, PCI_ANY_ID
, PCI_CLASS_DISPLAY_VGA
<< 8, INTELFB_CLASS_MASK
, INTEL_915G
},
161 static int num_registered
= 0;
164 static struct fb_ops intel_fb_ops
= {
165 .owner
= THIS_MODULE
,
166 .fb_check_var
= intelfb_check_var
,
167 .fb_set_par
= intelfb_set_par
,
168 .fb_setcolreg
= intelfb_setcolreg
,
169 .fb_blank
= intelfb_blank
,
170 .fb_pan_display
= intelfb_pan_display
,
171 .fb_fillrect
= intelfb_fillrect
,
172 .fb_copyarea
= intelfb_copyarea
,
173 .fb_imageblit
= intelfb_imageblit
,
174 .fb_cursor
= intelfb_cursor
,
175 .fb_sync
= intelfb_sync
,
176 .fb_ioctl
= intelfb_ioctl
179 /* PCI driver module table */
180 static struct pci_driver intelfb_driver
= {
181 .name
= "Intel(R) " SUPPORTED_CHIPSETS
" Framebuffer Driver",
182 .id_table
= intelfb_pci_table
,
183 .probe
= intelfb_pci_register
,
184 .remove
= __devexit_p(intelfb_pci_unregister
)
187 /* Module description/parameters */
188 MODULE_AUTHOR("David Dawes <dawes@tungstengraphics.com>, "
189 "Sylvain Meyer <sylvain.meyer@worldonline.fr>");
191 "Framebuffer driver for Intel(R) " SUPPORTED_CHIPSETS
" chipsets");
192 MODULE_LICENSE("Dual BSD/GPL");
193 MODULE_DEVICE_TABLE(pci
, intelfb_pci_table
);
195 static int accel __initdata
= 1;
196 static int vram __initdata
= 4;
197 static int hwcursor __initdata
= 1;
198 static int mtrr __initdata
= 1;
199 static int fixed __initdata
= 0;
200 static int noinit __initdata
= 0;
201 static int noregister __initdata
= 0;
202 static int probeonly __initdata
= 0;
203 static int idonly __initdata
= 0;
204 static int bailearly __initdata
= 0;
205 static char *mode __initdata
= NULL
;
207 module_param(accel
, bool, S_IRUGO
);
208 MODULE_PARM_DESC(accel
, "Enable console acceleration");
209 module_param(vram
, int, S_IRUGO
);
210 MODULE_PARM_DESC(vram
, "System RAM to allocate to framebuffer in MiB");
211 module_param(hwcursor
, bool, S_IRUGO
);
212 MODULE_PARM_DESC(hwcursor
, "Enable HW cursor");
213 module_param(mtrr
, bool, S_IRUGO
);
214 MODULE_PARM_DESC(mtrr
, "Enable MTRR support");
215 module_param(fixed
, bool, S_IRUGO
);
216 MODULE_PARM_DESC(fixed
, "Disable mode switching");
217 module_param(noinit
, bool, 0);
218 MODULE_PARM_DESC(noinit
, "Don't initialise graphics mode when loading");
219 module_param(noregister
, bool, 0);
220 MODULE_PARM_DESC(noregister
, "Don't register, just probe and exit (debug)");
221 module_param(probeonly
, bool, 0);
222 MODULE_PARM_DESC(probeonly
, "Do a minimal probe (debug)");
223 module_param(idonly
, bool, 0);
224 MODULE_PARM_DESC(idonly
, "Just identify without doing anything else (debug)");
225 module_param(bailearly
, bool, 0);
226 MODULE_PARM_DESC(bailearly
, "Bail out early, depending on value (debug)");
227 module_param(mode
, charp
, S_IRUGO
);
228 MODULE_PARM_DESC(mode
,
229 "Initial video mode \"<xres>x<yres>[-<depth>][@<refresh>]\"");
232 #define OPT_EQUAL(opt, name) (!strncmp(opt, name, strlen(name)))
233 #define OPT_INTVAL(opt, name) simple_strtoul(opt + strlen(name), NULL, 0)
234 #define OPT_STRVAL(opt, name) (opt + strlen(name))
236 static __inline__
char *
237 get_opt_string(const char *this_opt
, const char *name
)
243 p
= OPT_STRVAL(this_opt
, name
);
245 while (p
[i
] && p
[i
] != ' ' && p
[i
] != ',')
247 ret
= kmalloc(i
+ 1, GFP_KERNEL
);
255 static __inline__
int
256 get_opt_int(const char *this_opt
, const char *name
, int *ret
)
261 if (!OPT_EQUAL(this_opt
, name
))
264 *ret
= OPT_INTVAL(this_opt
, name
);
268 static __inline__
int
269 get_opt_bool(const char *this_opt
, const char *name
, int *ret
)
274 if (OPT_EQUAL(this_opt
, name
)) {
275 if (this_opt
[strlen(name
)] == '=')
276 *ret
= simple_strtoul(this_opt
+ strlen(name
) + 1,
281 if (OPT_EQUAL(this_opt
, "no") && OPT_EQUAL(this_opt
+ 2, name
))
290 intelfb_setup(char *options
)
294 DBG_MSG("intelfb_setup\n");
296 if (!options
|| !*options
) {
297 DBG_MSG("no options\n");
300 DBG_MSG("options: %s\n", options
);
303 * These are the built-in options analogous to the module parameters
308 * video=intelfb:[mode][,<param>=<val>] ...
312 * video=intelfb:1024x768-16@75,accel=0
315 while ((this_opt
= strsep(&options
, ","))) {
318 if (get_opt_bool(this_opt
, "accel", &accel
))
320 else if (get_opt_int(this_opt
, "vram", &vram
))
322 else if (get_opt_bool(this_opt
, "hwcursor", &hwcursor
))
324 else if (get_opt_bool(this_opt
, "mtrr", &mtrr
))
326 else if (get_opt_bool(this_opt
, "fixed", &fixed
))
328 else if (get_opt_bool(this_opt
, "init", &noinit
))
330 else if (OPT_EQUAL(this_opt
, "mode="))
331 mode
= get_opt_string(this_opt
, "mode=");
348 DBG_MSG("intelfb_init\n");
350 INF_MSG("Framebuffer driver for "
351 "Intel(R) " SUPPORTED_CHIPSETS
" chipsets\n");
352 INF_MSG("Version " INTELFB_VERSION
"\n");
358 if (fb_get_options("intelfb", &option
))
360 intelfb_setup(option
);
363 return pci_register_driver(&intelfb_driver
);
369 DBG_MSG("intelfb_exit\n");
370 pci_unregister_driver(&intelfb_driver
);
373 module_init(intelfb_init
);
374 module_exit(intelfb_exit
);
376 /***************************************************************
377 * mtrr support functions *
378 ***************************************************************/
381 static inline void __devinit
set_mtrr(struct intelfb_info
*dinfo
)
383 dinfo
->mtrr_reg
= mtrr_add(dinfo
->aperture
.physical
,
384 dinfo
->aperture
.size
, MTRR_TYPE_WRCOMB
, 1);
385 if (dinfo
->mtrr_reg
< 0) {
386 ERR_MSG("unable to set MTRR\n");
391 static inline void unset_mtrr(struct intelfb_info
*dinfo
)
394 mtrr_del(dinfo
->mtrr_reg
, dinfo
->aperture
.physical
,
395 dinfo
->aperture
.size
);
398 #define set_mtrr(x) WRN_MSG("MTRR is disabled in the kernel\n")
400 #define unset_mtrr(x) do { } while (0)
401 #endif /* CONFIG_MTRR */
403 /***************************************************************
404 * driver init / cleanup *
405 ***************************************************************/
408 cleanup(struct intelfb_info
*dinfo
)
410 DBG_MSG("cleanup\n");
415 fb_dealloc_cmap(&dinfo
->info
->cmap
);
416 kfree(dinfo
->info
->pixmap
.addr
);
418 if (dinfo
->registered
)
419 unregister_framebuffer(dinfo
->info
);
423 if (dinfo
->fbmem_gart
&& dinfo
->gtt_fb_mem
) {
424 agp_unbind_memory(dinfo
->gtt_fb_mem
);
425 agp_free_memory(dinfo
->gtt_fb_mem
);
427 if (dinfo
->gtt_cursor_mem
) {
428 agp_unbind_memory(dinfo
->gtt_cursor_mem
);
429 agp_free_memory(dinfo
->gtt_cursor_mem
);
431 if (dinfo
->gtt_ring_mem
) {
432 agp_unbind_memory(dinfo
->gtt_ring_mem
);
433 agp_free_memory(dinfo
->gtt_ring_mem
);
436 if (dinfo
->mmio_base
)
437 iounmap((void __iomem
*)dinfo
->mmio_base
);
438 if (dinfo
->aperture
.virtual)
439 iounmap((void __iomem
*)dinfo
->aperture
.virtual);
441 if (dinfo
->mmio_base_phys
)
442 release_mem_region(dinfo
->mmio_base_phys
, INTEL_REG_SIZE
);
443 if (dinfo
->aperture
.physical
)
444 release_mem_region(dinfo
->aperture
.physical
,
445 dinfo
->aperture
.size
);
446 framebuffer_release(dinfo
->info
);
449 #define bailout(dinfo) do { \
450 DBG_MSG("bailout\n"); \
452 INF_MSG("Not going to register framebuffer, exiting...\n"); \
458 intelfb_pci_register(struct pci_dev
*pdev
, const struct pci_device_id
*ent
)
460 struct fb_info
*info
;
461 struct intelfb_info
*dinfo
;
463 int aperture_size
, stolen_size
;
464 struct agp_kern_info gtt_info
;
467 struct agp_bridge_data
*bridge
;
468 int aperture_bar
= 0;
471 DBG_MSG("intelfb_pci_register\n");
474 if (num_registered
!= 1) {
475 ERR_MSG("Attempted to register %d devices "
476 "(should be only 1).\n", num_registered
);
480 info
= framebuffer_alloc(sizeof(struct intelfb_info
), &pdev
->dev
);
482 ERR_MSG("Could not allocate memory for intelfb_info.\n");
485 if (fb_alloc_cmap(&info
->cmap
, 256, 1) < 0) {
486 ERR_MSG("Could not allocate cmap for intelfb_info.\n");
493 dinfo
->fbops
= &intel_fb_ops
;
496 /* Reserve pixmap space. */
497 info
->pixmap
.addr
= kmalloc(64 * 1024, GFP_KERNEL
);
498 if (info
->pixmap
.addr
== NULL
) {
499 ERR_MSG("Cannot reserve pixmap memory.\n");
502 memset(info
->pixmap
.addr
, 0, 64 * 1024);
504 /* set early this option because it could be changed by tv encoder
506 dinfo
->fixed_mode
= fixed
;
509 if ((err
= pci_enable_device(pdev
))) {
510 ERR_MSG("Cannot enable device.\n");
515 /* Set base addresses. */
516 if (ent
->device
== PCI_DEVICE_ID_INTEL_915G
) {
519 /* Disable HW cursor on 915G (not implemented yet) */
522 dinfo
->aperture
.physical
= pci_resource_start(pdev
, aperture_bar
);
523 dinfo
->aperture
.size
= pci_resource_len(pdev
, aperture_bar
);
524 dinfo
->mmio_base_phys
= pci_resource_start(pdev
, mmio_bar
);
525 DBG_MSG("fb aperture: 0x%llx/0x%llx, MMIO region: 0x%llx/0x%llx\n",
526 (unsigned long long)pci_resource_start(pdev
, aperture_bar
),
527 (unsigned long long)pci_resource_len(pdev
, aperture_bar
),
528 (unsigned long long)pci_resource_start(pdev
, mmio_bar
),
529 (unsigned long long)pci_resource_len(pdev
, mmio_bar
));
531 /* Reserve the fb and MMIO regions */
532 if (!request_mem_region(dinfo
->aperture
.physical
, dinfo
->aperture
.size
,
533 INTELFB_MODULE_NAME
)) {
534 ERR_MSG("Cannot reserve FB region.\n");
538 if (!request_mem_region(dinfo
->mmio_base_phys
,
540 INTELFB_MODULE_NAME
)) {
541 ERR_MSG("Cannot reserve MMIO region.\n");
546 /* Map the fb and MMIO regions */
547 dinfo
->aperture
.virtual = (u8 __iomem
*)ioremap_nocache
548 (dinfo
->aperture
.physical
, dinfo
->aperture
.size
);
549 if (!dinfo
->aperture
.virtual) {
550 ERR_MSG("Cannot remap FB region.\n");
555 (u8 __iomem
*)ioremap_nocache(dinfo
->mmio_base_phys
,
557 if (!dinfo
->mmio_base
) {
558 ERR_MSG("Cannot remap MMIO region.\n");
563 /* Get the chipset info. */
564 dinfo
->pci_chipset
= pdev
->device
;
566 if (intelfbhw_get_chipset(pdev
, &dinfo
->name
, &dinfo
->chipset
,
572 if (intelfbhw_get_memory(pdev
, &aperture_size
,&stolen_size
)) {
577 INF_MSG("%02x:%02x.%d: %s, aperture size %dMB, "
578 "stolen memory %dkB\n",
579 pdev
->bus
->number
, PCI_SLOT(pdev
->devfn
),
580 PCI_FUNC(pdev
->devfn
), dinfo
->name
,
581 BtoMB(aperture_size
), BtoKB(stolen_size
));
583 /* Set these from the options. */
584 dinfo
->accel
= accel
;
585 dinfo
->hwcursor
= hwcursor
;
587 if (NOACCEL_CHIPSET(dinfo
) && dinfo
->accel
== 1) {
588 INF_MSG("Acceleration is not supported for the %s chipset.\n",
593 /* Framebuffer parameters - Use all the stolen memory if >= vram */
594 if (ROUND_UP_TO_PAGE(stolen_size
) >= MB(vram
)) {
595 dinfo
->fb
.size
= ROUND_UP_TO_PAGE(stolen_size
);
596 dinfo
->fbmem_gart
= 0;
598 dinfo
->fb
.size
= MB(vram
);
599 dinfo
->fbmem_gart
= 1;
602 /* Allocate space for the ring buffer and HW cursor if enabled. */
604 dinfo
->ring
.size
= RINGBUFFER_SIZE
;
605 dinfo
->ring_tail_mask
= dinfo
->ring
.size
- 1;
607 if (dinfo
->hwcursor
) {
608 dinfo
->cursor
.size
= HW_CURSOR_SIZE
;
611 /* Use agpgart to manage the GATT */
612 if (!(bridge
= agp_backend_acquire(pdev
))) {
613 ERR_MSG("cannot acquire agp\n");
618 /* get the current gatt info */
619 if (agp_copy_info(bridge
, >t_info
)) {
620 ERR_MSG("cannot get agp info\n");
621 agp_backend_release(bridge
);
626 /* set the mem offsets - set them after the already used pages */
628 dinfo
->ring
.offset
= (stolen_size
>> 12)
629 + gtt_info
.current_memory
;
631 if (dinfo
->hwcursor
) {
632 dinfo
->cursor
.offset
= (stolen_size
>> 12) +
633 + gtt_info
.current_memory
+ (dinfo
->ring
.size
>> 12);
635 if (dinfo
->fbmem_gart
) {
636 dinfo
->fb
.offset
= (stolen_size
>> 12) +
637 + gtt_info
.current_memory
+ (dinfo
->ring
.size
>> 12)
638 + (dinfo
->cursor
.size
>> 12);
641 /* Allocate memories (which aren't stolen) */
643 if (!(dinfo
->gtt_ring_mem
=
644 agp_allocate_memory(bridge
, dinfo
->ring
.size
>> 12,
645 AGP_NORMAL_MEMORY
))) {
646 ERR_MSG("cannot allocate ring buffer memory\n");
647 agp_backend_release(bridge
);
651 if (agp_bind_memory(dinfo
->gtt_ring_mem
,
652 dinfo
->ring
.offset
)) {
653 ERR_MSG("cannot bind ring buffer memory\n");
654 agp_backend_release(bridge
);
658 dinfo
->ring
.physical
= dinfo
->aperture
.physical
659 + (dinfo
->ring
.offset
<< 12);
660 dinfo
->ring
.virtual = dinfo
->aperture
.virtual
661 + (dinfo
->ring
.offset
<< 12);
662 dinfo
->ring_head
= dinfo
->ring
.virtual;
664 if (dinfo
->hwcursor
) {
665 agp_memtype
= dinfo
->mobile
? AGP_PHYSICAL_MEMORY
667 if (!(dinfo
->gtt_cursor_mem
=
668 agp_allocate_memory(bridge
, dinfo
->cursor
.size
>> 12,
670 ERR_MSG("cannot allocate cursor memory\n");
671 agp_backend_release(bridge
);
675 if (agp_bind_memory(dinfo
->gtt_cursor_mem
,
676 dinfo
->cursor
.offset
)) {
677 ERR_MSG("cannot bind cursor memory\n");
678 agp_backend_release(bridge
);
683 dinfo
->cursor
.physical
684 = dinfo
->gtt_cursor_mem
->physical
;
686 dinfo
->cursor
.physical
= dinfo
->aperture
.physical
687 + (dinfo
->cursor
.offset
<< 12);
688 dinfo
->cursor
.virtual = dinfo
->aperture
.virtual
689 + (dinfo
->cursor
.offset
<< 12);
691 if (dinfo
->fbmem_gart
) {
692 if (!(dinfo
->gtt_fb_mem
=
693 agp_allocate_memory(bridge
, dinfo
->fb
.size
>> 12,
694 AGP_NORMAL_MEMORY
))) {
695 WRN_MSG("cannot allocate framebuffer memory - use "
697 dinfo
->fbmem_gart
= 0;
699 if (agp_bind_memory(dinfo
->gtt_fb_mem
,
701 WRN_MSG("cannot bind framebuffer memory - use "
703 dinfo
->fbmem_gart
= 0;
707 /* update framebuffer memory parameters */
708 if (!dinfo
->fbmem_gart
)
709 dinfo
->fb
.offset
= 0; /* starts at offset 0 */
710 dinfo
->fb
.physical
= dinfo
->aperture
.physical
711 + (dinfo
->fb
.offset
<< 12);
712 dinfo
->fb
.virtual = dinfo
->aperture
.virtual + (dinfo
->fb
.offset
<< 12);
713 dinfo
->fb_start
= dinfo
->fb
.offset
<< 12;
715 /* release agpgart */
716 agp_backend_release(bridge
);
721 DBG_MSG("fb: 0x%x(+ 0x%x)/0x%x (0x%x)\n",
722 dinfo
->fb
.physical
, dinfo
->fb
.offset
, dinfo
->fb
.size
,
723 (u32 __iomem
) dinfo
->fb
.virtual);
724 DBG_MSG("MMIO: 0x%x/0x%x (0x%x)\n",
725 dinfo
->mmio_base_phys
, INTEL_REG_SIZE
,
726 (u32 __iomem
) dinfo
->mmio_base
);
727 DBG_MSG("ring buffer: 0x%x/0x%x (0x%x)\n",
728 dinfo
->ring
.physical
, dinfo
->ring
.size
,
729 (u32 __iomem
) dinfo
->ring
.virtual);
730 DBG_MSG("HW cursor: 0x%x/0x%x (0x%x) (offset 0x%x) (phys 0x%x)\n",
731 dinfo
->cursor
.physical
, dinfo
->cursor
.size
,
732 (u32 __iomem
) dinfo
->cursor
.virtual, dinfo
->cursor
.offset
,
733 dinfo
->cursor
.physical
);
735 DBG_MSG("options: vram = %d, accel = %d, hwcursor = %d, fixed = %d, "
736 "noinit = %d\n", vram
, accel
, hwcursor
, fixed
, noinit
);
737 DBG_MSG("options: mode = \"%s\"\n", mode
? mode
: "");
743 * Check if the LVDS port or any DVO ports are enabled. If so,
744 * don't allow mode switching
746 dvo
= intelfbhw_check_non_crt(dinfo
);
748 dinfo
->fixed_mode
= 1;
749 WRN_MSG("Non-CRT device is enabled ( ");
753 s
= intelfbhw_dvo_to_string(1 << i
);
760 printk("). Disabling mode switching.\n");
766 if (FIXED_MODE(dinfo
) && ORIG_VIDEO_ISVGA
!= VIDEO_TYPE_VLFB
) {
767 ERR_MSG("Video mode must be programmed at boot time.\n");
775 /* Initialise dinfo and related data. */
776 /* If an initial mode was programmed at boot time, get its details. */
777 if (ORIG_VIDEO_ISVGA
== VIDEO_TYPE_VLFB
)
778 get_initial_mode(dinfo
);
783 if (FIXED_MODE(dinfo
)) {
784 /* remap fb address */
785 update_dinfo(dinfo
, &dinfo
->initial_var
);
792 if (intelfb_set_fbinfo(dinfo
)) {
800 for (i
= 0; i
< 16; i
++) {
802 dinfo
->palette
[i
].red
= default_red
[j
];
803 dinfo
->palette
[i
].green
= default_grn
[j
];
804 dinfo
->palette
[i
].blue
= default_blu
[j
];
810 pci_set_drvdata(pdev
, dinfo
);
812 /* Save the initial register state. */
813 i
= intelfbhw_read_hw_state(dinfo
, &dinfo
->save_state
,
814 bailearly
> 6 ? bailearly
- 6 : 0);
816 DBG_MSG("intelfbhw_read_hw_state returned %d\n", i
);
820 intelfbhw_print_hw_state(dinfo
, &dinfo
->save_state
);
825 /* Cursor initialisation */
826 if (dinfo
->hwcursor
) {
827 intelfbhw_cursor_init(dinfo
);
828 intelfbhw_cursor_reset(dinfo
);
834 /* 2d acceleration init */
836 intelfbhw_2d_start(dinfo
);
844 if (register_framebuffer(dinfo
->info
) < 0) {
845 ERR_MSG("Cannot register framebuffer.\n");
850 dinfo
->registered
= 1;
855 fb_dealloc_cmap(&info
->cmap
);
857 framebuffer_release(info
);
861 static void __devexit
862 intelfb_pci_unregister(struct pci_dev
*pdev
)
864 struct intelfb_info
*dinfo
= pci_get_drvdata(pdev
);
866 DBG_MSG("intelfb_pci_unregister\n");
873 pci_set_drvdata(pdev
, NULL
);
876 /***************************************************************
878 ***************************************************************/
881 intelfb_var_to_depth(const struct fb_var_screeninfo
*var
)
883 DBG_MSG("intelfb_var_to_depth: bpp: %d, green.length is %d\n",
884 var
->bits_per_pixel
, var
->green
.length
);
886 switch (var
->bits_per_pixel
) {
888 return (var
->green
.length
== 6) ? 16 : 15;
892 return var
->bits_per_pixel
;
897 static __inline__
int
898 var_to_refresh(const struct fb_var_screeninfo
*var
)
900 int xtot
= var
->xres
+ var
->left_margin
+ var
->right_margin
+
902 int ytot
= var
->yres
+ var
->upper_margin
+ var
->lower_margin
+
905 return (1000000000 / var
->pixclock
* 1000 + 500) / xtot
/ ytot
;
908 /***************************************************************
909 * Various intialisation functions *
910 ***************************************************************/
912 static void __devinit
913 get_initial_mode(struct intelfb_info
*dinfo
)
915 struct fb_var_screeninfo
*var
;
918 DBG_MSG("get_initial_mode\n");
920 dinfo
->initial_vga
= 1;
921 dinfo
->initial_fb_base
= screen_info
.lfb_base
;
922 dinfo
->initial_video_ram
= screen_info
.lfb_size
* KB(64);
923 dinfo
->initial_pitch
= screen_info
.lfb_linelength
;
925 var
= &dinfo
->initial_var
;
926 memset(var
, 0, sizeof(*var
));
927 var
->xres
= screen_info
.lfb_width
;
928 var
->yres
= screen_info
.lfb_height
;
929 var
->bits_per_pixel
= screen_info
.lfb_depth
;
930 switch (screen_info
.lfb_depth
) {
932 var
->bits_per_pixel
= 16;
935 var
->bits_per_pixel
= 32;
939 DBG_MSG("Initial info: FB is 0x%x/0x%x (%d kByte)\n",
940 dinfo
->initial_fb_base
, dinfo
->initial_video_ram
,
941 BtoKB(dinfo
->initial_video_ram
));
943 DBG_MSG("Initial info: mode is %dx%d-%d (%d)\n",
944 var
->xres
, var
->yres
, var
->bits_per_pixel
,
945 dinfo
->initial_pitch
);
947 /* Dummy timing values (assume 60Hz) */
948 var
->left_margin
= (var
->xres
/ 8) & 0xf8;
949 var
->right_margin
= 32;
950 var
->upper_margin
= 16;
951 var
->lower_margin
= 4;
952 var
->hsync_len
= (var
->xres
/ 8) & 0xf8;
955 xtot
= var
->xres
+ var
->left_margin
+
956 var
->right_margin
+ var
->hsync_len
;
957 ytot
= var
->yres
+ var
->upper_margin
+
958 var
->lower_margin
+ var
->vsync_len
;
959 var
->pixclock
= 10000000 / xtot
* 1000 / ytot
* 100 / 60;
964 if (var
->bits_per_pixel
> 8) {
965 var
->red
.offset
= screen_info
.red_pos
;
966 var
->red
.length
= screen_info
.red_size
;
967 var
->green
.offset
= screen_info
.green_pos
;
968 var
->green
.length
= screen_info
.green_size
;
969 var
->blue
.offset
= screen_info
.blue_pos
;
970 var
->blue
.length
= screen_info
.blue_size
;
971 var
->transp
.offset
= screen_info
.rsvd_pos
;
972 var
->transp
.length
= screen_info
.rsvd_size
;
975 var
->green
.length
= 8;
976 var
->blue
.length
= 8;
981 intelfb_init_var(struct intelfb_info
*dinfo
)
983 struct fb_var_screeninfo
*var
;
986 DBG_MSG("intelfb_init_var\n");
988 var
= &dinfo
->info
->var
;
989 if (FIXED_MODE(dinfo
)) {
990 memcpy(var
, &dinfo
->initial_var
,
991 sizeof(struct fb_var_screeninfo
));
995 msrc
= fb_find_mode(var
, dinfo
->info
, mode
,
996 vesa_modes
, VESA_MODEDB_SIZE
,
1002 msrc
= fb_find_mode(var
, dinfo
->info
, PREFERRED_MODE
,
1003 vesa_modes
, VESA_MODEDB_SIZE
,
1009 ERR_MSG("Cannot find a suitable video mode.\n");
1013 INF_MSG("Initial video mode is %dx%d-%d@%d.\n", var
->xres
, var
->yres
,
1014 var
->bits_per_pixel
, var_to_refresh(var
));
1016 DBG_MSG("Initial video mode is from %d.\n", msrc
);
1018 #if ALLOCATE_FOR_PANNING
1019 /* Allow use of half of the video ram for panning */
1020 var
->xres_virtual
= var
->xres
;
1022 dinfo
->fb
.size
/ 2 / (var
->bits_per_pixel
* var
->xres
);
1023 if (var
->yres_virtual
< var
->yres
)
1024 var
->yres_virtual
= var
->yres
;
1026 var
->yres_virtual
= var
->yres
;
1030 var
->accel_flags
|= FB_ACCELF_TEXT
;
1032 var
->accel_flags
&= ~FB_ACCELF_TEXT
;
1037 static int __devinit
1038 intelfb_set_fbinfo(struct intelfb_info
*dinfo
)
1040 struct fb_info
*info
= dinfo
->info
;
1042 DBG_MSG("intelfb_set_fbinfo\n");
1044 info
->flags
= FBINFO_FLAG_DEFAULT
;
1045 info
->fbops
= &intel_fb_ops
;
1046 info
->pseudo_palette
= dinfo
->pseudo_palette
;
1048 info
->pixmap
.size
= 64*1024;
1049 info
->pixmap
.buf_align
= 8;
1050 info
->pixmap
.flags
= FB_PIXMAP_SYSTEM
;
1052 if (intelfb_init_var(dinfo
))
1055 info
->pixmap
.scan_align
= 1;
1057 update_dinfo(dinfo
, &info
->var
);
1062 /* Update dinfo to match the active video mode. */
1064 update_dinfo(struct intelfb_info
*dinfo
, struct fb_var_screeninfo
*var
)
1066 DBG_MSG("update_dinfo\n");
1068 dinfo
->bpp
= var
->bits_per_pixel
;
1069 dinfo
->depth
= intelfb_var_to_depth(var
);
1070 dinfo
->xres
= var
->xres
;
1071 dinfo
->yres
= var
->xres
;
1072 dinfo
->pixclock
= var
->pixclock
;
1074 intelfb_get_fix(&dinfo
->info
->fix
, dinfo
->info
);
1076 switch (dinfo
->bpp
) {
1078 dinfo
->visual
= FB_VISUAL_PSEUDOCOLOR
;
1079 dinfo
->pitch
= var
->xres_virtual
;
1082 dinfo
->visual
= FB_VISUAL_TRUECOLOR
;
1083 dinfo
->pitch
= var
->xres_virtual
* 2;
1086 dinfo
->visual
= FB_VISUAL_TRUECOLOR
;
1087 dinfo
->pitch
= var
->xres_virtual
* 4;
1091 /* Make sure the line length is a aligned correctly. */
1092 dinfo
->pitch
= ROUND_UP_TO(dinfo
->pitch
, STRIDE_ALIGNMENT
);
1094 if (FIXED_MODE(dinfo
))
1095 dinfo
->pitch
= dinfo
->initial_pitch
;
1097 dinfo
->info
->screen_base
= (char __iomem
*)dinfo
->fb
.virtual;
1098 dinfo
->info
->fix
.line_length
= dinfo
->pitch
;
1099 dinfo
->info
->fix
.visual
= dinfo
->visual
;
1102 /* fbops functions */
1105 intelfb_get_fix(struct fb_fix_screeninfo
*fix
, struct fb_info
*info
)
1107 struct intelfb_info
*dinfo
= GET_DINFO(info
);
1109 DBG_MSG("intelfb_get_fix\n");
1111 memset(fix
, 0, sizeof(*fix
));
1112 strcpy(fix
->id
, dinfo
->name
);
1113 fix
->smem_start
= dinfo
->fb
.physical
;
1114 fix
->smem_len
= dinfo
->fb
.size
;
1115 fix
->type
= FB_TYPE_PACKED_PIXELS
;
1117 fix
->visual
= dinfo
->visual
;
1121 fix
->line_length
= dinfo
->pitch
;
1122 fix
->mmio_start
= dinfo
->mmio_base_phys
;
1123 fix
->mmio_len
= INTEL_REG_SIZE
;
1124 fix
->accel
= FB_ACCEL_I830
;
1128 /***************************************************************
1130 ***************************************************************/
1133 intelfb_check_var(struct fb_var_screeninfo
*var
, struct fb_info
*info
)
1136 struct fb_var_screeninfo v
;
1137 struct intelfb_info
*dinfo
;
1138 static int first
= 1;
1140 DBG_MSG("intelfb_check_var: accel_flags is %d\n", var
->accel_flags
);
1142 dinfo
= GET_DINFO(info
);
1144 if (intelfbhw_validate_mode(dinfo
, var
) != 0)
1149 /* Check for a supported bpp. */
1150 if (v
.bits_per_pixel
<= 8) {
1151 v
.bits_per_pixel
= 8;
1152 } else if (v
.bits_per_pixel
<= 16) {
1153 if (v
.bits_per_pixel
== 16)
1155 v
.bits_per_pixel
= 16;
1156 } else if (v
.bits_per_pixel
<= 32) {
1157 v
.bits_per_pixel
= 32;
1161 change_var
= ((info
->var
.xres
!= var
->xres
) ||
1162 (info
->var
.yres
!= var
->yres
) ||
1163 (info
->var
.xres_virtual
!= var
->xres_virtual
) ||
1164 (info
->var
.yres_virtual
!= var
->yres_virtual
) ||
1165 (info
->var
.bits_per_pixel
!= var
->bits_per_pixel
) ||
1166 memcmp(&info
->var
.red
, &var
->red
, sizeof(var
->red
)) ||
1167 memcmp(&info
->var
.green
, &var
->green
,
1168 sizeof(var
->green
)) ||
1169 memcmp(&info
->var
.blue
, &var
->blue
, sizeof(var
->blue
)));
1171 if (FIXED_MODE(dinfo
) &&
1173 var
->yres_virtual
> dinfo
->initial_var
.yres_virtual
||
1174 var
->yres_virtual
< dinfo
->initial_var
.yres
||
1175 var
->xoffset
|| var
->nonstd
)) {
1177 ERR_MSG("Changing the video mode is not supported.\n");
1183 switch (intelfb_var_to_depth(&v
)) {
1185 v
.red
.offset
= v
.green
.offset
= v
.blue
.offset
= 0;
1186 v
.red
.length
= v
.green
.length
= v
.blue
.length
= 8;
1187 v
.transp
.offset
= v
.transp
.length
= 0;
1193 v
.red
.length
= v
.green
.length
= v
.blue
.length
= 5;
1194 v
.transp
.offset
= v
.transp
.length
= 0;
1203 v
.transp
.offset
= v
.transp
.length
= 0;
1209 v
.red
.length
= v
.green
.length
= v
.blue
.length
= 8;
1210 v
.transp
.offset
= v
.transp
.length
= 0;
1216 v
.red
.length
= v
.green
.length
= v
.blue
.length
= 8;
1217 v
.transp
.offset
= 24;
1218 v
.transp
.length
= 8;
1227 if (v
.xoffset
> v
.xres_virtual
- v
.xres
)
1228 v
.xoffset
= v
.xres_virtual
- v
.xres
;
1229 if (v
.yoffset
> v
.yres_virtual
- v
.yres
)
1230 v
.yoffset
= v
.yres_virtual
- v
.yres
;
1232 v
.red
.msb_right
= v
.green
.msb_right
= v
.blue
.msb_right
=
1233 v
.transp
.msb_right
= 0;
1241 intelfb_set_par(struct fb_info
*info
)
1243 struct intelfb_hwstate
*hw
;
1244 struct intelfb_info
*dinfo
= GET_DINFO(info
);
1246 if (FIXED_MODE(dinfo
)) {
1247 ERR_MSG("Changing the video mode is not supported.\n");
1251 hw
= kmalloc(sizeof(*hw
), GFP_ATOMIC
);
1255 DBG_MSG("intelfb_set_par (%dx%d-%d)\n", info
->var
.xres
,
1256 info
->var
.yres
, info
->var
.bits_per_pixel
);
1258 intelfb_blank(FB_BLANK_POWERDOWN
, info
);
1261 intelfbhw_2d_stop(dinfo
);
1263 memcpy(hw
, &dinfo
->save_state
, sizeof(*hw
));
1264 if (intelfbhw_mode_to_hw(dinfo
, hw
, &info
->var
))
1266 if (intelfbhw_program_mode(dinfo
, hw
, 0))
1270 intelfbhw_read_hw_state(dinfo
, hw
, 0);
1271 intelfbhw_print_hw_state(dinfo
, hw
);
1274 update_dinfo(dinfo
, &info
->var
);
1277 intelfbhw_2d_start(dinfo
);
1279 intelfb_pan_display(&info
->var
, info
);
1281 intelfb_blank(FB_BLANK_UNBLANK
, info
);
1283 if (ACCEL(dinfo
, info
)) {
1284 info
->flags
= FBINFO_DEFAULT
| FBINFO_HWACCEL_YPAN
|
1285 FBINFO_HWACCEL_COPYAREA
| FBINFO_HWACCEL_FILLRECT
|
1286 FBINFO_HWACCEL_IMAGEBLIT
;
1288 info
->flags
= FBINFO_DEFAULT
| FBINFO_HWACCEL_YPAN
;
1298 intelfb_setcolreg(unsigned regno
, unsigned red
, unsigned green
,
1299 unsigned blue
, unsigned transp
, struct fb_info
*info
)
1301 struct intelfb_info
*dinfo
= GET_DINFO(info
);
1304 DBG_MSG("intelfb_setcolreg: regno %d, depth %d\n", regno
, dinfo
->depth
);
1310 switch (dinfo
->depth
) {
1317 dinfo
->palette
[regno
].red
= red
;
1318 dinfo
->palette
[regno
].green
= green
;
1319 dinfo
->palette
[regno
].blue
= blue
;
1321 intelfbhw_setcolreg(dinfo
, regno
, red
, green
, blue
,
1326 dinfo
->pseudo_palette
[regno
] = ((red
& 0xf800) >> 1) |
1327 ((green
& 0xf800) >> 6) |
1328 ((blue
& 0xf800) >> 11);
1331 dinfo
->pseudo_palette
[regno
] = (red
& 0xf800) |
1332 ((green
& 0xfc00) >> 5) |
1333 ((blue
& 0xf800) >> 11);
1336 dinfo
->pseudo_palette
[regno
] = ((red
& 0xff00) << 8) |
1338 ((blue
& 0xff00) >> 8);
1345 intelfb_blank(int blank
, struct fb_info
*info
)
1347 intelfbhw_do_blank(blank
, info
);
1352 intelfb_pan_display(struct fb_var_screeninfo
*var
, struct fb_info
*info
)
1354 intelfbhw_pan_display(var
, info
);
1358 /* When/if we have our own ioctls. */
1360 intelfb_ioctl(struct inode
*inode
, struct file
*file
, unsigned int cmd
,
1361 unsigned long arg
, struct fb_info
*info
)
1369 intelfb_fillrect (struct fb_info
*info
, const struct fb_fillrect
*rect
)
1371 struct intelfb_info
*dinfo
= GET_DINFO(info
);
1375 DBG_MSG("intelfb_fillrect\n");
1378 if (!ACCEL(dinfo
, info
) || dinfo
->depth
== 4)
1379 return cfb_fillrect(info
, rect
);
1381 if (rect
->rop
== ROP_COPY
)
1382 rop
= PAT_ROP_GXCOPY
;
1384 rop
= PAT_ROP_GXXOR
;
1386 if (dinfo
->depth
!= 8)
1387 color
= dinfo
->pseudo_palette
[rect
->color
];
1389 color
= rect
->color
;
1391 intelfbhw_do_fillrect(dinfo
, rect
->dx
, rect
->dy
,
1392 rect
->width
, rect
->height
, color
,
1393 dinfo
->pitch
, info
->var
.bits_per_pixel
,
1398 intelfb_copyarea(struct fb_info
*info
, const struct fb_copyarea
*region
)
1400 struct intelfb_info
*dinfo
= GET_DINFO(info
);
1403 DBG_MSG("intelfb_copyarea\n");
1406 if (!ACCEL(dinfo
, info
) || dinfo
->depth
== 4)
1407 return cfb_copyarea(info
, region
);
1409 intelfbhw_do_bitblt(dinfo
, region
->sx
, region
->sy
, region
->dx
,
1410 region
->dy
, region
->width
, region
->height
,
1411 dinfo
->pitch
, info
->var
.bits_per_pixel
);
1415 intelfb_imageblit(struct fb_info
*info
, const struct fb_image
*image
)
1417 struct intelfb_info
*dinfo
= GET_DINFO(info
);
1418 u32 fgcolor
, bgcolor
;
1421 DBG_MSG("intelfb_imageblit\n");
1424 if (!ACCEL(dinfo
, info
) || dinfo
->depth
== 4
1425 || image
->depth
!= 1)
1426 return cfb_imageblit(info
, image
);
1428 if (dinfo
->depth
!= 8) {
1429 fgcolor
= dinfo
->pseudo_palette
[image
->fg_color
];
1430 bgcolor
= dinfo
->pseudo_palette
[image
->bg_color
];
1432 fgcolor
= image
->fg_color
;
1433 bgcolor
= image
->bg_color
;
1436 if (!intelfbhw_do_drawglyph(dinfo
, fgcolor
, bgcolor
, image
->width
,
1437 image
->height
, image
->data
,
1438 image
->dx
, image
->dy
,
1439 dinfo
->pitch
, info
->var
.bits_per_pixel
))
1440 return cfb_imageblit(info
, image
);
1444 intelfb_cursor(struct fb_info
*info
, struct fb_cursor
*cursor
)
1446 struct intelfb_info
*dinfo
= GET_DINFO(info
);
1449 DBG_MSG("intelfb_cursor\n");
1452 if (!dinfo
->hwcursor
)
1453 return soft_cursor(info
, cursor
);
1455 intelfbhw_cursor_hide(dinfo
);
1457 /* If XFree killed the cursor - restore it */
1458 if (INREG(CURSOR_A_BASEADDR
) != dinfo
->cursor
.offset
<< 12) {
1461 DBG_MSG("the cursor was killed - restore it !!\n");
1462 DBG_MSG("size %d, %d pos %d, %d\n",
1463 cursor
->image
.width
, cursor
->image
.height
,
1464 cursor
->image
.dx
, cursor
->image
.dy
);
1466 intelfbhw_cursor_init(dinfo
);
1467 intelfbhw_cursor_reset(dinfo
);
1468 intelfbhw_cursor_setpos(dinfo
, cursor
->image
.dx
,
1471 if (dinfo
->depth
!= 8) {
1472 fg
=dinfo
->pseudo_palette
[cursor
->image
.fg_color
];
1473 bg
=dinfo
->pseudo_palette
[cursor
->image
.bg_color
];
1475 fg
= cursor
->image
.fg_color
;
1476 bg
= cursor
->image
.bg_color
;
1478 intelfbhw_cursor_setcolor(dinfo
, bg
, fg
);
1479 intelfbhw_cursor_load(dinfo
, cursor
->image
.width
,
1480 cursor
->image
.height
,
1484 intelfbhw_cursor_show(dinfo
);
1488 if (cursor
->set
& FB_CUR_SETPOS
) {
1491 dx
= cursor
->image
.dx
- info
->var
.xoffset
;
1492 dy
= cursor
->image
.dy
- info
->var
.yoffset
;
1494 intelfbhw_cursor_setpos(dinfo
, dx
, dy
);
1497 if (cursor
->set
& FB_CUR_SETSIZE
) {
1498 if (cursor
->image
.width
> 64 || cursor
->image
.height
> 64)
1501 intelfbhw_cursor_reset(dinfo
);
1504 if (cursor
->set
& FB_CUR_SETCMAP
) {
1507 if (dinfo
->depth
!= 8) {
1508 fg
= dinfo
->pseudo_palette
[cursor
->image
.fg_color
];
1509 bg
= dinfo
->pseudo_palette
[cursor
->image
.bg_color
];
1511 fg
= cursor
->image
.fg_color
;
1512 bg
= cursor
->image
.bg_color
;
1515 intelfbhw_cursor_setcolor(dinfo
, bg
, fg
);
1518 if (cursor
->set
& (FB_CUR_SETSHAPE
| FB_CUR_SETIMAGE
)) {
1519 u32 s_pitch
= (ROUND_UP_TO(cursor
->image
.width
, 8) / 8);
1520 u32 size
= s_pitch
* cursor
->image
.height
;
1521 u8
*dat
= (u8
*) cursor
->image
.data
;
1522 u8
*msk
= (u8
*) cursor
->mask
;
1526 if (cursor
->image
.depth
!= 1)
1529 switch (cursor
->rop
) {
1531 for (i
= 0; i
< size
; i
++)
1532 src
[i
] = dat
[i
] ^ msk
[i
];
1536 for (i
= 0; i
< size
; i
++)
1537 src
[i
] = dat
[i
] & msk
[i
];
1541 /* save the bitmap to restore it when XFree will
1542 make the cursor dirty */
1543 memcpy(dinfo
->cursor_src
, src
, size
);
1545 intelfbhw_cursor_load(dinfo
, cursor
->image
.width
,
1546 cursor
->image
.height
, src
);
1550 intelfbhw_cursor_show(dinfo
);
1556 intelfb_sync(struct fb_info
*info
)
1558 struct intelfb_info
*dinfo
= GET_DINFO(info
);
1561 DBG_MSG("intelfb_sync\n");
1564 if (dinfo
->ring_lockup
)
1567 intelfbhw_do_sync(dinfo
);