Changeset 63046 in vbox
- Timestamp:
- Aug 5, 2016 2:41:00 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 109658
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPHGSMI.cpp
r62522 r63046 1 1 /* $Id$ */ 2 3 2 /** @file 4 3 * VBox Miniport HGSMI related functions … … 42 41 43 42 /** 44 * Helper function to register secondary displays (DualView). Note that this will not 45 * be available on pre-XP versions, and some editions on XP will fail because they are 46 * intentionally crippled. 43 * Helper function to register secondary displays (DualView). 44 * 45 * Note that this will not be available on pre-XP versions, and some editions on 46 * XP will fail because they are intentionally crippled. 47 47 * 48 48 * HGSMI variant is a bit different because it uses only HGSMI interface (VBVA channel) … … 56 56 * ones (failure == rc < 0) anyway. This needs to be fully reviewed and 57 57 * fixed. */ 58 int rc = VINF_SUCCESS;59 uint32_t offVRAMBaseMapping, cbMapping, offGuestHeapMemory, cbGuestHeapMemory,60 offHostFlags, offVRAMHostArea, cbHostArea;61 58 LOGF_ENTER(); 62 59 … … 67 64 pCommon->cDisplays = 1; 68 65 pCommon->bHGSMI = VBoxHGSMIIsSupported(); 66 67 #if 1 /* Style that works for MSC and is easier to read. */ 68 69 if (pCommon->bHGSMI) 70 { 71 uint32_t offVRAMBaseMapping, cbMapping, offGuestHeapMemory, cbGuestHeapMemory, offHostFlags; 72 VBoxHGSMIGetBaseMappingInfo(pCommon->cbVRAM, &offVRAMBaseMapping, 73 &cbMapping, &offGuestHeapMemory, 74 &cbGuestHeapMemory, &offHostFlags); 75 76 /* Map the adapter information. It will be needed for HGSMI IO. */ 77 int rc = VBoxMPCmnMapAdapterMemory(pCommon, &pCommon->pvAdapterInformation, offVRAMBaseMapping, cbMapping); 78 if (RT_SUCCESS(rc)) 79 { 80 /* Setup an HGSMI heap within the adapter information area. */ 81 rc = VBoxHGSMISetupGuestContext(&pCommon->guestCtx, 82 pCommon->pvAdapterInformation, 83 cbGuestHeapMemory, 84 offVRAMBaseMapping 85 + offGuestHeapMemory, 86 &g_hgsmiEnvMP); 87 if (RT_SUCCESS(rc)) 88 { 89 if (pCommon->bHGSMI) /* Paranoia caused by the structure of the original code, probably unnecessary. */ 90 { 91 /* Setup the host heap and the adapter memory. */ 92 uint32_t offVRAMHostArea, cbHostArea; 93 VBoxHGSMIGetHostAreaMapping(&pCommon->guestCtx, pCommon->cbVRAM, 94 offVRAMBaseMapping, &offVRAMHostArea, 95 &cbHostArea); 96 if (cbHostArea) 97 { 98 /* Map the heap region. 99 * 100 * Note: the heap will be used for the host buffers submitted to the guest. 101 * The miniport driver is responsible for reading FIFO and notifying 102 * display drivers. 103 */ 104 pCommon->cbMiniportHeap = cbHostArea; 105 rc = VBoxMPCmnMapAdapterMemory(pCommon, &pCommon->pvMiniportHeap, offVRAMHostArea, cbHostArea); 106 if (RT_SUCCESS(rc)) 107 { 108 VBoxHGSMISetupHostContext(&pCommon->hostCtx, 109 pCommon->pvAdapterInformation, 110 offHostFlags, 111 pCommon->pvMiniportHeap, 112 offVRAMHostArea, cbHostArea); 113 114 if (pCommon->bHGSMI) /* Paranoia caused by the structure of the original code, probably unnecessary. */ 115 { 116 /* Setup the information for the host. */ 117 rc = VBoxHGSMISendHostCtxInfo(&pCommon->guestCtx, 118 offVRAMBaseMapping + offHostFlags, 119 fCaps, 120 offVRAMHostArea, 121 pCommon->cbMiniportHeap); 122 if (RT_SUCCESS(rc)) 123 { 124 /* Check whether the guest supports multimonitors. */ 125 if (pCommon->bHGSMI) 126 { 127 /* Query the configured number of displays. */ 128 pCommon->cDisplays = VBoxHGSMIGetMonitorCount(&pCommon->guestCtx); 129 LOGF_LEAVE(); 130 return; 131 } 132 } 133 else 134 pCommon->bHGSMI = false; 135 } 136 } 137 else 138 { 139 pCommon->pvMiniportHeap = NULL; 140 pCommon->cbMiniportHeap = 0; 141 pCommon->bHGSMI = false; 142 } 143 } 144 else 145 { 146 /* Host has not requested a heap. */ 147 pCommon->pvMiniportHeap = NULL; 148 pCommon->cbMiniportHeap = 0; 149 } 150 } 151 } 152 else 153 { 154 LOG(("HGSMIHeapSetup failed rc = %d", rc)); 155 pCommon->bHGSMI = false; 156 } 157 } 158 else 159 { 160 LOG(("VBoxMPCmnMapAdapterMemory failed rc = %d", rc)); 161 pCommon->bHGSMI = false; 162 } 163 } 164 165 if (!pCommon->bHGSMI) 166 VBoxFreeDisplaysHGSMI(pCommon); 167 168 169 #else /* MSC isn't able to keep track of what's initialized and what's not with this style of code. Nor 170 is it clear whether bHGSMI can be modified by the calls made by the code or just the code itself, 171 which makes it hard to figure out! This makes this coding style hard to maintain. */ 172 int rc = VINF_SUCCESS; 173 uint32_t offVRAMBaseMapping, cbMapping, offGuestHeapMemory, cbGuestHeapMemory, 174 offHostFlags, offVRAMHostArea, cbHostArea; 69 175 70 176 if (pCommon->bHGSMI) … … 143 249 rc = VBoxHGSMISendHostCtxInfo(&pCommon->guestCtx, 144 250 offVRAMBaseMapping + offHostFlags, 145 fCaps, offVRAMHostArea, 251 fCaps, 252 offVRAMHostArea, 146 253 pCommon->cbMiniportHeap); 147 254 … … 162 269 VBoxFreeDisplaysHGSMI(pCommon); 163 270 } 271 #endif 164 272 165 273 LOGF_LEAVE(); … … 187 295 VBoxMPCmnUnmapAdapterMemory(pCommon, &pCommon->pvAdapterInformation); 188 296 } 297
Note:
See TracChangeset
for help on using the changeset viewer.