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.

148 lines
3.9 KiB

  1. /******************************Module*Header*******************************\
  2. *
  3. * Module Name: Xlate.h
  4. * Author: Noel VanHook
  5. * Purpose: Handles hardware color translation.
  6. *
  7. * Copyright (c) 1997 Cirrus Logic, Inc.
  8. *
  9. * $Log: X:/log/laguna/nt35/displays/cl546x/xlate.h $
  10. *
  11. * Rev 1.3 15 Oct 1997 14:19:50 noelv
  12. * Moved ODD to xlate.c
  13. *
  14. * Rev 1.2 15 Oct 1997 12:06:24 noelv
  15. *
  16. * Added hostdata workaround for 65.
  17. *
  18. * Rev 1.1 19 Feb 1997 13:07:32 noelv
  19. * Added translation table cache
  20. *
  21. * Rev 1.0 06 Feb 1997 10:35:48 noelv
  22. * Initial revision.
  23. */
  24. #ifndef _XLATE_H_
  25. #pragma pack(1)
  26. extern ULONG ulXlate[16];
  27. //
  28. // External functions.
  29. //
  30. BOOLEAN bCacheXlateTable(struct _PDEV *ppdev,
  31. unsigned long **ppulXlate,
  32. SURFOBJ *psoTrg,
  33. SURFOBJ *psoSrc,
  34. XLATEOBJ *pxlo,
  35. BYTE rop);
  36. void vInitHwXlate(struct _PDEV *ppdev);
  37. void vInvalidateXlateCache(struct _PDEV *ppdev);
  38. /*
  39. In 16, 24, and 32 BPP HOSTDATA color translation may or may not work
  40. correctly on the 5465.
  41. The following is an email from Gary describing how to tell a good BLT from
  42. a bad BLT.
  43. ==========================================================================
  44. Subject: color translate L3DA lockups
  45. Date: Fri, 10 Oct 97 09:50:03 PDT
  46. From: garyru (Gary Rudolph)
  47. To: noelv, vernh, martinb
  48. CC: garyru
  49. Here is the function to determine if the wrong amount
  50. of host data will be fetched for a color translate
  51. when the source and dest bpp differ. Add the least
  52. significant three bits of the number of source bytes
  53. to the least significant three bits of OP1 address
  54. and use that value to determine if "Odd" is set using
  55. the table below. Then use the least significant
  56. three bits of destination bytes plus the least significant
  57. three bits of OP1 address and use that value to determine
  58. if "Odd" is set. If you come up with the same value for
  59. "Odd" in both cases, then the right amount of host
  60. data will be fetched. If the values of "Odd" are
  61. different then the engine will fetch one too many
  62. or one too few dwords of host data per line.
  63. Add Odd
  64. --- ---
  65. 0000 0 0
  66. 0001 1 1
  67. 0010 2 1
  68. 0011 3 1
  69. 0100 4 1
  70. 0101 5 0
  71. 0110 6 0
  72. 0111 7 0
  73. 1000 8 0
  74. 1001 9 1
  75. 1010 10 1
  76. 1011 11 1
  77. 1100 12 1
  78. 1101 13 0
  79. 1110 14 0
  80. 1111 15 0
  81. Example: 8 to 32 translate
  82. bltx = 639 pixels
  83. op1 = 0000
  84. Source
  85. 639 = 0x27F
  86. 111
  87. + 000
  88. ---
  89. 111 ---> Odd = 0
  90. Dest
  91. 639 x 4 = 0x9FC
  92. 100
  93. + 000
  94. ---
  95. 100 ---> Odd = 1
  96. It is the Dest value of "Odd" that is used, so the engine
  97. only fetches one dWord of the last Qword incorrectly.
  98. I think the fix for the L128 is to use the srcx value rather
  99. than the byte converted blt extent to determine the number
  100. of dWords of host data to fetch.
  101. -Gary
  102. ===========================================================================
  103. */
  104. // Declared in XLATE.C
  105. extern char ODD[]; // = {0,1,1,1, 1,0,0,0, 0,1,1,1, 1,0,0,0};
  106. #define XLATE_IS_BROKEN(width_in_bytes, bytes_per_pixel, phase) \
  107. ( \
  108. ODD [ ((width_in_bytes) & 7) /* lowest three bits of source bytes */ \
  109. + ((phase) & 7 ) ] /* plus lowest three bits of OP_1 */ \
  110. != \
  111. ODD [ (((width_in_bytes)*(bytes_per_pixel)) & 7) /* low bits of dest bytes */\
  112. +((phase) & 7) ] /* plus lowest three bits of OP_1 */ \
  113. ) \
  114. #endif // _XLATE_H_