Changeset 33628 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm
- Timestamp:
- Oct 29, 2010 11:17:01 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVbva.cpp
r33226 r33628 125 125 { 126 126 int rc = VINF_SUCCESS; 127 /*rc = */VBoxUnmapAdapterMemory(pDevExt, (void**)&pVbva->pVBVA, pVbva->cbVBVA); 128 /* 129 AssertRC(rc); 130 if (RT_SUCCESS(rc)) 131 */ 132 memset(pVbva, 0, sizeof(VBOXVBVAINFO)); 133 /* 134 else 135 drprintf((__FUNCTION__": VBoxUnmapAdapterMemory failed, rc (%d)\n", rc)); 136 */ 127 VBoxUnmapAdapterMemory(pDevExt, (void**)&pVbva->pVBVA); 128 memset(pVbva, 0, sizeof(VBOXVBVAINFO)); 137 129 return rc; 138 130 } -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp
r33530 r33628 1116 1116 drprintf((__FUNCTION__": HGSMIHeapSetup failed rc = 0x%x\n", rc)); 1117 1117 1118 VBoxUnmapAdapterMemory(pDevExt, &pvBuffer , cbBuffer);1118 VBoxUnmapAdapterMemory(pDevExt, &pvBuffer); 1119 1119 } 1120 1120 else … … 1189 1189 rc = vboxVdmaDisable (pDevExt, pInfo); 1190 1190 #ifdef VBOX_WITH_VDMA 1191 VBoxUnmapAdapterMemory (pDevExt, (void**)&pInfo->CmdHeap.area.pu8Base , pInfo->CmdHeap.area.cbArea);1191 VBoxUnmapAdapterMemory (pDevExt, (void**)&pInfo->CmdHeap.area.pu8Base); 1192 1192 #endif 1193 1193 } -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r33540 r33628 493 493 } 494 494 495 static void vboxWddmSetupDisplays(PDEVICE_EXTENSION pDevExt) 496 { 497 /* For WDDM, we simply store the number of monitors as we will deal with 498 * VidPN stuff later */ 499 int rc = STATUS_SUCCESS; 500 501 if (commonFromDeviceExt(pDevExt)->bHGSMI) 502 { 503 ULONG ulAvailable = commonFromDeviceExt(pDevExt)->cbVRAM 504 - commonFromDeviceExt(pDevExt)->cbMiniportHeap 505 - VBVA_ADAPTER_INFORMATION_SIZE; 506 507 ULONG ulSize; 508 ULONG offset; 509 #ifdef VBOX_WITH_VDMA 510 ulSize = ulAvailable / 2; 511 if (ulSize > VBOXWDDM_C_VDMA_BUFFER_SIZE) 512 ulSize = VBOXWDDM_C_VDMA_BUFFER_SIZE; 513 514 /* Align down to 4096 bytes. */ 515 ulSize &= ~0xFFF; 516 offset = ulAvailable - ulSize; 517 518 Assert(!(offset & 0xFFF)); 519 #else 520 offset = ulAvailable; 521 #endif 522 rc = vboxVdmaCreate (pDevExt, &pDevExt->u.primary.Vdma 523 #ifdef VBOX_WITH_VDMA 524 , offset, ulSize 525 #endif 526 ); 527 AssertRC(rc); 528 if (RT_SUCCESS(rc)) 529 { 530 /* can enable it right away since the host does not need any screen/FB info 531 * for basic DMA functionality */ 532 rc = vboxVdmaEnable(pDevExt, &pDevExt->u.primary.Vdma); 533 AssertRC(rc); 534 if (RT_FAILURE(rc)) 535 vboxVdmaDestroy(pDevExt, &pDevExt->u.primary.Vdma); 536 } 537 538 ulAvailable = offset; 539 ulSize = ulAvailable/2; 540 offset = ulAvailable - ulSize; 541 542 NTSTATUS Status = vboxVideoAMgrCreate(pDevExt, &pDevExt->AllocMgr, offset, ulSize); 543 Assert(Status == STATUS_SUCCESS); 544 if (Status != STATUS_SUCCESS) 545 { 546 offset = ulAvailable; 547 } 548 549 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 550 if (RT_SUCCESS(rc)) 551 { 552 ulAvailable = offset; 553 ulSize = ulAvailable / 2; 554 ulSize /= commonFromDeviceExt(pDevExt)->cDisplays; 555 Assert(ulSize > VBVA_MIN_BUFFER_SIZE); 556 if (ulSize > VBVA_MIN_BUFFER_SIZE) 557 { 558 ULONG ulRatio = ulSize/VBVA_MIN_BUFFER_SIZE; 559 ulRatio >>= 4; /* /= 16; */ 560 if (ulRatio) 561 ulSize = VBVA_MIN_BUFFER_SIZE * ulRatio; 562 else 563 ulSize = VBVA_MIN_BUFFER_SIZE; 564 } 565 else 566 { 567 /* todo: ?? */ 568 } 569 570 ulSize &= ~0xFFF; 571 Assert(ulSize); 572 573 Assert(ulSize * commonFromDeviceExt(pDevExt)->cDisplays < ulAvailable); 574 575 for (int i = commonFromDeviceExt(pDevExt)->cDisplays-1; i >= 0; --i) 576 { 577 offset -= ulSize; 578 rc = vboxVbvaCreate(pDevExt, &pDevExt->aSources[i].Vbva, offset, ulSize, i); 579 AssertRC(rc); 580 if (RT_SUCCESS(rc)) 581 { 582 rc = vboxVbvaEnable(pDevExt, &pDevExt->aSources[i].Vbva); 583 AssertRC(rc); 584 if (RT_FAILURE(rc)) 585 { 586 /* @todo: de-initialize */ 587 } 588 } 589 } 590 } 591 #endif 592 593 rc = VBoxMapAdapterMemory(commonFromDeviceExt(pDevExt), (void**)&pDevExt->pvVisibleVram, 594 0, 595 vboxWddmVramCpuVisibleSize(pDevExt)); 596 Assert(rc == VINF_SUCCESS); 597 if (rc != VINF_SUCCESS) 598 pDevExt->pvVisibleVram = NULL; 599 600 if (RT_FAILURE(rc)) 601 commonFromDeviceExt(pDevExt)->bHGSMI = FALSE; 602 } 603 } 604 605 static int vboxWddmFreeDisplays(PDEVICE_EXTENSION pDevExt) 606 { 607 int rc = VINF_SUCCESS; 608 609 Assert(pDevExt->pvVisibleVram); 610 if (pDevExt->pvVisibleVram) 611 VBoxUnmapAdapterMemory(pDevExt, (void**)&pDevExt->pvVisibleVram); 612 613 for (int i = commonFromDeviceExt(pDevExt)->cDisplays-1; i >= 0; --i) 614 { 615 rc = vboxVbvaDisable(pDevExt, &pDevExt->aSources[i].Vbva); 616 AssertRC(rc); 617 if (RT_SUCCESS(rc)) 618 { 619 rc = vboxVbvaDestroy(pDevExt, &pDevExt->aSources[i].Vbva); 620 AssertRC(rc); 621 if (RT_FAILURE(rc)) 622 { 623 /* @todo: */ 624 } 625 } 626 } 627 628 vboxVideoAMgrDestroy(pDevExt, &pDevExt->AllocMgr); 629 630 rc = vboxVdmaDisable(pDevExt, &pDevExt->u.primary.Vdma); 631 AssertRC(rc); 632 if (RT_SUCCESS(rc)) 633 { 634 rc = vboxVdmaDestroy(pDevExt, &pDevExt->u.primary.Vdma); 635 AssertRC(rc); 636 } 637 return rc; 638 } 639 495 640 /* driver callbacks */ 496 641 NTSTATUS DxgkDdiAddDevice( … … 584 729 VbglInit (); 585 730 586 /* Guest supports only HGSMI, the old VBVA via VMMDev is not supported. Old 587 * code will be ifdef'ed and later removed. 731 /* Guest supports only HGSMI, the old VBVA via VMMDev is not supported. 588 732 * The host will however support both old and new interface to keep compatibility 589 733 * with old guest additions. … … 593 737 if (commonFromDeviceExt(pContext)->bHGSMI) 594 738 { 739 vboxWddmSetupDisplays(pContext); 740 if (!commonFromDeviceExt(pContext)->bHGSMI) 741 VBoxFreeDisplaysHGSMI(pContext); 742 } 743 if (commonFromDeviceExt(pContext)->bHGSMI) 744 { 595 745 drprintf(("VBoxVideoWddm: using HGSMI\n")); 596 746 *NumberOfVideoPresentSources = commonFromDeviceExt(pContext)->cDisplays; … … 661 811 #endif 662 812 663 int rc = VBoxFreeDisplaysHGSMI(pDevExt); 813 int rc = vboxWddmFreeDisplays(pDevExt); 814 if (RT_SUCCESS(rc)) 815 VBoxFreeDisplaysHGSMI(pDevExt); 664 816 AssertRC(rc); 665 817 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.