Changeset 40566 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video
- Timestamp:
- Mar 21, 2012 2:12:23 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPCommon.cpp
r40489 r40566 33 33 34 34 PHYSICAL_ADDRESS FrameBuffer; 35 FrameBuffer.QuadPart = pPEXT->u.primary.physLFBBase.QuadPart + ulOffset;35 FrameBuffer.QuadPart = VBoxCommonFromDeviceExt(pPEXT)->phVRAM.QuadPart + ulOffset; 36 36 37 37 PVOID VideoRamBase = NULL; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h
r40489 r40566 40 40 uint32_t cbVRAM; /* The VRAM size. */ 41 41 42 PHYSICAL_ADDRESS phVRAM; /* Physical VRAM base. */ 43 44 ULONG ulApertureSize; /* Size of the LFB aperture (>= VRAM size). */ 45 42 46 uint32_t cbMiniportHeap; /* The size of reserved VRAM for miniport driver heap. 43 47 * It is at offset: … … 128 132 ULONG ulVbvaEnabled; /* Indicates that VBVA mode is enabled. */ 129 133 ULONG ulMaxFrameBufferSize; /* The size of the VRAM allocated for the a single framebuffer. */ 130 PHYSICAL_ADDRESS physLFBBase; /* Physical linear framebuffer base. */131 ULONG ulApertureSize; /* Size of the LFB aperture (>= VRAM size). */132 134 BOOLEAN fMouseHidden; /* Has the mouse cursor been hidden by the guest? */ 133 135 VBOXMP_COMMON commonInfo; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPHGSMI.cpp
r40387 r40566 29 29 * to talk to the host. 30 30 */ 31 void VBoxSetupDisplaysHGSMI(PVBOXMP_COMMON pCommon, 32 uint32_t AdapterMemorySize, uint32_t fCaps)31 void VBoxSetupDisplaysHGSMI(PVBOXMP_COMMON pCommon, PHYSICAL_ADDRESS phVRAM, uint32_t ulApertureSize, 32 uint32_t cbVRAM, uint32_t fCaps) 33 33 { 34 34 /** @todo I simply converted this from Windows error codes. That is wrong, … … 42 42 43 43 memset(pCommon, 0, sizeof(*pCommon)); 44 pCommon->cbVRAM = AdapterMemorySize; 44 pCommon->phVRAM = phVRAM; 45 pCommon->ulApertureSize = ulApertureSize; 46 pCommon->cbVRAM = cbVRAM; 45 47 pCommon->cDisplays = 1; 46 48 pCommon->bHGSMI = VBoxHGSMIIsSupported(); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPHGSMI.h
r36867 r40566 23 23 24 24 RT_C_DECLS_BEGIN 25 void VBoxSetupDisplaysHGSMI(PVBOXMP_COMMON pCommon, uint32_t AdapterMemorySize, uint32_t fCaps);25 void VBoxSetupDisplaysHGSMI(PVBOXMP_COMMON pCommon, PHYSICAL_ADDRESS phVRAM, uint32_t ulApertureSize, uint32_t cbVRAM, uint32_t fCaps); 26 26 void VBoxFreeDisplaysHGSMI(PVBOXMP_COMMON pCommon); 27 27 RT_C_DECLS_END -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp
r40373 r40566 1386 1386 { 1387 1387 PHYSICAL_ADDRESS PhysicalAddress = {0}; 1388 PhysicalAddress.QuadPart = VB E_DISPI_LFB_PHYSICAL_ADDRESS+ offData;1388 PhysicalAddress.QuadPart = VBoxCommonFromDeviceExt(pDevExt)->phVRAM.QuadPart + offData; 1389 1389 pMgr->pvData = (uint8_t*)MmMapIoSpace(PhysicalAddress, cbData, MmNonCached); 1390 1390 Assert(pMgr->pvData); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r40483 r40566 609 609 } 610 610 611 NTSTATUS vboxWddmPickResources(PVBOXMP_DEVEXT pContext, PDXGK_DEVICE_INFO pDeviceInfo, PULONG pAdapterMemorySize) 611 typedef struct VBOXWDDM_HWRESOURCES 612 { 613 PHYSICAL_ADDRESS phVRAM; 614 ULONG cbVRAM; 615 ULONG ulApertureSize; 616 } VBOXWDDM_HWRESOURCES, *PVBOXWDDM_HWRESOURCES; 617 618 NTSTATUS vboxWddmPickResources(PVBOXMP_DEVEXT pDevExt, PDXGK_DEVICE_INFO pDeviceInfo, PVBOXWDDM_HWRESOURCES pHwResources) 612 619 { 613 620 NTSTATUS Status = STATUS_SUCCESS; 614 621 USHORT DispiId; 615 *pAdapterMemorySize = VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES; 622 memset(pHwResources, 0, sizeof (*pHwResources)); 623 pHwResources->cbVRAM = VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES; 616 624 617 625 VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID); … … 630 638 * an ULONG from the data port without setting an index before. 631 639 */ 632 *pAdapterMemorySize= VBoxVideoCmnPortReadUlong(VBE_DISPI_IOPORT_DATA);640 pHwResources->cbVRAM = VBoxVideoCmnPortReadUlong(VBE_DISPI_IOPORT_DATA); 633 641 if (VBoxHGSMIIsSupported ()) 634 642 { … … 648 656 break; 649 657 case CmResourceTypeMemory: 658 /* we assume there is one memory segment */ 659 Assert(pHwResources->phVRAM.QuadPart == 0); 660 pHwResources->phVRAM = pPRc->u.Memory.Start; 661 Assert(pHwResources->phVRAM.QuadPart != 0); 662 pHwResources->ulApertureSize = pPRc->u.Memory.Length; 663 Assert(pHwResources->cbVRAM <= pHwResources->ulApertureSize); 650 664 break; 651 665 case CmResourceTypeDma: … … 907 921 ) 908 922 { 909 PVBOXMP_DEVEXT p Context = (PVBOXMP_DEVEXT)MiniportDeviceContext;910 911 vboxWddmVGuidGet(p Context);923 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)MiniportDeviceContext; 924 925 vboxWddmVGuidGet(pDevExt); 912 926 913 927 /* Save DeviceHandle and function pointers supplied by the DXGKRNL_INTERFACE structure passed to DxgkInterface. */ 914 memcpy(&p Context->u.primary.DxgkInterface, DxgkInterface, sizeof (DXGKRNL_INTERFACE));928 memcpy(&pDevExt->u.primary.DxgkInterface, DxgkInterface, sizeof (DXGKRNL_INTERFACE)); 915 929 916 930 /* Allocate a DXGK_DEVICE_INFO structure, and call DxgkCbGetDeviceInformation to fill in the members of that structure, which include the registry path, the PDO, and a list of translated resources for the display adapter represented by MiniportDeviceContext. Save selected members (ones that the display miniport driver will need later) 917 931 * of the DXGK_DEVICE_INFO structure in the context block represented by MiniportDeviceContext. */ 918 932 DXGK_DEVICE_INFO DeviceInfo; 919 Status = p Context->u.primary.DxgkInterface.DxgkCbGetDeviceInformation (pContext->u.primary.DxgkInterface.DeviceHandle, &DeviceInfo);933 Status = pDevExt->u.primary.DxgkInterface.DxgkCbGetDeviceInformation (pDevExt->u.primary.DxgkInterface.DeviceHandle, &DeviceInfo); 920 934 if (Status == STATUS_SUCCESS) 921 935 { 922 ULONG AdapterMemorySize;923 Status = vboxWddmPickResources(p Context, &DeviceInfo, &AdapterMemorySize);936 VBOXWDDM_HWRESOURCES HwRc; 937 Status = vboxWddmPickResources(pDevExt, &DeviceInfo, &HwRc); 924 938 if (Status == STATUS_SUCCESS) 925 939 { … … 931 945 * with old guest additions. 932 946 */ 933 VBoxSetupDisplaysHGSMI(VBoxCommonFromDeviceExt(p Context),934 AdapterMemorySize,947 VBoxSetupDisplaysHGSMI(VBoxCommonFromDeviceExt(pDevExt), 948 HwRc.phVRAM, HwRc.ulApertureSize, HwRc.cbVRAM, 935 949 VBVACAPS_COMPLETEGCMD_BY_IOREAD | VBVACAPS_IRQ); 936 if (VBoxCommonFromDeviceExt(p Context)->bHGSMI)950 if (VBoxCommonFromDeviceExt(pDevExt)->bHGSMI) 937 951 { 938 vboxWddmSetupDisplays(p Context);939 if (!VBoxCommonFromDeviceExt(p Context)->bHGSMI)940 VBoxFreeDisplaysHGSMI(VBoxCommonFromDeviceExt(p Context));952 vboxWddmSetupDisplays(pDevExt); 953 if (!VBoxCommonFromDeviceExt(pDevExt)->bHGSMI) 954 VBoxFreeDisplaysHGSMI(VBoxCommonFromDeviceExt(pDevExt)); 941 955 } 942 if (VBoxCommonFromDeviceExt(p Context)->bHGSMI)956 if (VBoxCommonFromDeviceExt(pDevExt)->bHGSMI) 943 957 { 944 958 LOGREL(("using HGSMI")); 945 *NumberOfVideoPresentSources = VBoxCommonFromDeviceExt(p Context)->cDisplays;946 *NumberOfChildren = VBoxCommonFromDeviceExt(p Context)->cDisplays;959 *NumberOfVideoPresentSources = VBoxCommonFromDeviceExt(pDevExt)->cDisplays; 960 *NumberOfChildren = VBoxCommonFromDeviceExt(pDevExt)->cDisplays; 947 961 LOG(("sources(%d), children(%d)", *NumberOfVideoPresentSources, *NumberOfChildren)); 948 962 949 vboxVdmaDdiNodesInit(p Context);950 vboxVideoCmInit(&p Context->CmMgr);951 InitializeListHead(&p Context->SwapchainList3D);952 p Context->cContexts3D = 0;953 ExInitializeFastMutex(&p Context->ContextMutex);954 KeInitializeSpinLock(&p Context->SynchLock);955 956 VBoxMPCmnInitCustomVideoModes(p Context);957 VBoxWddmInvalidateVideoModesInfo(p Context);963 vboxVdmaDdiNodesInit(pDevExt); 964 vboxVideoCmInit(&pDevExt->CmMgr); 965 InitializeListHead(&pDevExt->SwapchainList3D); 966 pDevExt->cContexts3D = 0; 967 ExInitializeFastMutex(&pDevExt->ContextMutex); 968 KeInitializeSpinLock(&pDevExt->SynchLock); 969 970 VBoxMPCmnInitCustomVideoModes(pDevExt); 971 VBoxWddmInvalidateVideoModesInfo(pDevExt); 958 972 #if 0 959 vboxShRcTreeInit(p Context);973 vboxShRcTreeInit(pDevExt); 960 974 #endif 961 975 962 976 #ifdef VBOX_WITH_VIDEOHWACCEL 963 vboxVhwaInit(p Context);977 vboxVhwaInit(pDevExt); 964 978 #endif 965 979 } … … 1567 1581 LOGF(("ENTER, context(0x%x), Query type (%d)", hAdapter, pQueryAdapterInfo->Type)); 1568 1582 NTSTATUS Status = STATUS_SUCCESS; 1569 PVBOXMP_DEVEXT p Context = (PVBOXMP_DEVEXT)hAdapter;1583 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter; 1570 1584 1571 1585 vboxVDbgBreakFv(); … … 1587 1601 pCaps->MaxOverlays = 0; 1588 1602 #ifdef VBOX_WITH_VIDEOHWACCEL 1589 for (int i = 0; i < VBoxCommonFromDeviceExt(p Context)->cDisplays; ++i)1590 { 1591 if ( p Context->aSources[i].Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED)1592 pCaps->MaxOverlays += p Context->aSources[i].Vhwa.Settings.cOverlaysSupported;1603 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 1604 { 1605 if ( pDevExt->aSources[i].Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED) 1606 pCaps->MaxOverlays += pDevExt->aSources[i].Vhwa.Settings.cOverlaysSupported; 1593 1607 } 1594 1608 #endif … … 1639 1653 DXGK_SEGMENTDESCRIPTOR* pDr = pQsOut->pSegmentDescriptor; 1640 1654 /* we are requested to provide segment information */ 1641 pDr->BaseAddress.QuadPart = 0; /* VBE_DISPI_LFB_PHYSICAL_ADDRESS; */1642 pDr->CpuTranslatedAddress .QuadPart = VBE_DISPI_LFB_PHYSICAL_ADDRESS;1655 pDr->BaseAddress.QuadPart = 0; 1656 pDr->CpuTranslatedAddress = VBoxCommonFromDeviceExt(pDevExt)->phVRAM; 1643 1657 /* make sure the size is page aligned */ 1644 1658 /* @todo: need to setup VBVA buffers and adjust the mem size here */ 1645 pDr->Size = vboxWddmVramCpuVisibleSegmentSize(p Context);1659 pDr->Size = vboxWddmVramCpuVisibleSegmentSize(pDevExt); 1646 1660 pDr->NbOfBanks = 0; 1647 1661 pDr->pBankRangeTable = 0; … … 1656 1670 /* make sure the size is page aligned */ 1657 1671 /* @todo: need to setup VBVA buffers and adjust the mem size here */ 1658 pDr->Size = vboxWddmVramCpuInvisibleSegmentSize(p Context);1672 pDr->Size = vboxWddmVramCpuInvisibleSegmentSize(pDevExt); 1659 1673 pDr->NbOfBanks = 0; 1660 1674 pDr->pBankRangeTable = 0; … … 1676 1690 memset (pQi, 0, sizeof (VBOXWDDM_QI)); 1677 1691 pQi->u32Version = VBOXVIDEOIF_VERSION; 1678 pQi->cInfos = VBoxCommonFromDeviceExt(p Context)->cDisplays;1692 pQi->cInfos = VBoxCommonFromDeviceExt(pDevExt)->cDisplays; 1679 1693 #ifdef VBOX_WITH_VIDEOHWACCEL 1680 for (int i = 0; i < VBoxCommonFromDeviceExt(p Context)->cDisplays; ++i)1694 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 1681 1695 { 1682 pQi->aInfos[i] = p Context->aSources[i].Vhwa.Settings;1696 pQi->aInfos[i] = pDevExt->aSources[i].Vhwa.Settings; 1683 1697 } 1684 1698 #endif … … 1712 1726 LOGF(("ENTER, context(0x%x)", hAdapter)); 1713 1727 NTSTATUS Status = STATUS_SUCCESS; 1714 PVBOXMP_DEVEXT p Context = (PVBOXMP_DEVEXT)hAdapter;1728 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter; 1715 1729 1716 1730 vboxVDbgBreakFv(); … … 1726 1740 // } 1727 1741 1728 pDevice->pAdapter = p Context;1742 pDevice->pAdapter = pDevExt; 1729 1743 pDevice->hDevice = pCreateDevice->hDevice; 1730 1744 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPDriver.cpp
r40489 r40566 50 50 VP_STATUS rc; 51 51 USHORT DispiId; 52 ULONG AdapterMemorySize = VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES; 52 ULONG cbVRAM = VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES; 53 PHYSICAL_ADDRESS phVRAM = {0}; 54 ULONG ulApertureSize = 0; 53 55 54 56 PAGED_CODE(); … … 73 75 * an ULONG from the data port without setting an index before. 74 76 */ 75 AdapterMemorySize= VideoPortReadPortUlong((PULONG)VBE_DISPI_IOPORT_DATA);77 cbVRAM = VideoPortReadPortUlong((PULONG)VBE_DISPI_IOPORT_DATA); 76 78 77 79 /* Write hw information to registry, so that it's visible in windows property dialog */ … … 83 85 VBOXMP_WARN_VPS(rc); 84 86 rc = VideoPortSetRegistryParameters(pExt, L"HardwareInformation.MemorySize", 85 & AdapterMemorySize, sizeof(ULONG));87 &cbVRAM, sizeof(ULONG)); 86 88 VBOXMP_WARN_VPS(rc); 87 89 rc = VideoPortSetRegistryParameters(pExt, L"HardwareInformation.AdapterString", … … 121 123 122 124 /* The first range is the framebuffer. We require that information. */ 123 p Ext->u.primary.physLFBBase= tmpRanges[0].RangeStart;124 pExt->u.primary.ulApertureSize = tmpRanges[0].RangeLength;125 phVRAM = tmpRanges[0].RangeStart; 126 ulApertureSize = tmpRanges[0].RangeLength; 125 127 } 126 128 … … 143 145 * with old guest additions. 144 146 */ 145 VBoxSetupDisplaysHGSMI(&pExt->u.primary.commonInfo, AdapterMemorySize, 0);147 VBoxSetupDisplaysHGSMI(&pExt->u.primary.commonInfo, phVRAM, ulApertureSize, cbVRAM, 0); 146 148 147 149 if (pExt->u.primary.commonInfo.bHGSMI) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPIOCTL.cpp
r40489 r40566 75 75 LOGF(("framebuffer offset %#x", pExt->ulFrameBufferOffset)); 76 76 77 framebuffer.QuadPart = pExt->u.primary.physLFBBase.QuadPart + pExt->ulFrameBufferOffset;77 framebuffer.QuadPart = VBoxCommonFromDeviceExt(pExt)->phVRAM.QuadPart + pExt->ulFrameBufferOffset; 78 78 79 79 pMapInfo->VideoRamBase = pRequestedAddress->RequestedVirtualAddress; … … 145 145 } 146 146 147 shareAddress.QuadPart = pExt->u.primary.physLFBBase.QuadPart + pExt->ulFrameBufferOffset;147 shareAddress.QuadPart = VBoxCommonFromDeviceExt(pExt)->phVRAM.QuadPart + pExt->ulFrameBufferOffset; 148 148 149 149 pStatus->Status = VideoPortMapMemory(pExt, shareAddress, &size, &inIoSpace, &virtualAddress);
Note:
See TracChangeset
for help on using the changeset viewer.