Changeset 93444 in vbox for trunk/src/VBox/Main/src-client/AudioDriver.cpp
- Timestamp:
- Jan 26, 2022 6:01:15 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 149556
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/AudioDriver.cpp
r93115 r93444 28 28 #include <VBox/vmm/pdmapi.h> 29 29 #include <VBox/vmm/pdmdrv.h> 30 #include <VBox/vmm/vmmr3vtable.h> 30 31 31 32 #include "AudioDriver.h" … … 80 81 * 81 82 * @returns VBox status code. 82 * @param pUVM The user mode VM handle for talking to EMT. 83 * @param pAutoLock The callers auto lock instance. Can be NULL if 84 * not locked. 85 */ 86 int AudioDriver::doAttachDriverViaEmt(PUVM pUVM, util::AutoWriteLock *pAutoLock) 83 * @param pUVM The user mode VM handle for talking to EMT. 84 * @param pVMM The VMM ring-3 vtable. 85 * @param pAutoLock The callers auto lock instance. Can be NULL if not 86 * locked. 87 */ 88 int AudioDriver::doAttachDriverViaEmt(PUVM pUVM, PCVMMR3VTABLE pVMM, util::AutoWriteLock *pAutoLock) 87 89 { 88 90 if (!isConfigured()) … … 90 92 91 93 PVMREQ pReq; 92 int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,93 (PFNRT)attachDriverOnEmt, 1, this);94 int vrc = pVMM->pfnVMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 95 (PFNRT)attachDriverOnEmt, 1, this); 94 96 if (vrc == VERR_TIMEOUT) 95 97 { … … 98 100 pAutoLock->release(); 99 101 100 vrc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);102 vrc = pVMM->pfnVMR3ReqWait(pReq, RT_INDEFINITE_WAIT); 101 103 102 104 if (pAutoLock) … … 105 107 106 108 AssertRC(vrc); 107 VMR3ReqFree(pReq);109 pVMM->pfnVMR3ReqFree(pReq); 108 110 109 111 return vrc; … … 138 140 139 141 /* Detach the driver chain from the audio device first. */ 140 int rc = PDMR3DeviceDetach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN, 0 /* fFlags */);142 int rc = ptrVM.vtable()->pfnPDMR3DeviceDetach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN, 0 /* fFlags */); 141 143 if (RT_SUCCESS(rc)) 142 144 { 143 145 rc = pThis->configure(pCfg->uLUN, true /* Attach */); 144 146 if (RT_SUCCESS(rc)) 145 rc = PDMR3DriverAttach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN, 0 /* fFlags */,146 NULL /* ppBase */);147 rc = ptrVM.vtable()->pfnPDMR3DriverAttach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN, 148 0 /* fFlags */, NULL /* ppBase */); 147 149 } 148 150 … … 164 166 * 165 167 * @returns VBox status code. 166 * @param pUVM The user mode VM handle for talking to EMT. 167 * @param pAutoLock The callers auto lock instance. Can be NULL if 168 * not locked. 169 */ 170 int AudioDriver::doDetachDriverViaEmt(PUVM pUVM, util::AutoWriteLock *pAutoLock) 168 * @param pUVM The user mode VM handle for talking to EMT. 169 * @param pVMM The VMM ring-3 vtable. 170 * @param pAutoLock The callers auto lock instance. Can be NULL if not 171 * locked. 172 */ 173 int AudioDriver::doDetachDriverViaEmt(PUVM pUVM, PCVMMR3VTABLE pVMM, util::AutoWriteLock *pAutoLock) 171 174 { 172 175 if (!isConfigured()) … … 174 177 175 178 PVMREQ pReq; 176 int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,177 (PFNRT)detachDriverOnEmt, 1, this);179 int vrc = pVMM->pfnVMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS, 180 (PFNRT)detachDriverOnEmt, 1, this); 178 181 if (vrc == VERR_TIMEOUT) 179 182 { … … 182 185 pAutoLock->release(); 183 186 184 vrc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT);187 vrc = pVMM->pfnVMR3ReqWait(pReq, RT_INDEFINITE_WAIT); 185 188 186 189 if (pAutoLock) … … 189 192 190 193 AssertRC(vrc); 191 VMR3ReqFree(pReq);194 pVMM->pfnVMR3ReqFree(pReq); 192 195 193 196 return vrc; … … 227 230 * Start with the "AUDIO" driver, as this driver serves as the audio connector between 228 231 * the device emulation and the select backend(s). */ 229 int rc = PDMR3DriverDetach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN,230 "AUDIO", 0 /* iOccurrence */, 0 /* fFlags */);232 int rc = ptrVM.vtable()->pfnPDMR3DriverDetach(ptrVM.rawUVM(), pCfg->strDev.c_str(), pCfg->uInst, pCfg->uLUN, 233 "AUDIO", 0 /* iOccurrence */, 0 /* fFlags */); 231 234 if (RT_SUCCESS(rc)) 232 235 rc = pThis->configure(pCfg->uLUN, false /* Detach */);/** @todo r=bird: Illogical and from what I can tell pointless! */ … … 256 259 { 257 260 Console::SafeVMPtrQuiet ptrVM(mpConsole); 258 Assert(ptrVM.isOk()); 259 260 PUVM pUVM = ptrVM.rawUVM(); 261 AssertPtr(pUVM); 262 263 PCFGMNODE pRoot = CFGMR3GetRootU(pUVM); 261 AssertReturn(ptrVM.isOk(), VERR_INVALID_STATE); 262 263 PCFGMNODE pRoot = ptrVM.vtable()->pfnCFGMR3GetRootU(ptrVM.rawUVM()); 264 264 AssertPtr(pRoot); 265 PCFGMNODE pDev0 = CFGMR3GetChildF(pRoot, "Devices/%s/%u/", mCfg.strDev.c_str(), mCfg.uInst);265 PCFGMNODE pDev0 = ptrVM.vtable()->pfnCFGMR3GetChildF(pRoot, "Devices/%s/%u/", mCfg.strDev.c_str(), mCfg.uInst); 266 266 267 267 if (!pDev0) /* No audio device configured? Bail out. */ … … 273 273 int rc = VINF_SUCCESS; 274 274 275 PCFGMNODE pDevLun = CFGMR3GetChildF(pDev0, "LUN#%u/", uLUN);275 PCFGMNODE pDevLun = ptrVM.vtable()->pfnCFGMR3GetChildF(pDev0, "LUN#%u/", uLUN); 276 276 277 277 if (fAttach) 278 278 { 279 do 279 do /* break "loop" */ 280 280 { 281 281 AssertMsgBreakStmt(pDevLun, ("%s: Device LUN #%u not found\n", mCfg.strName.c_str(), uLUN), rc = VERR_NOT_FOUND); … … 283 283 LogRel2(("%s: Configuring audio driver (to LUN #%u)\n", mCfg.strName.c_str(), uLUN)); 284 284 285 CFGMR3RemoveNode(pDevLun); /* Remove LUN completely first. */285 ptrVM.vtable()->pfnCFGMR3RemoveNode(pDevLun); /* Remove LUN completely first. */ 286 286 287 287 /* Insert new LUN configuration and build up the new driver chain. */ 288 rc = CFGMR3InsertNodeF(pDev0, &pDevLun, "LUN#%u/", uLUN);AssertRCBreak(rc);289 rc = CFGMR3InsertString(pDevLun, "Driver", "AUDIO");AssertRCBreak(rc);288 rc = ptrVM.vtable()->pfnCFGMR3InsertNodeF(pDev0, &pDevLun, "LUN#%u/", uLUN); AssertRCBreak(rc); 289 rc = ptrVM.vtable()->pfnCFGMR3InsertString(pDevLun, "Driver", "AUDIO"); AssertRCBreak(rc); 290 290 291 291 PCFGMNODE pLunCfg; 292 rc = CFGMR3InsertNode(pDevLun, "Config", &pLunCfg);AssertRCBreak(rc);293 294 rc = CFGMR3InsertStringF(pLunCfg, "DriverName", "%s", mCfg.strName.c_str());AssertRCBreak(rc);295 rc = CFGMR3InsertInteger(pLunCfg, "InputEnabled", mCfg.fEnabledIn);AssertRCBreak(rc);296 rc = CFGMR3InsertInteger(pLunCfg, "OutputEnabled", mCfg.fEnabledOut);AssertRCBreak(rc);292 rc = ptrVM.vtable()->pfnCFGMR3InsertNode(pDevLun, "Config", &pLunCfg); AssertRCBreak(rc); 293 294 rc = ptrVM.vtable()->pfnCFGMR3InsertStringF(pLunCfg, "DriverName", "%s", mCfg.strName.c_str()); AssertRCBreak(rc); 295 rc = ptrVM.vtable()->pfnCFGMR3InsertInteger(pLunCfg, "InputEnabled", mCfg.fEnabledIn); AssertRCBreak(rc); 296 rc = ptrVM.vtable()->pfnCFGMR3InsertInteger(pLunCfg, "OutputEnabled", mCfg.fEnabledOut); AssertRCBreak(rc); 297 297 298 298 PCFGMNODE pAttachedDriver; 299 rc = CFGMR3InsertNode(pDevLun, "AttachedDriver", &pAttachedDriver);AssertRCBreak(rc);300 rc = CFGMR3InsertStringF(pAttachedDriver, "Driver", "%s", mCfg.strName.c_str());AssertRCBreak(rc);299 rc = ptrVM.vtable()->pfnCFGMR3InsertNode(pDevLun, "AttachedDriver", &pAttachedDriver); AssertRCBreak(rc); 300 rc = ptrVM.vtable()->pfnCFGMR3InsertStringF(pAttachedDriver, "Driver", "%s", mCfg.strName.c_str()); AssertRCBreak(rc); 301 301 PCFGMNODE pAttachedDriverCfg; 302 rc = CFGMR3InsertNode(pAttachedDriver, "Config", &pAttachedDriverCfg);AssertRCBreak(rc);302 rc = ptrVM.vtable()->pfnCFGMR3InsertNode(pAttachedDriver, "Config", &pAttachedDriverCfg); AssertRCBreak(rc); 303 303 304 304 /* Call the (virtual) method for driver-specific configuration. */ 305 rc = configureDriver(pAttachedDriverCfg );AssertRCBreak(rc);305 rc = configureDriver(pAttachedDriverCfg, ptrVM.vtable()); AssertRCBreak(rc); 306 306 307 307 } while (0); … … 316 316 #ifdef LOG_ENABLED 317 317 LogFunc(("%s: fAttach=%RTbool\n", mCfg.strName.c_str(), fAttach)); 318 CFGMR3Dump(pDevLun);318 ptrVM.vtable()->pfnCFGMR3Dump(pDevLun); 319 319 #endif 320 320 }
Note:
See TracChangeset
for help on using the changeset viewer.