Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
4.9 KiB

  1. /**************************************************************************
  2. ***************************************************************************
  3. *
  4. * Copyright (c) 1996, Cirrus Logic, Inc.
  5. * All Rights Reserved
  6. *
  7. * FILE: ddinline.h
  8. *
  9. * DESCRIPTION: Private declarations for DDraw blt code
  10. *
  11. * REVISION HISTORY:
  12. *
  13. * $Log: X:/log/laguna/ddraw/inc/ddinline.h $
  14. *
  15. * Rev 1.5 Feb 16 1998 16:33:02 frido
  16. * The previous fix should only happen for Windows 95.
  17. *
  18. * Rev 1.4 08 Jan 1998 12:38:12 eleland
  19. * Added a SyncWithQueueManager call in CurrentVLine. This fixes
  20. * a PCI bus hang (PDR 10917).
  21. *
  22. * Rev 1.3 06 Jan 1998 14:20:42 xcong
  23. * Access pDriverData locally for multi-monitor support.
  24. *
  25. * Rev 1.2 29 Aug 1997 17:46:34 RUSSL
  26. * Needed a couple more defines for previous change
  27. *
  28. * Rev 1.1 29 Aug 1997 17:40:02 RUSSL
  29. * Added CurrentVLine for 65 NT overlay
  30. *
  31. * Rev 1.0 20 Jan 1997 14:42:42 bennyn
  32. * Initial revision.
  33. *
  34. ***************************************************************************
  35. ***************************************************************************/
  36. // If WinNT 3.5 skip all the source code
  37. #if defined WINNT_VER35 // WINNT_VER35
  38. #else
  39. #ifndef _DDINLINE_H_
  40. #define _DDINLINE_H_
  41. /***************************************************************************
  42. * I N L I N E F U N C T I O N S
  43. ****************************************************************************/
  44. /***************************************************************************
  45. *
  46. * FUNCTION: DupColor()
  47. *
  48. * DESCRIPTION:
  49. *
  50. ****************************************************************************/
  51. static __inline DWORD DupColor
  52. (
  53. #ifdef WINNT_VER40
  54. struct _PDEV *ppdev,
  55. //?? struct _DRIVERDATA *lpDDHALData,
  56. #else
  57. LPGLOBALDATA lpDDHALData,
  58. #endif
  59. DWORD dwColor
  60. )
  61. {
  62. return (8 == BITSPERPIXEL) ?
  63. MAKELONG( MAKEWORD(dwColor,dwColor), MAKEWORD(dwColor,dwColor) )
  64. : (16 == BITSPERPIXEL) ?
  65. MAKELONG( dwColor, dwColor ) : // bpp must be 24 or 32.
  66. dwColor;
  67. }
  68. /***************************************************************************
  69. *
  70. * FUNCTION: EnoughFifoForBlt()
  71. *
  72. * DESCRIPTION:
  73. *
  74. ****************************************************************************/
  75. /*
  76. * EnoughFifoForBlt should be replaced with a test to see if there is enough
  77. * room in the hardware fifo for a blt
  78. */
  79. static __inline BOOL EnoughFifoForBlt
  80. (
  81. #ifdef WINNT_VER40
  82. struct _DRIVERDATA *lpDDHALData
  83. #else
  84. LPGLOBALDATA lpDDHALData
  85. #endif
  86. )
  87. {
  88. // This should probably be a little more specific to each call !!!
  89. // A (untiled) stretch blt actually needs 17 free entries.
  90. const BYTE QFREE = 16;
  91. PVGAR pREG = (PVGAR) lpDDHALData->RegsAddress;
  92. return (pREG->grQFREE >= QFREE);
  93. }
  94. /***************************************************************************
  95. *
  96. * FUNCTION: DupZFill
  97. *
  98. * DESCRIPTION: Gets the actual value for Z fills
  99. *
  100. ****************************************************************************/
  101. //JGO added for Laguna3D integration
  102. static __inline DWORD DupZFill
  103. (
  104. #ifdef WINNT_VER40
  105. struct _PDEV *ppdev,
  106. #else
  107. LPGLOBALDATA lpDDHALData,
  108. #endif
  109. DWORD dwFillValue,
  110. DWORD zBpp
  111. )
  112. {
  113. return (8 == zBpp) ?
  114. MAKELONG( MAKEWORD(dwFillValue,dwFillValue),
  115. MAKEWORD(dwFillValue,dwFillValue) )
  116. : (16 == BITSPERPIXEL) ?
  117. MAKELONG( dwFillValue, dwFillValue )
  118. : // bpp must be 24 or 32.
  119. dwFillValue;
  120. }
  121. #ifdef WINNT_VER40
  122. #if DRIVER_5465 && defined(OVERLAY)
  123. #define CSL 0x00C4
  124. #define CSL_5464 0x0140
  125. /***************************************************************************
  126. *
  127. * FUNCTION: CurrentVLine
  128. *
  129. * DESCRIPTION:
  130. *
  131. ****************************************************************************/
  132. static __inline int CurrentVLine (PDEV* ppdev)
  133. {
  134. WORD cline;
  135. PBYTE pMMReg = (PBYTE) ppdev->pLgREGS_real;
  136. PWORD pCSL;
  137. BYTE tmpb;
  138. #ifndef WINNT_VER40
  139. SyncWithQueueManager(lpDDHALData);
  140. #endif
  141. // on 5462 there is no CurrentScanLine register
  142. // on RevAA of 5465 it's busted
  143. if ((CL_GD5462 == ppdev->dwLgDevID) ||
  144. ((CL_GD5465 == ppdev->dwLgDevID) && (0 == ppdev->dwLgDevRev)))
  145. return 0;
  146. if (IN_VBLANK)
  147. return 0;
  148. // read current scanline
  149. if (ppdev->dwLgDevID == CL_GD5464)
  150. pCSL = (PWORD) (pMMReg + CSL_5464);
  151. else
  152. pCSL = (PWORD) (pMMReg + CSL);
  153. cline = *pCSL & 0x0FFF;
  154. // if scanline doubling is enabled, divide current scanline by 2
  155. tmpb = (BYTE) LLDR_SZ (grCR9);
  156. if (0x80 & tmpb)
  157. cline /= 2;
  158. // if current scanline is past end of visible screen return 0
  159. if (cline >= ppdev->cyScreen)
  160. return 0;
  161. else
  162. return cline;
  163. }
  164. #endif // DRIVER_5465 && OVERLAY
  165. #endif // WINNT_VER40
  166. #endif /* _DDINLINE_H_ */
  167. #endif // WINNT_VER35
  168. /* Don't write below this endif */