Changeset 33116 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Display
- Timestamp:
- Oct 13, 2010 9:06:35 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispCm.cpp
r30855 r33116 109 109 VBOXWDDM_CREATECONTEXT_INFO Info; 110 110 Info.u32IfVersion = pDevice->u32IfVersion; 111 Info. u32IsD3D = VBOXDISPMODE_IS_3D(pDevice->pAdapter);111 Info.enmType = VBOXDISPMODE_IS_3D(pDevice->pAdapter) ? VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D : VBOXWDDM_CONTEXT_TYPE_CUSTOM_2D; 112 112 Info.hUmEvent = (uint64_t)g_pVBoxCmMgr.Session.hEvent; 113 113 Info.u64UmInfo = (uint64_t)pContext; -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.def
r30483 r33116 20 20 OpenAdapter 21 21 VBoxDispMpGetCallbacks 22 22 VBoxDispCrHgsmiInit 23 VBoxDispCrHgsmiTerm 24 VBoxDispCrHgsmiQueryClient -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h
r32889 r33116 18 18 #include "VBoxDispD3DIf.h" 19 19 #include "../../Miniport/wddm/VBoxVideoIf.h" 20 #ifdef VBOX_WITH_CRHGSMI 20 21 #include "VBoxUhgsmiDisp.h" 22 #endif 21 23 22 24 #include <iprt/cdefs.h> … … 178 180 D3DVIEWPORT9 ViewPort; 179 181 VBOXWDDMDISP_CONTEXT DefaultContext; 182 #ifdef VBOX_WITH_CRHGSMI 180 183 VBOXUHGSMI_PRIVATE_D3D Uhgsmi; 184 #endif 181 185 182 186 CRITICAL_SECTION DirtyAllocListLock; … … 262 266 } VBOXWDDMDISP_OVERLAY, *PVBOXWDDMDISP_OVERLAY; 263 267 268 #ifdef VBOX_WITH_CRHGSMI 269 int vboxUhgsmiGlobalSetCurrent(); 270 int vboxUhgsmiGlobalClearCurrent(); 271 #endif 272 264 273 #define VBOXDISPMODE_IS_3D(_p) (!!((_p)->pD3D9If)) 265 274 #ifdef VBOXDISP_EARLYCREATEDEVICE -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D64.def
r30483 r33116 20 20 OpenAdapter 21 21 VBoxDispMpGetCallbacks 22 22 VBoxDispCrHgsmiInit 23 VBoxDispCrHgsmiTerm 24 VBoxDispCrHgsmiQueryClient -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxScreen.cpp
r32061 r33116 364 364 pMon->pfnD3DKMTEscape = (PFND3DKMT_ESCAPE)GetProcAddress(pMon->hGdi32, "D3DKMTEscape"); 365 365 Log((__FUNCTION__": pfnD3DKMTEscape = %p\n", pMon->pfnD3DKMTEscape)); 366 bSupported &= !!(pMon->pfnD3DKMT CloseAdapter);366 bSupported &= !!(pMon->pfnD3DKMTEscape); 367 367 368 368 Assert(bSupported); -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiDisp.cpp
r32889 r33116 20 20 typedef struct VBOXUHGSMI_BUFFER_PRIVATE_D3D 21 21 { 22 VBOXUHGSMI_BUFFER Base;22 VBOXUHGSMI_BUFFER_PRIVATE_BASE BasePrivate; 23 23 PVBOXWDDMDISP_DEVICE pDevice; 24 D3DKMT_HANDLE hAllocation;25 24 UINT aLockPageIndices[1]; 26 25 } VBOXUHGSMI_BUFFER_PRIVATE_D3D, *PVBOXUHGSMI_BUFFER_PRIVATE_D3D; 27 26 28 #define VBOXUHGSMID3D_GET_PRIVATE(_p, _t) ((_t*)(((uint8_t*)_p) - RT_OFFSETOF(_t, Base )))27 #define VBOXUHGSMID3D_GET_PRIVATE(_p, _t) ((_t*)(((uint8_t*)_p) - RT_OFFSETOF(_t, BasePrivate.Base))) 29 28 #define VBOXUHGSMID3D_GET(_p) VBOXUHGSMID3D_GET_PRIVATE(_p, VBOXUHGSMI_PRIVATE_D3D) 30 29 #define VBOXUHGSMID3D_GET_BUFFER(_p) VBOXUHGSMID3D_GET_PRIVATE(_p, VBOXUHGSMI_BUFFER_PRIVATE_D3D) … … 36 35 DdiDealloc.hResource = 0; 37 36 DdiDealloc.NumAllocations = 1; 38 DdiDealloc.HandleList = &pBuffer-> hAllocation;37 DdiDealloc.HandleList = &pBuffer->BasePrivate.hAllocation; 39 38 HRESULT hr = pBuffer->pDevice->RtCallbacks.pfnDeallocateCb(pBuffer->pDevice->hDevice, &DdiDealloc); 40 39 Assert(hr == S_OK); 41 40 if (hr == S_OK) 42 41 { 43 if (pBuffer->Base .bSynchCreated)42 if (pBuffer->BasePrivate.Base.bSynchCreated) 44 43 { 45 CloseHandle(pBuffer->Base .hSynch);44 CloseHandle(pBuffer->BasePrivate.Base.hSynch); 46 45 } 47 46 RTMemFree(pBuffer); … … 55 54 PVBOXUHGSMI_BUFFER_PRIVATE_D3D pBuffer = VBOXUHGSMID3D_GET_BUFFER(pBuf); 56 55 D3DDDICB_LOCK DdiLock; 57 DdiLock.hAllocation = pBuffer-> hAllocation;56 DdiLock.hAllocation = pBuffer->BasePrivate.hAllocation; 58 57 DdiLock.PrivateDriverData = 0; 59 58 60 if (fFlags.bLockEntire) 61 { 62 offLock = 0; 63 DdiLock.Flags.Value = 0; 64 DdiLock.Flags.LockEntire = 1; 65 } 66 else 67 { 68 if (!cbLock) 69 { 70 Assert(0); 71 return VERR_INVALID_PARAMETER; 72 } 73 if (offLock + cbLock > pBuf->cbBuffer) 74 { 75 Assert(0); 76 return VERR_INVALID_PARAMETER; 77 } 78 79 uint32_t iFirstPage = offLock >> 0x1000; 80 uint32_t iAfterLastPage = (cbLock + 0xfff) >> 0x1000; 81 uint32_t cPages = iAfterLastPage - iFirstPage; 82 uint32_t cBufPages = pBuf->cbBuffer >> 0x1000; 83 Assert(cPages <= (cBufPages)); 84 85 if (cPages == cBufPages) 86 { 87 DdiLock.NumPages = 0; 88 DdiLock.pPages = NULL; 89 DdiLock.Flags.Value = 0; 90 DdiLock.Flags.LockEntire = 1; 91 } 92 else 93 { 94 DdiLock.NumPages = cPages; 95 DdiLock.pPages = pBuffer->aLockPageIndices; 96 DdiLock.Flags.Value = 0; 97 for (UINT i = 0, j = iFirstPage; i < cPages; ++i, ++j) 98 { 99 pBuffer->aLockPageIndices[i] = j; 100 } 101 } 102 103 } 104 DdiLock.pData = NULL; 105 DdiLock.Flags.ReadOnly = fFlags.bReadOnly; 106 DdiLock.Flags.WriteOnly = fFlags.bWriteOnly; 107 DdiLock.Flags.DonotWait = fFlags.bDonotWait; 108 // DdiLock.Flags.Discard = fFlags.bDiscard; 59 int rc = vboxUhgsmiBaseLockData(pBuf, offLock, cbLock, fFlags, 60 &DdiLock.Flags, pBuffer->aLockPageIndices, &DdiLock.NumPages); 61 AssertRC(rc); 62 if (RT_FAILURE(rc)) 63 return rc; 64 65 DdiLock.pPages = pBuffer->aLockPageIndices; 109 66 110 67 HRESULT hr = pBuffer->pDevice->RtCallbacks.pfnLockCb(pBuffer->pDevice->hDevice, &DdiLock); … … 123 80 D3DDDICB_UNLOCK DdiUnlock; 124 81 DdiUnlock.NumAllocations = 1; 125 DdiUnlock.phAllocations = &pBuffer-> hAllocation;82 DdiUnlock.phAllocations = &pBuffer->BasePrivate.hAllocation; 126 83 HRESULT hr = pBuffer->pDevice->RtCallbacks.pfnUnlockCb(pBuffer->pDevice->hDevice, &DdiUnlock); 127 84 Assert(hr == S_OK); … … 139 96 return VERR_INVALID_PARAMETER; 140 97 141 switch (enmSynchType) 142 { 143 case VBOXUHGSMI_SYNCHOBJECT_TYPE_EVENT: 144 if (!hSynch) 145 { 146 hSynch = CreateEvent( 147 NULL, /* LPSECURITY_ATTRIBUTES lpEventAttributes */ 148 FALSE, /* BOOL bManualReset */ 149 FALSE, /* BOOL bInitialState */ 150 NULL /* LPCTSTR lpName */ 151 ); 152 Assert(hSynch); 153 if (!hSynch) 154 { 155 DWORD winEr = GetLastError(); 156 /* todo: translate winer */ 157 return VERR_GENERAL_FAILURE; 158 } 159 bSynchCreated = true; 160 } 161 break; 162 case VBOXUHGSMI_SYNCHOBJECT_TYPE_SEMAPHORE: 163 if (!hSynch) 164 { 165 hSynch = CreateSemaphore( 166 NULL, /* LPSECURITY_ATTRIBUTES lpSemaphoreAttributes */ 167 0, /* LONG lInitialCount */ 168 ~0L, /* LONG lMaximumCount */ 169 NULL /* LPCTSTR lpName */ 170 ); 171 Assert(hSynch); 172 if (!hSynch) 173 { 174 DWORD winEr = GetLastError(); 175 /* todo: translate winer */ 176 return VERR_GENERAL_FAILURE; 177 } 178 bSynchCreated = true; 179 } 180 break; 181 default: 182 Assert(0); 183 return VERR_INVALID_PARAMETER; 184 } 98 int rc = vboxUhgsmiBaseEventChkCreate(enmSynchType, &hSynch, &bSynchCreated); 99 AssertRC(rc); 100 if (RT_FAILURE(rc)) 101 return rc; 185 102 186 103 cbBuf = VBOXWDDM_ROUNDBOUND(cbBuf, 0x1000); … … 189 106 Assert(cPages); 190 107 191 int rc;192 108 PVBOXUHGSMI_PRIVATE_D3D pPrivate = VBOXUHGSMID3D_GET(pHgsmi); 193 109 PVBOXUHGSMI_BUFFER_PRIVATE_D3D pBuf = (PVBOXUHGSMI_BUFFER_PRIVATE_D3D)RTMemAllocZ(RT_OFFSETOF(VBOXUHGSMI_BUFFER_PRIVATE_D3D, aLockPageIndices)); … … 218 134 { 219 135 Assert(Buf.DdiAllocInfo.hAllocation); 220 pBuf->Base .pfnLock = vboxUhgsmiD3DBufferLock;221 pBuf->Base .pfnUnlock = vboxUhgsmiD3DBufferUnlock;136 pBuf->BasePrivate.Base.pfnLock = vboxUhgsmiD3DBufferLock; 137 pBuf->BasePrivate.Base.pfnUnlock = vboxUhgsmiD3DBufferUnlock; 222 138 // pBuf->Base.pfnAdjustValidDataRange = vboxUhgsmiD3DBufferAdjustValidDataRange; 223 pBuf->Base .pfnDestroy = vboxUhgsmiD3DBufferDestroy;224 225 pBuf->Base .hSynch = hSynch;226 pBuf->Base .enmSynchType =enmSynchType;227 pBuf->Base .cbBuffer = cbBuf;228 pBuf->Base .bSynchCreated = bSynchCreated;139 pBuf->BasePrivate.Base.pfnDestroy = vboxUhgsmiD3DBufferDestroy; 140 141 pBuf->BasePrivate.Base.hSynch = hSynch; 142 pBuf->BasePrivate.Base.enmSynchType = enmSynchType; 143 pBuf->BasePrivate.Base.cbBuffer = cbBuf; 144 pBuf->BasePrivate.Base.bSynchCreated = bSynchCreated; 229 145 230 146 pBuf->pDevice = pPrivate->pDevice; 231 pBuf-> hAllocation = Buf.DdiAllocInfo.hAllocation;232 233 *ppBuf = &pBuf->Base ;147 pBuf->BasePrivate.hAllocation = Buf.DdiAllocInfo.hAllocation; 148 149 *ppBuf = &pBuf->BasePrivate.Base; 234 150 235 151 return VINF_SUCCESS; … … 251 167 PVBOXUHGSMI_PRIVATE_D3D pHg = VBOXUHGSMID3D_GET(pHgsmi); 252 168 PVBOXWDDMDISP_DEVICE pDevice = pHg->pDevice; 253 const uint32_t cbDmaCmd = RT_OFFSETOF(VBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD, aBufInfos[cBuffers]); 254 if (pDevice->DefaultContext.ContextInfo.CommandBufferSize < cbDmaCmd) 255 { 256 Assert(0); 257 return VERR_GENERAL_FAILURE; 258 } 259 if (pDevice->DefaultContext.ContextInfo.AllocationListSize < cBuffers) 260 { 261 Assert(0); 262 return VERR_GENERAL_FAILURE; 263 } 264 265 PVBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD pHdr = (PVBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD)pDevice->DefaultContext.ContextInfo.pCommandBuffer; 266 pHdr->Base.enmCmd = VBOXVDMACMD_TYPE_CHROMIUM_CMD; 267 pHdr->Base.u32CmdReserved = cBuffers; 268 269 D3DDDI_ALLOCATIONLIST* pAllocationList = pDevice->DefaultContext.ContextInfo.pAllocationList; 270 PVBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO pBufSubmInfo = pHdr->aBufInfos; 271 272 for (uint32_t i = 0; i < cBuffers; ++i) 273 { 274 PVBOXUHGSMI_BUFFER_SUBMIT pBufInfo = &aBuffers[i]; 275 PVBOXUHGSMI_BUFFER_PRIVATE_D3D pBuffer = VBOXUHGSMID3D_GET_BUFFER(pBufInfo->pBuf); 276 277 memset(pAllocationList, 0, sizeof (D3DDDI_ALLOCATIONLIST)); 278 pAllocationList->hAllocation = pBuffer->hAllocation; 279 pAllocationList->WriteOperation = !pBufInfo->fFlags.bHostReadOnly; 280 pAllocationList->DoNotRetireInstance = pBufInfo->fFlags.bDoNotRetire; 281 pBufSubmInfo->fSubFlags = pBufInfo->fFlags; 282 if (pBufInfo->fFlags.bEntireBuffer) 283 { 284 pBufSubmInfo->offData = 0; 285 pBufSubmInfo->cbData = pBuffer->Base.cbBuffer; 286 } 287 else 288 { 289 pBufSubmInfo->offData = pBufInfo->offData; 290 pBufSubmInfo->cbData = pBufInfo->cbData; 291 } 292 293 ++pAllocationList; 294 ++pBufSubmInfo; 295 } 296 169 UINT cbDmaCmd = pDevice->DefaultContext.ContextInfo.CommandBufferSize; 170 int rc = vboxUhgsmiBaseDmaFill(aBuffers, cBuffers, 171 pDevice->DefaultContext.ContextInfo.pCommandBuffer, &cbDmaCmd, 172 pDevice->DefaultContext.ContextInfo.pAllocationList, pDevice->DefaultContext.ContextInfo.AllocationListSize, 173 pDevice->DefaultContext.ContextInfo.pPatchLocationList, pDevice->DefaultContext.ContextInfo.PatchLocationListSize); 174 AssertRC(rc); 175 if (RT_FAILURE(rc)) 176 return rc; 297 177 298 178 D3DDDICB_RENDER DdiRender = {0}; … … 327 207 HRESULT vboxUhgsmiD3DInit(PVBOXUHGSMI_PRIVATE_D3D pHgsmi, PVBOXWDDMDISP_DEVICE pDevice) 328 208 { 329 pHgsmi->Base.pfnBufferCreate = vboxUhgsmiD3DBufferCreate; 330 pHgsmi->Base.pfnBufferSubmitAsynch = vboxUhgsmiD3DBufferSubmitAsynch; 209 pHgsmi->BasePrivate.Base.pfnBufferCreate = vboxUhgsmiD3DBufferCreate; 210 pHgsmi->BasePrivate.Base.pfnBufferSubmitAsynch = vboxUhgsmiD3DBufferSubmitAsynch; 211 pHgsmi->BasePrivate.hClient = NULL; 331 212 pHgsmi->pDevice = pDevice; 332 213 return S_OK; 333 214 } 215 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiDisp.h
r32889 r33116 16 16 #define ___VBoxUhgsmiDisp_h__ 17 17 18 #include " ../../Miniport/wddm/VBoxUhgsmi.h"18 #include "VBoxUhgsmiBase.h" 19 19 #include "VBoxDispD3DCmn.h" 20 20 21 21 typedef struct VBOXUHGSMI_PRIVATE_D3D 22 22 { 23 VBOXUHGSMI Base;23 VBOXUHGSMI_PRIVATE_BASE BasePrivate; 24 24 struct VBOXWDDMDISP_DEVICE *pDevice; 25 25 } VBOXUHGSMI_PRIVATE_D3D, *PVBOXUHGSMI_PRIVATE_D3D; 26 26 27 27 HRESULT vboxUhgsmiD3DInit(PVBOXUHGSMI_PRIVATE_D3D pHgsmi, struct VBOXWDDMDISP_DEVICE *pDevice); 28 29 30 28 31 #endif /* #ifndef ___VBoxUhgsmiDisp_h__ */
Note:
See TracChangeset
for help on using the changeset viewer.