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.

2446 lines
124 KiB

  1. /******************************Module*Header**********************************\
  2. *
  3. * *******************
  4. * * GDI SAMPLE CODE *
  5. * *******************
  6. *
  7. * Module Name: pxrx.c
  8. *
  9. * Content: Permedia3 code.
  10. *
  11. * Copyright (c) 1994-1999 3Dlabs Inc. Ltd. All rights reserved.
  12. * Copyright (c) 1995-2003 Microsoft Corporation. All rights reserved.
  13. \*****************************************************************************/
  14. #include "precomp.h"
  15. #include "glint.h"
  16. #include "pxrx.h"
  17. #if DBG
  18. ULONG inPxRxContextSwitch = FALSE;
  19. #endif
  20. #define TEST_MINIMUM_FIFO_SPACE(min, str) do { ; } while(0)
  21. extern GAPFNstripFunc gapfnStripPXRX[];
  22. // table to determine which logicops use a source colour/pixel
  23. const DWORD LogicOpReadSrc[] = {
  24. 0, /* 00 */
  25. 1, /* 01 */
  26. 1, /* 02 */
  27. 1, /* 03 */
  28. 1, /* 04 */
  29. 0, /* 05 */
  30. 1, /* 06 */
  31. 1, /* 07 */
  32. 1, /* 08 */
  33. 1, /* 09 */
  34. 0, /* 10 */
  35. 1, /* 11 */
  36. 1, /* 12 */
  37. 1, /* 13 */
  38. 1, /* 14 */
  39. 0, /* 15 */
  40. };
  41. const ULONG render2D_NativeBlt[16] = {
  42. /* 0: 0 clear */ __RENDER2D_SPANS,
  43. /* 1: S & D AND */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  44. /* 2: S & ~D AND reverse */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  45. /* 3: S COPY */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  46. /* 4: ~S & D AND inverted */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  47. /* 5: D no op */ __RENDER2D_SPANS,
  48. /* 6: S ^ D XOR */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  49. /* 7: S | D OR */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  50. /* 8: ~(S | D) NOR */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  51. /* 9: ~(S ^ D) equiv */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  52. /* 10: ~D invert */ __RENDER2D_SPANS,
  53. /* 11: S | ~D OR reverse */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  54. /* 12: ~S copy invert */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  55. /* 13: ~S | D OR invert */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  56. /* 14: ~(S & D) NAND */ __RENDER2D_SPANS | __RENDER2D_FBSRCREAD,
  57. /* 15: 1 set */ __RENDER2D_SPANS,
  58. };
  59. const ULONG render2D_FillSolid[16] = {
  60. /* 0: 0 clear */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  61. /* 1: S & D AND */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  62. /* 2: S & ~D AND reverse */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  63. /* 3: S COPY */ __RENDER2D_INCX | __RENDER2D_INCY,
  64. /* 4: ~S & D AND inverted */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  65. /* 5: D no op */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  66. /* 6: S ^ D XOR */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  67. /* 7: S | D OR */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  68. /* 8: ~(S | D) NOR */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  69. /* 9: ~(S ^ D) equiv */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  70. /* 10: ~D invert */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  71. /* 11: S | ~D OR reverse */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  72. /* 12: ~S copy invert */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  73. /* 13: ~S | D OR invert */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  74. /* 14: ~(S & D) NAND */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  75. /* 15: 1 set */ __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS,
  76. };
  77. const ULONG config2D_FillColour[16] = {
  78. /* 0: 0 clear */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 0),
  79. /* 1: S & D AND */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 1) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  80. /* 2: S & ~D AND reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 2) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  81. /* 3: S COPY */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  82. /* 4: ~S & D AND inverted */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 4) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  83. /* 5: D no op */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 5) | __CONFIG2D_FBDESTREAD,
  84. /* 6: S ^ D XOR */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 6) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  85. /* 7: S | D OR */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 7) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  86. /* 8: ~(S | D) NOR */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 8) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  87. /* 9: ~(S ^ D) equiv */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 9) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  88. /* 10: ~D invert */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(10) | __CONFIG2D_FBDESTREAD,
  89. /* 11: S | ~D OR reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(11) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  90. /* 12: ~S copy invert */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(12) | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  91. /* 13: ~S | D OR invert */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(13) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  92. /* 14: ~(S & D) NAND */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(14) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  93. /* 15: 1 set */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(15),
  94. };
  95. const ULONG config2D_FillColour32bpp[16] = {
  96. /* 0: 0 clear */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 0),
  97. /* 1: S & D AND */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 1) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  98. /* 2: S & ~D AND reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 2) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  99. /* 3: S COPY */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_USERSCISSOR | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  100. /* 4: ~S & D AND inverted */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 4) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  101. /* 5: D no op */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 5) | __CONFIG2D_FBDESTREAD,
  102. /* 6: S ^ D XOR */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 6) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  103. /* 7: S | D OR */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 7) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  104. /* 8: ~(S | D) NOR */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 8) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  105. /* 9: ~(S ^ D) equiv */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 9) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  106. /* 10: ~D invert */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(10) | __CONFIG2D_FBDESTREAD,
  107. /* 11: S | ~D OR reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(11) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  108. /* 12: ~S copy invert */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(12) | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  109. /* 13: ~S | D OR invert */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(13) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  110. /* 14: ~(S & D) NAND */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(14) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  111. /* 15: 1 set */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(15),
  112. };
  113. const ULONG config2D_FillColourDual[16] = {
  114. /* 0: 0 clear */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 0),
  115. /* 1: S & D AND */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 1) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  116. /* 2: S & ~D AND reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 2) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  117. /* 3: S COPY */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 3) | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  118. /* 4: ~S & D AND inverted */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 4) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  119. /* 5: D no op */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 5) | __CONFIG2D_FBDESTREAD,
  120. /* 6: S ^ D XOR */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 6) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  121. /* 7: S | D OR */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 7) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  122. /* 8: ~(S | D) NOR */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 8) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  123. /* 9: ~(S ^ D) equiv */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE( 9) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  124. /* 10: ~D invert */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(10) | __CONFIG2D_FBDESTREAD,
  125. /* 11: S | ~D OR reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(11) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  126. /* 12: ~S copy invert */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(12) | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  127. /* 13: ~S | D OR invert */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(13) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  128. /* 14: ~(S & D) NAND */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(14) | __CONFIG2D_FBDESTREAD | __CONFIG2D_EXTERNALSRC | __CONFIG2D_LUTENABLE,
  129. /* 15: 1 set */ __CONFIG2D_FBWRITE | __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(15),
  130. };
  131. const ULONG config2D_FillSolid[16] = {
  132. /* 0: 0 clear */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 0),
  133. /* 1: S & D AND */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 1) | __CONFIG2D_FBDESTREAD,
  134. /* 2: S & ~D AND reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 2) | __CONFIG2D_FBDESTREAD,
  135. /* 3: S COPY */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC,
  136. /* 4: ~S & D AND inverted */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 4) | __CONFIG2D_FBDESTREAD,
  137. /* 5: D no op */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 5) | __CONFIG2D_FBDESTREAD,
  138. /* 6: S ^ D XOR */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 6) | __CONFIG2D_FBDESTREAD,
  139. /* 7: S | D OR */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 7) | __CONFIG2D_FBDESTREAD,
  140. /* 8: ~(S | D) NOR */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 8) | __CONFIG2D_FBDESTREAD,
  141. /* 9: ~(S ^ D) equiv */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 9) | __CONFIG2D_FBDESTREAD,
  142. /* 10: ~D invert */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(10) | __CONFIG2D_FBDESTREAD,
  143. /* 11: S | ~D OR reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(11) | __CONFIG2D_FBDESTREAD,
  144. /* 12: ~S copy invert */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(12),
  145. /* 13: ~S | D OR invert */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(13) | __CONFIG2D_FBDESTREAD,
  146. /* 14: ~(S & D) NAND */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(14) | __CONFIG2D_FBDESTREAD,
  147. /* 15: 1 set */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(15),
  148. };
  149. const ULONG config2D_FillSolidVariableSpans[16] = {
  150. /* 0: 0 clear */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 0),
  151. /* 1: S & D AND */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 1) | __CONFIG2D_FBDESTREAD,
  152. /* 2: S & ~D AND reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 2) | __CONFIG2D_FBDESTREAD,
  153. /* 3: S COPY */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 3),
  154. /* 4: ~S & D AND inverted */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 4) | __CONFIG2D_FBDESTREAD,
  155. /* 5: D no op */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 5) | __CONFIG2D_FBDESTREAD,
  156. /* 6: S ^ D XOR */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 6) | __CONFIG2D_FBDESTREAD,
  157. /* 7: S | D OR */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 7) | __CONFIG2D_FBDESTREAD,
  158. /* 8: ~(S | D) NOR */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 8) | __CONFIG2D_FBDESTREAD,
  159. /* 9: ~(S ^ D) equiv */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 9) | __CONFIG2D_FBDESTREAD,
  160. /* 10: ~D invert */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(10) | __CONFIG2D_FBDESTREAD,
  161. /* 11: S | ~D OR reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(11) | __CONFIG2D_FBDESTREAD,
  162. /* 12: ~S copy invert */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(12),
  163. /* 13: ~S | D OR invert */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(13) | __CONFIG2D_FBDESTREAD,
  164. /* 14: ~(S & D) NAND */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(14) | __CONFIG2D_FBDESTREAD,
  165. /* 15: 1 set */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(15),
  166. };
  167. const ULONG config2D_FillSolid32bpp[16] = {
  168. /* 0: 0 clear */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 0),
  169. /* 1: S & D AND */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 1) | __CONFIG2D_FBDESTREAD,
  170. /* 2: S & ~D AND reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 2) | __CONFIG2D_FBDESTREAD,
  171. /* 3: S COPY */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_USERSCISSOR,
  172. /* 4: ~S & D AND inverted */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 4) | __CONFIG2D_FBDESTREAD,
  173. /* 5: D no op */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 5) | __CONFIG2D_FBDESTREAD,
  174. /* 6: S ^ D XOR */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 6) | __CONFIG2D_FBDESTREAD,
  175. /* 7: S | D OR */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 7) | __CONFIG2D_FBDESTREAD,
  176. /* 8: ~(S | D) NOR */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 8) | __CONFIG2D_FBDESTREAD,
  177. /* 9: ~(S ^ D) equiv */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE( 9) | __CONFIG2D_FBDESTREAD,
  178. /* 10: ~D invert */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(10) | __CONFIG2D_FBDESTREAD,
  179. /* 11: S | ~D OR reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(11) | __CONFIG2D_FBDESTREAD,
  180. /* 12: ~S copy invert */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(12),
  181. /* 13: ~S | D OR invert */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(13) | __CONFIG2D_FBDESTREAD,
  182. /* 14: ~(S & D) NAND */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(14) | __CONFIG2D_FBDESTREAD,
  183. /* 15: 1 set */ __CONFIG2D_FBWRITE | __CONFIG2D_CONSTANTSRC | __CONFIG2D_LOGOP_FORE(15),
  184. };
  185. const ULONG config2D_NativeBlt[16] = {
  186. /* 0: 0 clear */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE( 0),
  187. /* 1: S & D AND */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE( 1) | __CONFIG2D_FBDESTREAD,
  188. /* 2: S & ~D AND reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE( 2) | __CONFIG2D_FBDESTREAD,
  189. /* 3: S COPY */ __CONFIG2D_FBWRITE,
  190. /* 4: ~S & D AND inverted */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE( 4) | __CONFIG2D_FBDESTREAD,
  191. /* 5: D no op */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE( 5) | __CONFIG2D_FBDESTREAD,
  192. /* 6: S ^ D XOR */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE( 6) | __CONFIG2D_FBDESTREAD,
  193. /* 7: S | D OR */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE( 7) | __CONFIG2D_FBDESTREAD,
  194. /* 8: ~(S | D) NOR */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE( 8) | __CONFIG2D_FBDESTREAD,
  195. /* 9: ~(S ^ D) equiv */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE( 9) | __CONFIG2D_FBDESTREAD,
  196. /* 10: ~D invert */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE(10) | __CONFIG2D_FBDESTREAD,
  197. /* 11: S | ~D OR reverse */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE(11) | __CONFIG2D_FBDESTREAD,
  198. /* 12: ~S copy invert */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE(12),
  199. /* 13: ~S | D OR invert */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE(13) | __CONFIG2D_FBDESTREAD,
  200. /* 14: ~(S & D) NAND */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE(14) | __CONFIG2D_FBDESTREAD,
  201. /* 15: 1 set */ __CONFIG2D_FBWRITE | __CONFIG2D_LOGOP_FORE(15),
  202. };
  203. typedef struct Tag_Data_TAG {
  204. ULONG tag;
  205. ULONG data;
  206. } Tag_Data;
  207. Tag_Data DefaultContext_P3[] = {
  208. { __GlintTagFilterMode, 0x00000000 }, // [0x180]
  209. // { __GlintTagAStart, 0x00000000 }, // [0x0F9]
  210. // { __GlintTagBStart, 0x00000000 }, // [0x0F6]
  211. // { __GlintTagFStart, 0x00000000 }, // [0x0D4]
  212. // { __GlintTagGStart, 0x00000000 }, // [0x0F3]
  213. { __GlintTagAlphaBlendAlphaMode, __PERMEDIA_DISABLE }, // [0x5F5]
  214. { __GlintTagAlphaBlendColorMode, __PERMEDIA_DISABLE }, // [0x5F4]
  215. { __GlintTagAlphaDestColor, 0xFFFFFFFF }, // [0x5F1]
  216. { __GlintTagAlphaSourceColor, 0xFFFFFFFF }, // [0x5F0]
  217. { __GlintTagAlphaTestMode, __PERMEDIA_DISABLE }, // [0x100]
  218. { __GlintTagAntialiasMode, __PERMEDIA_DISABLE }, // [0x101]
  219. { __GlintTagAreaStippleMode, __PERMEDIA_DISABLE }, // [0x034]
  220. { __GlintTagColor, 0xFFFFFFFF }, // [0x0FE]
  221. { __GlintTagColorDDAMode, __PERMEDIA_DISABLE }, // [0x0FC]
  222. { __GlintTagConstantColor, 0xFFFFFFFF }, // [0x0FD]
  223. // { __GlintTagBasePageOfWorkingSet, 0x00000000 }, // [0x699]
  224. { __GlintTagBitMaskPattern, 0xFFFFFFFF }, // [0x00D]
  225. // { __GlintTagBorderColor0, 0x00000000 }, // [0x095]
  226. // { __GlintTagBorderColor1, 0x00000000 }, // [0x09F]
  227. { __GlintTagChromaFailColor, 0x00000000 }, // [0x5F3]
  228. { __GlintTagChromaPassColor, 0xFFFFFFFF }, // [0x5F2]
  229. { __GlintTagChromaTestMode, __PERMEDIA_DISABLE }, // [0x1E3]
  230. { __PXRXTagChromaLower, 0x00000000 }, // [0x1E2]
  231. { __PXRXTagChromaUpper, 0xFFFFFFFF }, // [0x1E1]
  232. // { __GlintTagD3DAlphaTestMode, 0x00000000 }, // [0x5F8]
  233. { __DeltaTagDeltaMode, (1 << 19) }, // [0x260]
  234. // { __DeltaTagDeltaControl, (1 << 11) }, // [0x26A] // P3, R3 & P4 Only
  235. // { __GlintTagDeltaTexture01, 0x00000000 }, // [0x28B]
  236. // { __GlintTagDeltaTexture11, 0x00000000 }, // [0x28C]
  237. // { __GlintTagDeltaTexture21, 0x00000000 }, // [0x28D]
  238. // { __GlintTagDeltaTexture31, 0x00000000 }, // [0x28E]
  239. { __DeltaTagXBias, P3_LINES_BIAS_P }, // [0x290]
  240. { __DeltaTagYBias, P3_LINES_BIAS_P }, // [0x291]
  241. { __GlintTagDepth, 0x00000000 }, // [0x135]
  242. { __GlintTagDepthMode, __PERMEDIA_DISABLE }, // [0x134]
  243. { __GlintTagDitherMode, __PERMEDIA_DISABLE },// ??? 0x00000403, // [0x103]
  244. // { __GlintTagEndOfFeedback, 0x00000000 }, // [0x1FF]
  245. // { __GlintTagFBBlockColor, 0x00000000 }, // [0x159]
  246. // { __GlintTagFBBlockColor0, 0x00000000 }, // [0x60C]
  247. // { __GlintTagFBBlockColor1, 0x00000000 }, // [0x60D]
  248. // { __GlintTagFBBlockColor2, 0x00000000 }, // [0x60E]
  249. // { __GlintTagFBBlockColor3, 0x00000000 }, // [0x60F]
  250. // { __GlintTagFBBlockColorBack, 0x00000000 }, // [0x614]
  251. // { __GlintTagFBBlockColorBack0, 0x00000000 }, // [0x610]
  252. // { __GlintTagFBBlockColorBack1, 0x00000000 }, // [0x611]
  253. // { __GlintTagFBBlockColorBack2, 0x00000000 }, // [0x612]
  254. // { __GlintTagFBBlockColorBack3, 0x00000000 }, // [0x613]
  255. // { __GlintTagFBBlockColorBackExt, 0x00000000 }, // [0x61D]
  256. // { __GlintTagFBBlockColorBackL, 0x00000000 }, // [0x18C]
  257. // { __GlintTagFBBlockColorBackU, 0x00000000 }, // [0x18B]
  258. // { __GlintTagFBBlockColorExt, 0x00000000 }, // [0x61C]
  259. // { __GlintTagFBBlockColorL, 0x00000000 }, // [0x18E]
  260. // { __GlintTagFBBlockColorU, 0x00000000 }, // [0x18D]
  261. // { __GlintTagFBColor, 0x00000000 }, // [0x153]
  262. // { __GlintTagFBData, 0x00000000 }, // [0x154]
  263. // { __GlintTagFBDestReadEnables, 0x00000000 }, // [0x5DD]
  264. { __GlintTagFBSoftwareWriteMask, 0xFFFFFFFF }, // [0x104]
  265. { __GlintTagFBSourceData, 0x00000000 }, // [0x155]
  266. // { __GlintTagFBWriteMaskExt, 0x00000000 }, // [0x61E]
  267. // { __GlintTagFastBlockLimits, 0x00000000 }, // [0x026]
  268. // { __GlintTagFastClearDepth, 0x00000000 }, // [0x13C]
  269. // { __GlintTagFeedbackX, 0x00000000 }, // [0x1F1]
  270. // { __GlintTagFeedbackY, 0x00000000 }, // [0x1F2]
  271. // { __GlintTagFlushSpan, 0x00000000 }, // [0x00C]
  272. { __GlintTagFogColor, 0xFFFFFFFF }, // [0x0D3]
  273. { __GlintTagFogMode, 0x00000001 }, // [0x0D2]
  274. { __GlintTagGIDMode, __PERMEDIA_DISABLE }, // [0x6A7]
  275. // { __GlintTagGlyphData, 0x00000000 }, // [0x6CC]
  276. // { __GlintTagGlyphPosition, 0x00000000 }, // [0x6C1]
  277. // { __GlintTagHeadPhysicalPageAllocation0, 0x00000000 }, // [0x690]
  278. // { __GlintTagHeadPhysicalPageAllocation1, 0x00000000 }, // [0x691]
  279. // { __GlintTagHeadPhysicalPageAllocation2, 0x00000000 }, // [0x692]
  280. // { __GlintTagHeadPhysicalPageAllocation3, 0x00000000 }, // [0x693]
  281. // { __GlintTagInvalidateCache, 0x00000000 }, // [0x66B]
  282. // { __GlintTagKdBStart, 0x00000000 }, // [0x1A6]
  283. // { __GlintTagKdGStart, 0x00000000 }, // [0x1A3]
  284. // { __GlintTagKdRStart, 0x00000000 }, // [0x1A0]
  285. // { __GlintTagKsBStart, 0x00000000 }, // [0x196]
  286. // { __GlintTagKsGStart, 0x00000000 }, // [0x193]
  287. // { __GlintTagKsRStart, 0x00000000 }, // [0x190]
  288. // { __GlintTagLBCancelWrite, 0x00000000 }, // [0x13D] // Obsoleted !!! ??? !!!
  289. // { __GlintTagLBClearDataL, 0x00000000 }, // [0x6AA]
  290. // { __GlintTagLBClearDataU, 0x00000000 }, // [0x6AB]
  291. // { __GlintTagLBDepth, 0x00000000 }, // [0x116]
  292. // { __GlintTagLBDestReadBufferAddr, 0x005FF000 }, // [0x6A2] ???
  293. // { __GlintTagLBDestReadBufferOffset, 0x00000000 }, // [0x6A3]
  294. // { __GlintTagLBDestReadEnables, 0x00000000 }, // [0x6A1]
  295. // { __GlintTagLBReadFormat, 0x0C4C0420 }, // [0x111] ???
  296. // { __GlintTagLBReadMode, 0x00000000 }, // [0x110] // Obsoleted !!! ??? !!!
  297. // { __GlintTagLBSourceData, 0x00000000 }, // [0x114]
  298. // { __GlintTagLBSourceOffset, 0x00000000 }, // [0x112]
  299. // { __GlintTagLBSourceReadBufferAddr, 0x005FF000 }, // [0x6A5] ???
  300. // { __GlintTagLBSourceReadBufferOffset, 0x00000000 }, // [0x6A6]
  301. // { __GlintTagLBStencil, 0x00000000 }, // [0x115]
  302. // { __GlintTagLBWindowBase, 0x00000000 }, // [0x117]
  303. // { __GlintTagLBWindowOffset, 0x00000000 }, // [0x11F]
  304. // { __GlintTagLBWriteBufferAddr, 0x005FF000 }, // [0x6A8] ???
  305. // { __GlintTagLBWriteBufferOffset, 0x00000000 }, // [0x6A9]
  306. // { __GlintTagLBWriteFormat, 0x0C4C0420 }, // [0x119] ???
  307. // { __GlintTagLUTIndex, 0x00000000 }, // [0x098]
  308. // { __GlintTagLUTData, 0x00000000 }, // [0x099]
  309. // { __GlintTagLUTAddress, 0x00000000 }, // [0x09A]
  310. // { __GlintTagLUTTransfer, 0x00000000 }, // [0x09B]
  311. { __GlintTagLineStippleMode, __PERMEDIA_DISABLE }, // [0x035]
  312. // { __GlintTagLoadLineStippleCounters, 0x00000000 }, // [0x036]
  313. // { __GlintTagLOD, 0x00000000 }, // [0x07A]
  314. { __GlintTagLOD1, 0x00000000 }, // [0x089]
  315. { __GlintTagLodRange0, 0x00C00000 }, // [0x669]
  316. { __GlintTagLodRange1, 0x00C00000 }, // [0x66A]
  317. { __GlintTagLogicalOpMode, __PERMEDIA_DISABLE }, // [0x105]
  318. // { __GlintTagLogicalTexturePageTableAddr, 0x00000000 }, // [0x69A]
  319. // { __GlintTagLogicalTexturePageTableLength, 0x00000000 }, // [0x69B]
  320. // { __GlintTagMaxHitRegion, 0x00000000 }, // [0x186]
  321. // { __GlintTagMaxRegion, 0x00000000 }, // [0x183]
  322. // { __GlintTagMergeSpanData, 0x00000000 }, // [0x5E7]
  323. // { __GlintTagMinHitRegion, 0x00000000 }, // [0x185]
  324. // { __GlintTagMinRegion, 0x00000000 }, // [0x182]
  325. // { __GlintTagPCIWindowBase0, 0x00000000 }, // [0x5E8]
  326. // { __GlintTagPCIWindowBase1, 0x00000000 }, // [0x5E9]
  327. // { __GlintTagPCIWindowBase2, 0x00000000 }, // [0x5EA]
  328. // { __GlintTagPCIWindowBase3, 0x00000000 }, // [0x5EB]
  329. // { __GlintTagPCIWindowBase4, 0x00000000 }, // [0x5EC]
  330. // { __GlintTagPCIWindowBase5, 0x00000000 }, // [0x5ED]
  331. // { __GlintTagPCIWindowBase6, 0x00000000 }, // [0x5EE]
  332. // { __GlintTagPCIWindowBase7, 0x00000000 }, // [0x5EF]
  333. // { __GlintTagPacked4Pixels, 0x00000000 }, // [0x6CD]
  334. // { __GlintTagPhysicalPageAllocationTableAddr,0x00000000 }, // [0x698]
  335. // { __GlintTagPickResult, 0x00000000 }, // [0x187]
  336. // { __GlintTagPointTable0, 0x00000000 }, // [0x010]
  337. // { __GlintTagPointTable1, 0x00000000 }, // [0x011]
  338. // { __GlintTagPointTable2, 0x00000000 }, // [0x012]
  339. // { __GlintTagPointTable3, 0x00000000 }, // [0x013]
  340. // { __GlintTagPrepareToRender, 0x00000000 }, // [0x021]
  341. // { __GlintTagProvokingVertex, 0x00000000 }, // [0x267]
  342. // { __GlintTagQ1Start, 0x00000000 }, // [0x086]
  343. // { __GlintTagRLCount, 0x00000000 }, // [0x6CF]
  344. // { __GlintTagRLData, 0x00000000 }, // [0x6CE]
  345. // { __GlintTagRLEMask, 0x00000000 }, // [0x189]
  346. // { __GlintTagRStart, 0x00000000 }, // [0x0F0]
  347. { __GlintTagRasterizerMode, // [0x014]
  348. (1 << 0) | // mirror bitmasks
  349. (3 << 7) | // byteswap bitmasks ABCD => DCBA
  350. (1 << 18) }, // YLimits enabled
  351. // { __GlintTagRectangleOrigin, 0x00000000 }, // [0x6C0]
  352. { __GlintTagRenderPatchOffset, 0x00000000 }, // [0x6C2]
  353. // { __GlintTagRepeatLine, 0x00000000 }, // [0x265]
  354. // { __GlintTagRepeatTriangle, 0x00000000 }, // [0x262]
  355. // { __GlintTagResetPickResult, 0x00000000 }, // [0x184]
  356. { __GlintTagRouterMode, 0x00000000 }, // [0x108]
  357. // { __GlintTagS1Start, 0x00000000 }, // [0x080]
  358. // { __GlintTagSaveLineStippleCounters, 0x00000000 }, // [0x038]
  359. // { __GlintTagScanlineOwnership, 0x00000000 }, // [0x016]
  360. { __GlintTagScissorMaxXY, 0x7FFF7FFF }, // [0x032]
  361. // { __GlintTagScissorMinXY, 0x00000000 }, // [0x031]
  362. { __GlintTagScissorMode, __PERMEDIA_DISABLE }, // [0x030]
  363. // { __GlintTagSetLogicalTexturePage, 0x00000000 }, // [0x66C]
  364. { __GlintTagSizeOfFramebuffer, 0x00080000 }, // [0x615]
  365. // { __GlintTagStartXDom, 0x00000000 }, // [0x000]
  366. // { __GlintTagStartXSub, 0x00000000 }, // [0x002]
  367. // { __GlintTagStartY, 0x00000000 }, // [0x004]
  368. { __GlintTagStatisticMode, 0x00000000 }, // [0x181]
  369. // { __GlintTagStencil, 0x00000000 }, // [0x133]
  370. { __GlintTagStencilData, 0x00FFFFFF }, // [0x132]
  371. { __GlintTagStencilMode, 0x00040000 }, // [0x131] ???
  372. // { __GlintTagSuspendUntilFrameBlank, 0x00000000 }, // [0x18F]
  373. // { __GlintTagSync, 0x00000000 }, // [0x188]
  374. // { __GlintTagT1Start, 0x00000000 }, // [0x083]
  375. // { __GlintTagTailPhysicalPageAllocation0, 0x00000000 }, // [0x694]
  376. // { __GlintTagTailPhysicalPageAllocation1, 0x00000000 }, // [0x695]
  377. // { __GlintTagTailPhysicalPageAllocation2, 0x00000000 }, // [0x696]
  378. // { __GlintTagTailPhysicalPageAllocation3, 0x00000000 }, // [0x697]
  379. { __PXRXTagTextureApplicationMode, __PERMEDIA_DISABLE }, // [0x0D0]
  380. { __GlintTagQStart, 0x00000000 }, // [0x077]
  381. { __GlintTagSStart, 0x00000000 }, // [0x071]
  382. { __GlintTagTStart, 0x00000000 }, // [0x074]
  383. // { __GlintTagTextureCacheControl, 0x00000000 }, // [0x092]
  384. // { __GlintTagTextureChromaLower0, 0x00000000 }, // [0x09E]
  385. // { __GlintTagTextureChromaLower1, 0x00000000 }, // [0x0C1]
  386. // { __GlintTagTextureChromaUpper0, 0x00000000 }, // [0x09D]
  387. // { __GlintTagTextureChromaUpper1, 0x00000000 }, // [0x0C0]
  388. { __GlintTagTextureCompositeAlphaMode0, 0x00008000 }, // [0x662] ???
  389. { __GlintTagTextureCompositeAlphaMode1, 0x00008000 }, // [0x664] ???
  390. { __GlintTagTextureCompositeColorMode0, __PERMEDIA_DISABLE }, // [0x661]
  391. { __GlintTagTextureCompositeColorMode1, 0x00008000 }, // [0x663] ???
  392. { __GlintTagTextureCompositeFactor0, 0xFFFFFFFF }, // [0x665] ???
  393. { __GlintTagTextureCompositeFactor1, 0xFFFFFFFF }, // [0x666] ???
  394. { __GlintTagTextureCompositeMode, 0x00000000 }, // [0x660]
  395. { __PXRXTagTextureCoordMode, __PERMEDIA_ENABLE | // [0x070]
  396. (1 << 1) | // SWrap repeat
  397. (1 << 3) | // TWrap repeat
  398. (1 << 17) }, // texture map type == 2D
  399. // { __GlintTagTextureData, 0x00000000 }, // [0x11D]
  400. // { __GlintTagTextureDownloadOffset, 0x00000000 }, // [0x11E]
  401. { __GlintTagTextureEnvColor, 0xFFFFFFFF }, // [0x0D1]
  402. { __GlintTagTextureFilterMode, __PERMEDIA_DISABLE }, // [0x09C]
  403. // { __GlintTagTextureFormat, 0x00000000 }, // [0x091]
  404. { __GlintTagTextureIndexMode0, __PERMEDIA_ENABLE | // [0x667]
  405. (10 << 1) | // texture map log2(width) == log2(1024)
  406. (10 << 5) | // texture map log2(height) == log2(1024)
  407. (1 << 10) | // UWrap repeat
  408. (1 << 12) | // VWrap repeat
  409. (1 << 14) | // texture map type == 2D
  410. (1 << 21) }, // nearest neighbour bias = 0
  411. { __GlintTagTextureIndexMode1, 0x00200000 }, // [0x668] ???
  412. { __GlintTagTextureLODBiasS, 0x00000000 }, // [0x08A] ???
  413. { __GlintTagTextureLODBiasT, 0x00000000 }, // [0x08B] ???
  414. // { __GlintTagTextureLODScale, 0x00000000 }, // [0x268]
  415. // { __GlintTagTextureLODScale1, 0x00000000 }, // [0x269]
  416. // { __GlintTagTextureMapWidth0, 0x00000000 }, // [0x683]
  417. // { __GlintTagTextureMapWidth1, 0x00000000 }, // [0x684]
  418. // { __GlintTagTextureReadMode, 0x00000000 }, // [0x090]
  419. { __GlintTagTextureReadMode0, __PERMEDIA_ENABLE | // [0x680]
  420. (7 << 25) | // byteswap: HGFEDCBA
  421. (1 << 28) }, // mirror bitmap
  422. { __GlintTagTextureReadMode1, 0x00000400 }, // [0x681] ???
  423. // { __GlintTagTouchLogicalPage, 0x00000000 }, // [0x66E]
  424. // { __GlintTagUpdateLineStippleCounters, 0x00000000 }, // [0x037]
  425. // { __GlintTagUpdateLogicalTextureInfo, 0x00000000 }, // [0x66D]
  426. // { __GlintTagV0FloatA, 0x00000000 }, // [0x238]
  427. // { __GlintTagV0FloatB, 0x00000000 }, // [0x237]
  428. // { __GlintTagV0FloatF, 0x00000000 }, // [0x239]
  429. // { __GlintTagV0FloatG, 0x00000000 }, // [0x236]
  430. // { __GlintTagV0FloatKdB, 0x00000000 }, // [0x20F]
  431. // { __GlintTagV0FloatKdG, 0x00000000 }, // [0x20E]
  432. // { __GlintTagV0FloatKdR, 0x00000000 }, // [0x20D]
  433. // { __GlintTagV0FloatKsB, 0x00000000 }, // [0x20C]
  434. // { __GlintTagV0FloatKsG, 0x00000000 }, // [0x20B]
  435. // { __GlintTagV0FloatKsR, 0x00000000 }, // [0x20A]
  436. // { __GlintTagV0FloatPackedColour, 0x00000000 }, // [0x23E]
  437. // { __GlintTagV0FloatPackedSpecularFog, 0x00000000 }, // [0x23F]
  438. // { __GlintTagV0FloatQ, 0x00000000 }, // [0x232]
  439. // { __GlintTagV0FloatQ1, 0x00000000 }, // [0x202]
  440. // { __GlintTagV0FloatR, 0x00000000 }, // [0x235]
  441. // { __GlintTagV0FloatS, 0x00000000 }, // [0x230]
  442. // { __GlintTagV0FloatS1, 0x00000000 }, // [0x200]
  443. // { __GlintTagV0FloatT, 0x00000000 }, // [0x231]
  444. // { __GlintTagV0FloatT1, 0x00000000 }, // [0x201]
  445. // { __GlintTagV0FloatX, 0x00000000 }, // [0x23A]
  446. // { __GlintTagV0FloatY, 0x00000000 }, // [0x23B]
  447. // { __GlintTagV0FloatZ, 0x00000000 }, // [0x23C]
  448. // { __GlintTagV0Reserved0, 0x00000000 }, // [0x203]
  449. // { __GlintTagV0Reserved1, 0x00000000 }, // [0x204]
  450. // { __GlintTagV0Reserved2, 0x00000000 }, // [0x205]
  451. // { __GlintTagV0Reserved3, 0x00000000 }, // [0x206]
  452. // { __GlintTagV0Reserved4, 0x00000000 }, // [0x207]
  453. // { __GlintTagV0Reserved5, 0x00000000 }, // [0x208]
  454. // { __GlintTagV0Reserved6, 0x00000000 }, // [0x209]
  455. // { __GlintTagV0Reserved7, 0x00000000 }, // [0x233]
  456. // { __GlintTagV0Reserved8, 0x00000000 }, // [0x234]
  457. // { __GlintTagV1FloatA, 0x00000000 }, // [0x248]
  458. // { __GlintTagV1FloatB, 0x00000000 }, // [0x247]
  459. // { __GlintTagV1FloatF, 0x00000000 }, // [0x249]
  460. // { __GlintTagV1FloatG, 0x00000000 }, // [0x246]
  461. // { __GlintTagV1FloatKdB, 0x00000000 }, // [0x21F]
  462. // { __GlintTagV1FloatKdG, 0x00000000 }, // [0x21E]
  463. // { __GlintTagV1FloatKdR, 0x00000000 }, // [0x21D]
  464. // { __GlintTagV1FloatKsB, 0x00000000 }, // [0x21C]
  465. // { __GlintTagV1FloatKsG, 0x00000000 }, // [0x21B]
  466. // { __GlintTagV1FloatKsR, 0x00000000 }, // [0x21A]
  467. // { __GlintTagV1FloatPackedColour, 0x00000000 }, // [0x24E]
  468. // { __GlintTagV1FloatPackedSpecularFog, 0x00000000 }, // [0x24F]
  469. // { __GlintTagV1FloatQ, 0x00000000 }, // [0x242]
  470. // { __GlintTagV1FloatQ1, 0x00000000 }, // [0x212]
  471. // { __GlintTagV1FloatR, 0x00000000 }, // [0x245]
  472. // { __GlintTagV1FloatS, 0x00000000 }, // [0x240]
  473. // { __GlintTagV1FloatS1, 0x00000000 }, // [0x210]
  474. // { __GlintTagV1FloatT, 0x00000000 }, // [0x241]
  475. // { __GlintTagV1FloatT1, 0x00000000 }, // [0x211]
  476. // { __GlintTagV1FloatX, 0x00000000 }, // [0x24A]
  477. // { __GlintTagV1FloatY, 0x00000000 }, // [0x24B]
  478. // { __GlintTagV1FloatZ, 0x00000000 }, // [0x24C]
  479. // { __GlintTagV1Reserved0, 0x00000000 }, // [0x213]
  480. // { __GlintTagV1Reserved1, 0x00000000 }, // [0x214]
  481. // { __GlintTagV1Reserved2, 0x00000000 }, // [0x215]
  482. // { __GlintTagV1Reserved3, 0x00000000 }, // [0x216]
  483. // { __GlintTagV1Reserved4, 0x00000000 }, // [0x217]
  484. // { __GlintTagV1Reserved5, 0x00000000 }, // [0x218]
  485. // { __GlintTagV1Reserved6, 0x00000000 }, // [0x219]
  486. // { __GlintTagV1Reserved7, 0x00000000 }, // [0x243]
  487. // { __GlintTagV1Reserved8, 0x00000000 }, // [0x244]
  488. // { __GlintTagV2FloatA, 0x00000000 }, // [0x258]
  489. // { __GlintTagV2FloatB, 0x00000000 }, // [0x257]
  490. // { __GlintTagV2FloatF, 0x00000000 }, // [0x259]
  491. // { __GlintTagV2FloatG, 0x00000000 }, // [0x256]
  492. // { __GlintTagV2FloatKdB, 0x00000000 }, // [0x22F]
  493. // { __GlintTagV2FloatKdG, 0x00000000 }, // [0x22E]
  494. // { __GlintTagV2FloatKdR, 0x00000000 }, // [0x22D]
  495. // { __GlintTagV2FloatKsB, 0x00000000 }, // [0x22C]
  496. // { __GlintTagV2FloatKsG, 0x00000000 }, // [0x22B]
  497. // { __GlintTagV2FloatKsR, 0x00000000 }, // [0x22A]
  498. // { __GlintTagV2FloatPackedColour, 0x00000000 }, // [0x25E]
  499. // { __GlintTagV2FloatPackedSpecularFog, 0x00000000 }, // [0x25F]
  500. // { __GlintTagV2FloatQ, 0x00000000 }, // [0x252]
  501. // { __GlintTagV2FloatQ1, 0x00000000 }, // [0x222]
  502. // { __GlintTagV2FloatR, 0x00000000 }, // [0x255]
  503. // { __GlintTagV2FloatS, 0x00000000 }, // [0x250]
  504. // { __GlintTagV2FloatS1, 0x00000000 }, // [0x220]
  505. // { __GlintTagV2FloatT, 0x00000000 }, // [0x251]
  506. // { __GlintTagV2FloatT1, 0x00000000 }, // [0x221]
  507. // { __GlintTagV2FloatX, 0x00000000 }, // [0x25A]
  508. // { __GlintTagV2FloatY, 0x00000000 }, // [0x25B]
  509. // { __GlintTagV2FloatZ, 0x00000000 }, // [0x25C]
  510. // { __GlintTagV2Reserved0, 0x00000000 }, // [0x223]
  511. // { __GlintTagV2Reserved1, 0x00000000 }, // [0x224]
  512. // { __GlintTagV2Reserved2, 0x00000000 }, // [0x225]
  513. // { __GlintTagV2Reserved3, 0x00000000 }, // [0x226]
  514. // { __GlintTagV2Reserved4, 0x00000000 }, // [0x227]
  515. // { __GlintTagV2Reserved5, 0x00000000 }, // [0x228]
  516. // { __GlintTagV2Reserved6, 0x00000000 }, // [0x229]
  517. // { __GlintTagV2Reserved7, 0x00000000 }, // [0x253]
  518. // { __GlintTagV2Reserved8, 0x00000000 }, // [0x254]
  519. // { __GlintTagVTGAddress, 0x00000000 }, // [0x616]
  520. // { __GlintTagVTGData, 0x00000000 }, // [0x617]
  521. // { __GlintTagWaitForCompletion, 0x00000000 }, // [0x017]
  522. { __GlintTagWindow, 0x00000000 }, // [0x130]
  523. { __GlintTagWindowOrigin, 0x00000000 }, // [0x039]
  524. // { __GlintTagXBias, 0x00000000 }, // [0x290]
  525. // { __GlintTagYBias, 0x00000000 }, // [0x291]
  526. { __GlintTagYLimits, 0x7FFF0000 }, // [0x015] // Allow y values from 0 to 32767
  527. { __PXRXTagYUVMode, __PERMEDIA_DISABLE }, // [0x1E0]
  528. // { __GlintTagZFogBias, 0x00000000 }, // [0x0D7]
  529. // { __GlintTagZStartL, 0x00000000 }, // [0x137]
  530. // { __GlintTagZStartU, 0x00000000 }, // [0x136]
  531. // { __GlintTagdAdx, 0x00000000 }, // [0x0FA]
  532. // { __GlintTagdAdyDom, 0x00000000 }, // [0x0FB]
  533. // { __GlintTagdBdx, 0x00000000 }, // [0x0F7]
  534. // { __GlintTagdBdyDom, 0x00000000 }, // [0x0F8]
  535. // { __GlintTagdFdx, 0x00000000 }, // [0x0D5]
  536. // { __GlintTagdFdyDom, 0x00000000 }, // [0x0D6]
  537. // { __GlintTagdGdx, 0x00000000 }, // [0x0F4]
  538. // { __GlintTagdGdyDom, 0x00000000 }, // [0x0F5]
  539. // { __GlintTagdKdBdx, 0x00000000 }, // [0x1A7]
  540. // { __GlintTagdKdBdyDom, 0x00000000 }, // [0x1A8]
  541. // { __GlintTagdKdGdx, 0x00000000 }, // [0x1A4]
  542. // { __GlintTagdKdGdyDom, 0x00000000 }, // [0x1A5]
  543. // { __GlintTagdKdRdx, 0x00000000 }, // [0x1A1]
  544. // { __GlintTagdKdRdyDom, 0x00000000 }, // [0x1A2]
  545. // { __GlintTagdKsBdx, 0x00000000 }, // [0x197]
  546. // { __GlintTagdKsBdyDom, 0x00000000 }, // [0x198]
  547. // { __GlintTagdKsGdx, 0x00000000 }, // [0x194]
  548. // { __GlintTagdKsGdyDom, 0x00000000 }, // [0x195]
  549. // { __GlintTagdKsRdx, 0x00000000 }, // [0x191]
  550. // { __GlintTagdKsRdyDom, 0x00000000 }, // [0x192]
  551. // { __GlintTagdQ1dx, 0x00000000 }, // [0x087]
  552. // { __GlintTagdQ1dyDom, 0x00000000 }, // [0x088]
  553. { __GlintTagdQdx, 0x00000000 }, // [0x078]
  554. { __GlintTagdQdy, 0x00000000 }, // [0x07D]
  555. { __GlintTagdQdyDom, 0x00000000 }, // [0x079]
  556. // { __GlintTagdRdx, 0x00000000 }, // [0x0F1]
  557. // { __GlintTagdRdyDom, 0x00000000 }, // [0x0F2]
  558. // { __GlintTagdS1dx, 0x00000000 }, // [0x081]
  559. // { __GlintTagdS1dyDom, 0x00000000 }, // [0x082]
  560. { __GlintTagdSdx, 1 << (32 - 10) }, // [0x072]
  561. { __GlintTagdSdy, 0x00000000 }, // [0x07B]
  562. { __GlintTagdSdyDom, 0x00000000 }, // [0x073]
  563. // { __GlintTagdT1dx, 0x00000000 }, // [0x084]
  564. // { __GlintTagdT1dyDom, 0x00000000 }, // [0x085]
  565. { __GlintTagdTdx, 0x00000000 }, // [0x075]
  566. { __GlintTagdTdy, 0x00000000 }, // [0x07C]
  567. { __GlintTagdTdyDom, 1 << (32 - 10) }, // [0x076]
  568. { __GlintTagdXDom, 0 }, // [0x001]
  569. { __GlintTagdXSub, 0 }, // [0x003]
  570. { __GlintTagdY, INTtoFIXED(1) }, // [0x005]
  571. // { __GlintTagdZdxL, 0x00000000 }, // [0x139]
  572. // { __GlintTagdZdxU, 0x00000000 }, // [0x138]
  573. // { __GlintTagdZdyDomL, 0x00000000 }, // [0x13B]
  574. // { __GlintTagdZdyDomU, 0x00000000 }, // [0x13A]
  575. { __GlintTagLBDestReadMode, 0x00000000 }, // [0x6A0]
  576. { __GlintTagLBSourceReadMode, 0x00000000 }, // [0x6A4]
  577. { __GlintTagLBWriteMode, 0x00000000 }, // [0x118]
  578. };
  579. DWORD NUM_P3_CTXT_TAGS = (sizeof(DefaultContext_P3) / sizeof(DefaultContext_P3[0]));
  580. void pxrxSetupDualWrites_Patching( PPDEV ppdev ) {
  581. ULONG bypass = 0;
  582. GLINT_DECL;
  583. DISPDBG((7, "pxrxSetupDualWrites_Patching entered"));
  584. __RENDER2D_OP_PATCHORDER = 0;
  585. glintInfo->fbWriteModeSingleWrite = 1;
  586. glintInfo->fbWriteModeDualWrite = 1 | (1 << 4) | (1 << 12) | (1 << 13);
  587. glintInfo->fbWriteModeSingleWriteStereo = 1 | (1 << 4) | (1 << 12) | (1 << 15);
  588. glintInfo->fbWriteModeDualWriteStereo = 1 | (1 << 4) | (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15);
  589. if( glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_FRONT ) {
  590. DISPDBG((7, "pxrxSetupDualWrites_Patching: Enabling front buffer patching"));
  591. __RENDER2D_OP_PATCHORDER = __RENDER2D_OP_PATCHORDER_PATCHED;
  592. glintInfo->fbWriteModeSingleWrite |= (1 << 16) | (1 << 18) | (1 << 20) | (1 << 22);
  593. glintInfo->fbWriteModeDualWrite |= (1 << 16);
  594. glintInfo->fbWriteModeSingleWriteStereo |= (1 << 16) | (1 << 18) | (1 << 20) | (1 << 22);
  595. glintInfo->fbWriteModeDualWriteStereo |= (1 << 16) | (1 << 20);
  596. }
  597. bypass |= ppdev->cPelSize << 5;
  598. if( ppdev->cxMemory <= 1024 )
  599. bypass |= (0 << 7);
  600. else if( ppdev->cxMemory <= 2048 )
  601. bypass |= (1 << 7);
  602. else if( ppdev->cxMemory <= 4096 )
  603. bypass |= (2 << 7);
  604. else if( ppdev->cxMemory <= 8192 )
  605. bypass |= (3 << 7);
  606. if( glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_BACK ) {
  607. DISPDBG((7, "pxrxSetupDualWrites_Patching: Enabling back buffer patching"));
  608. __RENDER2D_OP_PATCHORDER = __RENDER2D_OP_PATCHORDER_PATCHED;
  609. glintInfo->fbWriteModeDualWrite |= (1 << 18);
  610. glintInfo->fbWriteModeDualWriteStereo |= (1 << 18) | (1 << 22);
  611. }
  612. if( glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_FRONT ) {
  613. if( glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_BACK ) {
  614. // Patched front and back:
  615. bypass |= (1 << 2);
  616. // We need to do very odd things with a non power of 2 stride :-(.
  617. // if( ppdev->cxMemory > 8192 )
  618. if( ppdev->cxMemory != 1024 )
  619. glintInfo->GdiCantAccessFramebuffer = TRUE; // bypass 'effective stride' is too big
  620. } else {
  621. // Patched front only:
  622. glintInfo->GdiCantAccessFramebuffer = TRUE;
  623. }
  624. } else {
  625. if( glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_BACK ) {
  626. // Patched back only:
  627. glintInfo->GdiCantAccessFramebuffer = TRUE;
  628. } else {
  629. // Linear front and back:
  630. }
  631. }
  632. if( glintInfo->pxrxFlags & PXRX_FLAGS_DUAL_WRITE ) {
  633. DISPDBG((7, "pxrxSetupDualWrites_Patching: Enabling dual writes"));
  634. if( glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITE )
  635. glintInfo->fbWriteMode = glintInfo->fbWriteModeDualWriteStereo;
  636. else
  637. glintInfo->fbWriteMode = glintInfo->fbWriteModeDualWrite;
  638. glintInfo->pxrxFlags |= PXRX_FLAGS_DUAL_WRITING;
  639. glintInfo->fbWriteOffset[1] = glintInfo->backBufferXY;
  640. glintInfo->fbWriteOffset[2] = glintInfo->backRightBufferXY;
  641. } else {
  642. DISPDBG((7, "pxrxSetupDualWrites_Patching: Disabling dual writes"));
  643. if( glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITE )
  644. glintInfo->fbWriteMode = glintInfo->fbWriteModeSingleWriteStereo;
  645. else
  646. glintInfo->fbWriteMode = glintInfo->fbWriteModeSingleWrite;
  647. glintInfo->pxrxFlags &= ~PXRX_FLAGS_DUAL_WRITING;
  648. glintInfo->fbWriteOffset[1] = 0x00000000;
  649. glintInfo->fbWriteOffset[2] = 0x00000000;
  650. }
  651. if( glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITE ) {
  652. DISPDBG((7, "pxrxSetupDualWrites_Patching: Enabling stereo writes"));
  653. glintInfo->pxrxFlags |= PXRX_FLAGS_STEREO_WRITING;
  654. glintInfo->fbWriteOffset[3] = glintInfo->frontRightBufferXY;
  655. }
  656. else {
  657. DISPDBG((7, "pxrxSetupDualWrites_Patching: Disabling stereo writes"));
  658. glintInfo->pxrxFlags &= ~PXRX_FLAGS_STEREO_WRITING;
  659. glintInfo->fbWriteOffset[3] = 0x00000000;
  660. }
  661. if( (glintInfo->pxrxFlags & PXRX_FLAGS_DUAL_WRITE) ||
  662. (glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITE) ) {
  663. // Unfortunately, the bypass requires the back buffer to be aligned on a
  664. // (power of 2) * 1MB boundary. So for the time being, just pretend we
  665. // can't actually dual write through it.
  666. // Also, we can't set the bypass up to read from the back buffer. So when
  667. // OGL has page flipped so that the back buffer is now the current buffer
  668. // any logic-ops will get source data from the wrong location :-(.
  669. glintInfo->GdiCantAccessFramebuffer = TRUE;
  670. /*{
  671. ULONG size = (ppdev->cxMemory * (glintInfo->backBufferXY >> 16)) + (glintInfo->backBufferXY & 0xFFFF);
  672. int i;
  673. size <<= ppdev->cPelSize;
  674. size >>= 20;
  675. for( i = 0; i <= 7; i++ )
  676. if( size & (1 << i) )
  677. break;
  678. if( i < 0 )
  679. glintInfo->GdiCantAccessFramebuffer = TRUE;
  680. else
  681. bypass |= (i << 7);
  682. }*/
  683. }
  684. //@@BEGIN_DDKSPLIT
  685. // if( GLINT_P3R3 ) {
  686. //@@END_DDKSPLIT
  687. switch( ppdev->cPelSize ) {
  688. case GLINTDEPTH32:
  689. if( (glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_FRONT) ||
  690. (glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_BACK) ) {
  691. ppdev->pgfnFillSolid = p3r3FillSolidVariableSpans;
  692. ppdev->pgfnFillPatColor = p3r3FillPatColorVariableSpans;
  693. ppdev->pgfnFillPatMono = p3r3FillPatMonoVariableSpans;
  694. } else {
  695. ppdev->pgfnFillSolid = p3r3FillSolid32bpp;
  696. ppdev->pgfnFillPatColor = p3r3FillPatColor32bpp;
  697. ppdev->pgfnFillPatMono = p3r3FillPatMono32bpp;
  698. }
  699. break;
  700. case GLINTDEPTH8:
  701. if( (glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_FRONT) ||
  702. (glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_BACK) ) {
  703. ppdev->pgfnFillPatMono = p3r3FillPatMonoVariableSpans;
  704. } else {
  705. ppdev->pgfnFillPatMono = pxrxFillPatMono;
  706. }
  707. break;
  708. }
  709. //@@BEGIN_DDKSPLIT
  710. // }
  711. //@@END_DDKSPLIT
  712. if( (glintInfo->pxrxFlags & (PXRX_FLAGS_PATCHING_FRONT | PXRX_FLAGS_PATCHING_BACK)) ||
  713. (glintInfo->pxrxFlags & PXRX_FLAGS_DUAL_WRITE) ||
  714. (glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITE) ||
  715. glintInfo->GdiCantAccessFramebuffer ||
  716. ((ppdev->cPelSize != GLINTDEPTH16) && (ppdev->cPelSize != GLINTDEPTH32)) )
  717. {
  718. ppdev->pgfnCopyXfer8bppLge = pxrxCopyXfer8bppLge;
  719. ppdev->pgfnCopyXfer8bpp = pxrxCopyXfer8bppLge;
  720. } else {
  721. ppdev->pgfnCopyXfer8bppLge = pxrxCopyXfer8bppLge;
  722. ppdev->pgfnCopyXfer8bpp = vGlintCopyBltBypassDownloadXlate8bpp;
  723. }
  724. WRITE_GLINT_CTRL_REG( PXRXByAperture2Stride, ppdev->cxMemory );
  725. WRITE_GLINT_CTRL_REG( PXRXByAperture2Mode, bypass );
  726. glintInfo->pxrxByDMAReadMode = bypass;
  727. if(ppdev->flCaps & CAPS_USE_AGP_DMA)
  728. glintInfo->pxrxByDMAReadMode |= PXRX_BYPASS_READ_DMA_AGP_BIT;
  729. WRITE_GLINT_CTRL_REG( PXRXByDMAReadMode, glintInfo->pxrxByDMAReadMode );
  730. WRITE_GLINT_CTRL_REG( PXRXByDMAReadStride, ppdev->cxMemory );
  731. DISPDBG((7, "pxrxSetupDualWrites_Patching exited"));
  732. }
  733. void pxrxRestore2DContext( PPDEV ppdev, BOOL switchingIn ) {
  734. ULONG i, f, b;
  735. ULONG enableFlags;
  736. GLINT_DECL;
  737. #if DBG
  738. inPxRxContextSwitch = TRUE;
  739. #endif
  740. DISPDBG((7, "pxrxRestore2DContext entered"));
  741. if( switchingIn ) {
  742. // Switching in to 2D...
  743. gi_pxrxDMA.NTbuff = 0;
  744. gi_pxrxDMA.NTptr = gi_pxrxDMA.DMAaddrL[gi_pxrxDMA.NTbuff];
  745. gi_pxrxDMA.P3at = gi_pxrxDMA.NTptr;
  746. gi_pxrxDMA.NTdone = gi_pxrxDMA.NTptr;
  747. #if PXRX_DMA_BUFFER_CHECK
  748. glintInfo->NTwait = gi_pxrxDMA.NTptr;
  749. #endif
  750. CHECK_PXRX_DMA_VALIDITY( CHECK_SWITCH, 0 );
  751. pxrxSetupDualWrites_Patching( ppdev );
  752. DISPDBG((8, "pxrxRestore2DContext: restoring core registers"));
  753. WAIT_PXRX_DMA_TAGS( NUM_P3_CTXT_TAGS );
  754. for( i = 0; i < NUM_P3_CTXT_TAGS; i++ )
  755. QUEUE_PXRX_DMA_TAG( DefaultContext_P3[i].tag, DefaultContext_P3[i].data );
  756. if( glintInfo->pxrxFlags & PXRX_FLAGS_DUAL_WRITE ) {
  757. f = (glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_FRONT) ? 1 : 0;
  758. b = (glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_BACK ) ? 1 : 0;
  759. } else
  760. f = b = (glintInfo->pxrxFlags & PXRX_FLAGS_PATCHING_FRONT) ? 1 : 0;
  761. WAIT_PXRX_DMA_TAGS( 40 );
  762. QUEUE_PXRX_DMA_TAG( __DeltaTagDeltaControl, (1 << 11) );
  763. QUEUE_PXRX_DMA_TAG( __GlintTagPixelSize, 2 - ppdev->cPelSize ); // [0x018]
  764. QUEUE_PXRX_DMA_TAG( __GlintTagForegroundColor, glintInfo->foregroundColour ); // [0x618]
  765. QUEUE_PXRX_DMA_TAG( __GlintTagBackgroundColor, glintInfo->backgroundColour ); // [0x619]
  766. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferAddr0, glintInfo->fbDestAddr[0] ); // [0x5D0]
  767. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferAddr1, glintInfo->fbDestAddr[1] ); // [0x5D1]
  768. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferAddr2, glintInfo->fbDestAddr[2] ); // [0x5D2]
  769. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferAddr3, glintInfo->fbDestAddr[3] ); // [0x5D3]
  770. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferOffset0, glintInfo->fbDestOffset[0] ); // [0x5D4]
  771. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferOffset1, glintInfo->fbDestOffset[1] ); // [0x5D5]
  772. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferOffset2, glintInfo->fbDestOffset[2] ); // [0x5D6]
  773. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferOffset3, glintInfo->fbDestOffset[3] ); // [0x5D7]
  774. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferWidth0, glintInfo->fbDestWidth[0] ); // [0x5D8]
  775. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferWidth1, glintInfo->fbDestWidth[1] ); // [0x5D9]
  776. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferWidth2, glintInfo->fbDestWidth[2] ); // [0x5DA]
  777. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadBufferWidth3, glintInfo->fbDestWidth[3] ); // [0x5DB]
  778. QUEUE_PXRX_DMA_TAG( __GlintTagFBSourceReadBufferAddr, glintInfo->fbSourceAddr ); // [0x5E1]
  779. QUEUE_PXRX_DMA_TAG( __GlintTagFBSourceReadBufferOffset, glintInfo->fbSourceOffset ); // [0x5E2]
  780. QUEUE_PXRX_DMA_TAG( __GlintTagFBSourceReadBufferWidth, glintInfo->fbSourceWidth ); // [0x5E3]
  781. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferAddr0, glintInfo->fbWriteAddr[0] ); // [0x600]
  782. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferAddr1, glintInfo->fbWriteAddr[1] ); // [0x601]
  783. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferAddr2, glintInfo->fbWriteAddr[2] ); // [0x602]
  784. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferAddr3, glintInfo->fbWriteAddr[3] ); // [0x603]
  785. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferOffset0, glintInfo->fbWriteOffset[0] ); // [0x604]
  786. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferOffset1, glintInfo->fbWriteOffset[1] ); // [0x605]
  787. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferOffset2, glintInfo->fbWriteOffset[2] ); // [0x606]
  788. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferOffset3, glintInfo->fbWriteOffset[3] ); // [0x607]
  789. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferWidth0, glintInfo->fbWriteWidth[0] ); // [0x608]
  790. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferWidth1, glintInfo->fbWriteWidth[1] ); // [0x609]
  791. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferWidth2, glintInfo->fbWriteWidth[2] ); // [0x60A]
  792. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteBufferWidth3, glintInfo->fbWriteWidth[3] ); // [0x60B]
  793. QUEUE_PXRX_DMA_TAG( __GlintTagFBWriteMode, glintInfo->fbWriteMode ); // [0x157]
  794. QUEUE_PXRX_DMA_TAG( __GlintTagFBHardwareWriteMask, glintInfo->DefaultWriteMask ); // [0x158]
  795. glintInfo->WriteMask = glintInfo->DefaultWriteMask;
  796. QUEUE_PXRX_DMA_TAG( __GlintTagFBDestReadMode, glintInfo->fbDestMode); // [0x5DC]
  797. QUEUE_PXRX_DMA_TAG( __GlintTagFBSourceReadMode, (1 << 0) | (1 << 1) | (f << 8) ); // [0x5E0]
  798. QUEUE_PXRX_DMA_TAG( __GlintTagScreenSize, MAKEDWORD_XY(ppdev->cxScreen, ppdev->cyScreen) ); // [0x033]
  799. QUEUE_PXRX_DMA_TAG( __GlintTagLUTMode, glintInfo->lutMode ); // [0x66F]
  800. QUEUE_PXRX_DMA_TAG( __GlintTagConfig2D, glintInfo->config2D ); // [0x6C3]
  801. SEND_PXRX_DMA_FORCE;
  802. //wait for host in id to come out.
  803. SYNC_WITH_GLINT;
  804. // Invalidate some caches:
  805. ppdev->PalLUTType = LUTCACHE_INVALID;
  806. RtlZeroMemory( &ppdev->abeMono, sizeof(ppdev->abeMono) );
  807. DISPDBG((7, "pxrxRestore2DContext: restoring control registers"));
  808. if( (ppdev->sendPXRXdmaBatch != ppdev->sendPXRXdmaForce) && INTERRUPTS_ENABLED ) {
  809. gi_pxrxDMA.scheme = glintInfo->usePXRXdma;
  810. glintInfo->pInterruptCommandBlock->Control |= PXRX_SEND_ON_VBLANK_ENABLED;
  811. READ_GLINT_CTRL_REG ( IntEnable, enableFlags );
  812. WRITE_GLINT_CTRL_REG( IntEnable, enableFlags | INTR_ENABLE_VBLANK );
  813. } else
  814. gi_pxrxDMA.scheme = USE_PXRX_DMA_NONE;
  815. } else {
  816. // Switching out of 2D...
  817. if( INTERRUPTS_ENABLED )
  818. glintInfo->pInterruptCommandBlock->Control &= ~PXRX_SEND_ON_VBLANK_ENABLED;
  819. }
  820. #if DBG
  821. inPxRxContextSwitch = FALSE;
  822. #endif
  823. DISPDBG((7, "pxrxRestore2DContext exited"));
  824. }
  825. VOID pxrxSetupFunctionPointers( PPDEV ppdev )
  826. {
  827. ULONG ul;
  828. GLINT_DECL;
  829. switch( glintInfo->usePXRXdma ) {
  830. case USE_PXRX_DMA_FIFO:
  831. ppdev->sendPXRXdmaForce = sendPXRXdmaFIFO;
  832. ppdev->sendPXRXdmaQuery = sendPXRXdmaFIFO;
  833. ppdev->sendPXRXdmaBatch = sendPXRXdmaFIFO;
  834. ppdev->switchPXRXdmaBuffer = switchPXRXdmaBufferFIFO;
  835. ppdev->waitPXRXdmaCompletedBuffer = waitPXRXdmaCompletedBufferFIFO;
  836. break;
  837. default:
  838. DISPDBG((ERRLVL,"Unknown PXRX dma scheme!"));
  839. }
  840. if( !INTERRUPTS_ENABLED )
  841. ppdev->sendPXRXdmaBatch = ppdev->sendPXRXdmaQuery = ppdev->sendPXRXdmaForce;
  842. ppdev->pgfnCopyBltCopyROP = pxrxCopyBltNative;
  843. ppdev->pgfnCopyBltNative = pxrxCopyBltNative;
  844. ppdev->pgfnCopyBlt = pxrxCopyBltNative;
  845. ppdev->pgfnFillSolid = pxrxFillSolid;
  846. ppdev->pgfnFillPatMono = pxrxFillPatMono;
  847. ppdev->pgfnFillPatColor = pxrxFillPatColor;
  848. ppdev->pgfnXfer1bpp = pxrxXfer1bpp;
  849. ppdev->pgfnXfer4bpp = pxrxXfer4bpp;
  850. ppdev->pgfnXfer8bpp = pxrxXfer8bpp;
  851. // ppdev->pgfnXfer16bpp = pxrxXfer16bpp;
  852. // ppdev->pgfnXfer24bpp = pxrxXfer24bpp;
  853. ppdev->pgfnXferImage = pxrxXferImage;
  854. ppdev->pgfnMaskCopyBlt = pxrxMaskCopyBlt;
  855. ppdev->pgfnPatRealize = pxrxPatRealize;
  856. ppdev->pgfnMonoOffset = pxrxMonoOffset;
  857. ppdev->pgfnFillPolygon = bGlintFastFillPolygon;
  858. ppdev->pgfnDrawLine = pxrxDrawLine;
  859. ppdev->pgfnIntegerLine = pxrxIntegerLine;
  860. ppdev->pgfnContinueLine = pxrxContinueLine;
  861. ppdev->pgfnInitStrips = pxrxInitStrips;
  862. ppdev->pgfnResetStrips = pxrxResetStrips;
  863. ppdev->pgfnRepNibbles = pxrxRepNibbles;
  864. ppdev->pgfnUpload = pxrxFifoUpload;
  865. // add any depth-specific function overrides here
  866. switch( ppdev->cPelSize )
  867. {
  868. case GLINTDEPTH32:
  869. ppdev->pgfnFillSolid = p3r3FillSolid32bpp;
  870. ppdev->pgfnFillPatColor = p3r3FillPatColor32bpp;
  871. ppdev->pgfnFillPatMono = p3r3FillPatMono32bpp;
  872. break;
  873. case GLINTDEPTH16:
  874. // this specialization seems to give the same
  875. // performance as the generic color pattern fill
  876. //ppdev->pgfnFillPatColor = p3r3FillPatColor16bpp;
  877. break;
  878. case GLINTDEPTH8:
  879. ppdev->pgfnFillSolid = p3r3FillSolidVariableSpans;
  880. ppdev->pgfnFillPatColor = p3r3FillPatColorVariableSpans;
  881. break;
  882. }
  883. ppdev->pgfnCopyXferImage = NULL;
  884. ppdev->pgfnCopyXfer24bpp = pxrxCopyXfer24bpp;
  885. ppdev->pgfnCopyXfer4bpp = NULL;
  886. if( (glintInfo->pxrxFlags & (PXRX_FLAGS_PATCHING_FRONT | PXRX_FLAGS_PATCHING_BACK)) ||
  887. (glintInfo->pxrxFlags & PXRX_FLAGS_DUAL_WRITE) ||
  888. (glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITE) ||
  889. glintInfo->GdiCantAccessFramebuffer ||
  890. ((ppdev->cPelSize != GLINTDEPTH16) && (ppdev->cPelSize !=
  891. GLINTDEPTH32)) )
  892. {
  893. ppdev->pgfnCopyXfer8bppLge = pxrxCopyXfer8bppLge;
  894. ppdev->pgfnCopyXfer8bpp = pxrxCopyXfer8bppLge;
  895. } else {
  896. ppdev->pgfnCopyXfer8bppLge = pxrxCopyXfer8bppLge;
  897. ppdev->pgfnCopyXfer8bpp = vGlintCopyBltBypassDownloadXlate8bpp;
  898. }
  899. ppdev->gapfnStrip = &gapfnStripPXRX[0];
  900. }
  901. VOID pxrxCopyBltNative( PPDEV ppdev, RECTL *pRect, LONG count, DWORD logicOp, POINTL *pptlSrc, RECTL *pRectDst )
  902. {
  903. ULONG config2D, render2D;
  904. int dx, dy;
  905. GLINT_DECL;
  906. DISPDBG((7, "pxrxCopyBltNative: (%d, %d) => (%d,%d -> %d,%d) x %d, logicOp = %d, offset = (%d, %d)",
  907. pptlSrc->x, pptlSrc->y, pRectDst->left, pRectDst->top, pRectDst->right, pRectDst->bottom,
  908. count, logicOp, ppdev->xyOffsetDst & 0xffff, ppdev->xyOffsetDst >> 16));
  909. ASSERTDD(count > 0, "Can't handle zero rectangles");
  910. ASSERTDD(logicOp <= 15, "Weird hardware Rop");
  911. SET_WRITE_BUFFERS;
  912. WAIT_PXRX_DMA_TAGS( 7 + 3 );
  913. config2D = config2D_NativeBlt[logicOp];
  914. render2D = render2D_NativeBlt[logicOp] | __RENDER2D_OP_PATCHORDER;
  915. if( LogicopReadDest[logicOp] )
  916. SET_READ_BUFFERS;
  917. dx = pptlSrc->x - pRectDst->left;
  918. dy = pptlSrc->y - pRectDst->top;
  919. if(ppdev->DstPixelOrigin == ppdev->SrcPixelOrigin)
  920. {
  921. if( dy >= 0 )
  922. render2D |= __RENDER2D_INCY;
  923. if( dx >= 0 )
  924. render2D |= __RENDER2D_INCX;
  925. // source and dest are part of the same surface
  926. if( (dy == 0) && (dx > -64) && (dx < 64) )
  927. config2D |= __CONFIG2D_FBBLOCKING;
  928. }
  929. LOAD_FBSOURCE_ADDR( ppdev->SrcPixelOrigin );
  930. LOAD_FBSOURCE_OFFSET_XY( dx + ppdev->xOffset, dy + (ppdev->xyOffsetSrc >> 16) );
  931. LOAD_FBSOURCE_WIDTH( ppdev->SrcPixelDelta );
  932. LOAD_CONFIG2D( config2D );
  933. DISPDBG((8, "offset: (%d, %d) -> (%d, %d), d = (%d, %d), %cve X, %cve Y", pptlSrc->x, pptlSrc->y, pRectDst->left, pRectDst->top,
  934. dx, dy, (render2D & __RENDER2D_INCX) ? '+' : '-', (render2D & __RENDER2D_INCY) ? '+' : '-'));
  935. while( 1 ) {
  936. render2D &= ~(__RENDER2D_WIDTH_MASK | __RENDER2D_HEIGHT_MASK);
  937. render2D |= __RENDER2D_WIDTH(pRect->right - pRect->left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top);
  938. DISPDBG((8, "dest rect: (%d, %d -> %d, %d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
  939. QUEUE_PXRX_DMA_INDEX2( __GlintTagFillRectanglePosition, __GlintTagFillRender2D );
  940. QUEUE_PXRX_DMA_DWORD( MAKEDWORD_XY(pRect->left, pRect->top) );
  941. QUEUE_PXRX_DMA_DWORD( render2D );
  942. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  943. if( !(--count) )
  944. break;
  945. ++pRect;
  946. WAIT_PXRX_DMA_DWORDS( 3 );
  947. }
  948. SEND_PXRX_DMA_BATCH;
  949. }
  950. VOID pxrxFillSolid( PPDEV ppdev, LONG count, RECTL *pRect, ULONG logicOp, ULONG bgLogicOp, RBRUSH_COLOR rbc, POINTL *pptlBrush )
  951. {
  952. DWORD config2D, render2D;
  953. ULONG ulColor = rbc.iSolidColor;
  954. GLINT_DECL;
  955. DISPDBG((7, "pxrxFillSolid: %d rects, logicOp = %d, colour = 0x%08X", count, logicOp, rbc.iSolidColor));
  956. SET_WRITE_BUFFERS;
  957. WAIT_PXRX_DMA_TAGS( 5 + 2 );
  958. config2D = config2D_FillSolid[logicOp];
  959. render2D = render2D_FillSolid[logicOp] | __RENDER2D_OP_PATCHORDER;
  960. if( LogicopReadDest[logicOp] )
  961. SET_READ_BUFFERS;
  962. LOAD_FOREGROUNDCOLOUR( ulColor );
  963. LOAD_CONFIG2D( config2D );
  964. while( 1 ) {
  965. DISPDBG((8, "rect: (%d, %d) to (%d, %d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
  966. render2D &= ~(__RENDER2D_WIDTH_MASK | __RENDER2D_HEIGHT_MASK);
  967. render2D |= __RENDER2D_WIDTH(pRect->right - pRect->left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top);
  968. QUEUE_PXRX_DMA_TAG( __GlintTagRectanglePosition, MAKEDWORD_XY(pRect->left, pRect->top) );
  969. QUEUE_PXRX_DMA_TAG( __GlintTagRender2D, render2D );
  970. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  971. if( !(--count) )
  972. break;
  973. ++pRect;
  974. WAIT_PXRX_DMA_TAGS( 2 );
  975. }
  976. SEND_PXRX_DMA_BATCH;
  977. }
  978. VOID p3r3FillSolidVariableSpans( PPDEV ppdev, LONG count, RECTL *pRect, ULONG logicOp, ULONG bgLogicOp, RBRUSH_COLOR rbc, POINTL *pptlBrush )
  979. {
  980. DWORD config2D, render2D;
  981. ULONG ulColor = rbc.iSolidColor;
  982. GLINT_DECL;
  983. DISPDBG((7, "p3r3FillSolidVariableSpans: %d rects, logicOp = %d, colour = 0x%08X", count, logicOp, rbc.iSolidColor));
  984. SET_WRITE_BUFFERS;
  985. WAIT_PXRX_DMA_TAGS( 5 + 2 );
  986. config2D = config2D_FillSolidVariableSpans[logicOp];
  987. render2D = __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS | __RENDER2D_OP_PATCHORDER;
  988. if( LogicopReadDest[logicOp] )
  989. SET_READ_BUFFERS;
  990. LOAD_FOREGROUNDCOLOUR( ulColor );
  991. LOAD_CONFIG2D( config2D );
  992. while( 1 ) {
  993. DISPDBG((8, "rect: (%d, %d) to (%d, %d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
  994. render2D &= ~(__RENDER2D_WIDTH_MASK | __RENDER2D_HEIGHT_MASK);
  995. render2D |= __RENDER2D_WIDTH(pRect->right - pRect->left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top);
  996. QUEUE_PXRX_DMA_TAG( __GlintTagRectanglePosition, MAKEDWORD_XY(pRect->left, pRect->top) );
  997. QUEUE_PXRX_DMA_TAG( __GlintTagRender2D, render2D );
  998. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  999. if( !(--count) )
  1000. break;
  1001. ++pRect;
  1002. WAIT_PXRX_DMA_TAGS( 2 );
  1003. }
  1004. SEND_PXRX_DMA_BATCH;
  1005. }
  1006. VOID p3r3FillSolid32bpp( PPDEV ppdev, LONG count, RECTL *pRect, ULONG logicOp, ULONG bgLogicOp, RBRUSH_COLOR rbc, POINTL *pptlBrush )
  1007. {
  1008. DWORD config2D, render2D;
  1009. ULONG ulColor = rbc.iSolidColor, left;
  1010. GLINT_DECL;
  1011. config2D = config2D_FillSolid32bpp[logicOp];
  1012. render2D = render2D_FillSolid[logicOp] | __RENDER2D_OP_PATCHORDER;
  1013. if(OFFSCREEN_LIN_DST(ppdev) && (config2D & __CONFIG2D_USERSCISSOR))
  1014. {
  1015. // When filling linear DFBs we can't use the scissor and align to a 32 pixel boundary in x because
  1016. // the coords aren't aligned to a scanline boundary in x. NB. Rectangular DFBs coords in x are always
  1017. // relative to the start of a scanline so the scissor alignment works.
  1018. p3r3FillSolidVariableSpans(ppdev, count, pRect, logicOp, bgLogicOp, rbc, pptlBrush);
  1019. return;
  1020. }
  1021. DISPDBG((7, "p3r3FillSolid32bpp: %d rects, logicOp = %d, colour = 0x%08X", count, logicOp, rbc.iSolidColor));
  1022. SET_WRITE_BUFFERS;
  1023. WAIT_PXRX_DMA_TAGS( 5 + 2 );
  1024. if( LogicopReadDest[logicOp] )
  1025. SET_READ_BUFFERS;
  1026. LOAD_FOREGROUNDCOLOUR( ulColor );
  1027. LOAD_CONFIG2D( config2D );
  1028. if( config2D & __CONFIG2D_USERSCISSOR ) {
  1029. while( 1 ) {
  1030. left = pRect->left & ~31;
  1031. DISPDBG((8, "rect: (%d:%d, %d) to (%d, %d)", pRect->left, left, pRect->top, pRect->right, pRect->bottom));
  1032. render2D &= ~(__RENDER2D_WIDTH_MASK | __RENDER2D_HEIGHT_MASK);
  1033. render2D |= __RENDER2D_WIDTH(pRect->right - left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top);
  1034. QUEUE_PXRX_DMA_INDEX3( __GlintTagFillScissorMinXY, __GlintTagFillRectanglePosition, __GlintTagFillRender2D );
  1035. QUEUE_PXRX_DMA_DWORD( MAKEDWORD_XY(pRect->left , 0) );
  1036. QUEUE_PXRX_DMA_DWORD( MAKEDWORD_XY(left, pRect->top) );
  1037. QUEUE_PXRX_DMA_DWORD( render2D );
  1038. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  1039. if( !(--count) )
  1040. break;
  1041. ++pRect;
  1042. WAIT_PXRX_DMA_DWORDS( 5 );
  1043. }
  1044. } else {
  1045. while( 1 ) {
  1046. DISPDBG((8, "rect: (%d, %d) to (%d, %d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
  1047. render2D &= ~(__RENDER2D_WIDTH_MASK | __RENDER2D_HEIGHT_MASK);
  1048. render2D |= __RENDER2D_WIDTH(pRect->right - pRect->left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top);
  1049. QUEUE_PXRX_DMA_TAG( __GlintTagRectanglePosition, MAKEDWORD_XY(pRect->left, pRect->top) );
  1050. QUEUE_PXRX_DMA_TAG( __GlintTagRender2D, render2D );
  1051. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  1052. if( !(--count) )
  1053. break;
  1054. ++pRect;
  1055. WAIT_PXRX_DMA_TAGS( 2 );
  1056. }
  1057. }
  1058. SEND_PXRX_DMA_BATCH;
  1059. }
  1060. VOID pxrxFillPatMono( PPDEV ppdev, LONG count, RECTL *pRect, ULONG fgLogicOp, ULONG bgLogicOp, RBRUSH_COLOR rbc, POINTL *pptlBrush )
  1061. {
  1062. BRUSHENTRY *pbe;
  1063. ULONG fgColor, bgColor;
  1064. DWORD config2D, render2D;
  1065. LONG c;
  1066. GLINT_DECL;
  1067. DISPDBG((7, "pxrxFillPatMono: %d rects. fgLogicOp = %d, bgLogicop %d", count, fgLogicOp, bgLogicOp));
  1068. // if anything has changed with the brush we must re-realize it. If the brush
  1069. // has been kicked out of the area stipple unit we must fully realize it. If
  1070. // only the alignment has changed we can simply update the alignment for the
  1071. // stipple.
  1072. //
  1073. pbe = rbc.prb->apbe;
  1074. if( (pbe == NULL) || (pbe->prbVerify != rbc.prb) ) {
  1075. DISPDBG((8, "full brush realise"));
  1076. (*ppdev->pgfnPatRealize)(ppdev, rbc.prb, pptlBrush);
  1077. }
  1078. else if( (rbc.prb->ptlBrushOrg.x != pptlBrush->x) ||
  1079. (rbc.prb->ptlBrushOrg.y != pptlBrush->y) ) {
  1080. DISPDBG((8, "changing brush offset"));
  1081. (*ppdev->pgfnMonoOffset)(ppdev, rbc.prb, pptlBrush);
  1082. }
  1083. fgColor = rbc.prb->ulForeColor;
  1084. bgColor = rbc.prb->ulBackColor;
  1085. DISPDBG((8, "fgColor 0x%x, bgColor 0x%x", fgColor, bgColor));
  1086. // we get some common operations which are really noops. we can save
  1087. // lots of time by cutting these out. As this happens a lot for masking
  1088. // operations it's worth doing.
  1089. if( ((fgLogicOp == __GLINT_LOGICOP_AND) && (fgColor == ppdev->ulWhite))
  1090. || ((fgLogicOp == __GLINT_LOGICOP_OR ) && (fgColor == 0))
  1091. || ((fgLogicOp == __GLINT_LOGICOP_XOR) && (fgColor == 0)) )
  1092. fgLogicOp = __GLINT_LOGICOP_NOOP;
  1093. // same for background
  1094. if( ((bgLogicOp == __GLINT_LOGICOP_AND) && (bgColor == ppdev->ulWhite))
  1095. || ((bgLogicOp == __GLINT_LOGICOP_OR ) && (bgColor == 0))
  1096. || ((bgLogicOp == __GLINT_LOGICOP_XOR) && (bgColor == 0)) )
  1097. bgLogicOp = __GLINT_LOGICOP_NOOP;
  1098. if( (fgLogicOp == __GLINT_LOGICOP_NOOP) && (bgLogicOp == __GLINT_LOGICOP_NOOP) ) {
  1099. DISPDBG((8, "both ops are no-op so lets quit now"));
  1100. return;
  1101. }
  1102. config2D = __CONFIG2D_CONSTANTSRC | __CONFIG2D_FBWRITE;
  1103. render2D = __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_AREASTIPPLE | __RENDER2D_OP_PATCHORDER;
  1104. SET_WRITE_BUFFERS;
  1105. WAIT_PXRX_DMA_TAGS( 9 + 2 );
  1106. if( (fgLogicOp != __GLINT_LOGICOP_COPY) || (bgLogicOp != __GLINT_LOGICOP_NOOP) ||
  1107. (glintInfo->pxrxFlags & PXRX_FLAGS_DUAL_WRITING) ||
  1108. (glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITING) ) {
  1109. config2D |= __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(fgLogicOp) | __CONFIG2D_LOGOP_BACK(bgLogicOp);
  1110. render2D |= __RENDER2D_SPANS;
  1111. } else {
  1112. LOAD_FBWRITE_ADDR( 1, ppdev->DstPixelOrigin );
  1113. LOAD_FBWRITE_WIDTH( 1, ppdev->DstPixelDelta );
  1114. LOAD_FBWRITE_OFFSET( 1, ppdev->xyOffsetDst );
  1115. }
  1116. if( LogicopReadDest[fgLogicOp] || LogicopReadDest[bgLogicOp] ) {
  1117. config2D |= __CONFIG2D_FBDESTREAD;
  1118. SET_READ_BUFFERS;
  1119. }
  1120. if( LogicOpReadSrc[fgLogicOp] )
  1121. LOAD_FOREGROUNDCOLOUR( fgColor );
  1122. if( LogicOpReadSrc[bgLogicOp] )
  1123. LOAD_BACKGROUNDCOLOUR( bgColor );
  1124. LOAD_CONFIG2D( config2D );
  1125. c = count;
  1126. while( TRUE ) {
  1127. DISPDBG((8, "mono pattern fill to rect (%d,%d) to (%d,%d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
  1128. QUEUE_PXRX_DMA_TAG( __GlintTagRectanglePosition, MAKEDWORD_XY(pRect->left, pRect->top) );
  1129. QUEUE_PXRX_DMA_TAG( __GlintTagRender2D, render2D | __RENDER2D_WIDTH(pRect->right - pRect->left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top) );
  1130. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  1131. if (--c == 0)
  1132. break;
  1133. pRect++;
  1134. WAIT_PXRX_DMA_TAGS( 2 );
  1135. }
  1136. SEND_PXRX_DMA_BATCH;
  1137. DISPDBG((7, "pxrxFillPatMono returning"));
  1138. }
  1139. VOID p3r3FillPatMonoVariableSpans( PPDEV ppdev, LONG count, RECTL *pRect, ULONG fgLogicOp, ULONG bgLogicOp, RBRUSH_COLOR rbc, POINTL *pptlBrush )
  1140. {
  1141. BRUSHENTRY *pbe;
  1142. ULONG fgColor, bgColor;
  1143. DWORD config2D, render2D;
  1144. LONG c;
  1145. GLINT_DECL;
  1146. DISPDBG((7, "p3r3FillPatMonoVariableSpans: %d rects. fgLogicOp = %d, bgLogicop %d", count, fgLogicOp, bgLogicOp));
  1147. // if anything has changed with the brush we must re-realize it. If the brush
  1148. // has been kicked out of the area stipple unit we must fully realize it. If
  1149. // only the alignment has changed we can simply update the alignment for the
  1150. // stipple.
  1151. //
  1152. pbe = rbc.prb->apbe;
  1153. if( (pbe == NULL) || (pbe->prbVerify != rbc.prb) ) {
  1154. DISPDBG((8, "full brush realise"));
  1155. (*ppdev->pgfnPatRealize)(ppdev, rbc.prb, pptlBrush);
  1156. }
  1157. else if( (rbc.prb->ptlBrushOrg.x != pptlBrush->x) ||
  1158. (rbc.prb->ptlBrushOrg.y != pptlBrush->y) ) {
  1159. DISPDBG((8, "changing brush offset"));
  1160. (*ppdev->pgfnMonoOffset)(ppdev, rbc.prb, pptlBrush);
  1161. }
  1162. fgColor = rbc.prb->ulForeColor;
  1163. bgColor = rbc.prb->ulBackColor;
  1164. DISPDBG((8, "fgColor 0x%x, bgColor 0x%x", fgColor, bgColor));
  1165. // we get some common operations which are really noops. we can save
  1166. // lots of time by cutting these out. As this happens a lot for masking
  1167. // operations it's worth doing.
  1168. if( ((fgLogicOp == __GLINT_LOGICOP_AND) && (fgColor == ppdev->ulWhite))
  1169. || ((fgLogicOp == __GLINT_LOGICOP_OR ) && (fgColor == 0))
  1170. || ((fgLogicOp == __GLINT_LOGICOP_XOR) && (fgColor == 0)) )
  1171. fgLogicOp = __GLINT_LOGICOP_NOOP;
  1172. // same for background
  1173. if( ((bgLogicOp == __GLINT_LOGICOP_AND) && (bgColor == ppdev->ulWhite))
  1174. || ((bgLogicOp == __GLINT_LOGICOP_OR ) && (bgColor == 0))
  1175. || ((bgLogicOp == __GLINT_LOGICOP_XOR) && (bgColor == 0)) )
  1176. bgLogicOp = __GLINT_LOGICOP_NOOP;
  1177. if( (fgLogicOp == __GLINT_LOGICOP_NOOP) && (bgLogicOp == __GLINT_LOGICOP_NOOP) ) {
  1178. DISPDBG((8, "both ops are no-op so lets quit now"));
  1179. return;
  1180. }
  1181. config2D = __CONFIG2D_CONSTANTSRC | __CONFIG2D_FBWRITE;
  1182. render2D = __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS | __RENDER2D_AREASTIPPLE | __RENDER2D_OP_PATCHORDER;
  1183. SET_WRITE_BUFFERS;
  1184. WAIT_PXRX_DMA_TAGS( 7 + 2 );
  1185. config2D |= __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(fgLogicOp) | __CONFIG2D_LOGOP_BACK(bgLogicOp);
  1186. if( LogicopReadDest[fgLogicOp] || LogicopReadDest[bgLogicOp] ) {
  1187. config2D |= __CONFIG2D_FBDESTREAD;
  1188. SET_READ_BUFFERS;
  1189. }
  1190. if( LogicOpReadSrc[fgLogicOp] )
  1191. LOAD_FOREGROUNDCOLOUR( fgColor );
  1192. if( LogicOpReadSrc[bgLogicOp] )
  1193. LOAD_BACKGROUNDCOLOUR( bgColor );
  1194. LOAD_CONFIG2D( config2D );
  1195. c = count;
  1196. while( TRUE ) {
  1197. DISPDBG((8, "mono pattern fill to rect (%d,%d) to (%d,%d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
  1198. QUEUE_PXRX_DMA_TAG( __GlintTagRectanglePosition, MAKEDWORD_XY(pRect->left, pRect->top) );
  1199. QUEUE_PXRX_DMA_TAG( __GlintTagRender2D, render2D | __RENDER2D_WIDTH(pRect->right - pRect->left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top) );
  1200. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  1201. if (--c == 0)
  1202. break;
  1203. pRect++;
  1204. WAIT_PXRX_DMA_TAGS( 2 );
  1205. }
  1206. SEND_PXRX_DMA_BATCH;
  1207. DISPDBG((7, "p3r3FillPatMonoVariableSpans returning"));
  1208. }
  1209. VOID p3r3FillPatMono32bpp( PPDEV ppdev, LONG count, RECTL *pRect, ULONG fgLogicOp, ULONG bgLogicOp, RBRUSH_COLOR rbc, POINTL *pptlBrush )
  1210. {
  1211. BRUSHENTRY *pbe;
  1212. ULONG fgColor, bgColor;
  1213. DWORD config2D, render2D;
  1214. LONG c, left;
  1215. GLINT_DECL;
  1216. DISPDBG((7, "p3r3FillPatMono32bpp: %d rects. fgLogicOp = %d, bgLogicop %d", count, fgLogicOp, bgLogicOp));
  1217. // if anything has changed with the brush we must re-realize it. If the brush
  1218. // has been kicked out of the area stipple unit we must fully realize it. If
  1219. // only the alignment has changed we can simply update the alignment for the
  1220. // stipple.
  1221. //
  1222. pbe = rbc.prb->apbe;
  1223. if( (pbe == NULL) || (pbe->prbVerify != rbc.prb) ) {
  1224. DISPDBG((8, "full brush realise"));
  1225. (*ppdev->pgfnPatRealize)(ppdev, rbc.prb, pptlBrush);
  1226. }
  1227. else if( (rbc.prb->ptlBrushOrg.x != pptlBrush->x) ||
  1228. (rbc.prb->ptlBrushOrg.y != pptlBrush->y) ) {
  1229. DISPDBG((8, "changing brush offset"));
  1230. (*ppdev->pgfnMonoOffset)(ppdev, rbc.prb, pptlBrush);
  1231. }
  1232. fgColor = rbc.prb->ulForeColor;
  1233. bgColor = rbc.prb->ulBackColor;
  1234. DISPDBG((8, "fgColor 0x%x, bgColor 0x%x", fgColor, bgColor));
  1235. // we get some common operations which are really noops. we can save
  1236. // lots of time by cutting these out. As this happens a lot for masking
  1237. // operations it's worth doing.
  1238. if( ((fgLogicOp == __GLINT_LOGICOP_AND) && (fgColor == ppdev->ulWhite))
  1239. || ((fgLogicOp == __GLINT_LOGICOP_OR ) && (fgColor == 0))
  1240. || ((fgLogicOp == __GLINT_LOGICOP_XOR) && (fgColor == 0)) )
  1241. fgLogicOp = __GLINT_LOGICOP_NOOP;
  1242. // same for background
  1243. if( ((bgLogicOp == __GLINT_LOGICOP_AND) && (bgColor == ppdev->ulWhite))
  1244. || ((bgLogicOp == __GLINT_LOGICOP_OR ) && (bgColor == 0))
  1245. || ((bgLogicOp == __GLINT_LOGICOP_XOR) && (bgColor == 0)) )
  1246. bgLogicOp = __GLINT_LOGICOP_NOOP;
  1247. if( (fgLogicOp == __GLINT_LOGICOP_NOOP) && (bgLogicOp == __GLINT_LOGICOP_NOOP) ) {
  1248. DISPDBG((8, "both ops are no-op so lets quit now"));
  1249. return;
  1250. }
  1251. config2D = __CONFIG2D_CONSTANTSRC | __CONFIG2D_FBWRITE;
  1252. render2D = __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_AREASTIPPLE | __RENDER2D_OP_PATCHORDER;
  1253. SET_WRITE_BUFFERS;
  1254. WAIT_PXRX_DMA_TAGS( 9 + 3 );
  1255. if( (fgLogicOp != __GLINT_LOGICOP_COPY) || (bgLogicOp != __GLINT_LOGICOP_NOOP) ||
  1256. (glintInfo->pxrxFlags & PXRX_FLAGS_DUAL_WRITING) ||
  1257. (glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITING) ||
  1258. OFFSCREEN_LIN_DST(ppdev)) {
  1259. config2D |= __CONFIG2D_OPAQUESPANS | __CONFIG2D_LOGOP_FORE(fgLogicOp) | __CONFIG2D_LOGOP_BACK(bgLogicOp);
  1260. render2D |= __RENDER2D_SPANS;
  1261. } else {
  1262. config2D |= __CONFIG2D_USERSCISSOR;
  1263. LOAD_FBWRITE_ADDR( 1, ppdev->DstPixelOrigin );
  1264. LOAD_FBWRITE_WIDTH( 1, ppdev->DstPixelDelta );
  1265. LOAD_FBWRITE_OFFSET( 1, ppdev->xyOffsetDst );
  1266. }
  1267. if( LogicopReadDest[fgLogicOp] || LogicopReadDest[bgLogicOp] ) {
  1268. config2D |= __CONFIG2D_FBDESTREAD;
  1269. SET_READ_BUFFERS;
  1270. }
  1271. if( LogicOpReadSrc[fgLogicOp] )
  1272. LOAD_FOREGROUNDCOLOUR( fgColor );
  1273. if( LogicOpReadSrc[bgLogicOp] )
  1274. LOAD_BACKGROUNDCOLOUR( bgColor );
  1275. LOAD_CONFIG2D( config2D );
  1276. c = count;
  1277. if( config2D & __CONFIG2D_USERSCISSOR ) {
  1278. while( TRUE ) {
  1279. left = pRect->left & ~31;
  1280. DISPDBG((8, "rect: (%d:%d, %d) to (%d, %d)", pRect->left, left, pRect->top, pRect->right, pRect->bottom));
  1281. QUEUE_PXRX_DMA_INDEX3( __GlintTagFillScissorMinXY, __GlintTagFillRectanglePosition, __GlintTagFillRender2D );
  1282. QUEUE_PXRX_DMA_DWORD( MAKEDWORD_XY(pRect->left , 0) );
  1283. QUEUE_PXRX_DMA_DWORD( MAKEDWORD_XY(left, pRect->top) );
  1284. QUEUE_PXRX_DMA_DWORD( render2D | __RENDER2D_WIDTH(pRect->right - left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top) );
  1285. if (--c == 0)
  1286. break;
  1287. pRect++;
  1288. WAIT_PXRX_DMA_DWORDS( 5 );
  1289. }
  1290. } else {
  1291. while( TRUE ) {
  1292. DISPDBG((8, "mono pattern fill to rect (%d,%d) to (%d,%d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
  1293. QUEUE_PXRX_DMA_TAG( __GlintTagRectanglePosition, MAKEDWORD_XY(pRect->left, pRect->top) );
  1294. QUEUE_PXRX_DMA_TAG( __GlintTagRender2D, render2D | __RENDER2D_WIDTH(pRect->right - pRect->left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top) );
  1295. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  1296. if (--c == 0)
  1297. break;
  1298. pRect++;
  1299. WAIT_PXRX_DMA_TAGS( 2 );
  1300. }
  1301. }
  1302. SEND_PXRX_DMA_BATCH;
  1303. DISPDBG((7, "p3r3FillPatMono32bpp returning"));
  1304. }
  1305. /*
  1306. 8 Bpp:
  1307. orgmodeCopy = 3;
  1308. orgmodeLogic = 3;
  1309. lmodeCopy = (1 << 27);
  1310. lmodeLogic = (1 << 27);
  1311. 15 Bpp:
  1312. 16 Bpp:
  1313. 32 Bpp:
  1314. orgmodeCopy = 1;
  1315. orgmodeLogic = 3;
  1316. lmodeCopy = (1 << 27);
  1317. lmodeLogic = (1 << 27);
  1318. ULONG orgmodeCopy = 1, orgmodeLogic = 3;
  1319. ULONG lmodeCopy = (1 << 27), lmodeLogic = (1 << 27);
  1320. ULONG orgmode;
  1321. ULONG lmode;
  1322. */
  1323. VOID pxrxFillPatColor( PPDEV ppdev, LONG count, RECTL *pRect, ULONG logicOp, ULONG bgLogicOp, RBRUSH_COLOR rbc, POINTL *pptlBrush ) {
  1324. BRUSHENTRY *pbe;
  1325. DWORD config2D, render2D;
  1326. LONG index = 0, i;
  1327. ULONG *pulBrush;
  1328. ULONG cRows, cCols;
  1329. POINTL brushOrg;
  1330. GLINT_DECL;
  1331. DISPDBG((7, "pxrxFillPatColor: %d rects, logicOp = %d, brush = 0x%08X", count, logicOp, rbc.prb));
  1332. // Determine the brush origin:
  1333. brushOrg = *pptlBrush;
  1334. if( (logicOp == __GLINT_LOGICOP_COPY) && (ppdev->cPelSize != 0) )
  1335. brushOrg.x += (8 - (ppdev->xyOffsetDst & 0xFFFF)) & 7;
  1336. // If anything has changed with the brush we must re-realize it.
  1337. pbe = rbc.prb->apbe;
  1338. if( (ppdev->PalLUTType != LUTCACHE_BRUSH) || (pbe == NULL) || (pbe->prbVerify != rbc.prb) ) {
  1339. DISPDBG((8, "realising brush"));
  1340. (*ppdev->pgfnPatRealize)(ppdev, rbc.prb, &brushOrg);
  1341. } else
  1342. if( (rbc.prb->ptlBrushOrg.x != brushOrg.x) || (rbc.prb->ptlBrushOrg.y != brushOrg.y) ||
  1343. (rbc.prb->patternBase != ((glintInfo->lutMode >> 18) & 255)) ) {
  1344. ULONG lutMode = glintInfo->lutMode;
  1345. DISPDBG((8, "resetting LUTMode"));
  1346. rbc.prb->ptlBrushOrg.x = brushOrg.x;
  1347. rbc.prb->ptlBrushOrg.y = brushOrg.y;
  1348. DISPDBG((8, "setting new LUT brush origin to (%d, %d)", rbc.prb->ptlBrushOrg.x & 7, rbc.prb->ptlBrushOrg.y & 7));
  1349. lutMode &= ~((7 << 8) | (7 << 12) | (7 << 15) | (255 << 18) | (1 << 26) | (1 << 27));
  1350. lutMode |= (1 << 27) | (1 << 8) | (rbc.prb->patternBase << 18) |
  1351. (((8 - rbc.prb->ptlBrushOrg.x) & 7) << 12) | (((8 - rbc.prb->ptlBrushOrg.y) & 7) << 15);
  1352. WAIT_PXRX_DMA_TAGS( 1 );
  1353. LOAD_LUTMODE( lutMode );
  1354. } else {
  1355. // we're cached already!
  1356. DISPDBG((7, "pxrxFillPatColor: reusing LUT for brush @ %d, origin = (%d,%d)", rbc.prb->patternBase, rbc.prb->ptlBrushOrg.x & 7, rbc.prb->ptlBrushOrg.y & 7));
  1357. }
  1358. SET_WRITE_BUFFERS;
  1359. WAIT_PXRX_DMA_TAGS( 5 + 2 );
  1360. if( (glintInfo->pxrxFlags & PXRX_FLAGS_DUAL_WRITING) ||
  1361. (glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITING) ) {
  1362. config2D = config2D_FillColourDual[logicOp];
  1363. render2D = __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS | __RENDER2D_OP_PATCHORDER; // render2D_FillSolidDual[logicOp]
  1364. if( LogicopReadDest[logicOp] )
  1365. SET_READ_BUFFERS;
  1366. } else {
  1367. config2D = config2D_FillColour[logicOp];
  1368. render2D = render2D_FillSolid[logicOp] | __RENDER2D_OP_PATCHORDER;
  1369. if( LogicopReadDest[logicOp] ) {
  1370. SET_READ_BUFFERS;
  1371. }
  1372. else if( logicOp == __GLINT_LOGICOP_COPY ) {
  1373. LOAD_FBWRITE_ADDR( 1, ppdev->DstPixelOrigin );
  1374. LOAD_FBWRITE_WIDTH( 1, ppdev->DstPixelDelta );
  1375. LOAD_FBWRITE_OFFSET( 1, ppdev->xyOffsetDst );
  1376. }
  1377. }
  1378. LOAD_CONFIG2D( config2D );
  1379. while( 1 ) {
  1380. DISPDBG((8, "rect: (%d, %d) to (%d, %d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
  1381. render2D &= ~(__RENDER2D_WIDTH_MASK | __RENDER2D_HEIGHT_MASK);
  1382. render2D |= __RENDER2D_WIDTH(pRect->right - pRect->left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top);
  1383. QUEUE_PXRX_DMA_TAG( __GlintTagRectanglePosition, MAKEDWORD_XY(pRect->left, pRect->top) );
  1384. QUEUE_PXRX_DMA_TAG( __GlintTagRender2D, render2D );
  1385. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  1386. WAIT_PXRX_DMA_TAGS( 2 );
  1387. if( !(--count) )
  1388. break;
  1389. ++pRect;
  1390. }
  1391. // Invalidate the foreground/background colours 'cos the LUT has just corrupted them!
  1392. WAIT_PXRX_DMA_TAGS( 2 );
  1393. QUEUE_PXRX_DMA_TAG( __GlintTagForegroundColor, glintInfo->foregroundColour );
  1394. QUEUE_PXRX_DMA_TAG( __GlintTagBackgroundColor, glintInfo->backgroundColour );
  1395. SEND_PXRX_DMA_BATCH;
  1396. }
  1397. VOID p3r3FillPatColorVariableSpans( PPDEV ppdev, LONG count, RECTL *pRect, ULONG logicOp, ULONG bgLogicOp, RBRUSH_COLOR rbc, POINTL *pptlBrush ) {
  1398. BRUSHENTRY *pbe;
  1399. DWORD config2D, render2D;
  1400. LONG index = 0, i;
  1401. ULONG *pulBrush;
  1402. ULONG cRows, cCols;
  1403. POINTL brushOrg;
  1404. GLINT_DECL;
  1405. DISPDBG((7, "p3r3FillPatColorVariableSpans: %d rects, logicOp = %d, brush = 0x%08X", count, logicOp, rbc.prb));
  1406. // Determine the brush origin:
  1407. brushOrg = *pptlBrush;
  1408. if( (logicOp == __GLINT_LOGICOP_COPY) && (ppdev->cPelSize != 0) )
  1409. brushOrg.x += (8 - (ppdev->xyOffsetDst & 0xFFFF)) & 7;
  1410. // If anything has changed with the brush we must re-realize it.
  1411. pbe = rbc.prb->apbe;
  1412. if( (ppdev->PalLUTType != LUTCACHE_BRUSH) || (pbe == NULL) || (pbe->prbVerify != rbc.prb) ) {
  1413. DISPDBG((8, "realising brush"));
  1414. (*ppdev->pgfnPatRealize)(ppdev, rbc.prb, &brushOrg);
  1415. } else
  1416. if( (rbc.prb->ptlBrushOrg.x != brushOrg.x) || (rbc.prb->ptlBrushOrg.y != brushOrg.y) ||
  1417. (rbc.prb->patternBase != ((glintInfo->lutMode >> 18) & 255)) ) {
  1418. ULONG lutMode = glintInfo->lutMode;
  1419. DISPDBG((8, "resetting LUTMode"));
  1420. rbc.prb->ptlBrushOrg.x = brushOrg.x;
  1421. rbc.prb->ptlBrushOrg.y = brushOrg.y;
  1422. DISPDBG((8, "setting new LUT brush origin to (%d, %d)", rbc.prb->ptlBrushOrg.x & 7, rbc.prb->ptlBrushOrg.y & 7));
  1423. lutMode &= ~((7 << 8) | (7 << 12) | (7 << 15) | (255 << 18) | (1 << 26) | (1 << 27));
  1424. lutMode |= (1 << 27) | (1 << 8) | (rbc.prb->patternBase << 18) |
  1425. (((8 - rbc.prb->ptlBrushOrg.x) & 7) << 12) | (((8 - rbc.prb->ptlBrushOrg.y) & 7) << 15);
  1426. WAIT_PXRX_DMA_TAGS( 1 );
  1427. LOAD_LUTMODE( lutMode );
  1428. } else {
  1429. // we're cached already!
  1430. DISPDBG((7, "p3r3FillPatColorVariableSpans: reusing LUT for brush @ %d, origin = (%d,%d)", rbc.prb->patternBase, rbc.prb->ptlBrushOrg.x & 7, rbc.prb->ptlBrushOrg.y & 7));
  1431. }
  1432. SET_WRITE_BUFFERS;
  1433. WAIT_PXRX_DMA_TAGS( 5 + 2 );
  1434. config2D = config2D_FillColourDual[logicOp];
  1435. render2D = __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS | __RENDER2D_OP_PATCHORDER;
  1436. if( LogicopReadDest[logicOp] )
  1437. SET_READ_BUFFERS;
  1438. LOAD_CONFIG2D( config2D );
  1439. while( 1 ) {
  1440. DISPDBG((8, "rect: (%d, %d) to (%d, %d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
  1441. render2D &= ~(__RENDER2D_WIDTH_MASK | __RENDER2D_HEIGHT_MASK);
  1442. render2D |= __RENDER2D_WIDTH(pRect->right - pRect->left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top);
  1443. QUEUE_PXRX_DMA_TAG( __GlintTagRectanglePosition, MAKEDWORD_XY(pRect->left, pRect->top) );
  1444. QUEUE_PXRX_DMA_TAG( __GlintTagRender2D, render2D );
  1445. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  1446. WAIT_PXRX_DMA_TAGS( 2 );
  1447. if( !(--count) )
  1448. break;
  1449. ++pRect;
  1450. }
  1451. // Invalidate the foreground/background colours 'cos the LUT has just corrupted them!
  1452. WAIT_PXRX_DMA_TAGS( 2 );
  1453. QUEUE_PXRX_DMA_TAG( __GlintTagForegroundColor, glintInfo->foregroundColour );
  1454. QUEUE_PXRX_DMA_TAG( __GlintTagBackgroundColor, glintInfo->backgroundColour );
  1455. SEND_PXRX_DMA_BATCH;
  1456. }
  1457. VOID pxrxCacheBrush16bpp(PDEV *ppdev, RBRUSH_COLOR rbc, POINTL *pbrushOrg)
  1458. {
  1459. BRUSHENTRY *pbe;
  1460. GLINT_DECL;
  1461. // If anything has changed with the brush we must re-realize it.
  1462. pbe = rbc.prb->apbe;
  1463. if( (ppdev->PalLUTType != LUTCACHE_BRUSH) || (pbe == NULL) || (pbe->prbVerify != rbc.prb) ) {
  1464. DISPDBG((8, "pxrxCacheBrush16bpp: realising brush"));
  1465. ppdev->pgfnPatRealize(ppdev, rbc.prb, pbrushOrg);
  1466. } else
  1467. if( (rbc.prb->ptlBrushOrg.x != pbrushOrg->x) || (rbc.prb->ptlBrushOrg.y != pbrushOrg->y) ||
  1468. (rbc.prb->patternBase != ((glintInfo->lutMode >> 18) & 255)) ) {
  1469. ULONG lutMode = glintInfo->lutMode;
  1470. DISPDBG((8, "pxrxCacheBrush16bpp: resetting LUTMode"));
  1471. rbc.prb->ptlBrushOrg.x = pbrushOrg->x;
  1472. rbc.prb->ptlBrushOrg.y = pbrushOrg->y;
  1473. DISPDBG((8, "pxrxCacheBrush16bpp: setting new LUT brush origin to (%d, %d)", rbc.prb->ptlBrushOrg.x & 7, rbc.prb->ptlBrushOrg.y & 7));
  1474. lutMode &= ~((7 << 8) | (7 << 12) | (7 << 15) | (255 << 18) | (1 << 26) | (1 << 27));
  1475. lutMode |= (1 << 27) | (1 << 8) | (rbc.prb->patternBase << 18) |
  1476. (((8 - rbc.prb->ptlBrushOrg.x) & 7) << 12) | (((8 - rbc.prb->ptlBrushOrg.y) & 7) << 15);
  1477. WAIT_PXRX_DMA_TAGS( 1 );
  1478. LOAD_LUTMODE( lutMode );
  1479. } else {
  1480. // we're cached already!
  1481. DISPDBG((7, "pxrxCacheBrush16bpp: reusing LUT for brush @ %d, origin = (%d,%d)", rbc.prb->patternBase, rbc.prb->ptlBrushOrg.x & 7, rbc.prb->ptlBrushOrg.y & 7));
  1482. }
  1483. }
  1484. VOID p3r3FillPatColor16bpp( PPDEV ppdev, LONG count, RECTL *pRect, ULONG logicOp, ULONG bgLogicOp, RBRUSH_COLOR rbc, POINTL *pptlBrush ) {
  1485. DWORD config2D, render2D;
  1486. LONG cx, cy, i;
  1487. POINTL brushOrg;
  1488. BOOL bCoreInitialized = FALSE;
  1489. BOOL bBypassInitialized = FALSE;
  1490. GLINT_DECL;
  1491. DISPDBG((7, "pxrxFillPatColor16bpp: %d rects, logicOp = %d, brush = 0x%08X", count, logicOp, rbc.prb));
  1492. // Determine the brush origin:
  1493. brushOrg = *pptlBrush;
  1494. if( (logicOp == __GLINT_LOGICOP_COPY) && (ppdev->cPelSize != 0) )
  1495. brushOrg.x += (8 - (ppdev->xyOffsetDst & 0xFFFF)) & 7;
  1496. while( 1 ) {
  1497. cx = pRect->right - pRect->left;
  1498. cy = pRect->bottom - pRect->top;
  1499. // render through core
  1500. if(!bCoreInitialized) {
  1501. pxrxCacheBrush16bpp(ppdev, rbc, &brushOrg);
  1502. SET_WRITE_BUFFERS;
  1503. WAIT_PXRX_DMA_TAGS( 5 + 2 );
  1504. if( (glintInfo->pxrxFlags & PXRX_FLAGS_DUAL_WRITING) ||
  1505. (glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITING) ) {
  1506. config2D = config2D_FillColourDual[logicOp];
  1507. render2D = __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS | __RENDER2D_OP_PATCHORDER; // render2D_FillSolidDual[logicOp]
  1508. if( LogicopReadDest[logicOp] )
  1509. SET_READ_BUFFERS;
  1510. } else {
  1511. config2D = config2D_FillColour[logicOp];
  1512. render2D = render2D_FillSolid[logicOp] | __RENDER2D_OP_PATCHORDER;
  1513. if( LogicopReadDest[logicOp] ) {
  1514. SET_READ_BUFFERS;
  1515. }
  1516. else if( logicOp == __GLINT_LOGICOP_COPY ) {
  1517. LOAD_FBWRITE_ADDR( 1, ppdev->DstPixelOrigin );
  1518. LOAD_FBWRITE_WIDTH( 1, ppdev->DstPixelDelta );
  1519. LOAD_FBWRITE_OFFSET( 1, ppdev->xyOffsetDst );
  1520. }
  1521. }
  1522. LOAD_CONFIG2D( config2D );
  1523. bCoreInitialized = TRUE;
  1524. }
  1525. render2D &= ~(__RENDER2D_WIDTH_MASK | __RENDER2D_HEIGHT_MASK);
  1526. render2D |= __RENDER2D_WIDTH(pRect->right - pRect->left) | __RENDER2D_HEIGHT(pRect->bottom - pRect->top);
  1527. QUEUE_PXRX_DMA_TAG( __GlintTagRectanglePosition, MAKEDWORD_XY(pRect->left, pRect->top) );
  1528. QUEUE_PXRX_DMA_TAG( __GlintTagRender2D, render2D );
  1529. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  1530. WAIT_PXRX_DMA_TAGS( 2 );
  1531. if( !(--count) )
  1532. break;
  1533. ++pRect;
  1534. }
  1535. // Invalidate the foreground/background colours 'cos the LUT has just corrupted them!
  1536. WAIT_PXRX_DMA_TAGS( 2 );
  1537. QUEUE_PXRX_DMA_TAG( __GlintTagForegroundColor, glintInfo->foregroundColour );
  1538. QUEUE_PXRX_DMA_TAG( __GlintTagBackgroundColor, glintInfo->backgroundColour );
  1539. SEND_PXRX_DMA_BATCH;
  1540. }
  1541. VOID pxrxCacheBrush32bpp(PDEV *ppdev, RBRUSH_COLOR rbc, POINTL *pbrushOrg)
  1542. {
  1543. BRUSHENTRY *pbe;
  1544. GLINT_DECL;
  1545. // If anything has changed with the brush we must re-realize it.
  1546. pbe = rbc.prb->apbe;
  1547. if( (ppdev->PalLUTType != LUTCACHE_BRUSH) || (pbe == NULL) || (pbe->prbVerify != rbc.prb) ) {
  1548. DISPDBG((8, "pxrxCacheBrush32bpp: realising brush"));
  1549. ppdev->pgfnPatRealize(ppdev, rbc.prb, pbrushOrg);
  1550. } else
  1551. if( (rbc.prb->ptlBrushOrg.x != pbrushOrg->x) || (rbc.prb->ptlBrushOrg.y != pbrushOrg->y) ||
  1552. (rbc.prb->patternBase != ((glintInfo->lutMode >> 18) & 255)) ) {
  1553. ULONG lutMode = glintInfo->lutMode;
  1554. DISPDBG((8, "pxrxCacheBrush32bpp: resetting LUTMode"));
  1555. rbc.prb->ptlBrushOrg.x = pbrushOrg->x;
  1556. rbc.prb->ptlBrushOrg.y = pbrushOrg->y;
  1557. DISPDBG((8, "pxrxCacheBrush32bpp: setting new LUT brush origin to (%d, %d)", rbc.prb->ptlBrushOrg.x & 7, rbc.prb->ptlBrushOrg.y & 7));
  1558. lutMode &= ~((7 << 8) | (7 << 12) | (7 << 15) | (255 << 18) | (1 << 26) | (1 << 27));
  1559. lutMode |= (1 << 27) | (1 << 8) | (rbc.prb->patternBase << 18) |
  1560. (((8 - rbc.prb->ptlBrushOrg.x) & 7) << 12) | (((8 - rbc.prb->ptlBrushOrg.y) & 7) << 15);
  1561. WAIT_PXRX_DMA_TAGS( 1 );
  1562. LOAD_LUTMODE( lutMode );
  1563. } else {
  1564. // we're cached already!
  1565. DISPDBG((7, "pxrxCacheBrush32bpp: reusing LUT for brush @ %d, origin = (%d, %d)", rbc.prb->patternBase, rbc.prb->ptlBrushOrg.x & 7, rbc.prb->ptlBrushOrg.y & 7));
  1566. }
  1567. }
  1568. VOID p3r3FillPatColor32bpp( PPDEV ppdev, LONG count, RECTL *pRect, ULONG logicOp, ULONG bgLogicOp, RBRUSH_COLOR rbc, POINTL *pptlBrush ) {
  1569. POINTL brushOrg;
  1570. DWORD config2D, render2D;
  1571. LONG cx, cy, i, left;
  1572. BOOL bCoreInitialized = FALSE;
  1573. BOOL bBypassInitialized = FALSE;
  1574. GLINT_DECL;
  1575. // Determine the brush origin:
  1576. brushOrg = *pptlBrush;
  1577. DISPDBG((7, "p3r3FillPatColor32bpp: %d rects, logicOp = %d, brush = 0x%08X", count, logicOp, rbc.prb));
  1578. while( 1 ) {
  1579. cx = pRect->right - pRect->left;
  1580. cy = pRect->bottom - pRect->top;
  1581. // render through core
  1582. if(!bCoreInitialized) {
  1583. pxrxCacheBrush32bpp(ppdev, rbc, &brushOrg);
  1584. SET_WRITE_BUFFERS;
  1585. WAIT_PXRX_DMA_TAGS( 5 + 2 );
  1586. if( (glintInfo->pxrxFlags & PXRX_FLAGS_DUAL_WRITING) ||
  1587. (glintInfo->pxrxFlags & PXRX_FLAGS_STEREO_WRITING) ||
  1588. OFFSCREEN_LIN_DST(ppdev)) {
  1589. config2D = config2D_FillColourDual[logicOp];
  1590. render2D = __RENDER2D_INCX | __RENDER2D_INCY | __RENDER2D_SPANS | __RENDER2D_OP_PATCHORDER; // render2D_FillSolidDual[logicOp]
  1591. if( LogicopReadDest[logicOp] )
  1592. SET_READ_BUFFERS;
  1593. } else {
  1594. config2D = config2D_FillColour32bpp[logicOp];
  1595. render2D = render2D_FillSolid[logicOp] | __RENDER2D_OP_PATCHORDER;
  1596. if( LogicopReadDest[logicOp] ) {
  1597. SET_READ_BUFFERS;
  1598. }
  1599. else if( logicOp == __GLINT_LOGICOP_COPY ) {
  1600. LOAD_FBWRITE_ADDR( 1, ppdev->DstPixelOrigin );
  1601. LOAD_FBWRITE_WIDTH( 1, ppdev->DstPixelDelta );
  1602. LOAD_FBWRITE_OFFSET( 1, ppdev->xyOffsetDst );
  1603. }
  1604. }
  1605. LOAD_CONFIG2D( config2D );
  1606. bCoreInitialized = TRUE;
  1607. if( config2D & __CONFIG2D_USERSCISSOR ) {
  1608. left = pRect->left & ~31;
  1609. DISPDBG((8, "p3r3FillPatColor32bpp: scissor core fill (%d:%d, %d) to (%d, %d)", pRect->left, left, pRect->top, pRect->right, pRect->bottom));
  1610. render2D &= ~(__RENDER2D_WIDTH_MASK | __RENDER2D_HEIGHT_MASK);
  1611. render2D |= __RENDER2D_WIDTH(pRect->right - left) | __RENDER2D_HEIGHT(cy);
  1612. QUEUE_PXRX_DMA_INDEX3( __GlintTagFillScissorMinXY, __GlintTagFillRectanglePosition, __GlintTagFillRender2D );
  1613. QUEUE_PXRX_DMA_DWORD( MAKEDWORD_XY(pRect->left , 0) );
  1614. QUEUE_PXRX_DMA_DWORD( MAKEDWORD_XY(left, pRect->top) );
  1615. QUEUE_PXRX_DMA_DWORD( render2D );
  1616. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  1617. WAIT_PXRX_DMA_DWORDS( 5 );
  1618. } else {
  1619. DISPDBG((8, "p3r3FillPatColor32bpp: core fill (%d, %d) to (%d, %d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
  1620. render2D &= ~(__RENDER2D_WIDTH_MASK | __RENDER2D_HEIGHT_MASK);
  1621. render2D |= __RENDER2D_WIDTH(cx) | __RENDER2D_HEIGHT(cy);
  1622. QUEUE_PXRX_DMA_TAG( __GlintTagRectanglePosition, MAKEDWORD_XY(pRect->left, pRect->top) );
  1623. QUEUE_PXRX_DMA_TAG( __GlintTagRender2D, render2D );
  1624. FLUSH_PXRX_PATCHED_RENDER2D(pRect->left, pRect->right);
  1625. WAIT_PXRX_DMA_TAGS( 2 );
  1626. }
  1627. }
  1628. if( !(--count) )
  1629. break;
  1630. ++pRect;
  1631. }
  1632. // Invalidate the foreground/background colours 'cos the LUT has just corrupted them!
  1633. WAIT_PXRX_DMA_TAGS( 2 );
  1634. QUEUE_PXRX_DMA_TAG( __GlintTagForegroundColor, glintInfo->foregroundColour );
  1635. QUEUE_PXRX_DMA_TAG( __GlintTagBackgroundColor, glintInfo->backgroundColour );
  1636. SEND_PXRX_DMA_BATCH;
  1637. }
  1638. VOID pxrxMaskCopyBlt( PPDEV ppdev, RECTL *a, LONG b, SURFOBJ *c, POINTL *d, ULONG e, ULONG f, POINTL *g, RECTL *h ) {
  1639. DISPDBG((ERRLVL,"pxrxMaskCopyBlt was called"));
  1640. }
  1641. VOID pxrxPatRealize( PPDEV ppdev, RBRUSH *prb, POINTL *pptlBrush )
  1642. {
  1643. BRUSHENTRY *pbe;
  1644. LONG iBrushCache;
  1645. LONG i;
  1646. DWORD *pSrc;
  1647. GLINT_DECL;
  1648. DISPDBG((7, "pxrxPatRealize started"));
  1649. pbe = prb->apbe;
  1650. if( prb->fl & RBRUSH_2COLOR ) {
  1651. if( (pbe == NULL) || (pbe->prbVerify != prb) ) {
  1652. // mono brushes are realized into the area stipple unit. For this we
  1653. // have a set of special BRUSHENTRYs, one for each board.
  1654. DISPDBG((8, "loading mono brush into cache"));
  1655. pbe = &ppdev->abeMono;
  1656. pbe->prbVerify = prb;
  1657. prb->apbe = pbe;
  1658. }
  1659. } else {
  1660. if( ppdev->PalLUTType != LUTCACHE_BRUSH ) {
  1661. // Someone has hijacked the LUT so we need to invalidate it:
  1662. ppdev->PalLUTType = LUTCACHE_BRUSH;
  1663. for( i = 0; i < MAX_P3_BRUSHES; i++ )
  1664. ppdev->abeP3[i].prbVerify = NULL;
  1665. }
  1666. if( (pbe == NULL) || (pbe->prbVerify != prb) ) {
  1667. // colourbrushes are realized into the LUT unit table.
  1668. DISPDBG((8, "loading colour brush into cache"));
  1669. iBrushCache = ppdev->iBrushCacheP3;
  1670. pbe = &ppdev->abeP3[iBrushCache];
  1671. // Update our links:
  1672. pbe->prbVerify = prb;
  1673. prb->apbe = pbe;
  1674. prb->patternBase = iBrushCache * (256 / MAX_P3_BRUSHES); // Should be related to colour depth ???
  1675. DISPDBG((8, "new cache entry allocated for color brush @ entry %d", prb->patternBase));
  1676. iBrushCache++;
  1677. if( iBrushCache >= MAX_P3_BRUSHES )
  1678. iBrushCache = 0;
  1679. ppdev->iBrushCacheP3 = iBrushCache;
  1680. }
  1681. }
  1682. pSrc = &prb->aulPattern[0];
  1683. // we're going to load mono patterns into the area stipple and set the
  1684. // start offset to the brush origin. WARNING: we assume that we are
  1685. // running little endian. I believe this is always true for NT.
  1686. if( prb->fl & RBRUSH_2COLOR ) {
  1687. // this function loads the stipple offset into the hardware. We also call
  1688. // this function on its own if the brush is realized but its offset changes.
  1689. // In that case we don't have to go through a complete realize again.
  1690. (*ppdev->pgfnMonoOffset)(ppdev, prb, pptlBrush);
  1691. DISPDBG((8, "area stipple pattern:"));
  1692. WAIT_PXRX_DMA_DWORDS( 9 );
  1693. QUEUE_PXRX_DMA_INC( __GlintTagAreaStipplePattern0, 8 );
  1694. QUEUE_PXRX_DMA_BUFF( pSrc, 8 );
  1695. SEND_PXRX_DMA_BATCH;
  1696. //for( i = 0; i < 8; ++i, ++pSrc ) {
  1697. // DISPDBG((8, "\t0x%08x", *pSrc));
  1698. //}
  1699. DISPDBG((7, "area stipple downloaded. pxrxPatRealize done"));
  1700. return;
  1701. } else {
  1702. ULONG lutMode;
  1703. prb->ptlBrushOrg.x = pptlBrush->x;
  1704. prb->ptlBrushOrg.y = pptlBrush->y;
  1705. lutMode = (1 << 27) | (1 << 8) | (prb->patternBase << 18) | // SpanOp = 8x8 brush, pattern base, x-offset, y-offset
  1706. (((8 - prb->ptlBrushOrg.x) & 7) << 12) | (((8 - prb->ptlBrushOrg.y) & 7) << 15);
  1707. DISPDBG((8, "setting new LUT brush origin to (%d, %d) @ %d", prb->ptlBrushOrg.x & 7, prb->ptlBrushOrg.y & 7, prb->patternBase));
  1708. switch( ppdev->cPelSize ) {
  1709. case 0: // 8 bpp
  1710. DISPDBG((8, "LUT pattern (8bpp, 8x8):"));
  1711. WAIT_PXRX_DMA_DWORDS( 4 + 17 );
  1712. LOAD_LUTMODE( lutMode );
  1713. QUEUE_PXRX_DMA_TAG( __PXRXTagLUTIndex, prb->patternBase );
  1714. QUEUE_PXRX_DMA_HOLD( __PXRXTagLUTData, 8 * 2 );
  1715. QUEUE_PXRX_DMA_BUFF( pSrc, 8 * 2 );
  1716. //for( i = 0; i < 8; ++i ) {
  1717. // DISPDBG((8, "\t0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x",
  1718. // pSrc[0] & 0xFF, (pSrc[0] >> 8) & 0xFF, (pSrc[0] >> 16) & 0xFF, (pSrc[0] >> 24) & 0xFF,
  1719. // pSrc[1] & 0xFF, (pSrc[1] >> 8) & 0xFF, (pSrc[2] >> 16) & 0xFF, (pSrc[3] >> 24) & 0xFF));
  1720. // pSrc += 2;
  1721. //}
  1722. SEND_PXRX_DMA_BATCH;
  1723. DISPDBG((7, "LUT downloaded. pxrxPatRealize done"));
  1724. return;
  1725. case 1: // 16 bpp
  1726. DISPDBG((8, "LUT pattern (16bpp, 8x8):"));
  1727. WAIT_PXRX_DMA_DWORDS( 4 + 33 );
  1728. LOAD_LUTMODE( lutMode );
  1729. QUEUE_PXRX_DMA_TAG( __PXRXTagLUTIndex, prb->patternBase );
  1730. QUEUE_PXRX_DMA_HOLD( __PXRXTagLUTData, 8 * 4 );
  1731. QUEUE_PXRX_DMA_BUFF( pSrc, 8 * 4 );
  1732. //for( i = 0; i < 8; ++i ) {
  1733. // DISPDBG((8, "\t0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x",
  1734. // pSrc[0] & 0xFFFF, pSrc[0] >> 16, pSrc[1] & 0xFFFF, pSrc[1] >> 16,
  1735. // pSrc[2] & 0xFFFF, pSrc[2] >> 16, pSrc[3] & 0xFFFF, pSrc[3] >> 16));
  1736. // pSrc += 4;
  1737. //}
  1738. SEND_PXRX_DMA_BATCH;
  1739. DISPDBG((7, "LUT downloaded. pxrxPatRealize done"));
  1740. return;
  1741. case 2: // 32 bpp
  1742. DISPDBG((8, "LUT pattern (32bpp, 8x8):"));
  1743. WAIT_PXRX_DMA_DWORDS( 4 + 65 );
  1744. LOAD_LUTMODE( lutMode );
  1745. QUEUE_PXRX_DMA_TAG( __PXRXTagLUTIndex, prb->patternBase );
  1746. QUEUE_PXRX_DMA_HOLD( __PXRXTagLUTData, 8 * 8 );
  1747. QUEUE_PXRX_DMA_BUFF( pSrc, 8 * 8 );
  1748. //for( i = 0; i < 8; ++i ) {
  1749. // DISPDBG((8, "\t0x%06x, 0x%06x, 0x%06x, 0x%06x, 0x%06x, 0x%06x, 0x%06x, 0x%06x",
  1750. // pSrc[0], pSrc[1], pSrc[2], pSrc[3], pSrc[4], pSrc[5], pSrc[6], pSrc[7]));
  1751. // pSrc += 8;
  1752. //}
  1753. SEND_PXRX_DMA_BATCH;
  1754. DISPDBG((7, "LUT downloaded. pxrxPatRealize done"));
  1755. return;
  1756. }
  1757. }
  1758. DISPDBG((-1, "pxrxPatRealize: Failed to realize brush!"));
  1759. }
  1760. VOID pxrxMonoOffset( PPDEV ppdev, RBRUSH *prb, POINTL *pptlBrush )
  1761. {
  1762. DWORD mode;
  1763. GLINT_DECL;
  1764. DISPDBG((7, "pxrxMonoOffset started"));
  1765. // construct the AreaStippleMode value. It contains the pattern size,
  1766. // the offset for the brush origin and the enable bit. Remember the
  1767. // offset so we can later check if it changes and update the hardware.
  1768. // Remember the mode so we can do a mirrored stipple easily.
  1769. prb->ptlBrushOrg.x = pptlBrush->x;
  1770. prb->ptlBrushOrg.y = pptlBrush->y;
  1771. mode = __PERMEDIA_ENABLE |
  1772. AREA_STIPPLE_XSEL(__GLINT_AREA_STIPPLE_32_PIXEL_PATTERN) |
  1773. AREA_STIPPLE_YSEL(__GLINT_AREA_STIPPLE_8_PIXEL_PATTERN) |
  1774. AREA_STIPPLE_MIRROR_X |
  1775. AREA_STIPPLE_XOFF(8 - (prb->ptlBrushOrg.x & 7)) |
  1776. AREA_STIPPLE_YOFF(8 - (prb->ptlBrushOrg.y & 7));
  1777. if( glintInfo->config2D & __CONFIG2D_OPAQUESPANS )
  1778. mode |= (1 << 20);
  1779. prb->areaStippleMode = mode;
  1780. DISPDBG((8, "setting new area stipple offset to %d, %d",
  1781. 8 - (prb->ptlBrushOrg.x & 7),
  1782. 8 - (prb->ptlBrushOrg.y & 7)));
  1783. WAIT_PXRX_DMA_TAGS( 1 );
  1784. QUEUE_PXRX_DMA_TAG( __GlintTagAreaStippleMode, mode );
  1785. // SEND_PXRX_DMA_BATCH;
  1786. DISPDBG((7, "pxrxMonoOffset done"));
  1787. }
  1788. VOID pxrxRepNibbles( PPDEV ppdev, RECTL *a, CLIPOBJ *b ) {
  1789. DISPDBG((ERRLVL,"pxrxRepNibbles was called"));
  1790. }
  1791. #if PXRX_DMA_BUFFER_CHECK
  1792. void checkPXRXdmaValidBuffer( PPDEV ppdev, GlintDataPtr glintInfo, ULONG type, ULONG count ) {
  1793. ULONG *ptr, origCount = count, failure = FALSE;
  1794. if(!inPxRxContextSwitch && (*ppdev->pCurrentCtxt != glintInfo->ddCtxtId))
  1795. {
  1796. DISPDBG((-1000, "CHECK_PXRX_DMA_VALIDITY: ERROR - not in 2D context!!!" ));
  1797. return;
  1798. }
  1799. ASSERTDD( (gi_pxrxDMA.NTbuff == 0) || (gi_pxrxDMA.NTbuff == 1), "CHECK_PXRX_DMA_VALIDITY failed for NTbuff!");
  1800. /*
  1801. 0k - 16k = 16k = protection zone 0 pxrxDMA.bufferBase
  1802. 16k - 56k = 40k = buffer 0 (40k) gi_pxrxDMA.DMAaddrL[0]
  1803. 56k - 72k = 16k = protection zone 1 gi_pxrxDMA.DMAaddrEndL[0]
  1804. 72k - 112k = 40k = buffer 1 gi_pxrxDMA.DMAaddrL[1]
  1805. 112k - 128k = 16k = protection zone 2 gi_pxrxDMA.DMAaddrEndL[1]
  1806. pxrxDMA.bufferTop
  1807. */
  1808. // DISPDBG((-1, "0x%08X - 0x%08X = 0x%08X ?=? 0x%08X", gi_pxrxDMA.DMAaddrL[0], pxrxDMA_bufferBase , (gi_pxrxDMA.DMAaddrL[0] - pxrxDMA_bufferBase ), PXRX_DMA_BUFFER_CHECK_SIZE));
  1809. // DISPDBG((-1, "0x%08X - 0x%08X = 0x%08X ?=? 0x%08X", gi_pxrxDMA.DMAaddrL[1], gi_pxrxDMA.DMAaddrEndL[0], (gi_pxrxDMA.DMAaddrL[1] - gi_pxrxDMA.DMAaddrEndL[0]), PXRX_DMA_BUFFER_CHECK_SIZE));
  1810. // DISPDBG((-1, "0x%08X - 0x%08X = 0x%08X ?=? 0x%08X", pxrxDMA_bufferTop , gi_pxrxDMA.DMAaddrEndL[1], ( pxrxDMA_bufferTop - gi_pxrxDMA.DMAaddrEndL[1]), PXRX_DMA_BUFFER_CHECK_SIZE));
  1811. // start0 - base == bufferSize
  1812. if( (gi_pxrxDMA.DMAaddrL[0] - glintInfo->pxrxDMA_bufferBase) != (PXRX_DMA_BUFFER_CHECK_SIZE) ) {
  1813. DISPDBG((-1000, "CHECK_BUFF failed on protection zone 0's size! (%d vs %d)",
  1814. gi_pxrxDMA.DMAaddrL[0] - glintInfo->pxrxDMA_bufferBase, PXRX_DMA_BUFFER_CHECK_SIZE));
  1815. DebugBreak();
  1816. }
  1817. // start1 - end0 == bufferSize
  1818. if( (gi_pxrxDMA.DMAaddrL[1] - gi_pxrxDMA.DMAaddrEndL[0]) != (PXRX_DMA_BUFFER_CHECK_SIZE) ) {
  1819. DISPDBG((-1000, "CHECK_BUFF failed on protection zone 1's size! (%d vs %d)",
  1820. gi_pxrxDMA.DMAaddrL[1] - gi_pxrxDMA.DMAaddrEndL[0], PXRX_DMA_BUFFER_CHECK_SIZE));
  1821. DebugBreak();
  1822. }
  1823. // top - end1 == bufferSize
  1824. if( (glintInfo->pxrxDMA_bufferTop - gi_pxrxDMA.DMAaddrEndL[1]) != (PXRX_DMA_BUFFER_CHECK_SIZE) ) {
  1825. DISPDBG((-1000, "CHECK_BUFF failed on protection zone 2's size! (%d vs %d)",
  1826. glintInfo->pxrxDMA_bufferTop - gi_pxrxDMA.DMAaddrEndL[1], PXRX_DMA_BUFFER_CHECK_SIZE));
  1827. DebugBreak();
  1828. }
  1829. // end0 - start0 == end1 - start1
  1830. if( (gi_pxrxDMA.DMAaddrEndL[0] - gi_pxrxDMA.DMAaddrL[0]) != (gi_pxrxDMA.DMAaddrEndL[1] - gi_pxrxDMA.DMAaddrL[1]) ) {
  1831. DISPDBG((-1000, "CHECK_BUFF failed on buffer sizes! (%d vs %d)",
  1832. gi_pxrxDMA.DMAaddrEndL[0] - gi_pxrxDMA.DMAaddrL[0], gi_pxrxDMA.DMAaddrEndL[1] - gi_pxrxDMA.DMAaddrL[1]));
  1833. DebugBreak();
  1834. }
  1835. // (start0 <= NTptr <= end0) || (start1 <= NTptr <= end1)
  1836. if( ((gi_pxrxDMA.NTptr < gi_pxrxDMA.DMAaddrL[0]) || (gi_pxrxDMA.NTptr > gi_pxrxDMA.DMAaddrEndL[0])) &&
  1837. ((gi_pxrxDMA.NTptr < gi_pxrxDMA.DMAaddrL[1]) || (gi_pxrxDMA.NTptr > gi_pxrxDMA.DMAaddrEndL[1])) ) {
  1838. DISPDBG((-1000, "CHECK_BUFF failed for NTptr!"));
  1839. DISPDBG((-1000, " 0x%08X: (0x%08X:0x%08X) or (0x%08X:0x%08X)", gi_pxrxDMA.NTptr,
  1840. gi_pxrxDMA.DMAaddrL[0], gi_pxrxDMA.DMAaddrEndL[0],
  1841. gi_pxrxDMA.DMAaddrL[1], gi_pxrxDMA.DMAaddrEndL[1]));
  1842. DebugBreak();
  1843. } else {
  1844. // startCurrent <= NTptr <= endCurrent
  1845. if( (gi_pxrxDMA.NTptr < gi_pxrxDMA.DMAaddrL[gi_pxrxDMA.NTbuff]) ||
  1846. (gi_pxrxDMA.NTptr > gi_pxrxDMA.DMAaddrEndL[gi_pxrxDMA.NTbuff]) ) {
  1847. DISPDBG((-1000, "CHECK_BUFF failed for NTptr II!"));
  1848. DISPDBG((-1000, " 0x%08X <= 0x%08X <= 0x%08X",
  1849. gi_pxrxDMA.DMAaddrL[gi_pxrxDMA.NTbuff], gi_pxrxDMA.NTptr,
  1850. gi_pxrxDMA.DMAaddrEndL[gi_pxrxDMA.NTbuff]));
  1851. DebugBreak();
  1852. }
  1853. }
  1854. // (start0 <= P3ptr <= end0) || (start1 <= P3ptr <= end1)
  1855. if( ((gi_pxrxDMA.P3at < gi_pxrxDMA.DMAaddrL[0]) && (gi_pxrxDMA.P3at > gi_pxrxDMA.DMAaddrEndL[0])) &&
  1856. ((gi_pxrxDMA.P3at < gi_pxrxDMA.DMAaddrL[1]) && (gi_pxrxDMA.P3at > gi_pxrxDMA.DMAaddrEndL[1])) ) {
  1857. DISPDBG((-1000, "CHECK_BUFF failed for P3at!"));
  1858. DISPDBG((-1000, " 0x%08X: (0x%08X:0x%08X) or (0x%08X:0x%08X)", gi_pxrxDMA.P3at,
  1859. gi_pxrxDMA.DMAaddrL[0], gi_pxrxDMA.DMAaddrEndL[0],
  1860. gi_pxrxDMA.DMAaddrL[1], gi_pxrxDMA.DMAaddrEndL[1]));
  1861. DebugBreak();
  1862. }
  1863. // P3at <= NTptr (if in the same buffer)
  1864. if( (gi_pxrxDMA.P3at >= gi_pxrxDMA.DMAaddrL[gi_pxrxDMA.NTbuff]) && (gi_pxrxDMA.P3at <= gi_pxrxDMA.DMAaddrEndL[gi_pxrxDMA.NTbuff]) ) {
  1865. if( gi_pxrxDMA.P3at > gi_pxrxDMA.NTptr ) {
  1866. DISPDBG((-1000, "CHECK_BUFF failed for P3at vs NTptr! (0x%08X <= 0x%08X)", gi_pxrxDMA.P3at, gi_pxrxDMA.NTptr));
  1867. DebugBreak();
  1868. }
  1869. }
  1870. // NTptr <= NTwait
  1871. if( gi_pxrxDMA.NTptr > glintInfo->NTwait ) {
  1872. DISPDBG((-1000, "CHECK_BUFF failed for NTptr vs NTwait! (0x%08X <= 0x%08X)", gi_pxrxDMA.NTptr, glintInfo->NTwait));
  1873. DebugBreak();
  1874. }
  1875. //@@BEGIN_DDKSPLIT
  1876. //AZN
  1877. // Here we have a FI AV when glintInfo->pxrxDMA_bufferBase != NULL but points
  1878. // to invalid memory!
  1879. //@@END_DDKSPLIT
  1880. // Protection zone 0: should be filled with (addr & 0x0FFFFFF0)
  1881. for( ptr = glintInfo->pxrxDMA_bufferBase; ptr < gi_pxrxDMA.DMAaddrL[0]; ptr++ ) {
  1882. ASSERTDBG(*ptr == (((ULONG_PTR) ptr) & 0x0FFFFFF0), (-1000,
  1883. "CHECK_BUFF failed on protection zone 0: 0x%08X vs 0x%08X!",
  1884. ((ULONG_PTR) ptr) & 0x0FFFFFF0, *ptr));
  1885. //if( ptr > glintInfo->pxrxDMA_bufferBase + 40 ) break;
  1886. }
  1887. // Protection zone 1: should be filled with (addr & 0x0FFFFFF0)
  1888. for( ptr = gi_pxrxDMA.DMAaddrEndL[0]; ptr < gi_pxrxDMA.DMAaddrL[1]; ptr++ ) {
  1889. ASSERTDBG(*ptr == (((ULONG_PTR) ptr) & 0x0FFFFFF0), (-1000,
  1890. "CHECK_BUFF failed on protection zone 1: 0x%08X vs 0x%08X!",
  1891. ((ULONG_PTR) ptr) & 0x0FFFFFF0, *ptr));
  1892. //if( ptr > gi_pxrxDMA.DMAaddrEndL[0] + 40 ) break;
  1893. }
  1894. // Protection zone 2: should be filled with (addr & 0x0FFFFFF0)
  1895. for( ptr = gi_pxrxDMA.DMAaddrEndL[1]; ptr < glintInfo->pxrxDMA_bufferTop; ptr++ ) {
  1896. ASSERTDBG(*ptr == (((ULONG_PTR) ptr) & 0x0FFFFFF0), (-1000,
  1897. "CHECK_BUFF failed on protection zone 2: 0x%08X vs 0x%08X!",
  1898. ((ULONG_PTR) ptr) & 0x0FFFFFF0, *ptr));
  1899. //if( ptr > gi_pxrxDMA.DMAaddrEndL[1] + 40 ) break;
  1900. }
  1901. switch( type ) {
  1902. case CHECK_QUEUE:
  1903. // Check that each dword contains 0x12345678:
  1904. while( count-- ) {
  1905. ptr = gi_pxrxDMA.NTptr + count;
  1906. if( *ptr != 0x12345678 ) {
  1907. DISPDBG((-1000, "CHECK_QUEUE failed: 0x%08X vs 0x12345678 @ 0x%08X!", *ptr, ptr));
  1908. failure = TRUE;
  1909. }
  1910. }
  1911. break;
  1912. case CHECK_WAIT:
  1913. // Check that each dword contains its address...
  1914. // Then replace it with 0x12345678:
  1915. while( count-- ) {
  1916. ptr = gi_pxrxDMA.NTptr + count;
  1917. if( (*ptr != (ULONG_PTR) ptr) && (*ptr != 0x12345678) ) {
  1918. DISPDBG((-1000, "CHECK_WAIT failed: 0x%08X vs 0x%08X @ 0x%08X!",
  1919. *ptr, (ULONG_PTR) ptr, ptr));
  1920. failure = TRUE;
  1921. }
  1922. *ptr = 0x12345678;
  1923. }
  1924. break;
  1925. case CHECK_SEND:
  1926. // Check that each dword contains neither its address nor 0x12345678:
  1927. for( ptr = (ULONG *) gi_pxrxDMA.P3at; ptr < gi_pxrxDMA.NTptr; ptr++ ) {
  1928. if( *ptr == (ULONG_PTR) ptr ) {
  1929. DISPDBG((-1000, "CHECK_SEND failed I: 0x%08X is 0x%08X!", ptr, *ptr));
  1930. failure = TRUE;
  1931. }
  1932. if( *ptr == 0x12345678 ) {
  1933. DISPDBG((-1000, "CHECK_SEND failed II: 0x%08X is 0x%08X!", ptr, *ptr));
  1934. failure = TRUE;
  1935. }
  1936. }
  1937. for( ptr = gi_pxrxDMA.NTptr; ptr < gi_pxrxDMA.DMAaddrEndL[gi_pxrxDMA.NTbuff]; ptr++ ) {
  1938. if( (*ptr != (ULONG_PTR) ptr) && (*ptr != 0x12345678) ) {
  1939. DISPDBG((-1000, "CHECK_SEND failed III: 0x%08X vs 0x%08X/0x12345678 @ 0x%08X!", *ptr,
  1940. (ULONG_PTR) ptr, ptr));
  1941. failure = TRUE;
  1942. }
  1943. if( ptr > (gi_pxrxDMA.NTptr + 4) )
  1944. break;
  1945. }
  1946. break;
  1947. case CHECK_SWITCH:
  1948. // Fill each dword with its address:
  1949. for( ptr = gi_pxrxDMA.DMAaddrL[gi_pxrxDMA.NTbuff]; ptr < gi_pxrxDMA.DMAaddrEndL[gi_pxrxDMA.NTbuff]; ptr++ )
  1950. *ptr = PtrToUlong(ptr);
  1951. break;
  1952. }
  1953. if( failure ) {
  1954. DISPDBG((-1000, "Check failed, count = %d", origCount));
  1955. DebugBreak();
  1956. }
  1957. }
  1958. #endif
  1959. /*******************************************************/
  1960. /*** Assorted versions of the SEND_PXRX_DMA 'macro' ***/
  1961. /*** For use with the FAKE_DMA flag to test that DMA ***/
  1962. /*** will actually work on all combinations of P3, ***/
  1963. /*** Gamma, & buggy motherboards! ***/
  1964. /*******************************************************/
  1965. /*******************/
  1966. /*** FIFO Access ***/
  1967. void sendPXRXdmaFIFO( PPDEV ppdev, GlintDataPtr glintInfo ) {
  1968. LONG count;
  1969. ULONG *NTptr = gi_pxrxDMA.NTptr;
  1970. ULONG *P3at = (ULONG *) gi_pxrxDMA.P3at;
  1971. CHECK_PXRX_DMA_VALIDITY( CHECK_SEND, 0 );
  1972. count = (DWORD)(NTptr - P3at);
  1973. DISPDBG((DBGLVL, "SEND_PXRX_DMA:fifo() %d dwords @ %d:0x%08X -> 0x%08X", count, gi_pxrxDMA.NTbuff, P3at, NTptr));
  1974. if( count > 0) {
  1975. volatile ULONG *dst;
  1976. ULONG *src, space;
  1977. DISPDBG((DBGLVL, "Sending FIFO tags (0x%08X x %d)", P3at, count));
  1978. src = P3at;
  1979. while( count > 0 ) {
  1980. GET_INPUT_FIFO_SPACE( space );
  1981. // Don't exceed real FIFO size
  1982. space = min (space, glintInfo->MaxInFifoEntries);
  1983. dst = (ULONG *) glintInfo->regs.InFIFOInterface;
  1984. while( space-- && count-- ) {
  1985. MEMORY_BARRIER();
  1986. WRITE_FAST_ULONG( dst, *src );
  1987. MEMORY_BARRIER();
  1988. dst++;
  1989. src++;
  1990. }
  1991. }
  1992. }
  1993. GLINT_CORE_BUSY;
  1994. gi_pxrxDMA.NTdone = NTptr;
  1995. gi_pxrxDMA.P3at = NTptr;
  1996. DISPDBG((DBGLVL, "Sent PXRX DMA"));
  1997. }
  1998. void switchPXRXdmaBufferFIFO( PPDEV ppdev, GlintDataPtr glintInfo ) {
  1999. TEMP_MACRO_VARS;
  2000. DISPDBG((DBGLVL, "SWITCH_PXRX_DMA_BUFFER() from %d:0x%08X", gi_pxrxDMA.NTbuff, gi_pxrxDMA.NTptr));
  2001. /* Close the old buffer and post it */
  2002. SEND_PXRX_DMA_FORCE;
  2003. /* Switch to the new buffer */
  2004. gi_pxrxDMA.NTbuff = !gi_pxrxDMA.NTbuff;
  2005. /* Ensure that the new buffer is empty */
  2006. //WAIT_PXRX_DMA_COMPLETED_BUFFER; // Not needed when running through FIFOs.
  2007. /* Start using the new buffer */
  2008. gi_pxrxDMA.NTptr = gi_pxrxDMA.DMAaddrL[gi_pxrxDMA.NTbuff];
  2009. gi_pxrxDMA.P3at = gi_pxrxDMA.NTptr;
  2010. #if PXRX_DMA_BUFFER_CHECK
  2011. glintInfo->NTwait = gi_pxrxDMA.NTptr;
  2012. #endif
  2013. DISPDBG((DBGLVL, "SWITCH_PXRX_DMA_BUFFER() to %d:0x%08X", gi_pxrxDMA.NTbuff, gi_pxrxDMA.NTptr));
  2014. CHECK_PXRX_DMA_VALIDITY( CHECK_SWITCH, 0 );
  2015. }
  2016. void waitPXRXdmaCompletedBufferFIFO( PPDEV ppdev, GlintDataPtr glintInfo ) {
  2017. ASSERTDD(FALSE,"waitPXRXdmaCompletedBufferFIFO was called!");
  2018. }