Changeset 26320 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Feb 8, 2010 8:37:39 AM (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
r26301 r26320 169 169 /* number of available video modes, set by VBoxBuildModesTable */ 170 170 static uint32_t gNumVideoModes = 0; 171 #ifdef VBOXWDDM 172 /* preferred mode index */ 173 static uint32_t gPreferredVideoMode = 0; 174 #endif 171 175 172 176 static uint32_t g_xresNoVRAM = 0, g_yresNoVRAM = 0, g_bppNoVRAM = 0; … … 222 226 223 227 gNumVideoModes = 0; 228 #ifdef VBOXWDDM 229 gPreferredVideoMode = 0; 230 #endif 224 231 225 232 size_t numModesCurrentColorDepth; … … 302 309 VideoModes[gNumVideoModes].BlueMask = 0xFF; 303 310 VideoModes[gNumVideoModes].AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN; 311 #ifdef VBOXWDDM 312 gPreferredVideoMode = gNumVideoModes; 313 #endif 304 314 } break; 305 315 } … … 564 574 */ 565 575 int curKeyNo = 0; 576 #ifdef VBOXWDDM 577 int fPreferredSet = 0; 578 #endif 566 579 do 567 580 { … … 611 624 612 625 dprintf(("VBoxVideo: adding mode from registry: xres = %d, yres = %d, bpp = %d\n", xres, yres, bpp)); 626 627 #ifdef VBOXWDDM 628 if (!fPreferredSet) 629 { 630 gPreferredVideoMode = gNumVideoModes; 631 fPreferredSet = 1; 632 } 633 #endif 613 634 /* 614 635 * Build mode entry. … … 650 671 VideoModes[gNumVideoModes].GreenMask = 0xFF00; 651 672 VideoModes[gNumVideoModes].BlueMask = 0xFF; 673 #ifdef VBOXWDDM 674 /* 32-bit mode is more preferable, select it if not yet */ 675 if (fPreferredSet < 2) 676 { 677 gPreferredVideoMode = gNumVideoModes; 678 fPreferredSet = 2; 679 } 680 #endif 652 681 break; 653 682 } … … 740 769 741 770 dprintf(("VBoxVideo: setting special mode to xres = %d, yres = %d, bpp = %d\n", xres, yres, bpp)); 771 #ifdef VBOXWDDM 772 /* assign host-supplied as the most preferable */ 773 gPreferredVideoMode = gNumVideoModes; 774 #endif 742 775 /* 743 776 * Build mode entry. … … 870 903 * or the available VRAM does not allow for additional modes. 871 904 */ 872 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes )905 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode) 873 906 { 874 907 static bool bTableInitialized = false; … … 881 914 *ppModes = VideoModes; 882 915 *pcModes = gNumVideoModes; 916 *pPreferrableMode = gPreferredVideoMode; 883 917 } 884 918 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r26301 r26320 624 624 RT_C_DECLS_END 625 625 626 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes); 626 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode); 627 D3DDDIFORMAT vboxWddmCalcPixelFormat(VIDEO_MODE_INFORMATION *pInfo); 628 UINT vboxWddmCalcBitsPerPixel(D3DDDIFORMAT format); 627 629 628 630 NTSTATUS vboxVidPnCheckTopology(const D3DKMDT_HVIDPN hDesiredVidPn, … … 646 648 BOOLEAN *pbSupported); 647 649 648 typedef struct VBOXVIDPNC MCONTEXT650 typedef struct VBOXVIDPNCOFUNCMODALITY 649 651 { 650 652 NTSTATUS Status; 651 653 CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* pEnumCofuncModalityArg; 652 }VBOXVIDPNCMCONTEXT, *PVBOXVIDPNCMCONTEXT; 653 654 typedef struct VBOXVIDPN_NEW_SRCMODESET_CHECK 655 { 656 VBOXVIDPNCMCONTEXT CommonInfo; 657 CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 658 BOOLEAN bNeedAdjustment; 659 }VBOXVIDPN_NEW_SRCMODESET_CHECK, *PVBOXVIDPN_NEW_SRCMODESET_CHECK; 660 661 typedef struct VBOXVIDPN_NEW_SRCMODESET_POPULATION 662 { 663 VBOXVIDPNCMCONTEXT CommonInfo; 664 CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 665 /* new source mode (the one being populated) */ 666 D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet; 667 CONST DXGK_VIDPNSOURCEMODESET_INTERFACE* pNewVidPnSourceModeSetInterface; 668 }VBOXVIDPN_NEW_SRCMODESET_POPULATION, *PVBOXVIDPN_NEW_SRCMODESET_POPULATION; 654 /* legacy mode information populated by the common XPDM-WDDM layer */ 655 uint32_t cModes; 656 uint32_t iPreferredMode; 657 VIDEO_MODE_INFORMATION *pModes; 658 }VBOXVIDPNCOFUNCMODALITY, *PVBOXVIDPNCOFUNCMODALITY; 669 659 670 660 /* !!!NOTE: The callback is responsible for releasing the path */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp
r26179 r26320 358 358 } 359 359 360 #if 0 360 361 DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalitySourceModeCheck(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, 361 362 D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface, … … 370 371 pCbContext->CommonInfo.Status = Status; 371 372 return Status == STATUS_SUCCESS; 372 373 373 } 374 374 … … 385 385 pCbContext->Status = Status; 386 386 return Status == STATUS_SUCCESS; 387 388 387 } 389 388 … … 401 400 return Status == STATUS_SUCCESS; 402 401 } 402 #endif 403 404 NTSTATUS vboxVidPnPopulateSourceModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt, 405 D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, 406 VIDEO_MODE_INFORMATION *pMode) 407 { 408 NTSTATUS Status = STATUS_SUCCESS; 409 if (pMode->AttributeFlags & VIDEO_MODE_GRAPHICS) 410 { 411 /* this is a graphics mode */ 412 pNewVidPnSourceModeInfo->Type = D3DKMDT_RMT_GRAPHICS; 413 pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx = pMode->VisScreenWidth; 414 pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy = pMode->VisScreenHeight; 415 pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize; 416 pNewVidPnSourceModeInfo->Format.Graphics.Stride = pMode->ScreenStride; 417 pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat = vboxWddmCalcPixelFormat(pMode); 418 Assert(pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat != D3DDDIFMT_UNKNOWN); 419 if (pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat != D3DDDIFMT_UNKNOWN) 420 { 421 pNewVidPnSourceModeInfo->Format.Graphics.ColorBasis = D3DKMDT_CB_SRGB; 422 if (pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat == D3DDDIFMT_P8) 423 pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_SETTABLEPALETTE; 424 else 425 pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_DIRECT; 426 } 427 else 428 { 429 drprintf((__FUNCTION__": vboxWddmCalcPixelFormat failed\n")); 430 Status = STATUS_INVALID_PARAMETER; 431 } 432 } 433 else 434 { 435 /* @todo: XPDM driver does not seem to return text modes, should we? */ 436 drprintf((__FUNCTION__": text mode not supported currently\n")); 437 AssertBreakpoint(); 438 Status = STATUS_INVALID_PARAMETER; 439 } 440 441 return Status; 442 } 443 444 NTSTATUS vboxVidPnPopulateSourceModeSetFromLegacy(PDEVICE_EXTENSION pDevExt, 445 D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, 446 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pNewVidPnSourceModeSetInterface, 447 VIDEO_MODE_INFORMATION *pModes, 448 uint32_t cModes, 449 uint32_t iPreferredMomde) 450 { 451 NTSTATUS Status = STATUS_SUCCESS; 452 for (uint32_t i = 0; i < cModes; ++i) 453 { 454 D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo; 455 Status = pNewVidPnSourceModeSetInterface->pfnCreateNewModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo); 456 Assert(Status == STATUS_SUCCESS); 457 if (Status == STATUS_SUCCESS) 458 { 459 Status = vboxVidPnPopulateSourceModeInfoFromLegacy(pDevExt, pNewVidPnSourceModeInfo, &pModes[i]); 460 Assert(Status == STATUS_SUCCESS); 461 if (Status == STATUS_SUCCESS) 462 { 463 D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID modeId = pNewVidPnSourceModeInfo->Id; 464 Status = pNewVidPnSourceModeSetInterface->pfnAddMode(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo); 465 Assert(Status == STATUS_SUCCESS); 466 if (Status == STATUS_SUCCESS) 467 { 468 if (iPreferredMomde == i) 469 { 470 Status = pNewVidPnSourceModeSetInterface->pfnPinMode(hNewVidPnSourceModeSet, modeId); 471 Assert(Status == STATUS_SUCCESS); 472 if (Status != STATUS_SUCCESS) 473 { 474 drprintf((__FUNCTION__": pfnPinMode failed, Status(0x%x)", Status)); 475 /* don't treat it as fatal */ 476 Status = STATUS_SUCCESS; 477 } 478 } 479 } 480 else 481 { 482 drprintf((__FUNCTION__": pfnAddMode failed, Status(0x%x)", Status)); 483 pNewVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo); 484 break; 485 } 486 } 487 else 488 { 489 drprintf((__FUNCTION__": pfnCreateNewModeInfo failed, Status(0x%x)", Status)); 490 pNewVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo); 491 break; 492 } 493 } 494 } 495 return Status; 496 } 497 498 NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt, 499 D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, 500 VIDEO_MODE_INFORMATION *pMode) 501 { 502 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 537 return Status; 538 } 539 540 NTSTATUS vboxVidPnPopulateTargetModeSetFromLegacy(PDEVICE_EXTENSION pDevExt, 541 D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, 542 const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface, 543 VIDEO_MODE_INFORMATION *pModes, 544 uint32_t cModes, 545 uint32_t iPreferredMomde) 546 { 547 NTSTATUS Status = STATUS_SUCCESS; 548 for (uint32_t i = 0; i < cModes; ++i) 549 { 550 D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo; 551 Status = pNewVidPnTargetModeSetInterface->pfnCreateNewModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo); 552 Assert(Status == STATUS_SUCCESS); 553 if (Status == STATUS_SUCCESS) 554 { 555 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pDevExt, pNewVidPnTargetModeInfo, &pModes[i]); 556 Assert(Status == STATUS_SUCCESS); 557 if (Status == STATUS_SUCCESS) 558 { 559 D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID modeId = pNewVidPnTargetModeInfo->Id; 560 Status = pNewVidPnTargetModeSetInterface->pfnAddMode(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo); 561 Assert(Status == STATUS_SUCCESS); 562 if (Status == STATUS_SUCCESS) 563 { 564 if (iPreferredMomde == i) 565 { 566 Status = pNewVidPnTargetModeSetInterface->pfnPinMode(hNewVidPnTargetModeSet, modeId); 567 Assert(Status == STATUS_SUCCESS); 568 if (Status != STATUS_SUCCESS) 569 { 570 drprintf((__FUNCTION__": pfnPinMode failed, Status(0x%x)", Status)); 571 /* don't treat it as fatal */ 572 Status = STATUS_SUCCESS; 573 } 574 } 575 } 576 else 577 { 578 drprintf((__FUNCTION__": pfnAddMode failed, Status(0x%x)", Status)); 579 pNewVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo); 580 break; 581 } 582 } 583 else 584 { 585 drprintf((__FUNCTION__": pfnCreateNewModeInfo failed, Status(0x%x)", Status)); 586 pNewVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo); 587 break; 588 } 589 } 590 } 591 return Status; 592 } 593 403 594 404 595 DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalityPathEnum(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, … … 406 597 const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo, PVOID pContext) 407 598 { 408 D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet; 409 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface; 410 PVBOXVIDPNCMCONTEXT pCbContext = (PVBOXVIDPNCMCONTEXT)pContext; 599 PVBOXVIDPNCOFUNCMODALITY pCbContext = (PVBOXVIDPNCOFUNCMODALITY)pContext; 411 600 NTSTATUS Status = STATUS_SUCCESS; 412 601 pCbContext->Status = STATUS_SUCCESS; 602 VIDEO_MODE_INFORMATION *pModes = pCbContext->pModes; 603 uint32_t cModes = pCbContext->cModes; 604 uint32_t iPreferredMode = pCbContext->iPreferredMode; 413 605 414 606 /* adjust scaling */ … … 438 630 || pNewVidPnPresentPathInfo->VidPnSourceId != pCbContext->pEnumCofuncModalityArg->EnumPivot.VidPnSourceId) 439 631 { 632 D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet; 633 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface; 440 634 441 635 Status = pVidPnInterface->pfnAcquireSourceModeSet(hDesiredVidPn, 442 636 pNewVidPnPresentPathInfo->VidPnSourceId, 443 &h NewVidPnSourceModeSet,444 &p VidPnSourceModeSetInterface);637 &hCurVidPnSourceModeSet, 638 &pCurVidPnSourceModeSetInterface); 445 639 Assert(Status == STATUS_SUCCESS); 446 640 if (Status == STATUS_SUCCESS) 447 641 { 448 642 CONST D3DKMDT_VIDPN_SOURCE_MODE* pPinnedVidPnSourceModeInfo; 449 Status = p VidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hNewVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);643 Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo); 450 644 Assert(Status == STATUS_SUCCESS); 451 645 if (Status == STATUS_SUCCESS) … … 453 647 if (!pPinnedVidPnSourceModeInfo) 454 648 { 455 /* no pinned mode set, do adjustment*/456 /* first iterate to see if there is anything that should be removed/added457 * if yes, create a new mode set and populate it with the necessary info */458 459 Status = vboxVidPnEnumSourceModes(pDevExt, hDesiredVidPn, pVidPnInterface,460 hNewVidPnSourceModeSet, pVidPnSourceModeSetInterface,461 vboxVidPnCofuncModalitySourceModeEnum, pCbContext);649 /* just create and populate the new source mode set for now */ 650 D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet; 651 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pNewVidPnSourceModeSetInterface; 652 Status = pVidPnInterface->pfnCreateNewSourceModeSet(hDesiredVidPn, 653 pNewVidPnPresentPathInfo->VidPnSourceId, /*__in CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId */ 654 &hNewVidPnSourceModeSet, 655 &pNewVidPnSourceModeSetInterface); 462 656 Assert(Status == STATUS_SUCCESS); 463 657 if (Status == STATUS_SUCCESS) 464 658 { 465 Status = pCbContext->Status; 659 Status = vboxVidPnPopulateSourceModeSetFromLegacy(pDevExt, 660 hNewVidPnSourceModeSet, pNewVidPnSourceModeSetInterface, 661 pModes, cModes, iPreferredMode); 466 662 Assert(Status == STATUS_SUCCESS); 467 if (Status != STATUS_SUCCESS) 468 drprintf((__FUNCTION__": vboxVidPnCofuncModalitySourceModeEnum failed Status(0x%x)\n", Status)); 663 if (Status == STATUS_SUCCESS) 664 { 665 Status = pVidPnInterface->pfnAssignSourceModeSet(hDesiredVidPn, 666 pNewVidPnPresentPathInfo->VidPnSourceId, 667 hNewVidPnSourceModeSet); 668 Assert(Status == STATUS_SUCCESS); 669 if(Status != STATUS_SUCCESS) 670 { 671 drprintf((__FUNCTION__": pfnAssignSourceModeSet failed Status(0x%x)\n", Status)); 672 pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hNewVidPnSourceModeSet); 673 } 674 } 675 else 676 { 677 drprintf((__FUNCTION__": vboxVidPnPopulateSourceModeSetFromLegacy failed Status(0x%x)\n", Status)); 678 pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hNewVidPnSourceModeSet); 679 } 469 680 } 470 681 else 471 drprintf((__FUNCTION__": vboxVidPnEnumSourceModes failed Status(0x%x)\n", Status)); 472 } 473 474 /* nothing to be done here, just release */ 475 pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pPinnedVidPnSourceModeInfo); 682 drprintf((__FUNCTION__": pfnCreateNewSourceModeSet failed Status(0x%x)\n", Status)); 683 } 684 else 685 { 686 /* release */ 687 pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo); 688 } 476 689 } 477 690 else 478 691 drprintf((__FUNCTION__": pfnAcquirePinnedModeInfo failed Status(0x%x)\n", Status)); 479 692 480 pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, h NewVidPnSourceModeSet);693 pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hCurVidPnSourceModeSet); 481 694 } 482 695 else 696 { 483 697 drprintf((__FUNCTION__": pfnAcquireSourceModeSet failed Status(0x%x)\n", Status)); 484 } 485 698 } 699 } 700 701 /* ensure we didn't fail earlier */ 486 702 if (Status == STATUS_SUCCESS) 487 703 { 488 D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet; 489 const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface; 490 Status = pVidPnInterface->pfnAcquireTargetModeSet(hDesiredVidPn, 491 pNewVidPnPresentPathInfo->VidPnTargetId, 492 &hNewVidPnTargetModeSet, 493 &pVidPnTargetModeSetInterface); 704 if (pCbContext->pEnumCofuncModalityArg->EnumPivotType != D3DKMDT_EPT_VIDPNTARGET 705 || pNewVidPnPresentPathInfo->VidPnTargetId != pCbContext->pEnumCofuncModalityArg->EnumPivot.VidPnTargetId) 706 { 707 D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet; 708 const DXGK_VIDPNTARGETMODESET_INTERFACE *pCurVidPnTargetModeSetInterface; 709 Status = pVidPnInterface->pfnAcquireTargetModeSet(hDesiredVidPn, 710 pNewVidPnPresentPathInfo->VidPnTargetId, 711 &hCurVidPnTargetModeSet, 712 &pCurVidPnTargetModeSetInterface); 494 713 Assert(Status == STATUS_SUCCESS); 495 714 if (Status == STATUS_SUCCESS) 496 715 { 497 716 CONST D3DKMDT_VIDPN_TARGET_MODE* pPinnedVidPnTargetModeInfo; 498 Status = p VidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hNewVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);717 Status = pCurVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo); 499 718 Assert(Status == STATUS_SUCCESS); 500 719 if (Status == STATUS_SUCCESS) 501 720 { 502 if ( pPinnedVidPnTargetModeInfo)721 if (!pPinnedVidPnTargetModeInfo) 503 722 { 504 /* nothing to be done here, just release */ 505 pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pPinnedVidPnTargetModeInfo); 723 /* just create and populate a new target mode info for now */ 724 D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet; 725 const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface; 726 Status = pVidPnInterface->pfnCreateNewTargetModeSet(hDesiredVidPn, 727 pNewVidPnPresentPathInfo->VidPnTargetId, /*__in CONST D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId */ 728 &hNewVidPnTargetModeSet, 729 &pNewVidPnTargetModeSetInterface); 730 Assert(Status == STATUS_SUCCESS); 731 if (Status == STATUS_SUCCESS) 732 { 733 Status = vboxVidPnPopulateTargetModeSetFromLegacy(pDevExt, 734 hNewVidPnTargetModeSet, pNewVidPnTargetModeSetInterface, 735 pModes, cModes, iPreferredMode); 736 Assert(Status == STATUS_SUCCESS); 737 if (Status == STATUS_SUCCESS) 738 { 739 Status = pVidPnInterface->pfnAssignTargetModeSet(hDesiredVidPn, 740 pNewVidPnPresentPathInfo->VidPnTargetId, 741 hNewVidPnTargetModeSet); 742 Assert(Status == STATUS_SUCCESS); 743 if(Status != STATUS_SUCCESS) 744 { 745 drprintf((__FUNCTION__": pfnAssignTargetModeSet failed Status(0x%x)\n", Status)); 746 pVidPnInterface->pfnReleaseTargetModeSet(hDesiredVidPn, hNewVidPnTargetModeSet); 747 } 748 } 749 else 750 { 751 drprintf((__FUNCTION__": vboxVidPnPopulateTargetModeSetFromLegacy failed Status(0x%x)\n", Status)); 752 pVidPnInterface->pfnReleaseTargetModeSet(hDesiredVidPn, hNewVidPnTargetModeSet); 753 } 754 } 506 755 } 507 756 else 508 757 { 509 /* no pinned mode set, do adjustment */ 510 Status = vboxVidPnEnumTargetModes(pDevExt, hDesiredVidPn, pVidPnInterface, 511 hNewVidPnTargetModeSet, pVidPnTargetModeSetInterface, 512 vboxVidPnCofuncModalityTargetModeEnum, pCbContext); 513 Assert(Status == STATUS_SUCCESS); 514 if (Status == STATUS_SUCCESS) 515 { 516 Status = pCbContext->Status; 517 Assert(Status == STATUS_SUCCESS); 518 if (Status != STATUS_SUCCESS) 519 drprintf((__FUNCTION__": vboxVidPnCofuncModalityTargetModeEnum failed Status(0x%x)\n", Status)); 520 } 521 else 522 drprintf((__FUNCTION__": vboxVidPnEnumTargetModes failed Status(0x%x)\n", Status)); 758 /* nothing to be done here, just release */ 759 pCurVidPnTargetModeSetInterface->pfnReleaseModeInfo(hCurVidPnTargetModeSet, pPinnedVidPnTargetModeInfo); 523 760 } 524 761 } … … 526 763 drprintf((__FUNCTION__": pfnAcquirePinnedModeInfo failed Status(0x%x)\n", Status)); 527 764 528 pVidPnInterface->pfnReleaseTargetModeSet(hDesiredVidPn, h NewVidPnTargetModeSet);765 pVidPnInterface->pfnReleaseTargetModeSet(hDesiredVidPn, hCurVidPnTargetModeSet); 529 766 } 530 767 else 531 768 drprintf((__FUNCTION__": pfnAcquireTargetModeSet failed Status(0x%x)\n", Status)); 769 } 532 770 } 533 771 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r26179 r26320 199 199 return 0; 200 200 } 201 } 202 203 D3DDDIFORMAT vboxWddmCalcPixelFormat(VIDEO_MODE_INFORMATION *pInfo) 204 { 205 switch (pInfo->BitsPerPlane) 206 { 207 case 32: 208 if(!(pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && !(pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE)) 209 { 210 if (pInfo->RedMask == 0xFF0000 && pInfo->GreenMask == 0xFF00 && pInfo->BlueMask == 0xFF) 211 return D3DDDIFMT_X8R8G8B8; 212 drprintf((__FUNCTION__": unsupported format: bpp(%d), rmask(%d), gmask(%d), bmask(%d)\n", pInfo->BitsPerPlane, pInfo->RedMask, pInfo->GreenMask, pInfo->BlueMask)); 213 AssertBreakpoint(); 214 } 215 else 216 { 217 drprintf((__FUNCTION__": unsupported AttributeFlags(0x%x)\n", pInfo->AttributeFlags)); 218 AssertBreakpoint(); 219 } 220 break; 221 case 24: 222 if(!(pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && !(pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE)) 223 { 224 if (pInfo->RedMask == 0xFF0000 && pInfo->GreenMask == 0xFF00 && pInfo->BlueMask == 0xFF) 225 return D3DDDIFMT_R8G8B8; 226 drprintf((__FUNCTION__": unsupported format: bpp(%d), rmask(%d), gmask(%d), bmask(%d)\n", pInfo->BitsPerPlane, pInfo->RedMask, pInfo->GreenMask, pInfo->BlueMask)); 227 AssertBreakpoint(); 228 } 229 else 230 { 231 drprintf((__FUNCTION__": unsupported AttributeFlags(0x%x)\n", pInfo->AttributeFlags)); 232 AssertBreakpoint(); 233 } 234 break; 235 case 16: 236 if(!(pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && !(pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE)) 237 { 238 if (pInfo->RedMask == 0xF800 && pInfo->GreenMask == 0x7E0 && pInfo->BlueMask == 0x1F) 239 return D3DDDIFMT_R5G6B5; 240 drprintf((__FUNCTION__": unsupported format: bpp(%d), rmask(%d), gmask(%d), bmask(%d)\n", pInfo->BitsPerPlane, pInfo->RedMask, pInfo->GreenMask, pInfo->BlueMask)); 241 AssertBreakpoint(); 242 } 243 else 244 { 245 drprintf((__FUNCTION__": unsupported AttributeFlags(0x%x)\n", pInfo->AttributeFlags)); 246 AssertBreakpoint(); 247 } 248 break; 249 case 8: 250 if((pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && (pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE)) 251 { 252 return D3DDDIFMT_P8; 253 } 254 else 255 { 256 drprintf((__FUNCTION__": unsupported AttributeFlags(0x%x)\n", pInfo->AttributeFlags)); 257 AssertBreakpoint(); 258 } 259 break; 260 default: 261 drprintf((__FUNCTION__": unsupported bpp(%d)\n", pInfo->BitsPerPlane)); 262 AssertBreakpoint(); 263 break; 264 } 265 266 return D3DDDIFMT_UNKNOWN; 201 267 } 202 268 … … 1439 1505 if (Status == STATUS_SUCCESS) 1440 1506 { 1441 VBOXVIDPNC MCONTEXTCbContext = {0};1507 VBOXVIDPNCOFUNCMODALITY CbContext = {0}; 1442 1508 CbContext.pEnumCofuncModalityArg = pEnumCofuncModalityArg; 1509 VBoxWddmGetModesTable(pContext, true, &CbContext.pModes, &CbContext.cModes, &CbContext.iPreferredMode); 1510 Assert(CbContext.cModes); 1511 Assert(CbContext.cModes > CbContext.iPreferredMode); 1443 1512 Status = vboxVidPnEnumPaths(pContext, pEnumCofuncModalityArg->hConstrainingVidPn, pVidPnInterface, 1444 1513 hVidPnTopology, pVidPnTopologyInterface,
Note:
See TracChangeset
for help on using the changeset viewer.