Changeset 33711 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Nov 2, 2010 9:48:55 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r33676 r33711 1475 1475 } 1476 1476 1477 BOOLEAN VBoxUnmapAdpInfoCallback(PVOID ext) 1478 { 1479 PDEVICE_EXTENSION PrimaryExtension = (PDEVICE_EXTENSION)ext; 1480 Assert(PrimaryExtension); 1481 1482 commonFromDeviceExt(PrimaryExtension)->pHostFlags = NULL; 1483 return TRUE; 1484 } 1485 1486 void VBoxUnmapAdapterInformation(PDEVICE_EXTENSION PrimaryExtension) 1487 { 1488 void *ppv; 1489 1490 dprintf(("VBoxVideo::VBoxUnmapAdapterInformation\n")); 1491 1492 ppv = commonFromDeviceExt(PrimaryExtension)->pvAdapterInformation; 1493 if (ppv) 1494 { 1477 bool VBoxSyncToVideoIRQ(PVBOXVIDEO_COMMON pCommon, PFNVIDEOIRQSYNC pfnSync, 1478 void *pvUser) 1479 { 1480 PDEVICE_EXTENSION PrimaryExtension = commonToPrimaryExt(pCommon); 1481 PMINIPORT_SYNCHRONIZE_ROUTINE pfnSyncMiniport; 1482 pfnSyncMiniport = (PMINIPORT_SYNCHRONIZE_ROUTINE) pfnSync; 1495 1483 #ifndef VBOX_WITH_WDDM 1496 /* The pHostFlags field is mapped through pvAdapterInformation. It must be cleared first, 1497 * and it must be done in a way which avoids races with the interrupt handler. 1498 */ 1499 VideoPortSynchronizeExecution(PrimaryExtension, VpMediumPriority, 1500 VBoxUnmapAdpInfoCallback, PrimaryExtension); 1501 VideoPortUnmapMemory(PrimaryExtension, ppv, NULL); 1484 return !!VideoPortSynchronizeExecution(PrimaryExtension, VpMediumPriority, 1485 pfnSyncMiniport, pvUser); 1502 1486 #else 1503 BOOLEAN bRet; 1504 NTSTATUS ntStatus = PrimaryExtension->u.primary.DxgkInterface.DxgkCbSynchronizeExecution(PrimaryExtension->u.primary.DxgkInterface.DeviceHandle, 1505 VBoxUnmapAdpInfoCallback, PrimaryExtension, 1506 0, &bRet); 1507 Assert(ntStatus == STATUS_SUCCESS); 1508 ntStatus = PrimaryExtension->u.primary.DxgkInterface.DxgkCbUnmapMemory(PrimaryExtension->u.primary.DxgkInterface.DeviceHandle, 1509 ppv); 1510 Assert(ntStatus == STATUS_SUCCESS); 1511 #endif 1512 commonFromDeviceExt(PrimaryExtension)->pvAdapterInformation = NULL; 1513 } 1514 } 1515 1516 void VBoxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension, void **ppv) 1487 BOOLEAN fRet; 1488 DXGKCB_SYNCHRONIZE_EXECUTION pfnDxgkCbSync = 1489 PrimaryExtension->u.primary.DxgkInterface.DxgkCbSynchronizeExecution; 1490 HANDLE hDev = PrimaryExtension->u.primary.DxgkInterface.DeviceHandle; 1491 NTSTATUS ntStatus = pfnDxgkCbSync(hDev, pfnSyncMiniport, pvUser, 0, &fRet); 1492 AssertReturn(ntStatus == STATUS_SUCCESS, false); 1493 return !!fRet; 1494 #endif 1495 } 1496 1497 void VBoxUnmapAdapterMemory (PVBOXVIDEO_COMMON pCommon, void **ppv) 1517 1498 { 1518 1499 dprintf(("VBoxVideo::VBoxUnmapAdapterMemory\n")); 1500 1501 PDEVICE_EXTENSION PrimaryExtension = commonToPrimaryExt(pCommon); 1519 1502 1520 1503 if (*ppv) … … 2691 2674 VbglTerminate (); 2692 2675 2693 VBoxFreeDisplaysHGSMI( pDevExt);2676 VBoxFreeDisplaysHGSMI(commonFromDeviceExt(pDevExt)); 2694 2677 /** @note using this callback instead of doing things manually adds an 2695 2678 * additional call to HGSMIHeapDestroy(). I assume that call was -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r33676 r33711 807 807 ULONG ulSize); 808 808 809 void VBoxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension, 810 void **ppv); 811 void VBoxUnmapAdapterInformation (PDEVICE_EXTENSION PrimaryExtension); 809 void VBoxUnmapAdapterMemory (PVBOXVIDEO_COMMON pCommon, void **ppv); 810 811 typedef bool(*PFNVIDEOIRQSYNC)(void *); 812 bool VBoxSyncToVideoIRQ(PVBOXVIDEO_COMMON pCommon, PFNVIDEOIRQSYNC pfnSync, 813 void *pvUser); 812 814 813 815 void VBoxComputeFrameBufferSizes (PDEVICE_EXTENSION PrimaryExtension); … … 850 852 uint32_t cbLength); 851 853 852 void VBoxFreeDisplaysHGSMI(P DEVICE_EXTENSION PrimaryExtension);854 void VBoxFreeDisplaysHGSMI(PVBOXVIDEO_COMMON pCommon); 853 855 #ifndef VBOX_WITH_WDDM 854 856 DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
r33628 r33711 539 539 } 540 540 541 #ifdef VBOX_WITH_WDDM542 /* For WDDM, we simply store the number of monitors as we will deal with543 * VidPN stuff later */544 if (commonFromDeviceExt(PrimaryExtension)->bHGSMI)545 {546 ULONG ulAvailable = commonFromDeviceExt(PrimaryExtension)->cbVRAM547 - commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap548 - VBVA_ADAPTER_INFORMATION_SIZE;549 550 ULONG ulSize;551 ULONG offset;552 #ifdef VBOX_WITH_VDMA553 ulSize = ulAvailable / 2;554 if (ulSize > VBOXWDDM_C_VDMA_BUFFER_SIZE)555 ulSize = VBOXWDDM_C_VDMA_BUFFER_SIZE;556 557 /* Align down to 4096 bytes. */558 ulSize &= ~0xFFF;559 offset = ulAvailable - ulSize;560 561 Assert(!(offset & 0xFFF));562 #else563 offset = ulAvailable;564 #endif565 rc = vboxVdmaCreate (PrimaryExtension, &PrimaryExtension->u.primary.Vdma566 #ifdef VBOX_WITH_VDMA567 , offset, ulSize568 #endif569 );570 AssertRC(rc);571 if (RT_SUCCESS(rc))572 {573 /* can enable it right away since the host does not need any screen/FB info574 * for basic DMA functionality */575 rc = vboxVdmaEnable(PrimaryExtension, &PrimaryExtension->u.primary.Vdma);576 AssertRC(rc);577 if (RT_FAILURE(rc))578 vboxVdmaDestroy(PrimaryExtension, &PrimaryExtension->u.primary.Vdma);579 }580 581 ulAvailable = offset;582 ulSize = ulAvailable/2;583 offset = ulAvailable - ulSize;584 585 NTSTATUS Status = vboxVideoAMgrCreate(PrimaryExtension, &PrimaryExtension->AllocMgr, offset, ulSize);586 Assert(Status == STATUS_SUCCESS);587 if (Status != STATUS_SUCCESS)588 {589 offset = ulAvailable;590 }591 592 #ifdef VBOXWDDM_RENDER_FROM_SHADOW593 if (RT_SUCCESS(rc))594 {595 ulAvailable = offset;596 ulSize = ulAvailable / 2;597 ulSize /= commonFromDeviceExt(PrimaryExtension)->cDisplays;598 Assert(ulSize > VBVA_MIN_BUFFER_SIZE);599 if (ulSize > VBVA_MIN_BUFFER_SIZE)600 {601 ULONG ulRatio = ulSize/VBVA_MIN_BUFFER_SIZE;602 ulRatio >>= 4; /* /= 16; */603 if (ulRatio)604 ulSize = VBVA_MIN_BUFFER_SIZE * ulRatio;605 else606 ulSize = VBVA_MIN_BUFFER_SIZE;607 }608 else609 {610 /* todo: ?? */611 }612 613 ulSize &= ~0xFFF;614 Assert(ulSize);615 616 Assert(ulSize * commonFromDeviceExt(PrimaryExtension)->cDisplays < ulAvailable);617 618 for (int i = commonFromDeviceExt(PrimaryExtension)->cDisplays-1; i >= 0; --i)619 {620 offset -= ulSize;621 rc = vboxVbvaCreate(PrimaryExtension, &PrimaryExtension->aSources[i].Vbva, offset, ulSize, i);622 AssertRC(rc);623 if (RT_SUCCESS(rc))624 {625 rc = vboxVbvaEnable(PrimaryExtension, &PrimaryExtension->aSources[i].Vbva);626 AssertRC(rc);627 if (RT_FAILURE(rc))628 {629 /* @todo: de-initialize */630 }631 }632 }633 }634 #endif635 636 rc = VBoxMapAdapterMemory(commonFromDeviceExt(PrimaryExtension), (void**)&PrimaryExtension->pvVisibleVram,637 0,638 vboxWddmVramCpuVisibleSize(PrimaryExtension));639 Assert(rc == VINF_SUCCESS);640 if (rc != VINF_SUCCESS)641 PrimaryExtension->pvVisibleVram = NULL;642 643 if (RT_FAILURE(rc))644 commonFromDeviceExt(PrimaryExtension)->bHGSMI = FALSE;645 }646 #endif647 648 541 if (!commonFromDeviceExt(PrimaryExtension)->bHGSMI) 649 VBoxFreeDisplaysHGSMI( PrimaryExtension);542 VBoxFreeDisplaysHGSMI(commonFromDeviceExt(PrimaryExtension)); 650 543 651 544 dprintf(("VBoxVideo::VBoxSetupDisplays: finished\n")); 652 545 } 653 546 654 void VBoxFreeDisplaysHGSMI(PDEVICE_EXTENSION PrimaryExtension) 655 { 656 VBoxUnmapAdapterMemory(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pvMiniportHeap); 657 HGSMIHeapDestroy(&commonFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap); 547 static bool VBoxUnmapAdpInfoCallback(PVOID pvCommon) 548 { 549 PVBOXVIDEO_COMMON pCommon = (PVBOXVIDEO_COMMON)pvCommon; 550 551 pCommon->pHostFlags = NULL; 552 return TRUE; 553 } 554 555 void VBoxFreeDisplaysHGSMI(PVBOXVIDEO_COMMON pCommon) 556 { 557 VBoxUnmapAdapterMemory(pCommon, &pCommon->pvMiniportHeap); 558 HGSMIHeapDestroy(&pCommon->hgsmiAdapterHeap); 658 559 659 560 /* Unmap the adapter information needed for HGSMI IO. */ 660 VBoxUnmapAdapterInformation(PrimaryExtension); 561 VBoxSyncToVideoIRQ(pCommon, VBoxUnmapAdpInfoCallback, pCommon); 562 VBoxUnmapAdapterMemory(pCommon, &pCommon->pvAdapterInformation); 661 563 } 662 564 … … 746 648 uint32_t cbData = 0; 747 649 748 if ( pointerAttr->Enable & VBOX_MOUSE_POINTER_SHAPE)650 if (!pointerAttr->Enable & VBOX_MOUSE_POINTER_SHAPE) 749 651 { 750 652 /* Size of the pointer data: sizeof (AND mask) + sizeof (XOR_MASK) */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVbva.cpp
r33628 r33711 125 125 { 126 126 int rc = VINF_SUCCESS; 127 VBoxUnmapAdapterMemory( pDevExt, (void**)&pVbva->pVBVA);127 VBoxUnmapAdapterMemory(commonFromDeviceExt(pDevExt), (void**)&pVbva->pVBVA); 128 128 memset(pVbva, 0, sizeof(VBOXVBVAINFO)); 129 129 return rc; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp
r33684 r33711 1116 1116 drprintf((__FUNCTION__": HGSMIHeapSetup failed rc = 0x%x\n", rc)); 1117 1117 1118 VBoxUnmapAdapterMemory( pDevExt, &pvBuffer);1118 VBoxUnmapAdapterMemory(commonFromDeviceExt(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);1191 VBoxUnmapAdapterMemory (commonFromDeviceExt(pDevExt), (void**)&pInfo->CmdHeap.area.pu8Base); 1192 1192 #endif 1193 1193 } -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r33684 r33711 609 609 Assert(pDevExt->pvVisibleVram); 610 610 if (pDevExt->pvVisibleVram) 611 VBoxUnmapAdapterMemory( pDevExt, (void**)&pDevExt->pvVisibleVram);611 VBoxUnmapAdapterMemory(commonFromDeviceExt(pDevExt), (void**)&pDevExt->pvVisibleVram); 612 612 613 613 for (int i = commonFromDeviceExt(pDevExt)->cDisplays-1; i >= 0; --i) … … 739 739 vboxWddmSetupDisplays(pContext); 740 740 if (!commonFromDeviceExt(pContext)->bHGSMI) 741 VBoxFreeDisplaysHGSMI( pContext);741 VBoxFreeDisplaysHGSMI(commonFromDeviceExt(pContext)); 742 742 } 743 743 if (commonFromDeviceExt(pContext)->bHGSMI) … … 813 813 int rc = vboxWddmFreeDisplays(pDevExt); 814 814 if (RT_SUCCESS(rc)) 815 VBoxFreeDisplaysHGSMI( pDevExt);815 VBoxFreeDisplaysHGSMI(commonFromDeviceExt(pDevExt)); 816 816 AssertRC(rc); 817 817 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.