Changeset 19515 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- May 8, 2009 8:44:45 AM (16 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c
r18246 r19515 26 26 * Module Name: ddenable.c 27 27 * 28 * Content: 28 * Content: 29 29 * 30 30 * Copyright (c) 1994-1998 3Dlabs Inc. Ltd. All rights reserved. … … 37 37 #include <winerror.h> 38 38 39 40 39 #if 0 41 40 static DWORD APIENTRY DdCreateSurface(PDD_CREATESURFACEDATA lpCreateSurface); 42 41 #endif 43 42 43 #ifdef VBOX_WITH_VIDEOHWACCEL 44 void getDDHALInfo(PPDEV pDev, DD_HALINFO* pHALInfo); 45 #endif 44 46 45 47 /** … … 49 51 * 50 52 * Parameters: 51 * 53 * 52 54 * dhpdev 53 55 * Handle to the PDEV returned by the drivers DrvEnablePDEV routine. … … 61 63 * Points to the location in which the driver should return the number of DWORDs pointed to by pdwFourCC. 62 64 * pdwFourCC 63 * Points to an array of DWORDs in which the driver should return information about each FOURCC that it supports. The driver should ignore this parameter when it is NULL. 65 * Points to an array of DWORDs in which the driver should return information about each FOURCC that it supports. The driver should ignore this parameter when it is NULL. 64 66 * 65 67 * Return Value: … … 89 91 /* Setup the HAL driver caps. */ 90 92 pHalInfo->dwSize = sizeof(DD_HALINFO); 93 #ifndef VBOX_WITH_VIDEOHWACCEL 91 94 pHalInfo->dwFlags = 0; 92 93 if (!(pvmList && pdwFourCC)) 94 { 95 #endif 96 97 if (!(pvmList && pdwFourCC)) 98 { 99 #ifdef VBOX_WITH_VIDEOHWACCEL 100 memset(pHalInfo, 0, sizeof(DD_HALINFO)); 101 pHalInfo->dwSize = sizeof(DD_HALINFO); 102 #else 95 103 memset(&pHalInfo->ddCaps, 0, sizeof(DDNTCORECAPS)); 104 #endif 105 96 106 pHalInfo->ddCaps.dwSize = sizeof(DDNTCORECAPS); 97 107 pHalInfo->ddCaps.dwVidMemTotal = pDev->layout.cbDDRAWHeap; … … 105 115 106 116 pHalInfo->ddCaps.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; 107 117 108 118 /* Create primary surface attributes */ 109 119 pHalInfo->vmiData.pvPrimary = pDev->pjScreen; … … 136 146 pHalInfo->vmiData.dwZBufferAlign = 4; 137 147 pHalInfo->vmiData.dwTextureAlign = 4; 138 } 139 148 149 150 #ifdef VBOX_WITH_VIDEOHWACCEL 151 pHalInfo->vmiData.dwOverlayAlign = 4; 152 153 #if 1 154 /* teesting */ 155 pDev->bVHWAEnabled = TRUE; 156 #endif 157 if(pDev->bVHWAEnabled) 158 { 159 getDDHALInfo(pDev, pHalInfo); 160 } 161 #endif 162 } 163 140 164 cHeaps = 0; 141 165 … … 171 195 pVm->fpStart = pDev->layout.offDDRAWHeap; 172 196 pVm->fpEnd = pDev->layout.offDDRAWHeap + pDev->layout.cbDDRAWHeap - 1; /* inclusive */ 173 197 #ifndef VBOX_WITH_VIDEOHWACCEL 174 198 pVm->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; 199 #endif 175 200 DISPDBG((0, "fpStart %x fpEnd %x\n", pVm->fpStart, pVm->fpEnd)); 176 201 … … 178 203 } 179 204 } 205 206 #ifdef VBOX_WITH_VIDEOHWACCEL 207 if(pDev->bVHWAEnabled) 208 { 209 // TODO: filter out hw-unsupported fourccs 210 #define FOURCC_YUV422 (MAKEFOURCC('Y','U','Y','2')) 211 #define FOURCC_YUV411 (MAKEFOURCC('Y','4','1','1')) 212 213 static DWORD fourCC[] = { FOURCC_YUV422, FOURCC_YUV411 }; // The FourCC's we support 214 215 *pdwNumFourCCCodes = sizeof( fourCC ) / sizeof( fourCC[0] ); 216 217 if (pdwFourCC) 218 { 219 memcpy(pdwFourCC, fourCC, sizeof(fourCC)); 220 } 221 } 222 #endif 180 223 181 224 #if 0 /* not mandatory */ … … 198 241 /** 199 242 * DrvEnableDirectDraw 200 * 243 * 201 244 * The DrvEnableDirectDraw function enables hardware for DirectDraw use. 202 * 245 * 203 246 * Parameters 204 * 247 * 205 248 * dhpdev 206 249 * Handle to the PDEV returned by the drivers DrvEnablePDEV routine. … … 210 253 * Points to the DD_SURFACECALLBACKS structure to be initialized by the driver. 211 254 * pPaletteCallBacks 212 * Points to the DD_PALETTECALLBACKS structure to be initialized by the driver. 213 * 255 * Points to the DD_PALETTECALLBACKS structure to be initialized by the driver. 256 * 214 257 * Return Value 215 * 258 * 216 259 * DrvEnableDirectDraw returns TRUE if it succeeds; otherwise, it returns FALSE. 217 260 * … … 224 267 ) 225 268 { 269 #ifdef VBOX_WITH_VIDEOHWACCEL 270 PPDEV pDev = (PPDEV)dhpdev; 271 272 #endif 273 226 274 DISPDBG((0, "%s: %p, %p, %p, %p\n", __FUNCTION__, dhpdev, pCallBacks, pSurfaceCallBacks, pPaletteCallBacks)); 227 275 … … 236 284 // pCallBacks->WaitForVerticalBlank = DdWaitForVerticalBlank; 237 285 // pCallBacks->GetScanLine = DdGetScanLine; 238 // DDHAL_CB32_WAITFORVERTICALBLANK | DDHAL_CB32_GETSCANLINE 286 // DDHAL_CB32_WAITFORVERTICALBLANK | DDHAL_CB32_GETSCANLINE 239 287 /* Note: pCallBacks->SetMode & pCallBacks->DestroyDriver are unused in Windows 2000 and up */ 240 288 … … 262 310 pPaletteCallBacks->dwFlags = 0; 263 311 312 #ifdef VBOX_WITH_VIDEOHWACCEL 313 if(pDev->bVHWAEnabled) 314 { 315 //TODO: filter out those we do not need in case not supported by hw 316 pSurfaceCallBacks->DestroySurface = DdDestroySurface; 317 // pSurfaceCallBacks->Lock = DdLock; 318 // pSurfaceCallBacks->Unlock = DdUnlock; 319 pSurfaceCallBacks->GetBltStatus = DdGetBltStatus; 320 pSurfaceCallBacks->GetFlipStatus = DdGetFlipStatus; 321 pSurfaceCallBacks->SetColorKey = DdSetColorKey; 322 pSurfaceCallBacks->Flip = DdFlip; 323 pSurfaceCallBacks->Blt = DdBlt; 324 325 pSurfaceCallBacks->dwFlags |= DDHAL_SURFCB32_DESTROYSURFACE | 326 DDHAL_SURFCB32_FLIP 327 // | DDHAL_SURFCB32_LOCK 328 | DDHAL_SURFCB32_BLT | 329 DDHAL_SURFCB32_GETBLTSTATUS | 330 DDHAL_SURFCB32_GETFLIPSTATUS | 331 DDHAL_SURFCB32_SETCOLORKEY 332 // | DDHAL_SURFCB32_UNLOCK 333 ; 334 335 pSurfaceCallBacks->UpdateOverlay = DdUpdateOverlay; // Now supporting overlays. 336 pSurfaceCallBacks->SetOverlayPosition = DdSetOverlayPosition; 337 pSurfaceCallBacks->dwFlags |= 338 DDHAL_SURFCB32_UPDATEOVERLAY | // Now supporting 339 DDHAL_SURFCB32_SETOVERLAYPOSITION ; // overlays. 340 } 341 #endif 264 342 return TRUE; 265 343 } … … 267 345 /** 268 346 * DrvDisableDirectDraw 269 * 347 * 270 348 * The DrvDisableDirectDraw function disables hardware for DirectDraw use. 271 * 349 * 272 350 * Parameters 273 * 351 * 274 352 * dhpdev 275 353 * Handle to the PDEV returned by the drivers DrvEnablePDEV routine. … … 283 361 /** 284 362 * DdGetDriverInfo 285 * 363 * 286 364 * The DdGetDriverInfo function queries the driver for additional DirectDraw and Direct3D functionality that the driver supports. 287 * 365 * 288 366 * Parameters 289 367 * lpGetDriverInfo 290 368 * Points to a DD_GETDRIVERINFODATA structure that contains the information required to perform the query. 291 * 369 * 292 370 * Return Value 293 * 294 * DdGetDriverInfo must return DDHAL_DRIVER_HANDLED. 371 * 372 * DdGetDriverInfo must return DDHAL_DRIVER_HANDLED. 295 373 * 296 374 */ … … 310 388 DISPDBG((0, " -> GUID_D3DCallbacks3\n")); 311 389 } 312 else 390 else 313 391 if (IsEqualIID(&lpData->guidInfo, &GUID_D3DExtendedCaps)) 314 392 { 315 393 DISPDBG((0, " -> GUID_D3DExtendedCaps\n")); 316 394 } 317 else 395 else 318 396 if (IsEqualIID(&lpData->guidInfo, &GUID_ZPixelFormats)) 319 397 { 320 398 DISPDBG((0, " -> GUID_ZPixelFormats\n")); 321 399 } 322 else 400 else 323 401 if (IsEqualIID(&(lpData->guidInfo), &GUID_D3DParseUnknownCommandCallback)) 324 402 { 325 403 DISPDBG((0, " -> GUID_D3DParseUnknownCommandCallback\n")); 326 404 } 327 else 405 else 328 406 if (IsEqualIID(&(lpData->guidInfo), &GUID_Miscellaneous2Callbacks)) 329 407 { 330 408 DISPDBG((0, " -> GUID_Miscellaneous2Callbacks\n")); 331 409 } 332 else 410 else 333 411 if (IsEqualIID(&(lpData->guidInfo), &GUID_UpdateNonLocalHeap)) 334 412 { 335 413 DISPDBG((0, " -> GUID_UpdateNonLocalHeap\n")); 336 414 } 337 else 415 else 338 416 if (IsEqualIID(&(lpData->guidInfo), &GUID_GetHeapAlignment)) 339 417 { 340 418 DISPDBG((0, " -> GUID_GetHeapAlignment\n")); 341 419 } 342 else 420 else 343 421 if (IsEqualIID(&(lpData->guidInfo), &GUID_NTPrivateDriverCaps)) 344 422 { … … 358 436 lpData->ddRVal = DD_OK; 359 437 } 360 else 438 else 361 439 if (IsEqualIID(&(lpData->guidInfo), &GUID_DDMoreSurfaceCaps)) 362 440 { … … 395 473 lpData->ddRVal = DD_OK; 396 474 } 397 else 475 else 398 476 if (IsEqualIID(&(lpData->guidInfo), &GUID_DDStereoMode)) 399 477 { 400 478 DISPDBG((0, " -> GUID_DDStereoMode\n")); 401 479 } 402 else 480 else 403 481 if (IsEqualIID(&(lpData->guidInfo), &GUID_NonLocalVidMemCaps)) 404 482 { 405 483 DISPDBG((0, " -> GUID_NonLocalVidMemCaps\n")); 406 } 407 else 484 } 485 else 408 486 if (IsEqualIID(&lpData->guidInfo, &GUID_NTCallbacks)) 409 487 { … … 475 553 /** 476 554 * DdCreateSurface 477 * 555 * 478 556 * The DdCreateSurface callback function creates a DirectDraw surface. 479 * 557 * 480 558 * lpCreateSurface 481 559 * Points to a DD_CREATESURFACEDATA structure that contains the information required to create a surface. 482 * 560 * 483 561 * Return Value 484 * 562 * 485 563 * DdCreateSurface returns one of the following callback codes: 486 564 * DDHAL_DRIVER_HANDLED 487 565 * DDHAL_DRIVER_NOTHANDLED 488 * 566 * 489 567 */ 490 568 DWORD APIENTRY DdCreateSurface(PDD_CREATESURFACEDATA lpCreateSurface) … … 499 577 500 578 lpSurfaceLocal = lpCreateSurface->lplpSList[0]; 501 lpSurfaceGlobal = lpSurfaceLocal->lpGbl; 579 lpSurfaceGlobal = lpSurfaceLocal->lpGbl; 502 580 lpSurfaceDesc = lpCreateSurface->lpDDSurfaceDesc; 503 581 … … 510 588 lPitch = (lPitch + 31) & ~31; 511 589 } 512 else 590 else 513 591 if (lpSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) 514 592 { … … 543 621 lpSurfaceGlobal->fpVidMem = DDHAL_PLEASEALLOC_BLOCKSIZE; 544 622 } 545 623 546 624 lpSurfaceDesc->lPitch = lpSurfaceGlobal->lPitch; 547 625 lpSurfaceDesc->dwFlags |= DDSD_PITCH; … … 553 631 /** 554 632 * DdCanCreateSurface 555 * 633 * 556 634 * The DdCanCreateSurface callback function indicates whether the driver can create a surface of the specified surface description. 557 * 558 * 635 * 636 * 559 637 * Parameters 560 638 * lpCanCreateSurface 561 639 * Points to the DD_CANCREATESURFACEDATA structure containing the information required for the driver to determine whether a surface can be created. 562 * 640 * 563 641 * Return Value 564 * 642 * 565 643 * DdCanCreateSurface returns one of the following callback codes: 566 * 644 * 567 645 * DDHAL_DRIVER_HANDLED 568 646 * DDHAL_DRIVER_NOTHANDLED … … 590 668 } 591 669 670 #ifndef VBOX_WITH_VIDEOHWACCEL 592 671 if (lpCanCreateSurface->bIsDifferentPixelFormat && (lpDDS->ddpfPixelFormat.dwFlags & DDPF_FOURCC)) 593 672 { … … 596 675 return DDHAL_DRIVER_HANDLED; 597 676 } 677 #else 678 /* TODO: filter out unsupported formats */ 679 #endif 598 680 599 681 lpCanCreateSurface->ddRVal = DD_OK; … … 605 687 // DdMapMemory 606 688 // 607 // Maps application-modifiable portions of the frame buffer into the 689 // Maps application-modifiable portions of the frame buffer into the 608 690 // user-mode address space of the specified process, or unmaps memory. 609 691 // 610 // DdMapMemory is called to perform memory mapping before the first call to 611 // DdLock. The handle returned by the driver in fpProcess will be passed to 612 // every DdLock call made on the driver. 613 // 614 // DdMapMemory is also called to unmap memory after the last DdUnLock call is 692 // DdMapMemory is called to perform memory mapping before the first call to 693 // DdLock. The handle returned by the driver in fpProcess will be passed to 694 // every DdLock call made on the driver. 695 // 696 // DdMapMemory is also called to unmap memory after the last DdUnLock call is 615 697 // made. 616 698 // … … 619 701 // 620 702 // Parameters 621 // lpMapMemory 622 // Points to a DD_MAPMEMORYDATA structure that contains details for 623 // the memory mapping or unmapping operation. 624 // 625 // .lpDD 626 // Points to a DD_DIRECTDRAW_GLOBAL structure that represents 627 // the driver. 628 // .bMap 629 // Specifies the memory operation that the driver should perform. 630 // A value of TRUE indicates that the driver should map memory; 631 // FALSE means that the driver should unmap memory. 632 // .hProcess 633 // Specifies a handle to the process whose address space is 634 // affected. 635 // .fpProcess 636 // Specifies the location in which the driver should return the 637 // base address of the process's memory mapped space when bMap 638 // is TRUE. When bMap is FALSE, fpProcess contains the base 703 // lpMapMemory 704 // Points to a DD_MAPMEMORYDATA structure that contains details for 705 // the memory mapping or unmapping operation. 706 // 707 // .lpDD 708 // Points to a DD_DIRECTDRAW_GLOBAL structure that represents 709 // the driver. 710 // .bMap 711 // Specifies the memory operation that the driver should perform. 712 // A value of TRUE indicates that the driver should map memory; 713 // FALSE means that the driver should unmap memory. 714 // .hProcess 715 // Specifies a handle to the process whose address space is 716 // affected. 717 // .fpProcess 718 // Specifies the location in which the driver should return the 719 // base address of the process's memory mapped space when bMap 720 // is TRUE. When bMap is FALSE, fpProcess contains the base 639 721 // address of the memory to be unmapped by the driver. 640 // .ddRVal 641 // Specifies the location in which the driver writes the return 642 // value of the DdMapMemory callback. A return code of DD_OK 643 // indicates success. 722 // .ddRVal 723 // Specifies the location in which the driver writes the return 724 // value of the DdMapMemory callback. A return code of DD_OK 725 // indicates success. 644 726 // 645 727 //----------------------------------------------------------------------------- … … 683 765 684 766 lpMapMemory->ddRVal = DDERR_GENERIC; 685 767 686 768 DISPDBG((0, "DdMapMemory: Exit GEN, DDHAL_DRIVER_HANDLED\n")); 687 769 688 770 return(DDHAL_DRIVER_HANDLED); 689 771 } 690 772 691 lpMapMemory->fpProcess = 773 lpMapMemory->fpProcess = 692 774 (FLATPTR) ShareMemoryInformation.VirtualAddress; 693 775 } … … 718 800 /** 719 801 * DdLock 720 * 802 * 721 803 * The DdLock callback function locks a specified area of surface memory and provides a valid pointer to a block of memory associated with a surface. 722 * 804 * 723 805 * Parameters 724 806 * lpLock 725 807 * Points to a DD_LOCKDATA structure that contains the information required to perform the lockdown. 726 * 808 * 727 809 * Return Value 728 * 810 * 729 811 * DdLock returns one of the following callback codes: 730 * 812 * 731 813 * DDHAL_DRIVER_HANDLED 732 814 * DDHAL_DRIVER_NOTHANDLED … … 736 818 { 737 819 PPDEV pDev = (PPDEV)lpLock->lpDD->dhpdev; 738 820 739 821 PDD_SURFACE_LOCAL lpSurfaceLocal = lpLock->lpDDSurface; 740 822 … … 774 856 /** 775 857 * DdUnlock 776 * 858 * 777 859 * The DdUnLock callback function releases the lock held on the specified surface. 778 * 860 * 779 861 * Parameters 780 862 * lpUnlock 781 * Points to a DD_UNLOCKDATA structure that contains the information required to perform the lock release. * 782 * 863 * Points to a DD_UNLOCKDATA structure that contains the information required to perform the lock release. * 864 * 783 865 * Return Value 784 * 866 * 785 867 * DdLock returns one of the following callback codes: 786 * 868 * 787 869 * DDHAL_DRIVER_HANDLED 788 870 * DDHAL_DRIVER_NOTHANDLED … … 797 879 { 798 880 DISPDBG((0, "%d,%d %dx%d\n", pDev->ddLock.rArea.left, pDev->ddLock.rArea.top, pDev->ddLock.rArea.right - pDev->ddLock.rArea.left, pDev->ddLock.rArea.bottom - pDev->ddLock.rArea.top)); 799 881 800 882 #ifndef VBOX_WITH_HGSMI 801 883 if (pDev->pInfo && vboxHwBufferBeginUpdate (pDev)) … … 853 935 /** 854 936 * DdDestroySurface 855 * 937 * 856 938 * The DdDestroySurface callback function destroys a DirectDraw surface. 857 * 939 * 858 940 * Parameters 859 941 * lpDestroySurface 860 942 * Points to a DD_DESTROYSURFACEDATA structure that contains the information needed to destroy a surface. 861 * 943 * 862 944 * Return Value 863 * 945 * 864 946 * DdDestroySurface returns one of the following callback codes: 865 * 947 * 866 948 * DDHAL_DRIVER_HANDLED 867 949 * DDHAL_DRIVER_NOTHANDLED … … 957 1039 } 958 1040 1041 #ifdef VBOX_WITH_VIDEOHWACCEL 1042 DWORD APIENTRY DdSetColorKey(PDD_SETCOLORKEYDATA lpSetColorKey) 1043 { 1044 DISPDBG((0, "%s\n", __FUNCTION__)); 1045 lpSetColorKey->ddRVal = DD_OK; 1046 return DDHAL_DRIVER_HANDLED; 1047 } 1048 1049 DWORD APIENTRY DdAddAttachedSurface(PDD_ADDATTACHEDSURFACEDATA lpAddAttachedSurface) 1050 { 1051 DISPDBG((0, "%s\n", __FUNCTION__)); 1052 lpAddAttachedSurface->ddRVal = DD_OK; 1053 return DDHAL_DRIVER_HANDLED; 1054 } 1055 1056 DWORD APIENTRY DdBlt(PDD_BLTDATA lpBlt) 1057 { 1058 DISPDBG((0, "%s\n", __FUNCTION__)); 1059 lpBlt->ddRVal = DD_OK; 1060 return DDHAL_DRIVER_HANDLED; 1061 } 1062 1063 //DWORD APIENTRY DdDestroySurface(PDD_DESTROYSURFACEDATA lpDestroySurface) 1064 //{ 1065 // DISPDBG((0, "%s\n", __FUNCTION__)); 1066 // lpDestroySurface->ddRVal = DD_OK; 1067 // return DDHAL_DRIVER_HANDLED; 1068 //} 1069 1070 DWORD APIENTRY DdFlip(PDD_FLIPDATA lpFlip) 1071 { 1072 DISPDBG((0, "%s\n", __FUNCTION__)); 1073 lpFlip->ddRVal = DD_OK; 1074 return DDHAL_DRIVER_HANDLED; 1075 } 1076 1077 DWORD APIENTRY DdGetBltStatus(PDD_GETBLTSTATUSDATA lpGetBltStatus) 1078 { 1079 DISPDBG((0, "%s\n", __FUNCTION__)); 1080 1081 if(lpGetBltStatus->dwFlags == DDGBS_CANBLT) 1082 { 1083 lpGetBltStatus->ddRVal = DD_OK; 1084 } 1085 else 1086 { 1087 lpGetBltStatus->ddRVal = DD_OK; 1088 } 1089 1090 return DDHAL_DRIVER_HANDLED; 1091 } 1092 1093 DWORD APIENTRY DdGetFlipStatus(PDD_GETFLIPSTATUSDATA lpGetFlipStatus) 1094 { 1095 DISPDBG((0, "%s\n", __FUNCTION__)); 1096 if(lpGetFlipStatus->dwFlags == DDGFS_CANFLIP) 1097 { 1098 lpGetFlipStatus->ddRVal = DD_OK; 1099 } 1100 else 1101 { 1102 lpGetFlipStatus->ddRVal = DD_OK; 1103 } 1104 1105 return DDHAL_DRIVER_HANDLED; 1106 } 1107 1108 DWORD APIENTRY DdSetOverlayPosition(PDD_SETOVERLAYPOSITIONDATA lpSetOverlayPosition) 1109 { 1110 DISPDBG((0, "%s\n", __FUNCTION__)); 1111 1112 lpSetOverlayPosition->ddRVal = DD_OK; 1113 return DDHAL_DRIVER_HANDLED; 1114 } 1115 1116 DWORD APIENTRY DdUpdateOverlay(PDD_UPDATEOVERLAYDATA lpUpdateOverlay) 1117 { 1118 DISPDBG((0, "%s\n", __FUNCTION__)); 1119 1120 lpUpdateOverlay->ddRVal = DD_OK; 1121 return DDHAL_DRIVER_HANDLED; 1122 } 1123 1124 //----------------------------------------------------------------------------- 1125 // setupRops 1126 // 1127 // Build array for supported ROPS 1128 //----------------------------------------------------------------------------- 1129 static void 1130 setupRops( 1131 LPBYTE proplist, 1132 LPDWORD proptable, 1133 int cnt ) 1134 { 1135 int i; 1136 DWORD idx; 1137 DWORD bit; 1138 DWORD rop; 1139 1140 for(i=0; i<cnt; i++) 1141 { 1142 rop = proplist[i]; 1143 idx = rop / 32; 1144 bit = 1L << ((DWORD)(rop % 32)); 1145 proptable[idx] |= bit; 1146 } 1147 1148 } // setupRops 1149 1150 //----------------------------------------------------------------------------- 1151 // 1152 // Function: __GetDDHALInfo 1153 // 1154 // Returns: void 1155 // 1156 // Description: 1157 // 1158 // Takes a pointer to a partially or fully filled in pThisDisplay and a pointer 1159 // to an empty DDHALINFO and fills in the DDHALINFO. This eases porting to NT 1160 // and means that caps changes are done in only one place. The pThisDisplay 1161 // may not be fully constructed here, so you should only: 1162 // a) Query the registry 1163 // b) DISPDBG 1164 // If you need to add anything to pThisDisplay for NT, you should fill it in 1165 // during the DrvGetDirectDraw call. 1166 // 1167 // The problem here is when the code is run on NT. If there was any other way... 1168 // 1169 // The following caps have been found to cause NT to bail.... 1170 // DDCAPS_GDI, DDFXCAPS_BLTMIRRORUPDOWN, DDFXCAPS_BLTMIRRORLEFTRIGHT 1171 // 1172 // 1173 //----------------------------------------------------------------------------- 1174 1175 // 1176 // use bits to indicate which ROPs you support. 1177 // 1178 // DWORD 0, bit 0 == ROP 0 1179 // DWORD 8, bit 31 == ROP 255 1180 // 1181 1182 //static DWORD ropsAGP[DD_ROP_SPACE] = { 0 }; 1183 static BYTE ropListNT[] = 1184 { 1185 SRCCOPY >> 16 1186 // WHITENESS >> 16, 1187 // BLACKNESS >> 16 1188 }; 1189 1190 static DWORD rops[DD_ROP_SPACE] = { 0 }; 1191 1192 void 1193 getDDHALInfo( 1194 PPDEV pDev, 1195 DD_HALINFO* pHALInfo) 1196 { 1197 int i; 1198 1199 /* TODO: only enable features supported by the host backend & host hw 1200 * for now this just combines all caps we might use */ 1201 1202 // Setup the ROPS we do. 1203 setupRops( ropListNT, 1204 rops, 1205 sizeof(ropListNT)/sizeof(ropListNT[0])); 1206 1207 // The most basic DirectDraw functionality 1208 pHALInfo->ddCaps.dwCaps |= DDCAPS_BLT 1209 | DDCAPS_BLTQUEUE 1210 | DDCAPS_BLTCOLORFILL 1211 // | DDCAPS_READSCANLINE 1212 ; 1213 1214 pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN 1215 | DDSCAPS_PRIMARYSURFACE 1216 | DDSCAPS_FLIP; 1217 1218 pHALInfo->ddCaps.dwCaps |= DDCAPS_3D | 1219 DDCAPS_BLTDEPTHFILL; 1220 1221 pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_3DDEVICE | 1222 DDSCAPS_ZBUFFER | 1223 DDSCAPS_ALPHA; 1224 pHALInfo->ddCaps.dwCaps2 = 0; 1225 1226 //#if DX7_TEXMANAGEMENT 1227 // We need to set this bit up in order to be able to do 1228 // out own texture management 1229 // pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_CANMANAGETEXTURE; 1230 //#if DX8_DDI 1231 // pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_CANMANAGERESOURCE; 1232 //#endif 1233 //#endif 1234 1235 //#if DX8_DDI 1236 // We need to flag we can run in windowed mode, otherwise we 1237 // might get restricted by apps to run in fullscreen only 1238 pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_CANRENDERWINDOWED; 1239 //#endif 1240 1241 //#if DX8_DDI 1242 // We need to flag we support dynamic textures. That is , apps can 1243 // lock with high frequency video memory textures without paying a 1244 // penalty for it. Since on this sample driver we only support 1245 // linear memory formats for textures we don't need to do anything 1246 // else for this support. Otherwise we would have to keep two surfaces 1247 // for textures created with the DDSCAPS2_HINTDYNAMIC hint in order 1248 // to efficiently do the linear<->swizzled transformation or keep the 1249 // texture permanantly in an unswizzled state. 1250 // pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_DYNAMICTEXTURES; 1251 #if DX9_DDI 1252 // Notice that dynamic textures MUST be supported in order to instantiate a DX9 device 1253 #endif // DX9_DDI 1254 //#endif 1255 1256 // pHALInfo->ddCaps.dwFXCaps = 0; 1257 1258 // P3RX can do: 1259 // 1. Stretching/Shrinking 1260 // 2. YUV->RGB conversion 1261 // 3. Mirroring in X and Y 1262 // 4. ColorKeying from a source color and a source color space 1263 pHALInfo->ddCaps.dwCaps |= DDCAPS_BLTSTRETCH 1264 | DDCAPS_BLTFOURCC 1265 | DDCAPS_COLORKEY 1266 // | DDCAPS_CANBLTSYSMEM 1267 ; 1268 1269 // Special effects caps 1270 pHALInfo->ddCaps.dwFXCaps |= DDFXCAPS_BLTSTRETCHY | 1271 DDFXCAPS_BLTSTRETCHX | 1272 DDFXCAPS_BLTSTRETCHYN | 1273 DDFXCAPS_BLTSTRETCHXN | 1274 DDFXCAPS_BLTSHRINKY | 1275 DDFXCAPS_BLTSHRINKX | 1276 DDFXCAPS_BLTSHRINKYN | 1277 DDFXCAPS_BLTSHRINKXN; 1278 1279 // ColorKey caps 1280 pHALInfo->ddCaps.dwCKeyCaps |= DDCKEYCAPS_SRCBLT | 1281 DDCKEYCAPS_SRCBLTCLRSPACE | 1282 DDCKEYCAPS_DESTBLT | 1283 DDCKEYCAPS_DESTBLTCLRSPACE; 1284 1285 // pHALInfo->ddCaps.dwSVBCaps = DDCAPS_BLT; 1286 1287 // // We can do a texture from sysmem to video mem. 1288 // pHALInfo->ddCaps.dwSVBCKeyCaps |= DDCKEYCAPS_DESTBLT | 1289 // DDCKEYCAPS_DESTBLTCLRSPACE; 1290 pHALInfo->ddCaps.dwSVBFXCaps = 0; 1291 1292 // // Fill in the sysmem->vidmem rops (only can copy); 1293 // for( i=0;i<DD_ROP_SPACE;i++ ) 1294 // { 1295 // pHALInfo->ddCaps.dwSVBRops[i] = rops[i]; 1296 // } 1297 1298 //mirroring with blitting 1299 pHALInfo->ddCaps.dwFXCaps |= DDFXCAPS_BLTMIRRORUPDOWN | 1300 DDFXCAPS_BLTMIRRORLEFTRIGHT; 1301 1302 pHALInfo->ddCaps.dwCKeyCaps |= DDCKEYCAPS_SRCBLTCLRSPACEYUV; 1303 1304 pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_TEXTURE; 1305 1306 //#if DX7_STEREO 1307 // // Report the stereo capability back to runtime 1308 // pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_STEREO; 1309 // pHALInfo->ddCaps.dwSVCaps = DDSVCAPS_STEREOSEQUENTIAL; 1310 //#endif 1311 1312 // Z Buffer is only 16 Bits 1313 // pHALInfo->ddCaps.dwZBufferBitDepths = DDBD_16; 1314 // pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_MIPMAP; 1315 1316 pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM; 1317 1318 { 1319 //#ifdef SUPPORT_VIDEOPORT 1320 // // We support 1 video port. Must set CurrVideoPorts to 0 1321 // // We can't do interleaved bobbing yet - maybe in the future. 1322 // pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_VIDEOPORT | 1323 // DDCAPS2_CANBOBNONINTERLEAVED; 1324 // 1325 // pHALInfo->ddCaps.dwMaxVideoPorts = 1; 1326 // pHALInfo->ddCaps.dwCurrVideoPorts = 0; 1327 // 1328 // 1329 //#endif // SUPPORT_VIDEOPORT 1330 1331 1332 { 1333 // Overlay is free to use. 1334 pHALInfo->ddCaps.dwMaxVisibleOverlays = 1; 1335 pHALInfo->ddCaps.dwCurrVisibleOverlays = 0; 1336 1337 pHALInfo->ddCaps.dwCaps |= DDCAPS_OVERLAY | 1338 DDCAPS_OVERLAYFOURCC | 1339 DDCAPS_OVERLAYSTRETCH | 1340 DDCAPS_COLORKEYHWASSIST | 1341 DDCAPS_OVERLAYCANTCLIP; 1342 1343 pHALInfo->ddCaps.dwCKeyCaps |= DDCKEYCAPS_SRCOVERLAY | 1344 DDCKEYCAPS_SRCOVERLAYONEACTIVE | 1345 DDCKEYCAPS_SRCOVERLAYYUV | 1346 DDCKEYCAPS_DESTOVERLAY | 1347 DDCKEYCAPS_DESTOVERLAYONEACTIVE | 1348 DDCKEYCAPS_DESTOVERLAYYUV; 1349 1350 pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_OVERLAY; 1351 1352 pHALInfo->ddCaps.dwFXCaps |= DDFXCAPS_OVERLAYSHRINKX | 1353 DDFXCAPS_OVERLAYSHRINKXN | 1354 DDFXCAPS_OVERLAYSHRINKY | 1355 DDFXCAPS_OVERLAYSHRINKYN | 1356 DDFXCAPS_OVERLAYSTRETCHX | 1357 DDFXCAPS_OVERLAYSTRETCHXN | 1358 DDFXCAPS_OVERLAYSTRETCHY | 1359 DDFXCAPS_OVERLAYSTRETCHYN; 1360 1361 // Indicates that Perm3 has no stretch ratio limitation 1362 pHALInfo->ddCaps.dwMinOverlayStretch = 1; 1363 pHALInfo->ddCaps.dwMaxOverlayStretch = 32000; 1364 } 1365 } 1366 1367 //#ifdef W95_DDRAW 1368 //#ifdef USE_DD_CONTROL_COLOR 1369 // // Enable colour control asc brightness, contrast, gamma. 1370 // pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_COLORCONTROLPRIMARY; 1371 //#endif 1372 //#endif 1373 1374 // Also permit surfaces wider than the display buffer. 1375 pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_WIDESURFACES; 1376 1377 // Enable copy blts betweemn Four CC formats for DShow acceleration 1378 pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_COPYFOURCC; 1379 1380 // Won't do Video-Sys mem Blits. 1381 pHALInfo->ddCaps.dwVSBCaps = 0; 1382 pHALInfo->ddCaps.dwVSBCKeyCaps = 0; 1383 pHALInfo->ddCaps.dwVSBFXCaps = 0; 1384 for( i=0;i<DD_ROP_SPACE;i++ ) 1385 { 1386 pHALInfo->ddCaps.dwVSBRops[i] = 0; 1387 } 1388 1389 // Won't do Sys-Sys mem Blits 1390 pHALInfo->ddCaps.dwSSBCaps = 0; 1391 pHALInfo->ddCaps.dwSSBCKeyCaps = 0; 1392 pHALInfo->ddCaps.dwSSBFXCaps = 0; 1393 for( i=0;i<DD_ROP_SPACE;i++ ) 1394 { 1395 pHALInfo->ddCaps.dwSSBRops[i] = 0; 1396 } 1397 1398 // 1399 // bit depths supported for alpha and Z 1400 // 1401 // pHALInfo->ddCaps.dwAlphaBltConstBitDepths = DDBD_2 | 1402 // DDBD_4 | 1403 // DDBD_8; 1404 // 1405 // pHALInfo->ddCaps.dwAlphaBltPixelBitDepths = DDBD_1 | 1406 // DDBD_8; 1407 // pHALInfo->ddCaps.dwAlphaBltSurfaceBitDepths = DDBD_1 | 1408 // DDBD_2 | 1409 // DDBD_4 | 1410 // DDBD_8; 1411 1412 // No alpha blending for overlays, so I'm not sure what these should be. 1413 // Because we support 32bpp overlays, it's just that you can't use the 1414 // alpha bits for blending. Pass. 1415 pHALInfo->ddCaps.dwAlphaBltConstBitDepths = DDBD_2 | 1416 DDBD_4 | 1417 DDBD_8; 1418 1419 pHALInfo->ddCaps.dwAlphaBltPixelBitDepths = DDBD_1 | 1420 DDBD_8; 1421 1422 pHALInfo->ddCaps.dwAlphaBltSurfaceBitDepths = DDBD_1 | 1423 DDBD_2 | 1424 DDBD_4 | 1425 DDBD_8; 1426 1427 // 1428 // ROPS supported 1429 // 1430 for( i=0;i<DD_ROP_SPACE;i++ ) 1431 { 1432 pHALInfo->ddCaps.dwRops[i] = rops[i]; 1433 } 1434 1435 //Reenable: // For DX5 and beyond we support this new informational callback. 1436 // pHALInfo->GetDriverInfo = DdGetDriverInfo; 1437 // pHALInfo->dwFlags |= DDHALINFO_GETDRIVERINFOSET; 1438 // 1439 //#if DX8_DDI 1440 // // Flag our support for a new class of GUIDs that may come through 1441 // // GetDriverInfo for DX8 drivers. (This support will be compulsory) 1442 // pHALInfo->dwFlags |= DDHALINFO_GETDRIVERINFO2; 1443 //#endif DX8_DDI 1444 1445 1446 } // getDDHALInfo 1447 1448 1449 #endif 1450 1451 959 1452 960 1453 #endif /* VBOX_WITH_DDRAW */ -
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.h
r8387 r19515 39 39 DWORD CALLBACK DdMapMemory(PDD_MAPMEMORYDATA lpMapMemory); 40 40 41 #ifdef VBOX_WITH_VIDEOHWACCEL 42 DWORD APIENTRY DdSetColorKey(PDD_SETCOLORKEYDATA lpSetColorKey); 43 DWORD APIENTRY DdAddAttachedSurface(PDD_ADDATTACHEDSURFACEDATA lpAddAttachedSurface); 44 DWORD APIENTRY DdBlt(PDD_BLTDATA lpBlt); 45 DWORD APIENTRY DdDestroySurface(PDD_DESTROYSURFACEDATA lpDestroySurface); 46 DWORD APIENTRY DdFlip(PDD_FLIPDATA lpFlip); 47 DWORD APIENTRY DdGetBltStatus(PDD_GETBLTSTATUSDATA lpGetBltStatus); 48 DWORD APIENTRY DdGetFlipStatus(PDD_GETFLIPSTATUSDATA lpGetFlipStatus); 49 DWORD APIENTRY DdSetOverlayPosition(PDD_SETOVERLAYPOSITIONDATA lpSetOverlayPosition); 50 DWORD APIENTRY DdUpdateOverlay(PDD_UPDATEOVERLAYDATA lpUpdateOverlay); 51 #endif 52 41 53 #endif /* __VBOX_DD_H__*/
Note:
See TracChangeset
for help on using the changeset viewer.