Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /*-*- linux-c -*- |
| 2 | * linux/drivers/video/i810fb_main.h -- Intel 810 frame buffer device |
| 3 | * main header file |
| 4 | * |
| 5 | * Copyright (C) 2001 Antonino Daplas<adaplas@pol.net> |
| 6 | * All Rights Reserved |
| 7 | * |
| 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 | #ifndef __I810_MAIN_H__ |
| 15 | #define __I810_MAIN_H__ |
| 16 | |
| 17 | static int __devinit i810fb_init_pci (struct pci_dev *dev, |
| 18 | const struct pci_device_id *entry); |
| 19 | static void __exit i810fb_remove_pci(struct pci_dev *dev); |
| 20 | static int i810fb_resume(struct pci_dev *dev); |
| 21 | static int i810fb_suspend(struct pci_dev *dev, pm_message_t state); |
| 22 | |
| 23 | /* |
| 24 | * voffset - framebuffer offset in MiB from aperture start address. In order for |
| 25 | * the driver to work with X, we must try to use memory holes left untouched by X. The |
| 26 | * following table lists where X's different surfaces start at. |
| 27 | * |
| 28 | * --------------------------------------------- |
| 29 | * : : 64 MiB : 32 MiB : |
| 30 | * ---------------------------------------------- |
| 31 | * : FrontBuffer : 0 : 0 : |
| 32 | * : DepthBuffer : 48 : 16 : |
| 33 | * : BackBuffer : 56 : 24 : |
| 34 | * ---------------------------------------------- |
| 35 | * |
| 36 | * So for chipsets with 64 MiB Aperture sizes, 32 MiB for v_offset is okay, allowing up to |
| 37 | * 15 + 1 MiB of Framebuffer memory. For 32 MiB Aperture sizes, a v_offset of 8 MiB should |
| 38 | * work, allowing 7 + 1 MiB of Framebuffer memory. |
| 39 | * Note, the size of the hole may change depending on how much memory you allocate to X, |
| 40 | * and how the memory is split up between these surfaces. |
| 41 | * |
| 42 | * Note: Anytime the DepthBuffer or FrontBuffer is overlapped, X would still run but with |
| 43 | * DRI disabled. But if the Frontbuffer is overlapped, X will fail to load. |
| 44 | * |
| 45 | * Experiment with v_offset to find out which works best for you. |
| 46 | */ |
| 47 | static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */ |
| 48 | static u32 voffset __initdata = 0; |
| 49 | |
| 50 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor); |
| 51 | |
| 52 | /* Chipset Specific Functions */ |
| 53 | static int i810fb_set_par (struct fb_info *info); |
| 54 | static int i810fb_getcolreg (u8 regno, u8 *red, u8 *green, u8 *blue, |
| 55 | u8 *transp, struct fb_info *info); |
| 56 | static int i810fb_setcolreg (unsigned regno, unsigned red, unsigned green, unsigned blue, |
| 57 | unsigned transp, struct fb_info *info); |
| 58 | static int i810fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); |
| 59 | static int i810fb_blank (int blank_mode, struct fb_info *info); |
| 60 | |
| 61 | /* Initialization */ |
| 62 | static void i810fb_release_resource (struct fb_info *info, struct i810fb_par *par); |
| 63 | extern int __init agp_intel_init(void); |
| 64 | |
| 65 | |
| 66 | /* Video Timings */ |
| 67 | extern void round_off_xres (u32 *xres); |
| 68 | extern void round_off_yres (u32 *xres, u32 *yres); |
| 69 | extern u32 i810_get_watermark (const struct fb_var_screeninfo *var, |
| 70 | struct i810fb_par *par); |
| 71 | extern void i810fb_encode_registers(const struct fb_var_screeninfo *var, |
| 72 | struct i810fb_par *par, u32 xres, u32 yres); |
| 73 | extern void i810fb_fill_var_timings(struct fb_var_screeninfo *var); |
| 74 | |
| 75 | /* Accelerated Functions */ |
| 76 | extern void i810fb_fillrect (struct fb_info *p, |
| 77 | const struct fb_fillrect *rect); |
| 78 | extern void i810fb_copyarea (struct fb_info *p, |
| 79 | const struct fb_copyarea *region); |
| 80 | extern void i810fb_imageblit(struct fb_info *p, const struct fb_image *image); |
| 81 | extern int i810fb_sync (struct fb_info *p); |
| 82 | |
| 83 | extern void i810fb_init_ringbuffer(struct fb_info *info); |
| 84 | extern void i810fb_load_front (u32 offset, struct fb_info *info); |
| 85 | |
Antonino A. Daplas | 74f6ae8 | 2005-09-09 13:10:04 -0700 | [diff] [blame^] | 86 | #ifdef CONFIG_FB_I810_I2C |
| 87 | /* I2C */ |
| 88 | extern int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid, |
| 89 | int conn); |
| 90 | extern void i810_create_i2c_busses(struct i810fb_par *par); |
| 91 | extern void i810_delete_i2c_busses(struct i810fb_par *par); |
| 92 | #else |
| 93 | static inline int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid, |
| 94 | int conn) |
| 95 | { |
| 96 | return 1; |
| 97 | } |
| 98 | static inline void i810_create_i2c_busses(struct i810fb_par *par) { } |
| 99 | static inline void i810_delete_i2c_busses(struct i810fb_par *par) { } |
| 100 | #endif |
| 101 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | /* Conditionals */ |
| 103 | #ifdef CONFIG_X86 |
| 104 | inline void flush_cache(void) |
| 105 | { |
| 106 | asm volatile ("wbinvd":::"memory"); |
| 107 | } |
| 108 | #else |
| 109 | #define flush_cache() do { } while(0) |
| 110 | #endif |
| 111 | |
| 112 | #ifdef CONFIG_MTRR |
| 113 | #define KERNEL_HAS_MTRR 1 |
| 114 | static inline void __devinit set_mtrr(struct i810fb_par *par) |
| 115 | { |
| 116 | par->mtrr_reg = mtrr_add((u32) par->aperture.physical, |
| 117 | par->aperture.size, MTRR_TYPE_WRCOMB, 1); |
| 118 | if (par->mtrr_reg < 0) { |
| 119 | printk(KERN_ERR "set_mtrr: unable to set MTRR\n"); |
| 120 | return; |
| 121 | } |
| 122 | par->dev_flags |= HAS_MTRR; |
| 123 | } |
| 124 | static inline void unset_mtrr(struct i810fb_par *par) |
| 125 | { |
| 126 | if (par->dev_flags & HAS_MTRR) |
| 127 | mtrr_del(par->mtrr_reg, (u32) par->aperture.physical, |
| 128 | par->aperture.size); |
| 129 | } |
| 130 | #else |
| 131 | #define KERNEL_HAS_MTRR 0 |
| 132 | #define set_mtrr(x) printk("set_mtrr: MTRR is disabled in the kernel\n") |
| 133 | |
| 134 | #define unset_mtrr(x) do { } while (0) |
| 135 | #endif /* CONFIG_MTRR */ |
| 136 | |
| 137 | #ifdef CONFIG_FB_I810_GTF |
| 138 | #define IS_DVT (0) |
| 139 | #else |
| 140 | #define IS_DVT (1) |
| 141 | #endif |
| 142 | |
| 143 | #endif /* __I810_MAIN_H__ */ |