1
0

sisfb.h 8.1 KB

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