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.

137 lines
3.8 KiB

  1. /************************************************************************/
  2. /* */
  3. /* CVTVDIF.C */
  4. /* */
  5. /* July 12 1995 (c) 1993, 1995 ATI Technologies Incorporated. */
  6. /************************************************************************/
  7. /********************** PolyTron RCS Utilities
  8. $Revision: 1.5 $
  9. $Date: 23 Jan 1996 11:45:32 $
  10. $Author: RWolff $
  11. $Log: S:/source/wnt/ms11/miniport/archive/cvtvdif.c_v $
  12. *
  13. * Rev 1.5 23 Jan 1996 11:45:32 RWolff
  14. * Protected against false values of TARGET_BUILD.
  15. *
  16. * Rev 1.4 11 Jan 1996 19:39:06 RWolff
  17. * Now restricts "canned" mode tables by both maximum index and maximum
  18. * pixel clock frequency, and VDIF mode tables by maximum pixel clock
  19. * frequency only, rather than both by maximum refresh rate.
  20. *
  21. * Rev 1.3 19 Dec 1995 14:07:14 RWolff
  22. * Added debug print statements.
  23. *
  24. * Rev 1.2 30 Oct 1995 12:09:42 MGrubac
  25. * Fixed bug in calculating CRTC parameters based on read in data from VDIF files.
  26. *
  27. * Rev 1.1 26 Jul 1995 13:06:44 mgrubac
  28. * Moved mode tables merging to VDIFCallback() routine.
  29. *
  30. * Rev 1.0 20 Jul 1995 18:19:12 mgrubac
  31. * Initial revision.
  32. End of PolyTron RCS section *****************/
  33. #include <stdio.h>
  34. #include <stdlib.h>
  35. #include <string.h>
  36. #include <errno.h>
  37. #include <math.h>
  38. #include "dderror.h"
  39. #include "miniport.h"
  40. #include "ntddvdeo.h"
  41. #include "video.h" /* for VP_STATUS definition */
  42. #include "vidlog.h"
  43. #include "stdtyp.h"
  44. #include "amach.h"
  45. #include "amach1.h"
  46. #include "atimp.h"
  47. #include "atint.h"
  48. #include "cvtvga.h"
  49. #include "atioem.h"
  50. #include "services.h"
  51. #include "vdptocrt.h"
  52. #include "vdpdata.h"
  53. #include "cvtvdif.h"
  54. /*
  55. * Allow miniport to be swapped out when not needed.
  56. */
  57. #if defined (ALLOC_PRAGMA)
  58. #pragma alloc_text(PAGE_COM, SetOtherModeParameters)
  59. #endif
  60. void *pCallbackArgs; /* Pointer for passing parameters to VDIFCallback() */
  61. /**************************************************************************
  62. *
  63. * void SetOtherModeParameters( PixelDepth, Pitch, Multiplier, pmode)
  64. * WORD Multiplier; What needs to be done to the pixel clock
  65. * WORD PixelDepth; Number of bits per pixel
  66. * WORD Pitch; Screen pitch to use
  67. * struct st_mode_table *pmode; Pointer to structure that must contain
  68. * at least the member ClockFreq
  69. *
  70. *
  71. * DESCRIPTION:
  72. * Sets parameters PixelDepth, Pitch and adjusts ClockFreq
  73. *
  74. * RETURN VALUE:
  75. * None
  76. *
  77. * GLOBALS CHANGED:
  78. * None
  79. *
  80. * CALLED BY:
  81. * SetFixedModes and VDIFCallback
  82. *
  83. * AUTHOR:
  84. * Miroslav Grubac
  85. *
  86. * CHANGE HISTORY:
  87. *
  88. * TEST HISTORY:
  89. *
  90. ***************************************************************************/
  91. void SetOtherModeParameters( WORD PixelDepth,
  92. WORD Pitch,
  93. WORD Multiplier,
  94. struct st_mode_table *pmode)
  95. {
  96. pmode->m_pixel_depth = (UCHAR) PixelDepth;
  97. pmode->m_screen_pitch = Pitch;
  98. /*
  99. * Take care of any pixel clock multiplication that is needed.
  100. */
  101. switch(Multiplier)
  102. {
  103. case CLOCK_TRIPLE:
  104. pmode->ClockFreq *= 3;
  105. break;
  106. case CLOCK_DOUBLE:
  107. pmode->ClockFreq *= 2;
  108. break;
  109. case CLOCK_THREE_HALVES:
  110. pmode->ClockFreq *= 3;
  111. pmode->ClockFreq >>= 1;
  112. break;
  113. case CLOCK_SINGLE:
  114. default:
  115. break;
  116. }
  117. } /* SetOtherModeParameters() */