Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp	(revision 82088)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp	(revision 82089)
@@ -336,8 +336,8 @@
 #ifdef IN_RING3
 # if defined(VMSVGA_USE_FIFO_ACCESS_HANDLER) || defined(DEBUG_FIFO_ACCESS)
-static FNPGMPHYSHANDLER vmsvgaR3FIFOAccessHandler;
+static FNPGMPHYSHANDLER vmsvgaR3FifoAccessHandler;
 # endif
 # ifdef DEBUG_GMR_ACCESS
-static FNPGMPHYSHANDLER vmsvgaR3GMRAccessHandler;
+static FNPGMPHYSHANDLER vmsvgaR3GmrAccessHandler;
 # endif
 #endif
@@ -541,10 +541,20 @@
     SSMFIELD_ENTRY_TERM()
 };
-
-static void vmsvgaSetTraces(PVGASTATE pThis, bool fTraces);
-static int vmsvgaLoadExecFifo(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
-static int vmsvgaSaveExecFifo(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PSSMHANDLE pSSM);
-
-VMSVGASCREENOBJECT *vmsvgaGetScreenObject(PVGASTATE pThis, uint32_t idScreen)
+#endif /* IN_RING3 */
+
+
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
+#ifdef IN_RING3
+static void vmsvgaR3SetTraces(PVGASTATE pThis, bool fTraces);
+static int vmsvgaR3LoadExecFifo(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
+static int vmsvgaR3SaveExecFifo(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PSSMHANDLE pSSM);
+#endif /* IN_RING3 */
+
+
+
+#ifdef IN_RING3
+VMSVGASCREENOBJECT *vmsvgaR3GetScreenObject(PVGASTATE pThis, uint32_t idScreen)
 {
     PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State;
@@ -557,5 +567,4 @@
     return NULL;
 }
-
 #endif /* IN_RING3 */
 
@@ -640,5 +649,5 @@
  * @param   u32Cmd      FIFO command
  */
-static const char *vmsvgaFIFOCmdToString(uint32_t u32Cmd)
+static const char *vmsvgaR3FifoCmdToString(uint32_t u32Cmd)
 {
     switch (u32Cmd)
@@ -715,5 +724,5 @@
 
     /** @todo Test how it interacts with multiple screen objects. */
-    VMSVGASCREENOBJECT *pScreen = vmsvgaGetScreenObject(pThis, idScreen);
+    VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThis, idScreen);
     uint32_t const uWidth = pScreen ? pScreen->cWidth : 0;
     uint32_t const uHeight = pScreen ? pScreen->cHeight : 0;
@@ -1281,5 +1290,5 @@
  * @param   pThis       VMSVGA State
  */
-static int vmsvgaChangeMode(PVGASTATE pThis)
+static int vmsvgaR3ChangeMode(PVGASTATE pThis)
 {
     int rc;
@@ -1408,5 +1417,5 @@
 }
 
-int vmsvgaUpdateScreen(PVGASTATE pThis, VMSVGASCREENOBJECT *pScreen, int x, int y, int w, int h)
+int vmsvgaR3UpdateScreen(PVGASTATE pThis, VMSVGASCREENOBJECT *pScreen, int x, int y, int w, int h)
 {
     VBVACMDHDR cmd;
@@ -1433,5 +1442,5 @@
  * @param   fState              The busy state.
  */
-DECLINLINE(void) vmsvgaSafeFifoBusyRegUpdate(PVGASTATE pThis, bool fState)
+DECLINLINE(void) vmsvgaHCSafeFifoBusyRegUpdate(PVGASTATE pThis, bool fState)
 {
     ASMAtomicWriteU32(&pThis->svga.CTX_SUFF(pFIFO)[SVGA_FIFO_BUSY], fState);
@@ -1457,5 +1466,5 @@
  * @param   pThis       VMSVGA State
  */
-DECLINLINE(void) vmsvgaUpdatePitch(PVGASTATE pThis)
+DECLINLINE(void) vmsvgaHCUpdatePitch(PVGASTATE pThis)
 {
     uint32_t RT_UNTRUSTED_VOLATILE_GUEST *pFIFO = pThis->svga.CTX_SUFF(pFIFO);
@@ -1526,5 +1535,5 @@
     }
     Log(("vmsvgaWritePort index=%s (%d) val=%#x\n", vmsvgaIndexToString(pThis, idxReg), idxReg, u32));
-    /* Check if the guest uses legacy registers. See vmsvgaChangeMode */
+    /* Check if the guest uses legacy registers. See vmsvgaR3ChangeMode */
     switch (idxReg)
     {
@@ -1587,5 +1596,5 @@
 
                 /* Disable or enable dirty page tracking according to the current fTraces value. */
-                vmsvgaSetTraces(pThis, !!pThis->svga.fTraces);
+                vmsvgaR3SetTraces(pThis, !!pThis->svga.fTraces);
 
                 /* bird: Whatever this is was added to make screenshot work, ask sunlover should explain... */
@@ -1601,5 +1610,5 @@
 
                 /* Enable dirty page tracking again when going into legacy mode. */
-                vmsvgaSetTraces(pThis, true);
+                vmsvgaR3SetTraces(pThis, true);
 
                 /* bird: Whatever this is was added to make screenshot work, ask sunlover should explain... */
@@ -1621,5 +1630,5 @@
 #if defined(IN_RING3) || defined(IN_RING0)
                 pThis->svga.uWidth = u32;
-                vmsvgaUpdatePitch(pThis);
+                vmsvgaHCUpdatePitch(pThis);
                 if (pThis->svga.fEnabled)
                     ASMAtomicOrU32(&pThis->svga.u32ActionFlags, VMSVGA_ACTION_CHANGEMODE);
@@ -1653,5 +1662,5 @@
 #if defined(IN_RING3) || defined(IN_RING0)
                 pThis->svga.uBpp = u32;
-                vmsvgaUpdatePitch(pThis);
+                vmsvgaHCUpdatePitch(pThis);
                 if (pThis->svga.fEnabled)
                     ASMAtomicOrU32(&pThis->svga.u32ActionFlags, VMSVGA_ACTION_CHANGEMODE);
@@ -1674,5 +1683,5 @@
             if (!pThis->svga.fConfigured)
                 pThis->svga.fTraces = true;
-            vmsvgaSetTraces(pThis, !!pThis->svga.fTraces);
+            vmsvgaR3SetTraces(pThis, !!pThis->svga.fTraces);
 #else
             rc = VINF_IOM_R3_IOPORT_WRITE;
@@ -1689,5 +1698,5 @@
                 ASMAtomicWriteU32(&pThis->svga.fBusy, VMSVGA_BUSY_F_EMT_FORCE | VMSVGA_BUSY_F_FIFO);
                 if (VMSVGA_IS_VALID_FIFO_REG(SVGA_FIFO_BUSY, pThis->svga.CTX_SUFF(pFIFO)[SVGA_FIFO_MIN]))
-                    vmsvgaSafeFifoBusyRegUpdate(pThis, true);
+                    vmsvgaHCSafeFifoBusyRegUpdate(pThis, true);
 
                 /* Kick the FIFO thread to start processing commands again. */
@@ -1783,5 +1792,5 @@
 
             /* Free the old GMR if present. */
-            vmsvgaGMRFree(pThis, idGMR);
+            vmsvgaR3GmrFree(pThis, idGMR);
 
             /* Just undefine the GMR? */
@@ -1864,5 +1873,5 @@
 
 #ifdef IN_RING3
-            vmsvgaSetTraces(pThis, !!u32);
+            vmsvgaR3SetTraces(pThis, !!u32);
 #else
             rc = VINF_IOM_R3_IOPORT_WRITE;
@@ -2043,5 +2052,5 @@
  * @param   fWriteAccess    Read or write access
  */
-static int vmsvgaDebugFIFOAccess(PVM pVM, PVGASTATE pThis, RTGCPHYS GCPhys, bool fWriteAccess)
+static int vmsvgaR3DebugFifoAccess(PVM pVM, PVGASTATE pThis, RTGCPHYS GCPhys, bool fWriteAccess)
 {
     RT_NOREF(pVM);
@@ -2392,5 +2401,5 @@
  */
 static DECLCALLBACK(VBOXSTRICTRC)
-vmsvgaR3FIFOAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
+vmsvgaR3FifoAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
                           PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
@@ -2413,5 +2422,5 @@
      */
     Assert(GCPhys >= pThis->svga.GCPhysFIFO);
-    rc = vmsvgaDebugFIFOAccess(pVM, pThis, GCPhys, enmAccessType == PGMACCESSTYPE_WRITE);
+    rc = vmsvgaR3DebugFifoAccess(pVM, pThis, GCPhys, enmAccessType == PGMACCESSTYPE_WRITE);
 # elif defined(VMSVGA_USE_FIFO_ACCESS_HANDLER)
     /*
@@ -2449,5 +2458,5 @@
  */
 static DECLCALLBACK(VBOXSTRICTRC)
-vmsvgaR3GMRAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
+vmsvgaR3GmrAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
                          PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
@@ -2457,5 +2466,5 @@
     NOREF(pVCpu); NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf); NOREF(enmAccessType); NOREF(enmOrigin);
 
-    Log(("vmsvgaR3GMRAccessHandler: GMR access to page %RGp\n", GCPhys));
+    Log(("vmsvgaR3GmrAccessHandler: GMR access to page %RGp\n", GCPhys));
 
     for (uint32_t i = 0; i < pThis->svga.cGMR; ++i)
@@ -2476,15 +2485,15 @@
                     int rc = PGMHandlerPhysicalPageTempOff(pVM, pGMR->paDesc[j].GCPhys, GCPhys);
                     AssertRC(rc);
-                    goto end;
+                    return VINF_PGM_HANDLER_DO_DEFAULT;
                 }
             }
         }
     }
-end:
+
     return VINF_PGM_HANDLER_DO_DEFAULT;
 }
 
-/* Callback handler for VMR3ReqCallWaitU */
-static DECLCALLBACK(int) vmsvgaRegisterGMR(PPDMDEVINS pDevIns, uint32_t gmrId)
+/** Callback handler for VMR3ReqCallWaitU */
+static DECLCALLBACK(int) vmsvgaR3RegisterGmr(PPDMDEVINS pDevIns, uint32_t gmrId)
 {
     PVGASTATE       pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
@@ -2503,6 +2512,6 @@
 }
 
-/* Callback handler for VMR3ReqCallWaitU */
-static DECLCALLBACK(int) vmsvgaDeregisterGMR(PPDMDEVINS pDevIns, uint32_t gmrId)
+/** Callback handler for VMR3ReqCallWaitU */
+static DECLCALLBACK(int) vmsvgaR3DeregisterGmr(PPDMDEVINS pDevIns, uint32_t gmrId)
 {
     PVGASTATE       pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
@@ -2518,6 +2527,6 @@
 }
 
-/* Callback handler for VMR3ReqCallWaitU */
-static DECLCALLBACK(int) vmsvgaResetGMRHandlers(PVGASTATE pThis)
+/** Callback handler for VMR3ReqCallWaitU */
+static DECLCALLBACK(int) vmsvgaR3ResetGmrHandlers(PVGASTATE pThis)
 {
     PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State;
@@ -2564,5 +2573,5 @@
 {
     LogRel2(("vmsvgaR3InstallNewCursor: cx=%d cy=%d xHot=%d yHot=%d fAlpha=%d cbData=%#x\n", cx, cy, xHot, yHot, fAlpha, cbData));
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (LogIs2Enabled())
     {
@@ -2605,5 +2614,5 @@
         }
     }
-#endif
+# endif
 
     int rc = pThis->pDrv->pfnVBVAMousePointerShape(pThis->pDrv, true /*fVisible*/, fAlpha, xHot, yHot, cx, cy, pbData);
@@ -2880,5 +2889,5 @@
     {
         case VMSVGA_FIFO_EXTCMD_RESET:
-            Log(("vmsvgaFIFOLoop: reset the fifo thread.\n"));
+            Log(("vmsvgaR3FifoLoop: reset the fifo thread.\n"));
             Assert(pThis->svga.pvFIFOExtCmdParam == NULL);
 # ifdef VBOX_WITH_VMSVGA3D
@@ -2892,5 +2901,5 @@
 
         case VMSVGA_FIFO_EXTCMD_TERMINATE:
-            Log(("vmsvgaFIFOLoop: terminate the fifo thread.\n"));
+            Log(("vmsvgaR3FifoLoop: terminate the fifo thread.\n"));
             Assert(pThis->svga.pvFIFOExtCmdParam == NULL);
 # ifdef VBOX_WITH_VMSVGA3D
@@ -2905,8 +2914,8 @@
         case VMSVGA_FIFO_EXTCMD_SAVESTATE:
         {
-            Log(("vmsvgaFIFOLoop: VMSVGA_FIFO_EXTCMD_SAVESTATE.\n"));
+            Log(("vmsvgaR3FifoLoop: VMSVGA_FIFO_EXTCMD_SAVESTATE.\n"));
             PSSMHANDLE pSSM = (PSSMHANDLE)pThis->svga.pvFIFOExtCmdParam;
             AssertLogRelMsgBreak(RT_VALID_PTR(pSSM), ("pSSM=%p\n", pSSM));
-            vmsvgaSaveExecFifo(pThis->pDevInsR3->pHlpR3, pThis, pSSM);
+            vmsvgaR3SaveExecFifo(pThis->pDevInsR3->pHlpR3, pThis, pSSM);
 # ifdef VBOX_WITH_VMSVGA3D
             if (pThis->svga.f3DEnabled)
@@ -2918,8 +2927,8 @@
         case VMSVGA_FIFO_EXTCMD_LOADSTATE:
         {
-            Log(("vmsvgaFIFOLoop: VMSVGA_FIFO_EXTCMD_LOADSTATE.\n"));
+            Log(("vmsvgaR3FifoLoop: VMSVGA_FIFO_EXTCMD_LOADSTATE.\n"));
             PVMSVGA_STATE_LOAD pLoadState = (PVMSVGA_STATE_LOAD)pThis->svga.pvFIFOExtCmdParam;
             AssertLogRelMsgBreak(RT_VALID_PTR(pLoadState), ("pLoadState=%p\n", pLoadState));
-            vmsvgaLoadExecFifo(pThis->pDevInsR3->pHlpR3, pThis, pLoadState->pSSM, pLoadState->uVersion, pLoadState->uPass);
+            vmsvgaR3LoadExecFifo(pThis->pDevInsR3->pHlpR3, pThis, pLoadState->pSSM, pLoadState->uVersion, pLoadState->uPass);
 # ifdef VBOX_WITH_VMSVGA3D
             if (pThis->svga.f3DEnabled)
@@ -2933,5 +2942,5 @@
 # ifdef VBOX_WITH_VMSVGA3D
             uint32_t sid = (uint32_t)(uintptr_t)pThis->svga.pvFIFOExtCmdParam;
-            Log(("vmsvgaFIFOLoop: VMSVGA_FIFO_EXTCMD_UPDATE_SURFACE_HEAP_BUFFERS sid=%#x\n", sid));
+            Log(("vmsvgaR3FifoLoop: VMSVGA_FIFO_EXTCMD_UPDATE_SURFACE_HEAP_BUFFERS sid=%#x\n", sid));
             vmsvga3dUpdateHeapBuffersForSurfaces(pThis, sid);
 # endif
@@ -2967,5 +2976,6 @@
  *                          milliseconds.
  */
-static int vmsvgaR3RunExtCmdOnFifoThread(PPDMDEVINS pDevIns, PVGASTATE pThis, uint8_t uExtCmd, void *pvParam, RTMSINTERVAL cMsWait)
+static int vmsvgaR3RunExtCmdOnFifoThread(PPDMDEVINS pDevIns, PVGASTATE pThis,
+                                         uint8_t uExtCmd, void *pvParam, RTMSINTERVAL cMsWait)
 {
     Assert(cMsWait >= RT_MS_1SEC * 5);
@@ -3058,14 +3068,14 @@
  * @param   offFifoMin      The start byte offset of the command FIFO.
  */
-static void vmsvgaFifoSetNotBusy(PVGASTATE pThis, PVMSVGAR3STATE pSVGAState, uint32_t offFifoMin)
+static void vmsvgaR3FifoSetNotBusy(PVGASTATE pThis, PVMSVGAR3STATE pSVGAState, uint32_t offFifoMin)
 {
     ASMAtomicAndU32(&pThis->svga.fBusy, ~VMSVGA_BUSY_F_FIFO);
     if (VMSVGA_IS_VALID_FIFO_REG(SVGA_FIFO_BUSY, offFifoMin))
-        vmsvgaSafeFifoBusyRegUpdate(pThis, pThis->svga.fBusy != 0);
+        vmsvgaHCSafeFifoBusyRegUpdate(pThis, pThis->svga.fBusy != 0);
 
     /* Wake up any waiting EMTs. */
     if (pSVGAState->cBusyDelayedEmts > 0)
     {
-#ifdef VMSVGA_USE_EMT_HALT_CODE
+# ifdef VMSVGA_USE_EMT_HALT_CODE
         PVM pVM = PDMDevHlpGetVM(pThis->pDevInsR3);
         VMCPUID idCpu = VMCpuSetFindLastPresentInternal(&pSVGAState->BusyDelayedEmts);
@@ -3077,8 +3087,8 @@
                     VMR3NotifyCpuDeviceReady(pVM, idCpu);
         }
-#else
+# else
         int rc2 = RTSemEventMultiSignal(pSVGAState->hBusyDelayedEmts);
         AssertRC(rc2);
-#endif
+# endif
     }
 }
@@ -3105,8 +3115,8 @@
  *                          statistics collection.
  */
-static void *vmsvgaFIFOGetCmdPayload(uint32_t cbPayloadReq, uint32_t RT_UNTRUSTED_VOLATILE_GUEST *pFIFO,
-                                     uint32_t offCurrentCmd, uint32_t offFifoMin, uint32_t offFifoMax,
-                                     uint8_t *pbBounceBuf, uint32_t *pcbAlreadyRead,
-                                     PPDMTHREAD pThread, PVGASTATE pThis, PVMSVGAR3STATE pSVGAState, PPDMDEVINS pDevIns)
+static void *vmsvgaR3FifoGetCmdPayload(uint32_t cbPayloadReq, uint32_t RT_UNTRUSTED_VOLATILE_GUEST *pFIFO,
+                                       uint32_t offCurrentCmd, uint32_t offFifoMin, uint32_t offFifoMax,
+                                       uint8_t *pbBounceBuf, uint32_t *pcbAlreadyRead,
+                                       PPDMTHREAD pThread, PVGASTATE pThis, PVMSVGAR3STATE pSVGAState, PPDMDEVINS pDevIns)
 {
     Assert(pbBounceBuf);
@@ -3159,5 +3169,5 @@
         {
             STAM_REL_COUNTER_INC(&pSVGAState->StatFifoErrors);
-            LogRelMax(16, ("vmsvgaFIFOGetCmdPayload: Invalid offNextCmd=%#x (offFifoMin=%#x offFifoMax=%#x)\n",
+            LogRelMax(16, ("vmsvgaR3FifoGetCmdPayload: Invalid offNextCmd=%#x (offFifoMin=%#x offFifoMax=%#x)\n",
                            offNextCmd, offFifoMin, offFifoMax));
             cbAfter = offFifoMax - offCurrentCmd;
@@ -3173,5 +3183,5 @@
         {
             STAM_REL_COUNTER_INC(&pSVGAState->StatFifoErrors);
-            LogRelMax(16, ("vmsvgaFIFOGetCmdPayload: Invalid offNextCmd=%#x (offFifoMin=%#x offFifoMax=%#x)\n",
+            LogRelMax(16, ("vmsvgaR3FifoGetCmdPayload: Invalid offNextCmd=%#x (offFifoMin=%#x offFifoMax=%#x)\n",
                            offNextCmd, offFifoMin, offFifoMax));
             cbBefore = 0;
@@ -3248,7 +3258,7 @@
  */
 static uint32_t
-vmsvgaFIFOUpdateCursor(PVGASTATE pVGAState, PVMSVGAR3STATE  pSVGAState, uint32_t RT_UNTRUSTED_VOLATILE_GUEST *pFIFO,
-                       uint32_t offFifoMin,  uint32_t uCursorUpdateCount,
-                       uint32_t *pxLast, uint32_t *pyLast, uint32_t *pfLastVisible)
+vmsvgaR3FifoUpdateCursor(PVGASTATE pVGAState, PVMSVGAR3STATE  pSVGAState, uint32_t RT_UNTRUSTED_VOLATILE_GUEST *pFIFO,
+                         uint32_t offFifoMin,  uint32_t uCursorUpdateCount,
+                         uint32_t *pxLast, uint32_t *pyLast, uint32_t *pfLastVisible)
 {
     /*
@@ -3296,5 +3306,5 @@
         else if (*pfLastVisible != fVisible)
         {
-            LogRel2(("vmsvgaFIFOUpdateCursor: fVisible %d fLastVisible %d (%d,%d)\n", fVisible, *pfLastVisible, x, y));
+            LogRel2(("vmsvgaR3FifoUpdateCursor: fVisible %d fLastVisible %d (%d,%d)\n", fVisible, *pfLastVisible, x, y));
             *pfLastVisible = fVisible;
             pVGAState->pDrv->pfnVBVAMousePointerShape(pVGAState->pDrv, RT_BOOL(fVisible), false, 0, 0, 0, 0, NULL);
@@ -3321,5 +3331,5 @@
  * @param   uLastCursorCount    The last cursor update counter value.
  */
-DECLINLINE(bool) vmsvgaFIFOHasWork(uint32_t RT_UNTRUSTED_VOLATILE_GUEST * const pFIFO, uint32_t uLastCursorCount)
+DECLINLINE(bool) vmsvgaR3FifoHasWork(uint32_t RT_UNTRUSTED_VOLATILE_GUEST * const pFIFO, uint32_t uLastCursorCount)
 {
     if (pFIFO[SVGA_FIFO_NEXT_CMD] != pFIFO[SVGA_FIFO_STOP])
@@ -3339,5 +3349,5 @@
  * @param   pThis   The VGA state.
  */
-void vmsvgaFIFOWatchdogTimer(PPDMDEVINS pDevIns, PVGASTATE pThis)
+void vmsvgaR3FifoWatchdogTimer(PPDMDEVINS pDevIns, PVGASTATE pThis)
 {
     /* Caller already checked pThis->svga.fFIFOThreadSleeping, so we only have
@@ -3345,5 +3355,5 @@
     uint32_t RT_UNTRUSTED_VOLATILE_GUEST * const pFIFO = pThis->svga.pFIFOR3;
     AssertReturnVoid(pFIFO);
-    if (   vmsvgaFIFOHasWork(pFIFO, ASMAtomicReadU32(&pThis->svga.uLastCursorUpdateCount))
+    if (   vmsvgaR3FifoHasWork(pFIFO, ASMAtomicReadU32(&pThis->svga.uLastCursorUpdateCount))
         && pThis->svga.fFIFOThreadSleeping)
     {
@@ -3355,6 +3365,8 @@
 
 
-/* The async FIFO handling thread. */
-static DECLCALLBACK(int) vmsvgaFIFOLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
+/**
+ * @callback_method_impl{PFNPDMTHREADDEV, The async FIFO handling thread.}
+ */
+static DECLCALLBACK(int) vmsvgaR3FifoLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
 {
     PVGASTATE       pThis = (PVGASTATE)pThread->pvUser;
@@ -3384,5 +3396,5 @@
     /*
      * Signal the semaphore to make sure we don't wait for 250ms after a
-     * suspend & resume scenario (see vmsvgaFIFOGetCmdPayload).
+     * suspend & resume scenario (see vmsvgaR3FifoGetCmdPayload).
      */
     PDMDevHlpSUPSemEventSignal(pDevIns, pThis->svga.hFIFORequestSem);
@@ -3429,5 +3441,5 @@
      * The FIFO loop.
      */
-    LogFlow(("vmsvgaFIFOLoop: started loop\n"));
+    LogFlow(("vmsvgaR3FifoLoop: started loop\n"));
     bool fBadOrDisabledFifo = false;
     while (pThread->enmState == PDMTHREADSTATE_RUNNING)
@@ -3446,5 +3458,5 @@
          */
         if (   fBadOrDisabledFifo
-            || !vmsvgaFIFOHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
+            || !vmsvgaR3FifoHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
         {
             ASMAtomicWriteBool(&pThis->svga.fFIFOThreadSleeping, true);
@@ -3459,5 +3471,5 @@
 # endif
                 if (   !fBadOrDisabledFifo
-                    && vmsvgaFIFOHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
+                    && vmsvgaR3FifoHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
                     rc = VINF_SUCCESS;
                 else
@@ -3472,5 +3484,5 @@
             if (pThread->enmState != PDMTHREADSTATE_RUNNING)
             {
-                LogFlow(("vmsvgaFIFOLoop: thread state %x\n", pThread->enmState));
+                LogFlow(("vmsvgaR3FifoLoop: thread state %x\n", pThread->enmState));
                 break;
             }
@@ -3481,5 +3493,5 @@
         if (rc == VERR_TIMEOUT)
         {
-            if (!vmsvgaFIFOHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
+            if (!vmsvgaR3FifoHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
             {
                 cMsSleep = RT_MIN(cMsSleep + cMsIncSleep, cMsMaxSleep);
@@ -3488,13 +3500,13 @@
             STAM_REL_COUNTER_INC(&pSVGAState->StatFifoTodoTimeout);
 
-            Log(("vmsvgaFIFOLoop: timeout\n"));
+            Log(("vmsvgaR3FifoLoop: timeout\n"));
         }
-        else if (vmsvgaFIFOHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
+        else if (vmsvgaR3FifoHasWork(pFIFO, pThis->svga.uLastCursorUpdateCount))
             STAM_REL_COUNTER_INC(&pSVGAState->StatFifoTodoWoken);
         cMsSleep = cMsMinSleep;
 
-        Log(("vmsvgaFIFOLoop: enabled=%d configured=%d busy=%d\n", pThis->svga.fEnabled, pThis->svga.fConfigured, pFIFO[SVGA_FIFO_BUSY]));
-        Log(("vmsvgaFIFOLoop: min  %x max  %x\n", pFIFO[SVGA_FIFO_MIN], pFIFO[SVGA_FIFO_MAX]));
-        Log(("vmsvgaFIFOLoop: next %x stop %x\n", pFIFO[SVGA_FIFO_NEXT_CMD], pFIFO[SVGA_FIFO_STOP]));
+        Log(("vmsvgaR3FifoLoop: enabled=%d configured=%d busy=%d\n", pThis->svga.fEnabled, pThis->svga.fConfigured, pFIFO[SVGA_FIFO_BUSY]));
+        Log(("vmsvgaR3FifoLoop: min  %x max  %x\n", pFIFO[SVGA_FIFO_MIN], pFIFO[SVGA_FIFO_MAX]));
+        Log(("vmsvgaR3FifoLoop: next %x stop %x\n", pFIFO[SVGA_FIFO_NEXT_CMD], pFIFO[SVGA_FIFO_STOP]));
 
         /*
@@ -3513,5 +3525,5 @@
             || !pThis->svga.fConfigured)
         {
-            vmsvgaFifoSetNotBusy(pThis, pSVGAState, pFIFO[SVGA_FIFO_MIN]);
+            vmsvgaR3FifoSetNotBusy(pThis, pSVGAState, pFIFO[SVGA_FIFO_MIN]);
             fBadOrDisabledFifo = true;
             cMsSleep           = cMsMaxSleep; /* cheat */
@@ -3538,6 +3550,6 @@
         {
             STAM_REL_COUNTER_INC(&pSVGAState->StatFifoErrors);
-            LogRelMax(8, ("vmsvgaFIFOLoop: Bad fifo: min=%#x stop=%#x max=%#x\n", offFifoMin, offCurrentCmd, offFifoMax));
-            vmsvgaFifoSetNotBusy(pThis, pSVGAState, offFifoMin);
+            LogRelMax(8, ("vmsvgaR3FifoLoop: Bad fifo: min=%#x stop=%#x max=%#x\n", offFifoMin, offCurrentCmd, offFifoMax));
+            vmsvgaR3FifoSetNotBusy(pThis, pSVGAState, offFifoMin);
             fBadOrDisabledFifo = true;
             continue;
@@ -3547,5 +3559,5 @@
         {
             STAM_REL_COUNTER_INC(&pSVGAState->StatFifoErrors);
-            LogRelMax(8, ("vmsvgaFIFOLoop: Misaligned offCurrentCmd=%#x?\n", offCurrentCmd));
+            LogRelMax(8, ("vmsvgaR3FifoLoop: Misaligned offCurrentCmd=%#x?\n", offCurrentCmd));
             offCurrentCmd &= ~UINT32_C(3);
         }
@@ -3562,5 +3574,5 @@
             else
             {
-                uint32_t const uLastCursorCount = vmsvgaFIFOUpdateCursor(pThis, pSVGAState, pFIFO, offFifoMin, uCursorUpdateCount,
+                uint32_t const uLastCursorCount = vmsvgaR3FifoUpdateCursor(pThis, pSVGAState, pFIFO, offFifoMin, uCursorUpdateCount,
                                                                          &xLastCursor, &yLastCursor, &fLastCursorVisible);
                 ASMAtomicWriteU32(&pThis->svga.uLastCursorUpdateCount, uLastCursorCount);
@@ -3569,5 +3581,5 @@
 
 /** @def VMSVGAFIFO_GET_CMD_BUFFER_BREAK
- * Macro for shortening calls to vmsvgaFIFOGetCmdPayload.
+ * Macro for shortening calls to vmsvgaR3FifoGetCmdPayload.
  *
  * Will break out of the switch on failure.
@@ -3581,11 +3593,11 @@
 # define VMSVGAFIFO_GET_CMD_BUFFER_BREAK(a_PtrVar, a_Type, a_cbPayloadReq) \
             if (1) { \
-                (a_PtrVar) = (a_Type *)vmsvgaFIFOGetCmdPayload((a_cbPayloadReq), pFIFO, offCurrentCmd, offFifoMin, offFifoMax, \
-                                                               pbBounceBuf, &cbPayload, pThread, pThis, pSVGAState, pDevIns); \
+                (a_PtrVar) = (a_Type *)vmsvgaR3FifoGetCmdPayload((a_cbPayloadReq), pFIFO, offCurrentCmd, offFifoMin, offFifoMax, \
+                                                                 pbBounceBuf, &cbPayload, pThread, pThis, pSVGAState, pDevIns); \
                 if (RT_UNLIKELY((uintptr_t)(a_PtrVar) < 2)) { if ((uintptr_t)(a_PtrVar) == 1) continue; break; } \
                 RT_UNTRUSTED_NONVOLATILE_COPY_FENCE(); \
             } else do {} while (0)
 /** @def VMSVGAFIFO_GET_MORE_CMD_BUFFER_BREAK
- * Macro for shortening calls to vmsvgaFIFOGetCmdPayload for refetching the
+ * Macro for shortening calls to vmsvgaR3FifoGetCmdPayload for refetching the
  * buffer after figuring out the actual command size.
  *
@@ -3625,5 +3637,5 @@
             if (ASMBitTestAndClear(&pThis->svga.u32ActionFlags, VMSVGA_ACTION_CHANGEMODE_BIT))
             {
-                vmsvgaChangeMode(pThis);
+                vmsvgaR3ChangeMode(pThis);
 # ifdef VBOX_WITH_VMSVGA3D
                 if (pThis->svga.p3dState != NULL)
@@ -3641,6 +3653,6 @@
             SVGAFifoCmdId const enmCmdId = (SVGAFifoCmdId)pFIFO[offCurrentCmd / sizeof(uint32_t)];
             RT_UNTRUSTED_NONVOLATILE_COPY_FENCE();
-            LogFlow(("vmsvgaFIFOLoop: FIFO command (iCmd=0x%x) %s 0x%x\n",
-                     offCurrentCmd / sizeof(uint32_t), vmsvgaFIFOCmdToString(enmCmdId), enmCmdId));
+            LogFlow(("vmsvgaR3FifoLoop: FIFO command (iCmd=0x%x) %s 0x%x\n",
+                     offCurrentCmd / sizeof(uint32_t), vmsvgaR3FifoCmdToString(enmCmdId), enmCmdId));
             switch (enmCmdId)
             {
@@ -3657,10 +3669,10 @@
                 if (VMSVGA_IS_VALID_FIFO_REG(SVGA_FIFO_FENCE, offFifoMin))
                 {
-                    Log(("vmsvgaFIFOLoop: SVGA_CMD_FENCE %x\n", pCmdFence->fence));
+                    Log(("vmsvgaR3FifoLoop: SVGA_CMD_FENCE %x\n", pCmdFence->fence));
                     pFIFO[SVGA_FIFO_FENCE] = pCmdFence->fence;
 
                     if (pThis->svga.u32IrqMask & SVGA_IRQFLAG_ANY_FENCE)
                     {
-                        Log(("vmsvgaFIFOLoop: any fence irq\n"));
+                        Log(("vmsvgaR3FifoLoop: any fence irq\n"));
                         u32IrqStatus |= SVGA_IRQFLAG_ANY_FENCE;
                     }
@@ -3670,5 +3682,5 @@
                         &&  pFIFO[SVGA_FIFO_FENCE_GOAL] == pCmdFence->fence)
                     {
-                        Log(("vmsvgaFIFOLoop: fence goal reached irq (fence=%x)\n", pCmdFence->fence));
+                        Log(("vmsvgaR3FifoLoop: fence goal reached irq (fence=%x)\n", pCmdFence->fence));
                         u32IrqStatus |= SVGA_IRQFLAG_FENCE_GOAL;
                     }
@@ -3687,9 +3699,9 @@
                 else
                     STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdUpdateVerbose);
-                Log(("vmsvgaFIFOLoop: UPDATE (%d,%d)(%d,%d)\n", pUpdate->x, pUpdate->y, pUpdate->width, pUpdate->height));
+                Log(("vmsvgaR3FifoLoop: UPDATE (%d,%d)(%d,%d)\n", pUpdate->x, pUpdate->y, pUpdate->width, pUpdate->height));
                 /** @todo Multiple screens? */
-                VMSVGASCREENOBJECT *pScreen = vmsvgaGetScreenObject(pThis, 0);
+                VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThis, 0);
                 AssertBreak(pScreen);
-                vmsvgaUpdateScreen(pThis, pScreen, pUpdate->x, pUpdate->y, pUpdate->width, pUpdate->height);
+                vmsvgaR3UpdateScreen(pThis, pScreen, pUpdate->x, pUpdate->y, pUpdate->width, pUpdate->height);
                 break;
             }
@@ -3702,5 +3714,5 @@
                 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdDefineCursor);
 
-                Log(("vmsvgaFIFOLoop: CURSOR id=%d size (%d,%d) hotspot (%d,%d) andMaskDepth=%d xorMaskDepth=%d\n",
+                Log(("vmsvgaR3FifoLoop: CURSOR id=%d size (%d,%d) hotspot (%d,%d) andMaskDepth=%d xorMaskDepth=%d\n",
                      pCursor->id, pCursor->width, pCursor->height, pCursor->hotspotX, pCursor->hotspotY,
                      pCursor->andMaskDepth, pCursor->xorMaskDepth));
@@ -3732,5 +3744,5 @@
                 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdDefineAlphaCursor);
 
-                Log(("vmsvgaFIFOLoop: ALPHA_CURSOR id=%d size (%d,%d) hotspot (%d,%d)\n", pCursor->id, pCursor->width, pCursor->height, pCursor->hotspotX, pCursor->hotspotY));
+                Log(("vmsvgaR3FifoLoop: ALPHA_CURSOR id=%d size (%d,%d) hotspot (%d,%d)\n", pCursor->id, pCursor->width, pCursor->height, pCursor->hotspotX, pCursor->hotspotY));
 
                 /* Check against a reasonable upper limit to prevent integer overflows in the sanity checks below. */
@@ -3779,5 +3791,5 @@
                     RT_UNTRUSTED_VALIDATED_FENCE();
                     uint32_t cmd = *(uint32_t *)(pEscape + 1);
-                    Log(("vmsvgaFIFOLoop: ESCAPE (%x %x) VMWARE cmd=%x\n", pEscape->nsid, pEscape->size, cmd));
+                    Log(("vmsvgaR3FifoLoop: ESCAPE (%x %x) VMWARE cmd=%x\n", pEscape->nsid, pEscape->size, cmd));
 
                     switch (cmd)
@@ -3813,5 +3825,5 @@
                 }
                 else
-                    Log(("vmsvgaFIFOLoop: ESCAPE %x %x\n", pEscape->nsid, pEscape->size));
+                    Log(("vmsvgaR3FifoLoop: ESCAPE %x %x\n", pEscape->nsid, pEscape->size));
 
                 break;
@@ -3822,5 +3834,5 @@
                 SVGAFifoCmdDefineGMR2 *pCmd;
                 VMSVGAFIFO_GET_CMD_BUFFER_BREAK(pCmd, SVGAFifoCmdDefineGMR2, sizeof(*pCmd));
-                Log(("vmsvgaFIFOLoop: SVGA_CMD_DEFINE_GMR2 id=%x %x pages\n", pCmd->gmrId, pCmd->numPages));
+                Log(("vmsvgaR3FifoLoop: SVGA_CMD_DEFINE_GMR2 id=%x %x pages\n", pCmd->gmrId, pCmd->numPages));
                 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdDefineGmr2);
 
@@ -3833,5 +3845,5 @@
                 {
                     STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdDefineGmr2Free);
-                    vmsvgaGMRFree(pThis, pCmd->gmrId);
+                    vmsvgaR3GmrFree(pThis, pCmd->gmrId);
                 }
                 else
@@ -3845,5 +3857,5 @@
                     /** @todo always free the descriptor in SVGA_CMD_DEFINE_GMR2? */
                     if (pGMR->cbTotal / X86_PAGE_SIZE > pGMR->cMaxPages)
-                        vmsvgaGMRFree(pThis, pCmd->gmrId);
+                        vmsvgaR3GmrFree(pThis, pCmd->gmrId);
 
                     pGMR->cMaxPages = pCmd->numPages;
@@ -3860,5 +3872,5 @@
                 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdRemapGmr2);
 
-                Log(("vmsvgaFIFOLoop: SVGA_CMD_REMAP_GMR2 id=%x flags=%x offset=%x npages=%x\n", pCmd->gmrId, pCmd->flags, pCmd->offsetPages, pCmd->numPages));
+                Log(("vmsvgaR3FifoLoop: SVGA_CMD_REMAP_GMR2 id=%x flags=%x offset=%x npages=%x\n", pCmd->gmrId, pCmd->flags, pCmd->offsetPages, pCmd->numPages));
                 AssertBreak(pCmd->gmrId < pThis->svga.cGMR);
                 RT_UNTRUSTED_VALIDATED_FENCE();
@@ -4005,5 +4017,5 @@
 
 #  ifdef DEBUG_GMR_ACCESS
-                VMR3ReqCallWaitU(PDMDevHlpGetUVM(pThis->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaRegisterGMR, 2, pThis->pDevInsR3, pCmd->gmrId);
+                VMR3ReqCallWaitU(PDMDevHlpGetUVM(pThis->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaR3RegisterGmr, 2, pThis->pDevInsR3, pCmd->gmrId);
 #  endif
                 break;
@@ -4076,5 +4088,5 @@
 
                 pThis->svga.fGFBRegisters = false;
-                vmsvgaChangeMode(pThis);
+                vmsvgaR3ChangeMode(pThis);
                 break;
             }
@@ -4086,5 +4098,5 @@
                 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdDestroyScreen);
 
-                Log(("vmsvgaFIFOLoop: SVGA_CMD_DESTROY_SCREEN id=%x\n", pCmd->screenId));
+                Log(("vmsvgaR3FifoLoop: SVGA_CMD_DESTROY_SCREEN id=%x\n", pCmd->screenId));
 
                 uint32_t const idScreen = pCmd->screenId;
@@ -4097,5 +4109,5 @@
                 pScreen->idScreen  = idScreen;
 
-                vmsvgaChangeMode(pThis);
+                vmsvgaR3ChangeMode(pThis);
                 break;
             }
@@ -4107,5 +4119,5 @@
                 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdDefineGmrFb);
 
-                Log(("vmsvgaFIFOLoop: SVGA_CMD_DEFINE_GMRFB gmr=%x offset=%x bytesPerLine=%x bpp=%d color depth=%d\n", pCmd->ptr.gmrId, pCmd->ptr.offset, pCmd->bytesPerLine, pCmd->format.s.bitsPerPixel, pCmd->format.s.colorDepth));
+                Log(("vmsvgaR3FifoLoop: SVGA_CMD_DEFINE_GMRFB gmr=%x offset=%x bytesPerLine=%x bpp=%d color depth=%d\n", pCmd->ptr.gmrId, pCmd->ptr.offset, pCmd->bytesPerLine, pCmd->format.s.bitsPerPixel, pCmd->format.s.colorDepth));
                 pSVGAState->GMRFB.ptr          = pCmd->ptr;
                 pSVGAState->GMRFB.bytesPerLine = pCmd->bytesPerLine;
@@ -4126,5 +4138,5 @@
                 RT_UNTRUSTED_VALIDATED_FENCE();
 
-                VMSVGASCREENOBJECT *pScreen = vmsvgaGetScreenObject(pThis, pCmd->destScreenId);
+                VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThis, pCmd->destScreenId);
                 AssertBreak(pScreen);
 
@@ -4139,5 +4151,5 @@
                 screenRect.bottom = pScreen->cHeight;
                 SVGASignedRect clipRect = pCmd->destRect;
-                vmsvgaClipRect(&screenRect, &clipRect);
+                vmsvgaR3ClipRect(&screenRect, &clipRect);
                 RT_UNTRUSTED_VALIDATED_FENCE();
 
@@ -4153,10 +4165,10 @@
 
                 /* Copy the defined by GMRFB image to the screen 0 VRAM area.
-                 * Prepare parameters for vmsvgaGMRTransfer.
+                 * Prepare parameters for vmsvgaR3GmrTransfer.
                  */
                 AssertBreak(pScreen->offVRAM < pThis->vram_size); /* Paranoia. Ensured by SVGA_CMD_DEFINE_SCREEN. */
 
                 /* Destination: host buffer which describes the screen 0 VRAM.
-                 * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaGMRTransfer.
+                 * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaR3GmrTransfer.
                  */
                 uint8_t * const pbHstBuf = (uint8_t *)pThis->CTX_SUFF(vram_ptr) + pScreen->offVRAM;
@@ -4170,5 +4182,5 @@
                 int32_t const cbHstPitch = cbScanline;
 
-                /* Source: GMRFB. vmsvgaGMRTransfer ensures that no memory outside the GMR is read. */
+                /* Source: GMRFB. vmsvgaR3GmrTransfer ensures that no memory outside the GMR is read. */
                 SVGAGuestPtr const gstPtr = pSVGAState->GMRFB.ptr;
                 uint32_t const offGst =  (srcx * RT_ALIGN(pSVGAState->GMRFB.format.s.bitsPerPixel, 8)) / 8
@@ -4176,10 +4188,10 @@
                 int32_t const cbGstPitch = pSVGAState->GMRFB.bytesPerLine;
 
-                rc = vmsvgaGMRTransfer(pThis, SVGA3D_WRITE_HOST_VRAM,
+                rc = vmsvgaR3GmrTransfer(pThis, SVGA3D_WRITE_HOST_VRAM,
                                        pbHstBuf, cbHstBuf, offHst, cbHstPitch,
                                        gstPtr, offGst, cbGstPitch,
                                        (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height);
                 AssertRC(rc);
-                vmsvgaUpdateScreen(pThis, pScreen, clipRect.left, clipRect.top, width, height);
+                vmsvgaR3UpdateScreen(pThis, pScreen, clipRect.left, clipRect.top, width, height);
                 break;
             }
@@ -4198,5 +4210,5 @@
                 RT_UNTRUSTED_VALIDATED_FENCE();
 
-                VMSVGASCREENOBJECT *pScreen = vmsvgaGetScreenObject(pThis, pCmd->srcScreenId);
+                VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThis, pCmd->srcScreenId);
                 AssertBreak(pScreen);
 
@@ -4211,5 +4223,5 @@
                 screenRect.bottom = pScreen->cHeight;
                 SVGASignedRect clipRect = pCmd->srcRect;
-                vmsvgaClipRect(&screenRect, &clipRect);
+                vmsvgaR3ClipRect(&screenRect, &clipRect);
                 RT_UNTRUSTED_VALIDATED_FENCE();
 
@@ -4225,10 +4237,10 @@
 
                 /* Copy the defined by GMRFB image to the screen 0 VRAM area.
-                 * Prepare parameters for vmsvgaGMRTransfer.
+                 * Prepare parameters for vmsvgaR3GmrTransfer.
                  */
                 AssertBreak(pScreen->offVRAM < pThis->vram_size); /* Paranoia. Ensured by SVGA_CMD_DEFINE_SCREEN. */
 
                 /* Source: host buffer which describes the screen 0 VRAM.
-                 * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaGMRTransfer.
+                 * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaR3GmrTransfer.
                  */
                 uint8_t * const pbHstBuf = (uint8_t *)pThis->CTX_SUFF(vram_ptr) + pScreen->offVRAM;
@@ -4242,5 +4254,5 @@
                 int32_t const cbHstPitch = cbScanline;
 
-                /* Destination: GMRFB. vmsvgaGMRTransfer ensures that no memory outside the GMR is read. */
+                /* Destination: GMRFB. vmsvgaR3GmrTransfer ensures that no memory outside the GMR is read. */
                 SVGAGuestPtr const gstPtr = pSVGAState->GMRFB.ptr;
                 uint32_t const offGst =  (dstx * RT_ALIGN(pSVGAState->GMRFB.format.s.bitsPerPixel, 8)) / 8
@@ -4248,8 +4260,8 @@
                 int32_t const cbGstPitch = pSVGAState->GMRFB.bytesPerLine;
 
-                rc = vmsvgaGMRTransfer(pThis, SVGA3D_READ_HOST_VRAM,
-                                       pbHstBuf, cbHstBuf, offHst, cbHstPitch,
-                                       gstPtr, offGst, cbGstPitch,
-                                       (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height);
+                rc = vmsvgaR3GmrTransfer(pThis, SVGA3D_READ_HOST_VRAM,
+                                         pbHstBuf, cbHstBuf, offHst, cbHstPitch,
+                                         gstPtr, offGst, cbGstPitch,
+                                         (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height);
                 AssertRC(rc);
                 break;
@@ -4262,5 +4274,5 @@
                 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdAnnotationFill);
 
-                Log(("vmsvgaFIFOLoop: SVGA_CMD_ANNOTATION_FILL red=%x green=%x blue=%x\n", pCmd->color.s.r, pCmd->color.s.g, pCmd->color.s.b));
+                Log(("vmsvgaR3FifoLoop: SVGA_CMD_ANNOTATION_FILL red=%x green=%x blue=%x\n", pCmd->color.s.r, pCmd->color.s.g, pCmd->color.s.b));
                 pSVGAState->colorAnnotation = pCmd->color;
                 break;
@@ -4273,5 +4285,5 @@
                 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdAnnotationCopy);
 
-                Log(("vmsvgaFIFOLoop: SVGA_CMD_ANNOTATION_COPY\n"));
+                Log(("vmsvgaR3FifoLoop: SVGA_CMD_ANNOTATION_COPY\n"));
                 AssertFailed();
                 break;
@@ -4324,5 +4336,5 @@
                                                    SVGA3D_TEX_FILTER_NONE, cMipLevels, (SVGA3dSize *)(pCmd + 1));
 #  ifdef DEBUG_GMR_ACCESS
-                        VMR3ReqCallWaitU(PDMDevHlpGetUVM(pThis->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaResetGMRHandlers, 1, pThis);
+                        VMR3ReqCallWaitU(PDMDevHlpGetUVM(pThis->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaR3ResetGmrHandlers, 1, pThis);
 #  endif
                         break;
@@ -4722,5 +4734,5 @@
                 if (pThis->svga.u32IrqMask & SVGA_IRQFLAG_FIFO_PROGRESS)
                 {
-                    Log(("vmsvgaFIFOLoop: fifo progress irq\n"));
+                    Log(("vmsvgaR3FifoLoop: fifo progress irq\n"));
                     u32IrqStatus |= SVGA_IRQFLAG_FIFO_PROGRESS;
                 }
@@ -4729,5 +4741,5 @@
                 if (pThis->svga.u32IrqMask & u32IrqStatus)
                 {
-                    Log(("vmsvgaFIFOLoop: Trigger interrupt with status %x\n", u32IrqStatus));
+                    Log(("vmsvgaR3FifoLoop: Trigger interrupt with status %x\n", u32IrqStatus));
                     ASMAtomicOrU32(&pThis->svga.u32IrqStatus, u32IrqStatus);
                     PDMDevHlpPCISetIrq(pDevIns, 0, 1);
@@ -4741,6 +4753,6 @@
         if (fDone)
         {
-            Log(("vmsvgaFIFOLoop: emptied the FIFO next=%x stop=%x\n", pFIFO[SVGA_FIFO_NEXT_CMD], offCurrentCmd));
-            vmsvgaFifoSetNotBusy(pThis, pSVGAState, offFifoMin);
+            Log(("vmsvgaR3FifoLoop: emptied the FIFO next=%x stop=%x\n", pFIFO[SVGA_FIFO_NEXT_CMD], offCurrentCmd));
+            vmsvgaR3FifoSetNotBusy(pThis, pSVGAState, offFifoMin);
         }
     }
@@ -4760,5 +4772,5 @@
  * @param   idGMR           GMR id
  */
-void vmsvgaGMRFree(PVGASTATE pThis, uint32_t idGMR)
+void vmsvgaR3GmrFree(PVGASTATE pThis, uint32_t idGMR)
 {
     PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State;
@@ -4770,5 +4782,5 @@
     {
 # ifdef DEBUG_GMR_ACCESS
-        VMR3ReqCallWaitU(PDMDevHlpGetUVM(pThis->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaDeregisterGMR, 2, pThis->pDevInsR3, idGMR);
+        VMR3ReqCallWaitU(PDMDevHlpGetUVM(pThis->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaR3DeregisterGmr, 2, pThis->pDevInsR3, idGMR);
 # endif
 
@@ -4800,8 +4812,8 @@
  * @param   cHeight         Number of scanllines to copy
  */
-int vmsvgaGMRTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType,
-                      uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch,
-                      SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch,
-                      uint32_t cbWidth, uint32_t cHeight)
+int vmsvgaR3GmrTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType,
+                        uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch,
+                        SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch,
+                        uint32_t cbWidth, uint32_t cHeight)
 {
     PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State;
@@ -5042,7 +5054,5 @@
  * @param   pBox        Coordinates to be clipped.
  */
-void vmsvgaClipCopyBox(const SVGA3dSize *pSizeSrc,
-                       const SVGA3dSize *pSizeDest,
-                       SVGA3dCopyBox *pBox)
+void vmsvgaR3ClipCopyBox(const SVGA3dSize *pSizeSrc, const SVGA3dSize *pSizeDest, SVGA3dCopyBox *pBox)
 {
     /* Src x, w */
@@ -5089,6 +5099,5 @@
  * @param   pBox    Coordinates to be clipped.
  */
-void vmsvgaClipBox(const SVGA3dSize *pSize,
-                   SVGA3dBox *pBox)
+void vmsvgaR3ClipBox(const SVGA3dSize *pSize, SVGA3dBox *pBox)
 {
     /* x, w */
@@ -5117,6 +5126,5 @@
  * @param   pRect   Rectangle to be clipped.
  */
-void vmsvgaClipRect(SVGASignedRect const *pBound,
-                    SVGASignedRect *pRect)
+void vmsvgaR3ClipRect(SVGASignedRect const *pBound, SVGASignedRect *pRect)
 {
     int32_t left;
@@ -5175,15 +5183,12 @@
 
 /**
- * Unblock the FIFO I/O thread so it can respond to a state change.
- *
- * @returns VBox status code.
- * @param   pDevIns     The VGA device instance.
- * @param   pThread     The send thread.
+ * @callback_method_impl{PFNPDMTHREADWAKEUPDEV,
+ * Unblock the FIFO I/O thread so it can respond to a state change.}
  */
-static DECLCALLBACK(int) vmsvgaFIFOLoopWakeUp(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
+static DECLCALLBACK(int) vmsvgaR3FifoLoopWakeUp(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
 {
     RT_NOREF(pDevIns);
     PVGASTATE pThis = (PVGASTATE)pThread->pvUser;
-    Log(("vmsvgaFIFOLoopWakeUp\n"));
+    Log(("vmsvgaR3FifoLoopWakeUp\n"));
     return PDMDevHlpSUPSemEventSignal(pDevIns, pThis->svga.hFIFORequestSem);
 }
@@ -5195,5 +5200,5 @@
  * @param   fTraces         Enable/disable traces
  */
-static void vmsvgaSetTraces(PVGASTATE pThis, bool fTraces)
+static void vmsvgaR3SetTraces(PVGASTATE pThis, bool fTraces)
 {
     if (    (!pThis->svga.fConfigured || !pThis->svga.fEnabled)
@@ -5201,5 +5206,5 @@
     {
         //Assert(pThis->svga.fTraces);
-        Log(("vmsvgaSetTraces: *not* allowed to disable dirty page tracking when the device is in legacy mode.\n"));
+        Log(("vmsvgaR3SetTraces: *not* allowed to disable dirty page tracking when the device is in legacy mode.\n"));
         return;
     }
@@ -5210,11 +5215,11 @@
         unsigned cbFrameBuffer = pThis->vram_size;
 
-        Log(("vmsvgaSetTraces: enable dirty page handling for the frame buffer only (%x bytes)\n", 0));
+        Log(("vmsvgaR3SetTraces: enable dirty page handling for the frame buffer only (%x bytes)\n", 0));
         /** @todo How does this work with screens? */
         if (pThis->svga.uHeight != VMSVGA_VAL_UNINITIALIZED)
         {
-#ifndef DEBUG_bird /* BB-10.3.1 triggers this as it initializes everything to zero. Better just ignore it. */
+# ifndef DEBUG_bird /* BB-10.3.1 triggers this as it initializes everything to zero. Better just ignore it. */
             Assert(pThis->svga.cbScanline);
-#endif
+# endif
             /* Hardware enabled; return real framebuffer size .*/
             cbFrameBuffer = (uint32_t)pThis->svga.uHeight * pThis->svga.cbScanline;
@@ -5224,5 +5229,5 @@
         if (!pThis->svga.fVRAMTracking)
         {
-            Log(("vmsvgaSetTraces: enable frame buffer dirty page tracking. (%x bytes; vram %x)\n", cbFrameBuffer, pThis->vram_size));
+            Log(("vmsvgaR3SetTraces: enable frame buffer dirty page tracking. (%x bytes; vram %x)\n", cbFrameBuffer, pThis->vram_size));
             vgaR3RegisterVRAMHandler(pThis, cbFrameBuffer);
             pThis->svga.fVRAMTracking = true;
@@ -5233,5 +5238,5 @@
         if (pThis->svga.fVRAMTracking)
         {
-            Log(("vmsvgaSetTraces: disable frame buffer dirty page tracking\n"));
+            Log(("vmsvgaR3SetTraces: disable frame buffer dirty page tracking\n"));
             vgaR3UnregisterVRAMHandler(pThis);
             pThis->svga.fVRAMTracking = false;
@@ -5309,5 +5314,5 @@
  *                              are processed.
  */
-void vmsvga3dSurfaceUpdateHeapBuffersOnFifoThread(PPDMDEVINS pDevIns, PVGASTATE pThis, uint32_t sid)
+void vmsvgaR33dSurfaceUpdateHeapBuffersOnFifoThread(PPDMDEVINS pDevIns, PVGASTATE pThis, uint32_t sid)
 {
     vmsvgaR3RunExtCmdOnFifoThread(pDevIns, pThis, VMSVGA_FIFO_EXTCMD_UPDATE_SURFACE_HEAP_BUFFERS, (void *)(uintptr_t)sid,
@@ -5459,7 +5464,8 @@
 }
 
-/** Portion of VMSVGA state which must be loaded oin the FIFO thread.
+/**
+ * Portion of VMSVGA state which must be loaded oin the FIFO thread.
  */
-static int vmsvgaLoadExecFifo(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
+static int vmsvgaR3LoadExecFifo(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
 {
     RT_NOREF(uPass);
@@ -5520,5 +5526,5 @@
  * @copydoc FNSSMDEVLOADEXEC
  */
-int vmsvgaLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
+int vmsvgaR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
 {
     RT_NOREF(uPass);
@@ -5626,5 +5632,5 @@
  * Reinit the video mode after the state has been loaded.
  */
-int vmsvgaLoadDone(PPDMDEVINS pDevIns)
+int vmsvgaR3LoadDone(PPDMDEVINS pDevIns)
 {
     PVGASTATE       pThis      = PDMINS_2_DATA(pDevIns, PVGASTATE);
@@ -5654,5 +5660,5 @@
  * Portion of SVGA state which must be saved in the FIFO thread.
  */
-static int vmsvgaSaveExecFifo(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PSSMHANDLE pSSM)
+static int vmsvgaR3SaveExecFifo(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PSSMHANDLE pSSM)
 {
     PVMSVGAR3STATE  pSVGAState = pThis->svga.pSvgaR3State;
@@ -5684,5 +5690,5 @@
  * @copydoc FNSSMDEVSAVEEXEC
  */
-int vmsvgaSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
+int vmsvgaR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
 {
     PVGASTATE       pThis      = PDMINS_2_DATA(pDevIns, PVGASTATE);
@@ -5745,5 +5751,5 @@
 static void vmsvgaR3StateTerm(PVGASTATE pThis, PVMSVGAR3STATE pSVGAState)
 {
-#ifndef VMSVGA_USE_EMT_HALT_CODE
+# ifndef VMSVGA_USE_EMT_HALT_CODE
     if (pSVGAState->hBusyDelayedEmts != NIL_RTSEMEVENTMULTI)
     {
@@ -5751,5 +5757,5 @@
         pSVGAState->hBusyDelayedEmts = NIL_RTSEMEVENT;
     }
-#endif
+# endif
 
     if (pSVGAState->Cursor.fActive)
@@ -5786,9 +5792,9 @@
     AssertReturn(pSVGAState->paGMR, VERR_NO_MEMORY);
 
-#ifndef VMSVGA_USE_EMT_HALT_CODE
+# ifndef VMSVGA_USE_EMT_HALT_CODE
     /* Create semaphore for delaying EMTs wait for the FIFO to stop being busy. */
     rc = RTSemEventMultiCreate(&pSVGAState->hBusyDelayedEmts);
     AssertRCReturn(rc, rc);
-#endif
+# endif
 
     return rc;
@@ -5801,5 +5807,5 @@
  * @param   pThis     The VGA instance.
  */
-static void vmsvgaInitCaps(PVGASTATE pThis)
+static void vmsvgaR3InitCaps(PVGASTATE pThis)
 {
     /* Register caps. */
@@ -5930,5 +5936,5 @@
  * @param   pThis     The VGA instance.
  */
-static void vmsvgaInitFifo3DCaps(PVGASTATE pThis)
+static void vmsvgaR3InitFifo3DCaps(PVGASTATE pThis)
 {
     /** @todo Probably query the capabilities once and cache in a memory buffer. */
@@ -5983,5 +5989,5 @@
  * @param   pDevIns     The device instance.
  */
-int vmsvgaReset(PPDMDEVINS pDevIns)
+int vmsvgaR3Reset(PPDMDEVINS pDevIns)
 {
     PVGASTATE       pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
@@ -5992,5 +5998,5 @@
         return VINF_SUCCESS;
 
-    Log(("vmsvgaReset\n"));
+    Log(("vmsvgaR3Reset\n"));
 
     /* Reset the FIFO processing as well as the 3d state (if we have one). */
@@ -6008,9 +6014,9 @@
 
     /* Initialize FIFO and register capabilities. */
-    vmsvgaInitCaps(pThis);
+    vmsvgaR3InitCaps(pThis);
 
 # ifdef VBOX_WITH_VMSVGA3D
     if (pThis->svga.f3DEnabled)
-        vmsvgaInitFifo3DCaps(pThis);
+        vmsvgaR3InitFifo3DCaps(pThis);
 # endif
 
@@ -6035,5 +6041,5 @@
  * @param   pDevIns     The device instance.
  */
-int vmsvgaDestruct(PPDMDEVINS pDevIns)
+int vmsvgaR3Destruct(PPDMDEVINS pDevIns)
 {
     PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
@@ -6091,5 +6097,5 @@
  * @param   pDevIns     The device instance.
  */
-int vmsvgaInit(PPDMDEVINS pDevIns)
+int vmsvgaR3Init(PPDMDEVINS pDevIns)
 {
     PVGASTATE       pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
@@ -6123,5 +6129,5 @@
 
     /* Initialize FIFO and register capabilities. */
-    vmsvgaInitCaps(pThis);
+    vmsvgaR3InitCaps(pThis);
 
 # ifdef VBOX_WITH_VMSVGA3D
@@ -6157,5 +6163,5 @@
     /* Register the GMR access handler type. */
     rc = PGMR3HandlerPhysicalTypeRegister(PDMDevHlpGetVM(pThis->pDevInsR3), PGMPHYSHANDLERKIND_WRITE,
-                                          vmsvgaR3GMRAccessHandler,
+                                          vmsvgaR3GmrAccessHandler,
                                           NULL, NULL, NULL,
                                           NULL, NULL, NULL,
@@ -6174,5 +6180,5 @@
                                           PGMPHYSHANDLERKIND_WRITE,
 #  endif
-                                          vmsvgaR3FIFOAccessHandler,
+                                          vmsvgaR3FifoAccessHandler,
                                           NULL, NULL, NULL,
                                           NULL, NULL, NULL,
@@ -6182,6 +6188,6 @@
 
     /* Create the async IO thread. */
-    rc = PDMDevHlpThreadCreate(pDevIns, &pThis->svga.pFIFOIOThread, pThis, vmsvgaFIFOLoop, vmsvgaFIFOLoopWakeUp, 0,
-                                RTTHREADTYPE_IO, "VMSVGA FIFO");
+    rc = PDMDevHlpThreadCreate(pDevIns, &pThis->svga.pFIFOIOThread, pThis, vmsvgaR3FifoLoop, vmsvgaR3FifoLoopWakeUp, 0,
+                               RTTHREADTYPE_IO, "VMSVGA FIFO");
     if (RT_FAILURE(rc))
     {
@@ -6193,13 +6199,13 @@
      * Statistics.
      */
-#define REG_CNT(a_pvSample, a_pszName, a_pszDesc) \
+# define REG_CNT(a_pvSample, a_pszName, a_pszDesc) \
         PDMDevHlpSTAMRegister(pDevIns, (a_pvSample), STAMTYPE_COUNTER, a_pszName, STAMUNIT_OCCURENCES, a_pszDesc)
-#define REG_PRF(a_pvSample, a_pszName, a_pszDesc) \
+# define REG_PRF(a_pvSample, a_pszName, a_pszDesc) \
         PDMDevHlpSTAMRegister(pDevIns, (a_pvSample), STAMTYPE_PROFILE, a_pszName, STAMUNIT_TICKS_PER_CALL, a_pszDesc)
-#ifdef VBOX_WITH_STATISTICS
+# ifdef VBOX_WITH_STATISTICS
     REG_PRF(&pSVGAState->StatR3Cmd3dDrawPrimitivesProf,   "VMSVGA/Cmd/3dDrawPrimitivesProf",       "Profiling of SVGA_3D_CMD_DRAW_PRIMITIVES.");
     REG_PRF(&pSVGAState->StatR3Cmd3dPresentProf,          "VMSVGA/Cmd/3dPresentProfBoth",          "Profiling of SVGA_3D_CMD_PRESENT and SVGA_3D_CMD_PRESENT_READBACK.");
     REG_PRF(&pSVGAState->StatR3Cmd3dSurfaceDmaProf,       "VMSVGA/Cmd/3dSurfaceDmaProf",           "Profiling of SVGA_3D_CMD_SURFACE_DMA.");
-#endif
+# endif
     REG_CNT(&pSVGAState->StatR3Cmd3dActivateSurface,      "VMSVGA/Cmd/3dActivateSurface",          "SVGA_3D_CMD_ACTIVATE_SURFACE");
     REG_CNT(&pSVGAState->StatR3Cmd3dBeginQuery,           "VMSVGA/Cmd/3dBeginQuery",               "SVGA_3D_CMD_BEGIN_QUERY");
@@ -6356,6 +6362,6 @@
     REG_CNT(&pSVGAState->StatFifoWatchdogWakeUps,         "VMSVGA/FifoWatchdogWakeUps",            "Number of times the FIFO refresh poller/watchdog woke up the FIFO thread.");
 
-#undef REG_CNT
-#undef REG_PRF
+# undef REG_CNT
+# undef REG_PRF
 
     /*
@@ -6397,5 +6403,5 @@
         {
             /* Initialize FIFO 3D capabilities. */
-            vmsvgaInitFifo3DCaps(pThis);
+            vmsvgaR3InitFifo3DCaps(pThis);
         }
     }
Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h	(revision 82088)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h	(revision 82089)
@@ -369,32 +369,28 @@
                                          uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
 
-int vmsvgaInit(PPDMDEVINS pDevIns);
-int vmsvgaReset(PPDMDEVINS pDevIns);
-int vmsvgaDestruct(PPDMDEVINS pDevIns);
-int vmsvgaLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
-int vmsvgaLoadDone(PPDMDEVINS pDevIns);
-int vmsvgaSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
+int vmsvgaR3Init(PPDMDEVINS pDevIns);
+int vmsvgaR3Reset(PPDMDEVINS pDevIns);
+int vmsvgaR3Destruct(PPDMDEVINS pDevIns);
+int vmsvgaR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
+int vmsvgaR3LoadDone(PPDMDEVINS pDevIns);
+int vmsvgaR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
 DECLCALLBACK(void) vmsvgaR3PowerOn(PPDMDEVINS pDevIns);
 DECLCALLBACK(void) vmsvgaR3PowerOff(PPDMDEVINS pDevIns);
-void vmsvgaFIFOWatchdogTimer(PPDMDEVINS pDevIns, PVGASTATE pThis);
+void vmsvgaR3FifoWatchdogTimer(PPDMDEVINS pDevIns, PVGASTATE pThis);
 
 #ifdef IN_RING3
-VMSVGASCREENOBJECT *vmsvgaGetScreenObject(PVGASTATE pThis, uint32_t idScreen);
-int vmsvgaUpdateScreen(PVGASTATE pThis, VMSVGASCREENOBJECT *pScreen, int x, int y, int w, int h);
-#endif
-
-void vmsvgaGMRFree(PVGASTATE pThis, uint32_t idGMR);
-int vmsvgaGMRTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType,
-                      uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch,
-                      SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch,
-                      uint32_t cbWidth, uint32_t cHeight);
-
-void vmsvgaClipCopyBox(const SVGA3dSize *pSizeSrc,
-                       const SVGA3dSize *pSizeDest,
-                       SVGA3dCopyBox *pBox);
-void vmsvgaClipBox(const SVGA3dSize *pSize,
-                   SVGA3dBox *pBox);
-void vmsvgaClipRect(SVGASignedRect const *pBound,
-                    SVGASignedRect *pRect);
+VMSVGASCREENOBJECT *vmsvgaR3GetScreenObject(PVGASTATE pThis, uint32_t idScreen);
+int vmsvgaR3UpdateScreen(PVGASTATE pThis, VMSVGASCREENOBJECT *pScreen, int x, int y, int w, int h);
+#endif
+
+void vmsvgaR3GmrFree(PVGASTATE pThis, uint32_t idGMR);
+int vmsvgaR3GmrTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType,
+                        uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch,
+                        SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch,
+                        uint32_t cbWidth, uint32_t cHeight);
+
+void vmsvgaR3ClipCopyBox(const SVGA3dSize *pSizeSrc, const SVGA3dSize *pSizeDest, SVGA3dCopyBox *pBox);
+void vmsvgaR3ClipBox(const SVGA3dSize *pSize, SVGA3dBox *pBox);
+void vmsvgaR3ClipRect(SVGASignedRect const *pBound, SVGASignedRect *pRect);
 
 #endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA_h */
Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-info.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-info.cpp	(revision 82088)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-info.cpp	(revision 82089)
@@ -2099,5 +2099,5 @@
                 {
                     if (fVerbose)
-                        vmsvga3dSurfaceUpdateHeapBuffersOnFifoThread(pDevIns, pThis, sid);
+                        vmsvgaR33dSurfaceUpdateHeapBuffersOnFifoThread(pDevIns, pThis, sid);
                     vmsvga3dInfoSurfaceWorkerOne(pHlp, pSurface, fVerbose, cxAscii, fInvY);
                     if (pszBitmapPath && *pszBitmapPath)
@@ -2114,5 +2114,5 @@
              */
             if (fVerbose)
-                vmsvga3dSurfaceUpdateHeapBuffersOnFifoThread(pDevIns, pThis, UINT32_MAX);
+                vmsvgaR33dSurfaceUpdateHeapBuffersOnFifoThread(pDevIns, pThis, UINT32_MAX);
             uint32_t cSurfaces = pState->cSurfaces;
             pHlp->pfnPrintf(pHlp, "cSurfaces=%d\n", cSurfaces);
Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 82088)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 82089)
@@ -2766,15 +2766,15 @@
         uint32_t const offGst = u32GuestBlockX * pSurface->cbBlock + u32GuestBlockY * cbGuestPitch;
 
-        rc = vmsvgaGMRTransfer(pThis,
-                               transfer,
-                               pDoubleBuffer,
-                               pMipLevel->cbSurface,
-                               offHst,
-                               cbSurfacePitch,
-                               GuestPtr,
-                               offGst,
-                               cbGuestPitch,
-                               cBlocksX * pSurface->cbBlock,
-                               cBlocksY);
+        rc = vmsvgaR3GmrTransfer(pThis,
+                                 transfer,
+                                 pDoubleBuffer,
+                                 pMipLevel->cbSurface,
+                                 offHst,
+                                 cbSurfacePitch,
+                                 GuestPtr,
+                                 offGst,
+                                 cbGuestPitch,
+                                 cBlocksX * pSurface->cbBlock,
+                                 cBlocksY);
         AssertRC(rc);
 
@@ -2913,15 +2913,15 @@
                 uint32_t const cbWidth = pBox->w * pSurface->cbBlock;
 
-                rc = vmsvgaGMRTransfer(pThis,
-                                       transfer,
-                                       pbData,
-                                       pMipLevel->cbSurface,
-                                       offHst,
-                                       pMipLevel->cbSurfacePitch,
-                                       GuestPtr,
-                                       pBox->srcx * pSurface->cbBlock,
-                                       cbGuestPitch,
-                                       cbWidth,
-                                       pBox->h);
+                rc = vmsvgaR3GmrTransfer(pThis,
+                                         transfer,
+                                         pbData,
+                                         pMipLevel->cbSurface,
+                                         offHst,
+                                         pMipLevel->cbSurfacePitch,
+                                         GuestPtr,
+                                         pBox->srcx * pSurface->cbBlock,
+                                         cbGuestPitch,
+                                         cbWidth,
+                                         pBox->h);
                 AssertRC(rc);
 
Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp	(revision 82088)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp	(revision 82089)
@@ -1548,5 +1548,5 @@
         {
             SVGA3dCopyBox clipBox = pBox[i];
-            vmsvgaClipCopyBox(&pMipmapLevelSrc->mipmapSize, &pMipmapLevelDest->mipmapSize, &clipBox);
+            vmsvgaR3ClipCopyBox(&pMipmapLevelSrc->mipmapSize, &pMipmapLevelDest->mipmapSize, &clipBox);
             if (   !clipBox.w
                 || !clipBox.h
@@ -1703,5 +1703,5 @@
 
             SVGA3dCopyBox clipBox = pBox[i];
-            vmsvgaClipCopyBox(&pMipmapLevelSrc->mipmapSize, &pMipmapLevelDest->mipmapSize, &clipBox);
+            vmsvgaR3ClipCopyBox(&pMipmapLevelSrc->mipmapSize, &pMipmapLevelDest->mipmapSize, &clipBox);
             if (   !clipBox.w
                 || !clipBox.h
@@ -2384,5 +2384,5 @@
         AssertMsgReturn(cBlocksX && cBlocksY, ("Empty box %dx%d\n", pBox->w, pBox->h), VERR_INTERNAL_ERROR);
 
-        /* vmsvgaGMRTransfer verifies uGuestOffset.
+        /* vmsvgaR3GmrTransfer verifies uGuestOffset.
          * srcx(u32GuestBlockX) and srcy(u32GuestBlockY) have been verified in vmsvga3dSurfaceDMA
          * to not cause 32 bit overflow when multiplied by cbBlock and cbGuestPitch.
@@ -2405,5 +2405,5 @@
                  Rect.left, Rect.top, Rect.right, Rect.bottom));
 
-        /* Prepare parameters for vmsvgaGMRTransfer, which needs the host buffer address, size
+        /* Prepare parameters for vmsvgaR3GmrTransfer, which needs the host buffer address, size
          * and offset of the first scanline.
          */
@@ -2414,15 +2414,15 @@
         uint32_t const offLockedBuf = (uint32_t)((uintptr_t)LockedRect.pBits - (uintptr_t)pu8LockedBuf);
 
-        rc = vmsvgaGMRTransfer(pThis,
-                               transfer,
-                               pu8LockedBuf,
-                               cbLockedBuf,
-                               offLockedBuf,
-                               LockedRect.Pitch,
-                               GuestPtr,
-                               (uint32_t)uGuestOffset,
-                               cbGuestPitch,
-                               cBlocksX * pSurface->cbBlock,
-                               cBlocksY);
+        rc = vmsvgaR3GmrTransfer(pThis,
+                                 transfer,
+                                 pu8LockedBuf,
+                                 cbLockedBuf,
+                                 offLockedBuf,
+                                 LockedRect.Pitch,
+                                 GuestPtr,
+                                 (uint32_t)uGuestOffset,
+                                 cbGuestPitch,
+                                 cBlocksX * pSurface->cbBlock,
+                                 cBlocksY);
         AssertRC(rc);
 
@@ -2472,5 +2472,5 @@
         Assert(pBox->y == 0 && pBox->h == 1 && pBox->z == 0 && pBox->d == 1);
 
-        /* vmsvgaGMRTransfer verifies input parameters except for the host buffer addres and size.
+        /* vmsvgaR3GmrTransfer verifies input parameters except for the host buffer addres and size.
          * srcx has been verified in vmsvga3dSurfaceDMA to not cause 32 bit overflow when multiplied by cbBlock.
          */
@@ -2481,15 +2481,15 @@
 
         /* Copy data between the guest and the host buffer. */
-        rc = vmsvgaGMRTransfer(pThis,
-                               transfer,
-                               (uint8_t *)pMipLevel->pSurfaceData,
-                               pMipLevel->cbSurface,
-                               offHst,
-                               pMipLevel->cbSurfacePitch,
-                               GuestPtr,
-                               offGst,
-                               cbGuestPitch,
-                               cbWidth,
-                               1); /* Buffers are 1-dimensional */
+        rc = vmsvgaR3GmrTransfer(pThis,
+                                 transfer,
+                                 (uint8_t *)pMipLevel->pSurfaceData,
+                                 pMipLevel->cbSurface,
+                                 offHst,
+                                 pMipLevel->cbSurfacePitch,
+                                 GuestPtr,
+                                 offGst,
+                                 cbGuestPitch,
+                                 cbWidth,
+                                 1); /* Buffers are 1-dimensional */
         AssertRC(rc);
 
Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp	(revision 82088)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp	(revision 82089)
@@ -459,6 +459,6 @@
     SVGA3dBox clipSrcBox = *pSrcBox;
     SVGA3dBox clipDstBox = *pDstBox;
-    vmsvgaClipBox(&pSrcMipmapLevel->mipmapSize, &clipSrcBox);
-    vmsvgaClipBox(&pDstMipmapLevel->mipmapSize, &clipDstBox);
+    vmsvgaR3ClipBox(&pSrcMipmapLevel->mipmapSize, &clipSrcBox);
+    vmsvgaR3ClipBox(&pDstMipmapLevel->mipmapSize, &clipDstBox);
 
     return vmsvga3dBackSurfaceStretchBlt(pThis, pState,
@@ -539,5 +539,5 @@
         hostBox.h = paBoxes[i].h;
         hostBox.d = paBoxes[i].d;
-        vmsvgaClipBox(&pMipLevel->mipmapSize, &hostBox);
+        vmsvgaR3ClipBox(&pMipLevel->mipmapSize, &hostBox);
 
         if (   !hostBox.w
@@ -551,5 +551,5 @@
 
         /* Adjust the guest, i.e. "src", point.
-         * Do not try to verify them here because vmsvgaGMRTransfer takes care of this.
+         * Do not try to verify them here because vmsvgaR3GmrTransfer takes care of this.
          */
         uint32_t const srcx = paBoxes[i].srcx + (hostBox.x - paBoxes[i].x);
@@ -600,5 +600,5 @@
         else
         {
-            /* vmsvgaGMRTransfer will verify the value, just check it is sane. */
+            /* vmsvgaR3GmrTransfer will verify the value, just check it is sane. */
             AssertReturn(cbGuestPitch <= SVGA3D_MAX_SURFACE_MEM_SIZE, VERR_INVALID_PARAMETER);
             RT_UNTRUSTED_VALIDATED_FENCE();
@@ -606,5 +606,5 @@
 
         /* srcx, srcy and srcz values are used to calculate the guest offset.
-         * The offset will be verified by vmsvgaGMRTransfer, so just check for overflows here.
+         * The offset will be verified by vmsvgaR3GmrTransfer, so just check for overflows here.
          */
         AssertReturn(srcz < UINT32_MAX / pMipLevel->mipmapSize.height / cbGuestPitch, VERR_INVALID_PARAMETER);
@@ -628,15 +628,15 @@
             for (uint32_t z = 0; z < hostBox.d; ++z)
             {
-                rc = vmsvgaGMRTransfer(pThis,
-                                       transfer,
-                                       (uint8_t *)pMipLevel->pSurfaceData,
-                                       pMipLevel->cbSurface,
-                                       uHostOffset,
-                                       (int32_t)pMipLevel->cbSurfacePitch,
-                                       guest.ptr,
-                                       (uint32_t)uGuestOffset,
-                                       cbGuestPitch,
-                                       cBlocksX * pSurface->cbBlock,
-                                       cBlocksY);
+                rc = vmsvgaR3GmrTransfer(pThis,
+                                         transfer,
+                                         (uint8_t *)pMipLevel->pSurfaceData,
+                                         pMipLevel->cbSurface,
+                                         uHostOffset,
+                                         (int32_t)pMipLevel->cbSurfacePitch,
+                                         guest.ptr,
+                                         (uint32_t)uGuestOffset,
+                                         cbGuestPitch,
+                                         cBlocksX * pSurface->cbBlock,
+                                         cBlocksY);
                 AssertRC(rc);
 
@@ -684,7 +684,7 @@
     queryResult.result32 = u32Result;
 
-    int rc = vmsvgaGMRTransfer(pThis, SVGA3D_READ_HOST_VRAM,
-                               (uint8_t *)&queryResult, sizeof(queryResult), 0, sizeof(queryResult),
-                               guestResult, 0, sizeof(queryResult), sizeof(queryResult), 1);
+    int rc = vmsvgaR3GmrTransfer(pThis, SVGA3D_READ_HOST_VRAM,
+                                 (uint8_t *)&queryResult, sizeof(queryResult), 0, sizeof(queryResult),
+                                 guestResult, 0, sizeof(queryResult), sizeof(queryResult), 1);
     AssertRC(rc);
     return rc;
@@ -820,5 +820,5 @@
     }
 
-    VMSVGASCREENOBJECT *pScreen = vmsvgaGetScreenObject(pThis, idDstScreen);
+    VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThis, idDstScreen);
     AssertReturn(pScreen, VERR_INTERNAL_ERROR);
 
@@ -863,5 +863,5 @@
 
         /* Update the guest image, which is at box.src. */
-        vmsvgaUpdateScreen(pThis, pScreen, box.srcx, box.srcy, box.w, box.h);
+        vmsvgaR3UpdateScreen(pThis, pScreen, box.srcx, box.srcy, box.w, box.h);
     }
     else
@@ -888,5 +888,5 @@
 
             /* Update the guest image, which is at box.src. */
-            vmsvgaUpdateScreen(pThis, pScreen, box.srcx, box.srcy, box.w, box.h);
+            vmsvgaR3UpdateScreen(pThis, pScreen, box.srcx, box.srcy, box.w, box.h);
         }
     }
@@ -906,5 +906,5 @@
 
     /** @todo Detect screen from coords? Or split rect to screens? */
-    VMSVGASCREENOBJECT *pScreen = vmsvgaGetScreenObject(pThis, 0);
+    VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThis, 0);
     AssertReturn(pScreen, VERR_INTERNAL_ERROR);
 
Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h	(revision 82088)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h	(revision 82089)
@@ -52,5 +52,5 @@
 
 /* DevVGA-SVGA.cpp: */
-void vmsvga3dSurfaceUpdateHeapBuffersOnFifoThread(PPDMDEVINS pDevIns, PVGASTATE pThis, uint32_t sid);
+void vmsvgaR33dSurfaceUpdateHeapBuffersOnFifoThread(PPDMDEVINS pDevIns, PVGASTATE pThis, uint32_t sid);
 
 
Index: trunk/src/VBox/Devices/Graphics/DevVGA.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA.cpp	(revision 82088)
+++ trunk/src/VBox/Devices/Graphics/DevVGA.cpp	(revision 82089)
@@ -5536,5 +5536,5 @@
      */
     if (pThis->svga.fFIFOThreadSleeping && pThis->svga.fEnabled && pThis->svga.fConfigured)
-        vmsvgaFIFOWatchdogTimer(pDevIns, pThis);
+        vmsvgaR3FifoWatchdogTimer(pDevIns, pThis);
 # endif
 }
@@ -5841,5 +5841,5 @@
     if (pThis->fVMSVGAEnabled)
     {
-        rc = vmsvgaSaveExec(pDevIns, pSSM);
+        rc = vmsvgaR3SaveExec(pDevIns, pSSM);
         AssertRCReturn(rc, rc);
     }
@@ -5931,5 +5931,5 @@
         if (pThis->fVMSVGAEnabled)
         {
-            rc = vmsvgaLoadExec(pDevIns, pSSM, uVersion, uPass);
+            rc = vmsvgaR3LoadExec(pDevIns, pSSM, uVersion, uPass);
             AssertRCReturn(rc, rc);
         }
@@ -5963,5 +5963,5 @@
     if (pThis->fVMSVGAEnabled)
     {
-        rc = vmsvgaLoadDone(pDevIns);
+        rc = vmsvgaR3LoadDone(pDevIns);
         AssertRCReturn(rc, rc);
     }
@@ -5998,5 +5998,5 @@
 # ifdef VBOX_WITH_VMSVGA
     if (pThis->fVMSVGAEnabled)
-        vmsvgaReset(pDevIns);
+        vmsvgaR3Reset(pDevIns);
 # endif
 
@@ -6235,5 +6235,5 @@
 # ifdef VBOX_WITH_VMSVGA
     if (pThis->fVMSVGAEnabled)
-        vmsvgaDestruct(pDevIns);
+        vmsvgaR3Destruct(pDevIns);
 # endif
 
@@ -7198,5 +7198,5 @@
     if (    rc == VINF_SUCCESS
         &&  pThis->fVMSVGAEnabled)
-        rc = vmsvgaInit(pDevIns);
+        rc = vmsvgaR3Init(pDevIns);
 # endif
 
