Changeset 33628 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
- Timestamp:
- Oct 29, 2010 11:17:01 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r33532 r33628 1514 1514 } 1515 1515 1516 void VBoxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension, void **ppv , ULONG ulSize)1516 void VBoxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension, void **ppv) 1517 1517 { 1518 1518 dprintf(("VBoxVideo::VBoxUnmapAdapterMemory\n")); … … 1638 1638 1639 1639 #ifndef VBOX_WITH_WDDM 1640 static int vbvaInitInfoDisplay (void *pvData, VBVAINFOVIEW *p) 1641 { 1642 PDEVICE_EXTENSION PrimaryExtension = (PDEVICE_EXTENSION) pvData; 1643 1644 int i; 1645 PDEVICE_EXTENSION Extension; 1646 1647 for (i = 0, Extension = PrimaryExtension; 1648 i < commonFromDeviceExt(PrimaryExtension)->cDisplays && Extension; 1649 i++, Extension = Extension->pNext) 1650 { 1651 p[i].u32ViewIndex = Extension->iDevice; 1652 p[i].u32ViewOffset = Extension->ulFrameBufferOffset; 1653 p[i].u32ViewSize = PrimaryExtension->u.primary.ulMaxFrameBufferSize; 1654 1655 /* How much VRAM should be reserved for the guest drivers to use VBVA. */ 1656 const uint32_t cbReservedVRAM = VBVA_DISPLAY_INFORMATION_SIZE + VBVA_MIN_BUFFER_SIZE; 1657 1658 p[i].u32MaxScreenSize = p[i].u32ViewSize > cbReservedVRAM? 1659 p[i].u32ViewSize - cbReservedVRAM: 1660 0; 1661 } 1662 1663 if (i == commonFromDeviceExt(PrimaryExtension)->cDisplays && Extension == NULL) 1664 { 1665 return VINF_SUCCESS; 1666 } 1667 1668 AssertFailed (); 1669 return VERR_INTERNAL_ERROR; 1670 } 1671 1672 1673 static VOID VBoxCreateDisplaysXPDM(PDEVICE_EXTENSION PrimaryExtension, 1674 PVIDEO_PORT_CONFIG_INFO pConfigInfo) 1675 { 1676 VP_STATUS rc; 1677 1678 if (commonFromDeviceExt(PrimaryExtension)->bHGSMI) 1679 { 1680 typedef VP_STATUS (*PFNCREATESECONDARYDISPLAY)(PVOID, PVOID *, ULONG); 1681 PFNCREATESECONDARYDISPLAY pfnCreateSecondaryDisplay = NULL; 1682 1683 /* Dynamically query the VideoPort import to be binary compatible across Windows versions */ 1684 if (vboxQueryWinVersion() > WINNT4) 1685 { 1686 /* This bluescreens on NT4, hence the above version check */ 1687 pfnCreateSecondaryDisplay = (PFNCREATESECONDARYDISPLAY)(pConfigInfo->VideoPortGetProcAddress) 1688 (PrimaryExtension, 1689 (PUCHAR)"VideoPortCreateSecondaryDisplay"); 1690 } 1691 1692 if (!pfnCreateSecondaryDisplay) 1693 commonFromDeviceExt(PrimaryExtension)->cDisplays = 1; 1694 else 1695 { 1696 PDEVICE_EXTENSION pPrev = PrimaryExtension; 1697 1698 ULONG iDisplay; 1699 ULONG cDisplays = commonFromDeviceExt(PrimaryExtension)->cDisplays; 1700 commonFromDeviceExt(PrimaryExtension)->cDisplays = 1; 1701 for (iDisplay = 1; iDisplay < cDisplays; iDisplay++) 1702 { 1703 PDEVICE_EXTENSION SecondaryExtension = NULL; 1704 rc = pfnCreateSecondaryDisplay (PrimaryExtension, (PVOID*)&SecondaryExtension, VIDEO_DUALVIEW_REMOVABLE); 1705 1706 dprintf(("VBoxVideo::VBoxSetupDisplays: VideoPortCreateSecondaryDisplay returned %#x, SecondaryExtension = %p\n", 1707 rc, SecondaryExtension)); 1708 1709 if (rc != NO_ERROR) 1710 { 1711 break; 1712 } 1713 1714 SecondaryExtension->pNext = NULL; 1715 SecondaryExtension->pPrimary = PrimaryExtension; 1716 SecondaryExtension->iDevice = iDisplay; 1717 SecondaryExtension->ulFrameBufferOffset = 0; 1718 SecondaryExtension->ulFrameBufferSize = 0; 1719 SecondaryExtension->u.secondary.bEnabled = FALSE; 1720 1721 /* Update the list pointers. */ 1722 pPrev->pNext = SecondaryExtension; 1723 pPrev = SecondaryExtension; 1724 1725 /* Take the successfully created display into account. */ 1726 commonFromDeviceExt(PrimaryExtension)->cDisplays++; 1727 } 1728 } 1729 1730 /* Failure to create secondary displays is not fatal */ 1731 rc = NO_ERROR; 1732 } 1733 1734 /* Now when the number of monitors is known and extensions are created, 1735 * calculate the layout of framebuffers. 1736 */ 1737 VBoxComputeFrameBufferSizes (PrimaryExtension); 1738 /* in case of WDDM we do not control the framebuffer location, 1739 * i.e. it is assigned by Video Memory Manager, 1740 * The FB information should be passed to guest from our 1741 * DxgkDdiSetVidPnSourceAddress callback */ 1742 1743 if (commonFromDeviceExt(PrimaryExtension)->bHGSMI) 1744 { 1745 if (RT_SUCCESS(rc)) 1746 { 1747 rc = VBoxHGSMISendViewInfo (commonFromDeviceExt(PrimaryExtension), 1748 commonFromDeviceExt(PrimaryExtension)->cDisplays, 1749 vbvaInitInfoDisplay, 1750 (void *) PrimaryExtension); 1751 AssertRC(rc); 1752 } 1753 1754 if (RT_FAILURE (rc)) 1755 { 1756 commonFromDeviceExt(PrimaryExtension)->bHGSMI = FALSE; 1757 } 1758 } 1759 } 1640 1760 1641 1761 VP_STATUS VBoxVideoFindAdapter(IN PVOID HwDeviceExtension, … … 1754 1874 * with old guest additions. 1755 1875 */ 1756 VBoxSetupDisplaysHGSMI((PDEVICE_EXTENSION)HwDeviceExtension, ConfigInfo,AdapterMemorySize, 0);1876 VBoxSetupDisplaysHGSMI((PDEVICE_EXTENSION)HwDeviceExtension, AdapterMemorySize, 0); 1757 1877 1758 1878 if (commonFromDeviceExt((PDEVICE_EXTENSION)HwDeviceExtension)->bHGSMI) 1759 1879 { 1760 1880 LogRel(("VBoxVideo: using HGSMI\n")); 1881 VBoxCreateDisplaysXPDM((PDEVICE_EXTENSION)HwDeviceExtension, ConfigInfo); 1761 1882 } 1762 1883 … … 2570 2691 VbglTerminate (); 2571 2692 2572 VBoxUnmapAdapterMemory (pDevExt, &commonFromDeviceExt(pDevExt)->pvMiniportHeap, commonFromDeviceExt(pDevExt)->cbMiniportHeap); 2573 VBoxUnmapAdapterInformation (pDevExt); 2693 VBoxFreeDisplaysHGSMI(pDevExt); 2694 /** @note using this callback instead of doing things manually adds an 2695 * additional call to HGSMIHeapDestroy(). I assume that call was 2696 * merely forgotton in the first place. */ 2574 2697 2575 2698 return TRUE;
Note:
See TracChangeset
for help on using the changeset viewer.