i810_main.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. #ifndef __I810_MAIN_H__
  14. #define __I810_MAIN_H__
  15. static int __devinit i810fb_init_pci (struct pci_dev *dev,
  16. const struct pci_device_id *entry);
  17. static void __exit i810fb_remove_pci(struct pci_dev *dev);
  18. static int i810fb_resume(struct pci_dev *dev);
  19. static int i810fb_suspend(struct pci_dev *dev, pm_message_t state);
  20. /*
  21. * voffset - framebuffer offset in MiB from aperture start address. In order for
  22. * the driver to work with X, we must try to use memory holes left untouched by X. The
  23. * following table lists where X's different surfaces start at.
  24. *
  25. * ---------------------------------------------
  26. * : : 64 MiB : 32 MiB :
  27. * ----------------------------------------------
  28. * : FrontBuffer : 0 : 0 :
  29. * : DepthBuffer : 48 : 16 :
  30. * : BackBuffer : 56 : 24 :
  31. * ----------------------------------------------
  32. *
  33. * So for chipsets with 64 MiB Aperture sizes, 32 MiB for v_offset is okay, allowing up to
  34. * 15 + 1 MiB of Framebuffer memory. For 32 MiB Aperture sizes, a v_offset of 8 MiB should
  35. * work, allowing 7 + 1 MiB of Framebuffer memory.
  36. * Note, the size of the hole may change depending on how much memory you allocate to X,
  37. * and how the memory is split up between these surfaces.
  38. *
  39. * Note: Anytime the DepthBuffer or FrontBuffer is overlapped, X would still run but with
  40. * DRI disabled. But if the Frontbuffer is overlapped, X will fail to load.
  41. *
  42. * Experiment with v_offset to find out which works best for you.
  43. */
  44. static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */
  45. static u32 voffset __initdata = 0;
  46. static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor);
  47. /* Chipset Specific Functions */
  48. static int i810fb_set_par (struct fb_info *info);
  49. static int i810fb_getcolreg (u8 regno, u8 *red, u8 *green, u8 *blue,
  50. u8 *transp, struct fb_info *info);
  51. static int i810fb_setcolreg (unsigned regno, unsigned red, unsigned green, unsigned blue,
  52. unsigned transp, struct fb_info *info);
  53. static int i810fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info);
  54. static int i810fb_blank (int blank_mode, struct fb_info *info);
  55. /* Initialization */
  56. static void i810fb_release_resource (struct fb_info *info, struct i810fb_par *par);
  57. extern int __init agp_intel_init(void);
  58. /* Video Timings */
  59. extern void round_off_xres (u32 *xres);
  60. extern void round_off_yres (u32 *xres, u32 *yres);
  61. extern u32 i810_get_watermark (const struct fb_var_screeninfo *var,
  62. struct i810fb_par *par);
  63. extern void i810fb_encode_registers(const struct fb_var_screeninfo *var,
  64. struct i810fb_par *par, u32 xres, u32 yres);
  65. extern void i810fb_fill_var_timings(struct fb_var_screeninfo *var);
  66. /* Accelerated Functions */
  67. extern void i810fb_fillrect (struct fb_info *p,
  68. const struct fb_fillrect *rect);
  69. extern void i810fb_copyarea (struct fb_info *p,
  70. const struct fb_copyarea *region);
  71. extern void i810fb_imageblit(struct fb_info *p, const struct fb_image *image);
  72. extern int i810fb_sync (struct fb_info *p);
  73. extern void i810fb_init_ringbuffer(struct fb_info *info);
  74. extern void i810fb_load_front (u32 offset, struct fb_info *info);
  75. /* Conditionals */
  76. #ifdef CONFIG_X86
  77. inline void flush_cache(void)
  78. {
  79. asm volatile ("wbinvd":::"memory");
  80. }
  81. #else
  82. #define flush_cache() do { } while(0)
  83. #endif
  84. #ifdef CONFIG_MTRR
  85. #define KERNEL_HAS_MTRR 1
  86. static inline void __devinit set_mtrr(struct i810fb_par *par)
  87. {
  88. par->mtrr_reg = mtrr_add((u32) par->aperture.physical,
  89. par->aperture.size, MTRR_TYPE_WRCOMB, 1);
  90. if (par->mtrr_reg < 0) {
  91. printk(KERN_ERR "set_mtrr: unable to set MTRR\n");
  92. return;
  93. }
  94. par->dev_flags |= HAS_MTRR;
  95. }
  96. static inline void unset_mtrr(struct i810fb_par *par)
  97. {
  98. if (par->dev_flags & HAS_MTRR)
  99. mtrr_del(par->mtrr_reg, (u32) par->aperture.physical,
  100. par->aperture.size);
  101. }
  102. #else
  103. #define KERNEL_HAS_MTRR 0
  104. #define set_mtrr(x) printk("set_mtrr: MTRR is disabled in the kernel\n")
  105. #define unset_mtrr(x) do { } while (0)
  106. #endif /* CONFIG_MTRR */
  107. #ifdef CONFIG_FB_I810_GTF
  108. #define IS_DVT (0)
  109. #else
  110. #define IS_DVT (1)
  111. #endif
  112. #endif /* __I810_MAIN_H__ */