Changeset 26324 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Timestamp:
- Feb 8, 2010 1:03:29 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r26320 r26324 172 172 /* preferred mode index */ 173 173 static uint32_t gPreferredVideoMode = 0; 174 175 static D3DKMDT_2DREGION g_VBoxWddmVideoResolutions[RT_ELEMENTS(VideoModes)]; 176 static uint32_t g_VBoxWddmNumResolutions; 177 178 DECLINLINE(int) vboxWddmRectComparator(const D3DKMDT_2DREGION *pReg1, const D3DKMDT_2DREGION *pReg2) 179 { 180 int tmp = pReg1->cx - pReg2->cx; 181 if(tmp) 182 return tmp; 183 tmp = pReg1->cy - pReg2->cy; 184 return tmp; 185 } 186 187 /* builds a g_VBoxWddmVideoResolutions given VideoModes info */ 188 VOID vboxWddmBuildResolutionTable() 189 { 190 g_VBoxWddmNumResolutions = 0; 191 192 /* we don't care about the efficiency at this time */ 193 for (uint32_t i = 0; i < gNumVideoModes; ++i) 194 { 195 VIDEO_MODE_INFORMATION *pMode = &VideoModes[i]; 196 bool bFound = false; 197 for (uint32_t j = 0; j < g_VBoxWddmNumResolutions; ++j) 198 { 199 if (g_VBoxWddmVideoResolutions[j].cx == pMode->VisScreenWidth 200 && g_VBoxWddmVideoResolutions[j].cy == pMode->VisScreenHeight) 201 { 202 bFound = true; 203 break; 204 } 205 } 206 207 if (!bFound) 208 { 209 g_VBoxWddmVideoResolutions[g_VBoxWddmNumResolutions].cx = pMode->VisScreenWidth; 210 g_VBoxWddmVideoResolutions[g_VBoxWddmNumResolutions].cy = pMode->VisScreenHeight; 211 } 212 } 213 } 174 214 #endif 175 215 … … 893 933 #endif 894 934 935 #ifdef VBOXWDDM 936 vboxWddmBuildResolutionTable(); 937 #endif 938 895 939 VBoxVideoCmnRegFini(Reg); 896 940 } … … 903 947 * or the available VRAM does not allow for additional modes. 904 948 */ 905 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode) 949 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, 950 VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode, 951 D3DKMDT_2DREGION **ppResolutions, uint32_t * pcResolutions) 906 952 { 907 953 static bool bTableInitialized = false; … … 915 961 *pcModes = gNumVideoModes; 916 962 *pPreferrableMode = gPreferredVideoMode; 963 *ppResolutions = g_VBoxWddmVideoResolutions; 964 *pcResolutions = g_VBoxWddmNumResolutions; 917 965 } 918 966 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r26320 r26324 624 624 RT_C_DECLS_END 625 625 626 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode); 626 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, 627 VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode, 628 D3DKMDT_2DREGION **pResolutions, uint32_t * pcResolutions); 629 627 630 D3DDDIFORMAT vboxWddmCalcPixelFormat(VIDEO_MODE_INFORMATION *pInfo); 628 631 UINT vboxWddmCalcBitsPerPixel(D3DDDIFORMAT format); … … 656 659 uint32_t iPreferredMode; 657 660 VIDEO_MODE_INFORMATION *pModes; 661 uint32_t cResolutions; 662 D3DKMDT_2DREGION *pResolutions; 658 663 }VBOXVIDPNCOFUNCMODALITY, *PVBOXVIDPNCOFUNCMODALITY; 659 664 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp
r26320 r26324 498 498 NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt, 499 499 D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, 500 VIDEO_MODE_INFORMATION *pMode) 500 D3DKMDT_2DREGION *pResolution, 501 BOOLEAN bPreferred) 501 502 { 502 503 NTSTATUS Status = STATUS_SUCCESS; 503 #if 0 504 todo(); 505 if (pMode->AttributeFlags & VIDEO_MODE_GRAPHICS) 506 { 507 /* this is a graphics mode */ 508 pNewVidPnSourceModeInfo->Type = D3DKMDT_RMT_GRAPHICS; 509 pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx = pMode->VisScreenWidth; 510 pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy = pMode->VisScreenHeight; 511 pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize; 512 pNewVidPnSourceModeInfo->Format.Graphics.Stride = pMode->ScreenStride; 513 pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat = vboxWddmCalcPixelFormat(pInfo); 514 Assert(pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat != D3DDDIFMT_UNKNOWN); 515 if (pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat != D3DDDIFMT_UNKNOWN) 516 { 517 pNewVidPnSourceModeInfo->Format.Graphics.ColorBasis = D3DKMDT_CB_SRGB; 518 if (pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat == D3DDDIFMT_P8) 519 pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_SETTABLEPALETTE; 520 else 521 pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_DIRECT; 522 } 523 else 524 { 525 drprintf((__FUNCTION__": vboxWddmCalcPixelFormat failed\n")); 526 Status = STATUS_INVALID_PARAMETER; 527 } 528 } 529 else 530 { 531 /* @todo: XPDM driver does not seem to return text modes, should we? */ 532 drprintf((__FUNCTION__": text mode not supported currently\n")); 533 AssertBreakPoint(); 534 Status = STATUS_INVALID_PARAMETER; 535 } 536 #endif 504 505 pNewVidPnTargetModeInfo->VideoSignalInfo.VideoStandard = D3DKMDT_VSS_VESA_DMT; 506 pNewVidPnTargetModeInfo->VideoSignalInfo.TotalSize = *pResolution; 507 pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize = pNewVidPnTargetModeInfo->VideoSignalInfo.TotalSize; 508 pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Numerator = 60000; 509 pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Denominator = 1000; 510 pNewVidPnTargetModeInfo->VideoSignalInfo.HSyncFreq.Numerator = pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy * 60 * 1.05; 511 pNewVidPnTargetModeInfo->VideoSignalInfo.HSyncFreq.Denominator = 1; 512 pNewVidPnTargetModeInfo->VideoSignalInfo.PixelRate = 165000; /* @todo: ? */ 513 pNewVidPnTargetModeInfo->VideoSignalInfo.ScanLineOrdering = D3DDDI_VSSLO_PROGRESSIVE; 514 pNewVidPnTargetModeInfo->Preference = bPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED; 515 537 516 return Status; 538 517 } … … 541 520 D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, 542 521 const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface, 543 VIDEO_MODE_INFORMATION *pModes,544 uint32_t c Modes,545 uint32_t iPreferredMomde)522 D3DKMDT_2DREGION *pResolutions, 523 uint32_t cResolutions, 524 VIDEO_MODE_INFORMATION *pPreferredMode) 546 525 { 547 526 NTSTATUS Status = STATUS_SUCCESS; 548 for (uint32_t i = 0; i < c Modes; ++i)527 for (uint32_t i = 0; i < cResolutions; ++i) 549 528 { 550 529 D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo; … … 553 532 if (Status == STATUS_SUCCESS) 554 533 { 555 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pDevExt, pNewVidPnTargetModeInfo, &pModes[i]); 534 bool bPreferred = pPreferredMode->VisScreenHeight == pResolutions[i].cx 535 && pPreferredMode->VisScreenWidth == pResolutions[i].cy; 536 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pDevExt, pNewVidPnTargetModeInfo, &pResolutions[i], bPreferred); 556 537 Assert(Status == STATUS_SUCCESS); 557 538 if (Status == STATUS_SUCCESS) … … 603 584 uint32_t cModes = pCbContext->cModes; 604 585 uint32_t iPreferredMode = pCbContext->iPreferredMode; 586 uint32_t cResolutions = pCbContext->cResolutions; 587 D3DKMDT_2DREGION * pResolutions = pCbContext->pResolutions; 588 605 589 606 590 /* adjust scaling */ … … 733 717 Status = vboxVidPnPopulateTargetModeSetFromLegacy(pDevExt, 734 718 hNewVidPnTargetModeSet, pNewVidPnTargetModeSetInterface, 735 p Modes, cModes, iPreferredMode);719 pResolutions, cResolutions, &pModes[iPreferredMode]); 736 720 Assert(Status == STATUS_SUCCESS); 737 721 if (Status == STATUS_SUCCESS) -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r26320 r26324 1507 1507 VBOXVIDPNCOFUNCMODALITY CbContext = {0}; 1508 1508 CbContext.pEnumCofuncModalityArg = pEnumCofuncModalityArg; 1509 VBoxWddmGetModesTable(pContext, true, &CbContext.pModes, &CbContext.cModes, &CbContext.iPreferredMode );1509 VBoxWddmGetModesTable(pContext, true, &CbContext.pModes, &CbContext.cModes, &CbContext.iPreferredMode, &CbContext.cResolutions, &CbContext.pResolutions); 1510 1510 Assert(CbContext.cModes); 1511 1511 Assert(CbContext.cModes > CbContext.iPreferredMode);
Note:
See TracChangeset
for help on using the changeset viewer.