sisfb.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * sisfb.h - definitions for the SiS framebuffer driver
  3. *
  4. * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the named License,
  9. * or any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
  19. */
  20. #ifndef _UAPI_LINUX_SISFB_H_
  21. #define _UAPI_LINUX_SISFB_H_
  22. #include <linux/types.h>
  23. #include <asm/ioctl.h>
  24. /**********************************************/
  25. /* PUBLIC */
  26. /**********************************************/
  27. /* vbflags, public (others in sis.h) */
  28. #define CRT2_DEFAULT 0x00000001
  29. #define CRT2_LCD 0x00000002
  30. #define CRT2_TV 0x00000004
  31. #define CRT2_VGA 0x00000008
  32. #define TV_NTSC 0x00000010
  33. #define TV_PAL 0x00000020
  34. #define TV_HIVISION 0x00000040
  35. #define TV_YPBPR 0x00000080
  36. #define TV_AVIDEO 0x00000100
  37. #define TV_SVIDEO 0x00000200
  38. #define TV_SCART 0x00000400
  39. #define TV_PALM 0x00001000
  40. #define TV_PALN 0x00002000
  41. #define TV_NTSCJ 0x00001000
  42. #define TV_CHSCART 0x00008000
  43. #define TV_CHYPBPR525I 0x00010000
  44. #define CRT1_VGA 0x00000000
  45. #define CRT1_LCDA 0x00020000
  46. #define VGA2_CONNECTED 0x00040000
  47. #define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */
  48. #define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */
  49. #define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */
  50. #define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */
  51. /* Aliases: */
  52. #define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA)
  53. #define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ)
  54. #define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I)
  55. /* Only if TV_YPBPR is set: */
  56. #define TV_YPBPR525I TV_NTSC
  57. #define TV_YPBPR525P TV_PAL
  58. #define TV_YPBPR750P TV_PALM
  59. #define TV_YPBPR1080I TV_PALN
  60. #define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I)
  61. #define VB_DISPTYPE_DISP2 CRT2_ENABLE
  62. #define VB_DISPTYPE_CRT2 CRT2_ENABLE
  63. #define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT1
  64. #define VB_DISPMODE_SINGLE VB_SINGLE_MODE
  65. #define VB_DISPMODE_MIRROR VB_MIRROR_MODE
  66. #define VB_DISPMODE_DUAL VB_DUALVIEW_MODE
  67. #define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE)
  68. /* Structure argument for SISFB_GET_INFO ioctl */
  69. struct sisfb_info {
  70. __u32 sisfb_id; /* for identifying sisfb */
  71. #ifndef SISFB_ID
  72. #define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */
  73. #endif
  74. __u32 chip_id; /* PCI-ID of detected chip */
  75. __u32 memory; /* total video memory in KB */
  76. __u32 heapstart; /* heap start offset in KB */
  77. __u8 fbvidmode; /* current sisfb mode */
  78. __u8 sisfb_version;
  79. __u8 sisfb_revision;
  80. __u8 sisfb_patchlevel;
  81. __u8 sisfb_caps; /* sisfb capabilities */
  82. __u32 sisfb_tqlen; /* turbo queue length (in KB) */
  83. __u32 sisfb_pcibus; /* The card's PCI ID */
  84. __u32 sisfb_pcislot;
  85. __u32 sisfb_pcifunc;
  86. __u8 sisfb_lcdpdc; /* PanelDelayCompensation */
  87. __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */
  88. __u32 sisfb_vbflags;
  89. __u32 sisfb_currentvbflags;
  90. __u32 sisfb_scalelcd;
  91. __u32 sisfb_specialtiming;
  92. __u8 sisfb_haveemi;
  93. __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33;
  94. __u8 sisfb_haveemilcd;
  95. __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */
  96. __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */
  97. __u32 sisfb_heapsize; /* heap size (in KB) */
  98. __u32 sisfb_videooffset; /* Offset of viewport in video memory (in bytes) */
  99. __u32 sisfb_curfstn; /* currently running FSTN/DSTN mode */
  100. __u32 sisfb_curdstn;
  101. __u16 sisfb_pci_vendor; /* PCI vendor (SiS or XGI) */
  102. __u32 sisfb_vbflags2; /* ivideo->vbflags2 */
  103. __u8 sisfb_can_post; /* sisfb can POST this card */
  104. __u8 sisfb_card_posted; /* card is POSTED */
  105. __u8 sisfb_was_boot_device; /* This card was the boot video device (ie is primary) */
  106. __u8 reserved[183]; /* for future use */
  107. };
  108. #define SISFB_CMD_GETVBFLAGS 0x55AA0001 /* no arg; result[1] = vbflags */
  109. #define SISFB_CMD_SWITCHCRT1 0x55AA0010 /* arg[0]: 99 = query, 0 = off, 1 = on */
  110. /* more to come */
  111. #define SISFB_CMD_ERR_OK 0x80000000 /* command succeeded */
  112. #define SISFB_CMD_ERR_LOCKED 0x80000001 /* sisfb is locked */
  113. #define SISFB_CMD_ERR_EARLY 0x80000002 /* request before sisfb took over gfx system */
  114. #define SISFB_CMD_ERR_NOVB 0x80000003 /* No video bridge */
  115. #define SISFB_CMD_ERR_NOCRT2 0x80000004 /* can't change CRT1 status, CRT2 disabled */
  116. /* more to come */
  117. #define SISFB_CMD_ERR_UNKNOWN 0x8000ffff /* Unknown command */
  118. #define SISFB_CMD_ERR_OTHER 0x80010000 /* Other error */
  119. /* Argument for SISFB_CMD ioctl */
  120. struct sisfb_cmd {
  121. __u32 sisfb_cmd;
  122. __u32 sisfb_arg[16];
  123. __u32 sisfb_result[4];
  124. };
  125. /* Additional IOCTLs for communication sisfb <> X driver */
  126. /* If changing this, vgatypes.h must also be changed (for X driver) */
  127. /* ioctl for identifying and giving some info (esp. memory heap start) */
  128. #define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32)
  129. #define SISFB_GET_INFO _IOR(0xF3,0x01,struct sisfb_info)
  130. /* ioctrl to get current vertical retrace status */
  131. #define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32)
  132. /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */
  133. #define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32)
  134. #define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32)
  135. /* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/
  136. #define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32)
  137. #define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32)
  138. /* ioctl for internal sisfb commands (sisfbctrl) */
  139. #define SISFB_COMMAND _IOWR(0xF3,0x05,struct sisfb_cmd)
  140. /* ioctl for locking sisfb (no register access during lock) */
  141. /* As of now, only used to avoid register access during
  142. * the ioctls listed above.
  143. */
  144. #define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32)
  145. /* ioctls 0xF3 up to 0x3F reserved for sisfb */
  146. /****************************************************************/
  147. /* The following are deprecated and should not be used anymore: */
  148. /****************************************************************/
  149. /* ioctl for identifying and giving some info (esp. memory heap start) */
  150. #define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32)
  151. /* ioctrl to get current vertical retrace status */
  152. #define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32)
  153. /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */
  154. #define SISFB_GET_AUTOMAXIMIZE_OLD _IOR('n',0xFA,__u32)
  155. #define SISFB_SET_AUTOMAXIMIZE_OLD _IOW('n',0xFA,__u32)
  156. /****************************************************************/
  157. /* End of deprecated ioctl numbers */
  158. /****************************************************************/
  159. /* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */
  160. struct sis_memreq {
  161. __u32 offset;
  162. __u32 size;
  163. };
  164. /**********************************************/
  165. /* PRIVATE */
  166. /* (for IN-KERNEL usage only) */
  167. /**********************************************/
  168. #endif /* _UAPI_LINUX_SISFB_H_ */