Source code of Windows XP (NT5)
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.

817 lines
22 KiB

  1. //******************************************************************************/
  2. //* *
  3. //* vpestrm.c - *
  4. //* *
  5. //* Copyright (c) C-Cube Microsystems 1996 *
  6. //* All Rights Reserved. *
  7. //* *
  8. //* Use of C-Cube Microsystems code is governed by terms and conditions *
  9. //* stated in the accompanying licensing statement. *
  10. //* *
  11. //******************************************************************************/
  12. #include "headers.h"
  13. #include "adapter.h"
  14. #include <vidstrm.h>
  15. #include <vpestrm.h>
  16. HANDLE hMaster;
  17. HANDLE hClk;
  18. #define DDVPTYPE_E_HREFH_VREFL \
  19. 0x92783220L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8
  20. #define DDVPTYPE_E_HREFL_VREFH \
  21. 0xA07A02E0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8
  22. #define DDVPTYPE_BROOKTREE \
  23. 0x1352A560L,0xDA61,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8
  24. #define DDVPTYPE_PHILIPS \
  25. 0x332CF160L,0xDA61,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8
  26. #define DDVPCONNECT_INTERLACED 0x00000020l
  27. #define DDVPCONNECT_HALFLINE 0x00000010l
  28. GUID g_ZvGuid = {DDVPTYPE_E_HREFL_VREFL};
  29. //GUID g_S3Guid = {DDVPTYPE_E_HREFL_VREFL};
  30. GUID g_ZvGuid2 = {DDVPTYPE_E_HREFH_VREFL};
  31. GUID g_ATIGuid2 = {DDVPTYPE_E_HREFH_VREFH};
  32. GUID g_ATIGuid3 = {DDVPTYPE_E_HREFL_VREFH};
  33. GUID g_ATIGuid4 = {DDVPTYPE_BROOKTREE};
  34. GUID g_ATIGuid5 = {DDVPTYPE_PHILIPS};
  35. //GUID g_ATIGuid = {0x1352A560L,0xDA61,0x11CF,0x9B,0x06,0x00,0xA0,0xC 9,0x03,0xA3,0xB8}; // DDVPTYPE_BROOKTREE
  36. GUID g_ATIGuid = {0xFCA326A0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8};
  37. // define this macro to facilitate giving the pixel format
  38. #define MKFOURCC(ch0, ch1, ch2, ch3) ((DWORD)(BYTE)(ch0) | \
  39. ((DWORD)(BYTE)(ch1) << 8) | \
  40. ((DWORD)(BYTE)(ch2) << 16) | \
  41. ((DWORD)(BYTE)(ch3) << 24 ))
  42. #ifdef VPE_CROP
  43. #define TOP_CROP 20
  44. #else
  45. #define TOP_CROP 18
  46. #endif
  47. /*
  48. ** VpeReceiveDataPacket()
  49. */
  50. VOID STREAMAPI VpeReceiveDataPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  51. {
  52. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  53. DebugPrint( (DebugLevelVerbose, "VpeReceiveDataPacket---------\r\n") );
  54. switch( pSrb->Command ){
  55. case SRB_READ_DATA:
  56. DebugPrint( (DebugLevelVerbose, "SRB_READ_DATA\r\n") );
  57. pSrb->ActualBytesTransferred = 0;
  58. pSrb->Status = STATUS_SUCCESS;
  59. break;
  60. case SRB_WRITE_DATA:
  61. DebugPrint( (DebugLevelTrace, "SRB_WRITE_DATA\r\n") );
  62. // TRAP;
  63. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  64. break;
  65. default:
  66. DebugPrint( (DebugLevelTrace, "default %d(0x%x)\r\n", pSrb->Command, pSrb->Command ) );
  67. // TRAP;
  68. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  69. break;
  70. }
  71. StreamClassStreamNotification( ReadyForNextStreamDataRequest,
  72. pSrb->StreamObject );
  73. StreamClassStreamNotification( StreamRequestComplete,
  74. pSrb->StreamObject,
  75. pSrb );
  76. }
  77. /*
  78. ** VpeReceiveCtrlPacket()
  79. */
  80. VOID STREAMAPI VpeReceiveCtrlPacket( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  81. {
  82. DebugPrint( (DebugLevelTrace, "VpeReceiveCtrlPacket---------\r\n") );
  83. switch( pSrb->Command ){
  84. case SRB_SET_STREAM_STATE:
  85. DebugPrint( (DebugLevelTrace, "SRB_SET_STREAM_STATE\r\n") );
  86. AdapterSetState( pSrb );
  87. break;
  88. case SRB_GET_STREAM_STATE:
  89. DebugPrint( (DebugLevelTrace, "SRB_GET_STREAM_STATE\r\n") );
  90. pSrb->Status = STATUS_SUCCESS;
  91. break;
  92. case SRB_GET_STREAM_PROPERTY:
  93. DebugPrint( (DebugLevelTrace, " SRB_GET_STREAM_PROPERTY\r\n") );
  94. GetVpeProperty( pSrb );
  95. if( pSrb->Status != STATUS_PENDING ) {
  96. StreamClassStreamNotification( ReadyForNextStreamControlRequest,
  97. pSrb->StreamObject );
  98. StreamClassStreamNotification( StreamRequestComplete,
  99. pSrb->StreamObject,
  100. pSrb );
  101. }
  102. return;
  103. case SRB_SET_STREAM_PROPERTY:
  104. DebugPrint( (DebugLevelTrace, " SRB_SET_STREAM_PROPERTY\r\n") );
  105. SetVpeProperty( pSrb );
  106. break;
  107. case SRB_OPEN_MASTER_CLOCK:
  108. DebugPrint( (DebugLevelTrace, " SRB_OPEN_MASTER_CLOCK\r\n") );
  109. hMaster = pSrb->CommandData.MasterClockHandle;
  110. pSrb->Status = STATUS_SUCCESS;
  111. break;
  112. case SRB_CLOSE_MASTER_CLOCK:
  113. DebugPrint( (DebugLevelTrace, " SRB_CLOSE_MASTER_CLOCK\r\n") );
  114. hMaster = pSrb->CommandData.MasterClockHandle;
  115. pSrb->Status = STATUS_SUCCESS;
  116. break;
  117. case SRB_INDICATE_MASTER_CLOCK:
  118. DebugPrint( (DebugLevelTrace, " SRB_INDICATE_MASTER_CLOCK\r\n") );
  119. hClk = pSrb->CommandData.MasterClockHandle;
  120. pSrb->Status = STATUS_SUCCESS;
  121. break;
  122. case SRB_UNKNOWN_STREAM_COMMAND:
  123. DebugPrint( (DebugLevelTrace, " SRB_UNKNOWN_STREAM_COMMAND\r\n") );
  124. // TRAP;
  125. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  126. break;
  127. case SRB_SET_STREAM_RATE:
  128. DebugPrint( (DebugLevelTrace, " SRB_SET_STREAM_RATE\r\n") );
  129. // TRAP;
  130. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  131. break;
  132. case SRB_PROPOSE_DATA_FORMAT:
  133. DebugPrint( (DebugLevelTrace, " SRB_PROPOSE_DATA_FORMAT\r\n") );
  134. // TRAP;
  135. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  136. break;
  137. default:
  138. DebugPrint( (DebugLevelTrace, " default %d(0x%x)\r\n", pSrb->Command, pSrb->Command ) );
  139. // TRAP;
  140. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  141. break;
  142. }
  143. StreamClassStreamNotification( ReadyForNextStreamControlRequest,
  144. pSrb->StreamObject );
  145. StreamClassStreamNotification( StreamRequestComplete,
  146. pSrb->StreamObject,
  147. pSrb );
  148. }
  149. void GetVpeProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  150. {
  151. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  152. DWORD dwInputBufferSize;
  153. DWORD dwOutputBufferSize;
  154. #ifdef EZDVD
  155. DWORD dwNumConnectInfo = 2;
  156. #else
  157. DWORD dwNumConnectInfo = 2;
  158. #endif
  159. DWORD dwNumVideoFormat = 1;
  160. DWORD dwFieldWidth = 720;
  161. DWORD dwFieldHeight = 240;
  162. // the pointers to which the input buffer will be cast to
  163. LPDDVIDEOPORTCONNECT pConnectInfo;
  164. LPDDPIXELFORMAT pVideoFormat;
  165. PKSVPMAXPIXELRATE pMaxPixelRate;
  166. PKS_AMVPDATAINFO pVpdata;
  167. DWORD dwMicroSecPerField;
  168. // LPAMSCALINGINFO pScaleFactor;
  169. //
  170. // NOTE: ABSOLUTELY DO NOT use pmulitem, until it is determined that
  171. // the stream property descriptor describes a multiple item, or you will
  172. // pagefault.
  173. //
  174. PKSMULTIPLE_ITEM pmulitem =
  175. &(((PKSMULTIPLE_DATA_PROP)pSrb->CommandData.PropertyInfo->Property)->MultipleItem);
  176. //
  177. // NOTE: same goes for this one as above.
  178. //
  179. PKS_AMVPSIZE pdim =
  180. &(((PKSVPSIZE_PROP)pSrb->CommandData.PropertyInfo->Property)->Size);
  181. if( pSrb->CommandData.PropertyInfo->PropertySetID ) {
  182. // TRAP;
  183. pSrb->Status = STATUS_NO_MATCH;
  184. return;
  185. }
  186. if(pHwDevExt->VidSystem == NTSC)
  187. {
  188. dwFieldHeight = 240;
  189. dwMicroSecPerField = 16666;
  190. }
  191. else
  192. {
  193. dwFieldHeight = 288;
  194. dwMicroSecPerField = 20000;
  195. }
  196. dwInputBufferSize = pSrb->CommandData.PropertyInfo->PropertyInputSize;
  197. dwOutputBufferSize = pSrb->CommandData.PropertyInfo->PropertyOutputSize;
  198. pSrb->Status = STATUS_SUCCESS;
  199. switch( pSrb->CommandData.PropertyInfo->Property->Id ) {
  200. case KSPROPERTY_VPCONFIG_NUMCONNECTINFO:
  201. DebugPrint( (DebugLevelTrace, " KSPROPERTY_VPCONFIG_NUMCONNECTINFO\r\n") );
  202. // check that the size of the output buffer is correct
  203. ASSERT(dwInputBufferSize >= sizeof(DWORD));
  204. pSrb->ActualBytesTransferred = sizeof(DWORD);
  205. *(PULONG) pSrb->CommandData.PropertyInfo->PropertyInfo
  206. = dwNumConnectInfo;
  207. break;
  208. case KSPROPERTY_VPCONFIG_NUMVIDEOFORMAT:
  209. DebugPrint( (DebugLevelTrace, " KSPROPERTY_VPCONFIG_NUMVIDEOFORMAT\r\n") );
  210. // check that the size of the output buffer is correct
  211. ASSERT(dwInputBufferSize >= sizeof(DWORD));
  212. pSrb->ActualBytesTransferred = sizeof(DWORD);
  213. *(PULONG) pSrb->CommandData.PropertyInfo->PropertyInfo
  214. = dwNumVideoFormat;
  215. break;
  216. case KSPROPERTY_VPCONFIG_GETCONNECTINFO:
  217. DebugPrint( (DebugLevelTrace, " KSPROPERTY_VPCONFIG_GETCONNECTINFO\r\n") );
  218. if (pmulitem->Count > dwNumConnectInfo ||
  219. pmulitem->Size != sizeof (DDVIDEOPORTCONNECT) ||
  220. dwOutputBufferSize <
  221. (pmulitem->Count * sizeof (DDVIDEOPORTCONNECT)))
  222. {
  223. DebugPrint(( DebugLevelTrace, " pmulitem->Count %d\r\n", pmulitem->Count ));
  224. DebugPrint(( DebugLevelTrace, " pmulitem->Size %d\r\n", pmulitem->Size ));
  225. DebugPrint(( DebugLevelTrace, " dwOutputBufferSize %d\r\n", dwOutputBufferSize ));
  226. DebugPrint(( DebugLevelTrace, " sizeof(DDVIDEOPORTCONNECT) %d\r\n", sizeof(DDVIDEOPORTCONNECT) ));
  227. // TRAP;
  228. //
  229. // buffer size is invalid, so error the call
  230. //
  231. pSrb->Status = STATUS_INVALID_BUFFER_SIZE;
  232. return;
  233. }
  234. //
  235. // specify the number of bytes written
  236. //
  237. pSrb->ActualBytesTransferred = pmulitem->Count*sizeof(DDVIDEOPORTCONNECT);
  238. pConnectInfo = (LPDDVIDEOPORTCONNECT)(pSrb->CommandData.PropertyInfo->PropertyInfo);
  239. #ifdef EZDVD
  240. // S3
  241. pConnectInfo->dwSize = sizeof (DDVIDEOPORTCONNECT);
  242. // Revisit. Create new entry for ZV
  243. //pConnectInfo->dwPortWidth = 8;
  244. pConnectInfo->dwPortWidth = 16;
  245. pConnectInfo->guidTypeID = g_ATIGuid3;
  246. pConnectInfo->dwFlags = DDVPCONNECT_INTERLACED;// | DDVPCONNECT_HALFLINE; // 0x4;;
  247. pConnectInfo->dwReserved1 = 0;
  248. pConnectInfo++;
  249. pConnectInfo->dwSize = sizeof (DDVIDEOPORTCONNECT);
  250. // Revisit. Create new entry for ZV
  251. //pConnectInfo->dwPortWidth = 8;
  252. pConnectInfo->dwPortWidth = 16;
  253. pConnectInfo->guidTypeID = g_ZvGuid2;
  254. pConnectInfo->dwFlags = DDVPCONNECT_INTERLACED;// | DDVPCONNECT_HALFLINE; // 0x4;0x3F;
  255. pConnectInfo->dwReserved1 = 0;
  256. #else
  257. // S3
  258. pConnectInfo->dwSize = sizeof (DDVIDEOPORTCONNECT);
  259. pConnectInfo->dwPortWidth = 8;
  260. pConnectInfo->guidTypeID = g_ZvGuid;
  261. pConnectInfo->dwFlags = 0x3F;
  262. pConnectInfo->dwReserved1 = 0;
  263. pConnectInfo++;
  264. // ATI
  265. pConnectInfo->dwSize = sizeof (DDVIDEOPORTCONNECT);
  266. pConnectInfo->dwPortWidth = 8;
  267. pConnectInfo->guidTypeID = g_ATIGuid;
  268. pConnectInfo->dwFlags = DDVPCONNECT_INTERLACED | DDVPCONNECT_HALFLINE; // 0x4;
  269. // pConnectInfo->dwFlags = DDVPCONNECT_INTERLACED|
  270. //
  271. // DDVPCONNECT_HALFLINE;
  272. pConnectInfo->dwReserved1 = 0;
  273. /* pConnectInfo++;
  274. pConnectInfo->dwSize = sizeof (DDVIDEOPORTCONNECT);
  275. pConnectInfo->dwPortWidth = 8;
  276. pConnectInfo->guidTypeID = g_ZvGuid2;
  277. pConnectInfo->dwFlags = 0x4;
  278. pConnectInfo->dwReserved1 = 0;
  279. pConnectInfo++;
  280. pConnectInfo->dwSize = sizeof (DDVIDEOPORTCONNECT);
  281. pConnectInfo->dwPortWidth = 8;
  282. pConnectInfo->guidTypeID = g_ATIGuid2;
  283. pConnectInfo->dwFlags = 0x4;
  284. pConnectInfo->dwReserved1 = 0;
  285. pConnectInfo++;
  286. pConnectInfo->dwSize = sizeof (DDVIDEOPORTCONNECT);
  287. pConnectInfo->dwPortWidth = 8;
  288. pConnectInfo->guidTypeID = g_ATIGuid3;
  289. pConnectInfo->dwFlags = 0x4;
  290. pConnectInfo->dwReserved1 = 0;
  291. pConnectInfo++;
  292. pConnectInfo->dwSize = sizeof (DDVIDEOPORTCONNECT);
  293. pConnectInfo->dwPortWidth = 8;
  294. pConnectInfo->guidTypeID = g_ATIGuid4;
  295. pConnectInfo->dwFlags = 0x4;
  296. pConnectInfo->dwReserved1 = 0;
  297. pConnectInfo++;
  298. pConnectInfo->dwSize = sizeof (DDVIDEOPORTCONNECT);
  299. pConnectInfo->dwPortWidth = 8;
  300. pConnectInfo->guidTypeID = g_ATIGuid5;
  301. pConnectInfo->dwFlags = 0x4;
  302. pConnectInfo->dwReserved1 = 0;
  303. */
  304. #endif
  305. break;
  306. case KSPROPERTY_VPCONFIG_VPDATAINFO:
  307. DebugPrint(( DebugLevelTrace, "KSPROPERTY_VPCONFIG_VPDATAINFO\r\n" ));
  308. //
  309. // specify the number of bytes written
  310. //
  311. pSrb->ActualBytesTransferred = sizeof(KS_AMVPDATAINFO);
  312. //
  313. // cast the buffer to the porper type
  314. //
  315. pVpdata = (PKS_AMVPDATAINFO)pSrb->CommandData.PropertyInfo->PropertyInfo;
  316. *pVpdata = pHwDevExt->VPFmt;
  317. pVpdata->dwSize = sizeof (KS_AMVPDATAINFO);
  318. pVpdata->dwMicrosecondsPerField = dwMicroSecPerField;//80;//60;//17;
  319. ASSERT( pVpdata->dwNumLinesInVREF == 0 );
  320. pVpdata->dwNumLinesInVREF = 0;
  321. #ifdef EZDVD
  322. DebugPrint(( DebugLevelTrace, "Set for ATI AMC\r\n" ));
  323. // ATI AMC
  324. pVpdata->bEnableDoubleClock = FALSE;
  325. pVpdata->bEnableVACT = FALSE;
  326. pVpdata->bDataIsInterlaced = TRUE;
  327. pVpdata->lHalfLinesOdd = 0;
  328. pVpdata->lHalfLinesEven = 0;
  329. pVpdata->bFieldPolarityInverted = FALSE;
  330. pVpdata->amvpDimInfo.dwFieldWidth = 720;
  331. pVpdata->amvpDimInfo.dwFieldHeight = dwFieldHeight;//+18 ;//24-+18//240 + 2;
  332. pVpdata->amvpDimInfo.rcValidRegion.left = 0;
  333. pVpdata->amvpDimInfo.rcValidRegion.top = 18;//2;
  334. pVpdata->amvpDimInfo.rcValidRegion.right = 720;//720 - 8;
  335. pVpdata->amvpDimInfo.rcValidRegion.bottom = dwFieldHeight+18;//240+18;//240 + 2;
  336. pVpdata->amvpDimInfo.dwVBIWidth = pVpdata->amvpDimInfo.dwFieldWidth;
  337. pVpdata->amvpDimInfo.dwVBIHeight = 0;//pVpdata->amvpDimInfo.rcValidRegion.top;
  338. pVpdata->dwPictAspectRatioX = 720;
  339. pVpdata->dwPictAspectRatioY = dwFieldHeight * 2;
  340. #else
  341. if( pHwDevExt->VideoPort == 4 ) {
  342. DebugPrint(( DebugLevelTrace, "Set for S3 LPB\r\n" ));
  343. // S3 LPB
  344. pVpdata->bEnableDoubleClock = FALSE;
  345. pVpdata->bEnableVACT = FALSE;
  346. pVpdata->bDataIsInterlaced = TRUE;
  347. pVpdata->lHalfLinesOdd = 0;
  348. pVpdata->lHalfLinesEven = 0;
  349. pVpdata->bFieldPolarityInverted = FALSE;
  350. pVpdata->amvpDimInfo.dwFieldWidth = 720 + 158/2;
  351. pVpdata->amvpDimInfo.dwFieldHeight = dwFieldHeight+1;//240 + 1;
  352. pVpdata->amvpDimInfo.rcValidRegion.left = 158/2;
  353. pVpdata->amvpDimInfo.rcValidRegion.top = 1;
  354. pVpdata->amvpDimInfo.rcValidRegion.right = 720 + 158/2 - 4;
  355. pVpdata->amvpDimInfo.rcValidRegion.bottom = dwFieldHeight+1;//240 + 1;
  356. pVpdata->amvpDimInfo.dwVBIWidth = pVpdata->amvpDimInfo.dwFieldWidth;
  357. pVpdata->amvpDimInfo.dwVBIHeight = pVpdata->amvpDimInfo.rcValidRegion.top;
  358. pVpdata->dwPictAspectRatioX = 720;
  359. pVpdata->dwPictAspectRatioY = dwFieldHeight * 2;
  360. }
  361. else if( pHwDevExt->VideoPort == 7 ) {
  362. DebugPrint(( DebugLevelTrace, "Set for ATI AMC\r\n" ));
  363. // ATI AMC
  364. pVpdata->bEnableDoubleClock = FALSE;
  365. pVpdata->bEnableVACT = FALSE;
  366. pVpdata->bDataIsInterlaced = TRUE;
  367. pVpdata->lHalfLinesOdd = 0;
  368. pVpdata->lHalfLinesEven = 0;
  369. pVpdata->bFieldPolarityInverted = FALSE;
  370. pVpdata->amvpDimInfo.dwFieldWidth = 720;
  371. pVpdata->amvpDimInfo.dwFieldHeight = dwFieldHeight;//+TOP_CROP;//240+18 ;//240 + 2;
  372. pVpdata->amvpDimInfo.rcValidRegion.left = 0;
  373. pVpdata->amvpDimInfo.rcValidRegion.top = TOP_CROP;//2;
  374. pVpdata->amvpDimInfo.rcValidRegion.right = 720;//720 - 8;
  375. pVpdata->amvpDimInfo.rcValidRegion.bottom = dwFieldHeight+TOP_CROP;//240+18;//240 + 2;
  376. pVpdata->amvpDimInfo.dwVBIWidth = pVpdata->amvpDimInfo.dwFieldWidth;
  377. pVpdata->amvpDimInfo.dwVBIHeight = 20;//pVpdata->amvpDimInfo.rcValidRegion.top;
  378. pVpdata->dwPictAspectRatioX = 720;
  379. pVpdata->dwPictAspectRatioY = dwFieldHeight * 2;
  380. }
  381. #endif
  382. break ;
  383. case KSPROPERTY_VPCONFIG_MAXPIXELRATE:
  384. DebugPrint( (DebugLevelTrace, "KSPROPERTY_VPCONFIG_MAXPIXELRATE\r\n") );
  385. //
  386. // NOTE:
  387. // this property is special. And has another different
  388. // input property!
  389. //
  390. if (dwInputBufferSize < sizeof (KSVPSIZE_PROP))
  391. {
  392. // TRAP;
  393. pSrb->Status = STATUS_INVALID_BUFFER_SIZE;
  394. return;
  395. }
  396. pSrb->ActualBytesTransferred = sizeof(KSVPMAXPIXELRATE);
  397. // cast the buffer to the porper type
  398. pMaxPixelRate = (PKSVPMAXPIXELRATE)pSrb->CommandData.PropertyInfo->PropertyInfo;
  399. // tell the app that the pixel rate is valid for these dimensions
  400. pMaxPixelRate->Size.dwWidth = dwFieldWidth;
  401. pMaxPixelRate->Size.dwHeight = dwFieldHeight;
  402. pMaxPixelRate->MaxPixelsPerSecond = 13500000;//1300;
  403. break;
  404. case KSPROPERTY_VPCONFIG_INFORMVPINPUT:
  405. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  406. break ;
  407. case KSPROPERTY_VPCONFIG_GETVIDEOFORMAT:
  408. DebugPrint(( DebugLevelTrace, "KSPROPERTY_VPCONFIG_GETVIDEOFORMAT\r\n" ));
  409. //
  410. // check that the size of the output buffer is correct
  411. //
  412. if (pmulitem->Count > dwNumConnectInfo ||
  413. pmulitem->Size != sizeof (DDPIXELFORMAT) ||
  414. dwOutputBufferSize <
  415. (pmulitem->Count * sizeof (DDPIXELFORMAT)))
  416. {
  417. DebugPrint(( DebugLevelTrace, "pmulitem->Count %d\r\n", pmulitem->Count ));
  418. DebugPrint(( DebugLevelTrace, "pmulitem->Size %d\r\n", pmulitem->Size ));
  419. DebugPrint(( DebugLevelTrace, "dwOutputBufferSize %d\r\n", dwOutputBufferSize ));
  420. DebugPrint(( DebugLevelTrace, "sizeof(DDPIXELFORMAT) %d\r\n", sizeof(DDPIXELFORMAT) ));
  421. // TRAP;
  422. //
  423. // buffer size is invalid, so error the call
  424. //
  425. pSrb->Status = STATUS_INVALID_BUFFER_SIZE;
  426. return;
  427. }
  428. //
  429. // specify the number of bytes written
  430. //
  431. pSrb->ActualBytesTransferred = pmulitem->Count*sizeof(DDPIXELFORMAT);
  432. pVideoFormat = (LPDDPIXELFORMAT)(pSrb->CommandData.PropertyInfo->PropertyInfo);
  433. if( pHwDevExt->VideoPort == 4 ) {
  434. DebugPrint(( DebugLevelTrace, "Set for S3 LPB\r\n" ));
  435. // S3 LPB
  436. pVideoFormat->dwSize= sizeof (DDPIXELFORMAT);
  437. pVideoFormat->dwFlags = DDPF_FOURCC;//|DDPF_INTERLACED;
  438. pVideoFormat->dwFourCC = MKFOURCC( 'Y', 'U', 'Y', '2' );
  439. pVideoFormat->dwYUVBitCount = 16;
  440. }
  441. else if( pHwDevExt->VideoPort == 7 ) {
  442. DebugPrint(( DebugLevelTrace, "Set for ATI AMC\r\n" ));
  443. // ATI AMC
  444. pVideoFormat->dwSize= sizeof (DDPIXELFORMAT);
  445. pVideoFormat->dwFlags = DDPF_FOURCC;//|DDPF_INTERLACED;
  446. pVideoFormat->dwYUVBitCount = 16;
  447. pVideoFormat->dwFourCC = MKFOURCC( 'U', 'Y', 'V', 'Y' );
  448. // Not needed?
  449. pVideoFormat->dwYBitMask = (DWORD)0xFF00FF00;
  450. pVideoFormat->dwUBitMask = (DWORD)0x000000FF;
  451. pVideoFormat->dwVBitMask = (DWORD)0x00FF0000;
  452. }
  453. // else
  454. // TRAP;
  455. break;
  456. case KSPROPERTY_VPCONFIG_DECIMATIONCAPABILITY:
  457. //
  458. // indicate that we can decimate anything, especially if it's late.
  459. //
  460. pSrb->ActualBytesTransferred = sizeof (BOOL);
  461. *((PBOOL)pSrb->CommandData.PropertyInfo->PropertyInfo) = TRUE;
  462. break;
  463. default:
  464. DebugPrint( (DebugLevelTrace, "PropertySetID 0 default %d(0x%x)\r\n", pSrb->CommandData.PropertyInfo->Property->Id, pSrb->CommandData.PropertyInfo->Property->Id ) );
  465. // TRAP;
  466. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  467. break;
  468. }
  469. }
  470. void SetVpeProperty( IN PHW_STREAM_REQUEST_BLOCK pSrb )
  471. {
  472. PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension;
  473. DWORD dwInputBufferSize;
  474. DWORD dwOutputBufferSize;
  475. DWORD *lpdwOutputBufferSize;
  476. ULONG index;
  477. PKS_AMVPSIZE pDim;
  478. if( pSrb->CommandData.PropertyInfo->PropertySetID ) {
  479. // TRAP;
  480. pSrb->Status = STATUS_NO_MATCH;
  481. return;
  482. }
  483. dwInputBufferSize = pSrb->CommandData.PropertyInfo->PropertyInputSize;
  484. dwOutputBufferSize = pSrb->CommandData.PropertyInfo->PropertyOutputSize;
  485. lpdwOutputBufferSize = &(pSrb->ActualBytesTransferred);
  486. pSrb->Status = STATUS_SUCCESS;
  487. switch( pSrb->CommandData.PropertyInfo->Property->Id ) {
  488. case KSPROPERTY_VPCONFIG_SETCONNECTINFO:
  489. DebugPrint( (DebugLevelTrace, "KSPROPERTY_VPCONFIG_SETCONNECTINFO\r\n") );
  490. //
  491. // pSrb->CommandData.PropertInfo->PropertyInfo
  492. // points to a ULONG which is an index into the array of
  493. // connectinfo structs returned to the caller from the
  494. // Get call to ConnectInfo.
  495. //
  496. // Since the sample only supports one connection type right
  497. // now, we will ensure that the requested index is 0.
  498. //
  499. //
  500. // at this point, we would program the hardware to use
  501. // the right connection information for the videoport.
  502. // since we are only supporting one connection, we don't
  503. // need to do anything, so we will just indicate success
  504. //
  505. index = *((ULONG *)(pSrb->CommandData.PropertyInfo->PropertyInfo));
  506. DebugPrint(( DebugLevelTrace, "%d\r\n", index ));
  507. if( index == 0 ) {
  508. pHwDevExt->VideoPort = 4; // S3 LPB
  509. // pHwDevExt->DAck.PCIF_SET_DIGITAL_OUT( pHwDevExt->VideoPort );
  510. }
  511. else {//if( index == 1 ) {
  512. pHwDevExt->VideoPort = 7; // ATI AMC
  513. // pHwDevExt->DAck.PCIF_SET_DIGITAL_OUT( pHwDevExt->VideoPort );
  514. }
  515. // else
  516. // TRAP;
  517. break;
  518. case KSPROPERTY_VPCONFIG_DDRAWHANDLE:
  519. DebugPrint( (DebugLevelTrace, "KSPROPERTY_VPCONFIG_DDRAWHANDLE\r\n") );
  520. pHwDevExt->ddrawHandle =
  521. (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo);
  522. break;
  523. case KSPROPERTY_VPCONFIG_VIDEOPORTID:
  524. DebugPrint( (DebugLevelTrace, "KSPROPERTY_VPCONFIG_VIDEOPORTID\r\n") );
  525. pHwDevExt->VidPortID =
  526. (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo);
  527. break;
  528. case KSPROPERTY_VPCONFIG_DDRAWSURFACEHANDLE:
  529. DebugPrint( (DebugLevelTrace, "KSPROPERTY_VPCONFIG_DDRAWSURFACEHANDLE\r\n") );
  530. pHwDevExt->SurfaceHandle =
  531. (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo);
  532. break;
  533. case KSPROPERTY_VPCONFIG_SETVIDEOFORMAT:
  534. DebugPrint(( DebugLevelTrace, "KSPROPERTY_VPCONFIG_SETVIDEOFORMAT\r\n" ));
  535. //
  536. // pSrb->CommandData.PropertInfo->PropertyInfo
  537. // points to a ULONG which is an index into the array of
  538. // VIDEOFORMAT structs returned to the caller from the
  539. // Get call to FORMATINFO
  540. //
  541. // Since the sample only supports one FORMAT type right
  542. // now, we will ensure that the requested index is 0.
  543. //
  544. //
  545. // at this point, we would program the hardware to use
  546. // the right connection information for the videoport.
  547. // since we are only supporting one connection, we don't
  548. // need to do anything, so we will just indicate success
  549. //
  550. index = *((ULONG *)(pSrb->CommandData.PropertyInfo->PropertyInfo));
  551. DebugPrint(( DebugLevelTrace, "%d\r\n", index ));
  552. break;
  553. case KSPROPERTY_VPCONFIG_INFORMVPINPUT:
  554. DebugPrint( (DebugLevelTrace, "KSPROPERTY_VPCONFIG_INFORMVPINPUT\r\n") );
  555. //
  556. // These are the preferred formats for the VPE client
  557. //
  558. // they are multiple properties passed in, return success
  559. //
  560. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  561. break;
  562. case KSPROPERTY_VPCONFIG_INVERTPOLARITY:
  563. DebugPrint( (DebugLevelTrace, "KSPROPERTY_VPCONFIG_INVERTPOLARITY\r\n") );
  564. //
  565. // Toggles the global polarity flag, telling the output
  566. // of the VPE port to be inverted. Since this hardware
  567. // does not support this feature, we will just return
  568. // success for now, although this should be returning not
  569. // implemented
  570. //
  571. break;
  572. case KSPROPERTY_VPCONFIG_SCALEFACTOR:
  573. DebugPrint( (DebugLevelTrace, "KSPROPERTY_VPCONFIG_SCALEFACTOR\r\n") );
  574. //
  575. // the sizes for the scaling factor are passed in, and the
  576. // image dimensions should be scaled appropriately
  577. //
  578. //
  579. // if there is a horizontal scaling available, do it here.
  580. //
  581. // TRAP;
  582. pDim =(PKS_AMVPSIZE)(pSrb->CommandData.PropertyInfo->PropertyInfo);
  583. break;
  584. default:
  585. DebugPrint( (DebugLevelTrace, "PropertySetID 0 default %d(0x%x)\r\n", pSrb->CommandData.PropertyInfo->Property->Id, pSrb->CommandData.PropertyInfo->Property->Id ) );
  586. // TRAP;
  587. pSrb->Status = STATUS_NOT_IMPLEMENTED;
  588. break;
  589. }
  590. }