VirtualBox

Changeset 57011 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 19, 2015 11:42:32 PM (9 years ago)
Author:
vboxsync
Message:

vmsvga: Combined the external FIFO command submission into one function and make sure we only execute the external command when we temporarily resume the FIFO thread.

Location:
trunk/src/VBox/Devices/Graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp

    r56992 r57011  
    244244    SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGAState, p3dState),
    245245    SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGAState, pFrameBufferBackup),
    246     SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGAState, pFIFOExtCmdParam),
     246    SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGAState, pvFIFOExtCmdParam),
    247247    SSMFIELD_ENTRY_IGN_GCPHYS(      VMSVGAState, GCPhysFIFO),
    248248    SSMFIELD_ENTRY_IGNORE(          VMSVGAState, cbFIFO),
     
    276276    SSMFIELD_ENTRY(                 VMSVGAState, fVRAMTracking),
    277277    SSMFIELD_ENTRY_IGNORE(          VMSVGAState, u8FIFOExtCommand),
     278    SSMFIELD_ENTRY_IGNORE(          VMSVGAState, fFifoExtCommandWakeup),
    278279    SSMFIELD_ENTRY_TERM()
    279280};
     
    20202021
    20212022/**
     2023 * Worker for vmsvgaR3FifoThread that handles an external command.
     2024 *
     2025 * @param   pThis           VGA device instance data.
     2026 */
     2027static void vmsvgaR3FifoHandleExtCmd(PVGASTATE pThis)
     2028{
     2029    uint8_t uExtCmd = pThis->svga.u8FIFOExtCommand;
     2030    switch (pThis->svga.u8FIFOExtCommand)
     2031    {
     2032        case VMSVGA_FIFO_EXTCMD_RESET:
     2033            Log(("vmsvgaFIFOLoop: reset the fifo thread.\n"));
     2034            Assert(pThis->svga.pvFIFOExtCmdParam == NULL);
     2035# ifdef VBOX_WITH_VMSVGA3D
     2036            if (pThis->svga.f3DEnabled)
     2037            {
     2038                /* The 3d subsystem must be reset from the fifo thread. */
     2039                vmsvga3dReset(pThis);
     2040            }
     2041# endif
     2042            break;
     2043
     2044        case VMSVGA_FIFO_EXTCMD_TERMINATE:
     2045            Log(("vmsvgaFIFOLoop: terminate the fifo thread.\n"));
     2046            Assert(pThis->svga.pvFIFOExtCmdParam == NULL);
     2047# ifdef VBOX_WITH_VMSVGA3D
     2048            if (pThis->svga.f3DEnabled)
     2049            {
     2050                /* The 3d subsystem must be shut down from the fifo thread. */
     2051                vmsvga3dTerminate(pThis);
     2052            }
     2053# endif
     2054            break;
     2055
     2056        case VMSVGA_FIFO_EXTCMD_SAVESTATE:
     2057        {
     2058            Log(("vmsvgaFIFOLoop: VMSVGA_FIFO_EXTCMD_SAVESTATE.\n"));
     2059# ifdef VBOX_WITH_VMSVGA3D
     2060            PSSMHANDLE pSSM = (PSSMHANDLE)pThis->svga.pvFIFOExtCmdParam;
     2061            AssertLogRelMsgBreak(RT_VALID_PTR(pSSM), ("pSSM=%p\n", pSSM));
     2062            vmsvga3dSaveExec(pThis, pSSM);
     2063# endif
     2064            break;
     2065        }
     2066
     2067        case VMSVGA_FIFO_EXTCMD_LOADSTATE:
     2068        {
     2069            Log(("vmsvgaFIFOLoop: VMSVGA_FIFO_EXTCMD_LOADSTATE.\n"));
     2070# ifdef VBOX_WITH_VMSVGA3D
     2071            PVMSVGA_STATE_LOAD pLoadState = (PVMSVGA_STATE_LOAD)pThis->svga.pvFIFOExtCmdParam;
     2072            AssertLogRelMsgBreak(RT_VALID_PTR(pLoadState), ("pLoadState=%p\n", pLoadState));
     2073            vmsvga3dLoadExec(pThis, pLoadState->pSSM, pLoadState->uVersion, pLoadState->uPass);
     2074# endif
     2075            break;
     2076        }
     2077
     2078        default:
     2079            AssertLogRelMsgFailed(("uExtCmd=%#x pvFIFOExtCmdParam=%p\n", uExtCmd, pThis->svga.pvFIFOExtCmdParam));
     2080            break;
     2081    }
     2082
     2083    /*
     2084     * Signal the end of the external command.
     2085     */
     2086    pThis->svga.pvFIFOExtCmdParam = NULL;
     2087    pThis->svga.u8FIFOExtCommand  = VMSVGA_FIFO_EXTCMD_NONE;
     2088    ASMMemoryFence(); /* paranoia^2 */
     2089    int rc = RTSemEventSignal(pThis->svga.FIFOExtCmdSem);
     2090    AssertLogRelRC(rc);
     2091}
     2092
     2093/**
     2094 * Worker for vmsvgaR3Destruct, vmsvgaR3Reset, vmsvgaR3Save and vmsvgaR3Load for
     2095 * doing a job on the FIFO thread (even when it's officially suspended).
     2096 *
     2097 * @returns VBox status code (fully asserted).
     2098 * @param   pThis           VGA device instance data.
     2099 * @param   uExtCmd         The command to execute on the FIFO thread.
     2100 * @param   pvParam         Pointer to command parameters.
     2101 * @param   cMsWait         The time to wait for the command, given in
     2102 *                          milliseconds.
     2103 */
     2104static int vmsvgaR3RunExtCmdOnFifoThread(PVGASTATE pThis, uint8_t uExtCmd, void *pvParam, RTMSINTERVAL cMsWait)
     2105{
     2106    Assert(cMsWait >= RT_MS_1SEC * 5);
     2107    AssertLogRelMsg(pThis->svga.u8FIFOExtCommand == VMSVGA_FIFO_EXTCMD_NONE,
     2108                    ("old=%d new=%d\n", pThis->svga.u8FIFOExtCommand, uExtCmd));
     2109
     2110    int rc;
     2111    PPDMTHREAD      pThread  = pThis->svga.pFIFOIOThread;
     2112    PDMTHREADSTATE  enmState = pThread->enmState;
     2113    if (enmState == PDMTHREADSTATE_SUSPENDED)
     2114    {
     2115        /*
     2116         * The thread is suspended, we have to temporarily wake it up so it can
     2117         * perform the task.
     2118         * (We ASSUME not racing code here, both wrt thread state and ext commands.)
     2119         */
     2120        Log(("vmsvgaR3RunExtCmdOnFifoThread: uExtCmd=%d enmState=SUSPENDED\n", uExtCmd));
     2121        /* Post the request. */
     2122        pThis->svga.fFifoExtCommandWakeup = true;
     2123        pThis->svga.pvFIFOExtCmdParam     = pvParam;
     2124        pThis->svga.u8FIFOExtCommand      = uExtCmd;
     2125        ASMMemoryFence(); /* paranoia^3 */
     2126
     2127        /* Resume the thread. */
     2128        rc = PDMR3ThreadResume(pThread);
     2129        AssertLogRelRC(rc);
     2130        if (RT_SUCCESS(rc))
     2131        {
     2132            /* Wait. Take care in case the semaphore was already posted (same as below). */
     2133            rc = RTSemEventWait(pThis->svga.FIFOExtCmdSem, cMsWait);
     2134            if (   rc == VINF_SUCCESS
     2135                && pThis->svga.u8FIFOExtCommand == uExtCmd)
     2136                rc = RTSemEventWait(pThis->svga.FIFOExtCmdSem, cMsWait);
     2137            AssertLogRelMsg(pThis->svga.u8FIFOExtCommand != uExtCmd || RT_FAILURE_NP(rc),
     2138                            ("%#x %Rrc\n", pThis->svga.u8FIFOExtCommand, rc));
     2139
     2140            /* suspend the thread */
     2141            pThis->svga.fFifoExtCommandWakeup = false;
     2142            int rc2 = PDMR3ThreadSuspend(pThread);
     2143            AssertLogRelRC(rc2);
     2144            if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
     2145                rc = rc2;
     2146        }
     2147        pThis->svga.fFifoExtCommandWakeup = false;
     2148        pThis->svga.pvFIFOExtCmdParam     = NULL;
     2149    }
     2150    else if (enmState == PDMTHREADSTATE_RUNNING)
     2151    {
     2152        /*
     2153         * The thread is running, should only happen during reset.
     2154         * We ASSUME not racing code here, both wrt thread state and ext commands.
     2155         */
     2156        Log(("vmsvgaR3RunExtCmdOnFifoThread: uExtCmd=%d enmState=RUNNING\n", uExtCmd));
     2157        Assert(uExtCmd == VMSVGA_FIFO_EXTCMD_RESET);
     2158
     2159        /* Post the request. */
     2160        pThis->svga.pvFIFOExtCmdParam = pvParam;
     2161        pThis->svga.u8FIFOExtCommand  = uExtCmd;
     2162        ASMMemoryFence(); /* paranoia^2 */
     2163        rc = SUPSemEventSignal(pThis->svga.pSupDrvSession, pThis->svga.FIFORequestSem);
     2164        AssertLogRelRC(rc);
     2165
     2166        /* Wait. Take care in case the semaphore was already posted (same as above). */
     2167        rc = RTSemEventWait(pThis->svga.FIFOExtCmdSem, cMsWait);
     2168        if (   rc == VINF_SUCCESS
     2169            && pThis->svga.u8FIFOExtCommand == uExtCmd)
     2170            rc = RTSemEventWait(pThis->svga.FIFOExtCmdSem, cMsWait); /* it was already posted, retry the wait. */
     2171        AssertLogRelMsg(pThis->svga.u8FIFOExtCommand != uExtCmd || RT_FAILURE_NP(rc),
     2172                        ("%#x %Rrc\n", pThis->svga.u8FIFOExtCommand, rc));
     2173
     2174        pThis->svga.pvFIFOExtCmdParam = NULL;
     2175    }
     2176    else
     2177    {
     2178        /*
     2179         * Something is wrong with the thread!
     2180         */
     2181        AssertLogRelMsgFailed(("uExtCmd=%d enmState=%d\n", uExtCmd, enmState));
     2182        rc = VERR_INVALID_STATE;
     2183    }
     2184    return rc;
     2185}
     2186
     2187
     2188/**
    20222189 * Marks the FIFO non-busy, notifying any waiting EMTs.
    20232190 *
     
    22162383
    22172384    /*
     2385     * Special mode where we only execute an external command and the go back
     2386     * to being suspended.  Currently, all ext cmds ends up here, with the reset
     2387     * one also being eligble for runtime execution further down as well.
     2388     */
     2389    if (pThis->svga.fFifoExtCommandWakeup)
     2390    {
     2391        vmsvgaR3FifoHandleExtCmd(pThis);
     2392        while (pThread->enmState == PDMTHREADSTATE_RUNNING)
     2393            if (pThis->svga.u8FIFOExtCommand == VMSVGA_FIFO_EXTCMD_NONE)
     2394                SUPSemEventWaitNoResume(pThis->svga.pSupDrvSession, pThis->svga.FIFORequestSem, RT_MS_1MIN);
     2395            else
     2396                vmsvgaR3FifoHandleExtCmd(pThis);
     2397        return VINF_SUCCESS;
     2398    }
     2399
     2400
     2401    /*
    22182402     * Signal the semaphore to make sure we don't wait for 250 after a
    22192403     * suspend & resume scenario (see vmsvgaFIFOGetCmdPayload).
     
    22662450
    22672451        /*
    2268          * Handle external commands.
     2452         * Handle external commands (currently only reset).
    22692453         */
    22702454        if (pThis->svga.u8FIFOExtCommand != VMSVGA_FIFO_EXTCMD_NONE)
    22712455        {
    2272             switch (pThis->svga.u8FIFOExtCommand)
    2273             {
    2274             case VMSVGA_FIFO_EXTCMD_RESET:
    2275                 Log(("vmsvgaFIFOLoop: reset the fifo thread.\n"));
    2276 # ifdef VBOX_WITH_VMSVGA3D
    2277                 if (pThis->svga.f3DEnabled)
    2278                 {
    2279                     /* The 3d subsystem must be reset from the fifo thread. */
    2280                     vmsvga3dReset(pThis);
    2281                 }
    2282 # endif
    2283                 break;
    2284 
    2285             case VMSVGA_FIFO_EXTCMD_TERMINATE:
    2286                 Log(("vmsvgaFIFOLoop: terminate the fifo thread.\n"));
    2287 # ifdef VBOX_WITH_VMSVGA3D
    2288                 if (pThis->svga.f3DEnabled)
    2289                 {
    2290                     /* The 3d subsystem must be shut down from the fifo thread. */
    2291                     vmsvga3dTerminate(pThis);
    2292                 }
    2293 # endif
    2294                 break;
    2295 
    2296             case VMSVGA_FIFO_EXTCMD_SAVESTATE:
    2297                 Log(("vmsvgaFIFOLoop: VMSVGA_FIFO_EXTCMD_SAVESTATE.\n"));
    2298 # ifdef VBOX_WITH_VMSVGA3D
    2299                 vmsvga3dSaveExec(pThis, (PSSMHANDLE)pThis->svga.pFIFOExtCmdParam);
    2300 # endif
    2301                 break;
    2302 
    2303             case VMSVGA_FIFO_EXTCMD_LOADSTATE:
    2304             {
    2305                 Log(("vmsvgaFIFOLoop: VMSVGA_FIFO_EXTCMD_LOADSTATE.\n"));
    2306 # ifdef VBOX_WITH_VMSVGA3D
    2307                 PVMSVGA_STATE_LOAD pLoadState = (PVMSVGA_STATE_LOAD)pThis->svga.pFIFOExtCmdParam;
    2308                 vmsvga3dLoadExec(pThis, pLoadState->pSSM, pLoadState->uVersion, pLoadState->uPass);
    2309 # endif
    2310                 break;
    2311             }
    2312             }
    2313 
    2314             pThis->svga.u8FIFOExtCommand = VMSVGA_FIFO_EXTCMD_NONE;
    2315 
    2316             /* Signal the end of the external command. */
    2317             RTSemEventSignal(pThis->svga.FIFOExtCmdSem);
     2456            vmsvgaR3FifoHandleExtCmd(pThis);
    23182457            continue;
    23192458        }
    23202459
    2321         if (    !pThis->svga.fEnabled
    2322             ||  !pThis->svga.fConfigured)
     2460        /*
     2461         * The device must be enabled and configured.
     2462         */
     2463        if (   !pThis->svga.fEnabled
     2464            || !pThis->svga.fConfigured)
    23232465        {
    23242466            vmsvgaFifoSetNotBusy(pThis, pSVGAState, pFIFO[SVGA_FIFO_MIN]);
    2325             continue;   /* device not enabled. */
     2467            continue;
    23262468        }
    23272469
     
    24102552                {/*nothing*/}
    24112553# endif
    2412             /* Check for pending external commands. */
     2554            /* Check for pending external commands (reset). */
    24132555            if (pThis->svga.u8FIFOExtCommand != VMSVGA_FIFO_EXTCMD_NONE)
    24142556                break;
     
    36153757    pHlp->pfnPrintf(pHlp, "FIFO size:          %u (%#x)\n", pThis->svga.cbFIFO, pThis->svga.cbFIFO);
    36163758    pHlp->pfnPrintf(pHlp, "FIFO external cmd:  %#x\n", pThis->svga.u8FIFOExtCommand);
     3759    pHlp->pfnPrintf(pHlp, "FIFO extcmd wakeup: %u\n", pThis->svga.fFifoExtCommandWakeup);
    36173760    pHlp->pfnPrintf(pHlp, "Busy:               %#x\n", pThis->svga.fBusy);
    36183761    pHlp->pfnPrintf(pHlp, "Traces:             %RTbool (effective: %RTbool)\n", pThis->svga.fTraces, pThis->svga.fVRAMTracking);
     
    36983841    if (pThis->svga.f3DEnabled)
    36993842    {
    3700         VMSVGA_STATE_LOAD loadstate;
    3701 
    3702         loadstate.pSSM     = pSSM;
    3703         loadstate.uVersion = uVersion;
    3704         loadstate.uPass    = uPass;
    3705 
    3706         /* Save the 3d state in the FIFO thread. */
    3707         pThis->svga.u8FIFOExtCommand = VMSVGA_FIFO_EXTCMD_LOADSTATE;
    3708         pThis->svga.pFIFOExtCmdParam = (void *)&loadstate;
    3709         /* Hack alert: resume the IO thread as it has been suspended before the destruct callback.
    3710          * The PowerOff notification isn't working, so not an option in this case.
    3711          */
    3712         PDMR3ThreadResume(pThis->svga.pFIFOIOThread);
    3713         SUPSemEventSignal(pThis->svga.pSupDrvSession, pThis->svga.FIFORequestSem);
    3714         /* Wait for the end of the command. */
    3715         rc = RTSemEventWait(pThis->svga.FIFOExtCmdSem, RT_INDEFINITE_WAIT);
    3716         AssertRC(rc);
    3717         PDMR3ThreadSuspend(pThis->svga.pFIFOIOThread);
     3843        VMSVGA_STATE_LOAD LoadState;
     3844        LoadState.pSSM     = pSSM;
     3845        LoadState.uVersion = uVersion;
     3846        LoadState.uPass    = uPass;
     3847        rc = vmsvgaR3RunExtCmdOnFifoThread(pThis, VMSVGA_FIFO_EXTCMD_LOADSTATE, &LoadState, RT_INDEFINITE_WAIT);
     3848        AssertLogRelRCReturn(rc, rc);
    37183849    }
    37193850# endif
     
    37623893    /* Save our part of the VGAState */
    37633894    rc = SSMR3PutStructEx(pSSM, &pThis->svga, sizeof(pThis->svga), 0, g_aVGAStateSVGAFields, NULL);
    3764     AssertRCReturn(rc, rc);
     3895    AssertLogRelRCReturn(rc, rc);
    37653896
    37663897    /* Save the framebuffer backup. */
    37673898    rc = SSMR3PutMem(pSSM, pThis->svga.pFrameBufferBackup, VMSVGA_FRAMEBUFFER_BACKUP_SIZE);
    3768     AssertRCReturn(rc, rc);
     3899    AssertLogRelRCReturn(rc, rc);
    37693900
    37703901    /* Save the VMSVGA state. */
    37713902    rc = SSMR3PutStructEx(pSSM, pSVGAState, sizeof(*pSVGAState), 0, g_aVMSVGASTATEFields, NULL);
    3772     AssertRCReturn(rc, rc);
     3903    AssertLogRelRCReturn(rc, rc);
    37733904
    37743905    /* Save the active cursor bitmaps. */
     
    37763907    {
    37773908        rc = SSMR3PutMem(pSSM, pSVGAState->Cursor.pData, pSVGAState->Cursor.cbData);
    3778         AssertRCReturn(rc, rc);
     3909        AssertLogRelRCReturn(rc, rc);
    37793910    }
    37803911
     
    37833914    {
    37843915        rc = SSMR3PutStructEx(pSSM, &pSVGAState->aGMR[i], sizeof(pSVGAState->aGMR[i]), 0, g_aGMRFields, NULL);
    3785         AssertRCReturn(rc, rc);
     3916        AssertLogRelRCReturn(rc, rc);
    37863917
    37873918        for (uint32_t j = 0; j < pSVGAState->aGMR[i].numDescriptors; j++)
    37883919        {
    37893920            rc = SSMR3PutStructEx(pSSM, &pSVGAState->aGMR[i].paDesc[j], sizeof(pSVGAState->aGMR[i].paDesc[j]), 0, g_aVMSVGAGMRDESCRIPTORFields, NULL);
    3790             AssertRCReturn(rc, rc);
     3921            AssertLogRelRCReturn(rc, rc);
    37913922        }
    37923923    }
    37933924
    37943925# ifdef VBOX_WITH_VMSVGA3D
     3926    /*
     3927     * Must save the 3d state in the FIFO thread.
     3928     */
    37953929    if (pThis->svga.f3DEnabled)
    37963930    {
    3797         /* Save the 3d state in the FIFO thread. */
    3798         pThis->svga.u8FIFOExtCommand = VMSVGA_FIFO_EXTCMD_SAVESTATE;
    3799         pThis->svga.pFIFOExtCmdParam = (void *)pSSM;
    3800         /* Hack alert: resume the IO thread as it has been suspended before the destruct callback.
    3801          * The PowerOff notification isn't working, so not an option in this case.
    3802          */
    3803         PDMR3ThreadResume(pThis->svga.pFIFOIOThread);
    3804         SUPSemEventSignal(pThis->svga.pSupDrvSession, pThis->svga.FIFORequestSem);
    3805         /* Wait for the end of the external command. */
    3806         rc = RTSemEventWait(pThis->svga.FIFOExtCmdSem, RT_INDEFINITE_WAIT);
    3807         AssertRC(rc);
    3808         PDMR3ThreadSuspend(pThis->svga.pFIFOIOThread);
     3931        rc = vmsvgaR3RunExtCmdOnFifoThread(pThis, VMSVGA_FIFO_EXTCMD_SAVESTATE, pSSM, RT_INDEFINITE_WAIT);
     3932        AssertLogRelRCReturn(rc, rc);
    38093933    }
    38103934# endif
     
    38293953    Log(("vmsvgaReset\n"));
    38303954
    3831     pThis->svga.pFIFOR3[SVGA_FIFO_NEXT_CMD]         = pThis->svga.pFIFOR3[SVGA_FIFO_STOP]                 = 0;
    3832 
    3833     /* Reset the FIFO thread. */
    3834     pThis->svga.u8FIFOExtCommand = VMSVGA_FIFO_EXTCMD_RESET;
    3835     SUPSemEventSignal(pThis->svga.pSupDrvSession, pThis->svga.FIFORequestSem);
    3836     /* Wait for the end of the termination sequence. */
    3837     int rc = RTSemEventWait(pThis->svga.FIFOExtCmdSem, 10000);
    3838     AssertRC(rc);
    3839 
     3955
     3956    /* Reset the FIFO processing as well as the 3d state (if we have one). */
     3957    pThis->svga.pFIFOR3[SVGA_FIFO_NEXT_CMD] = pThis->svga.pFIFOR3[SVGA_FIFO_STOP] = 0; /** @todo should probably let the FIFO thread do this ... */
     3958    int rc = vmsvgaR3RunExtCmdOnFifoThread(pThis, VMSVGA_FIFO_EXTCMD_RESET, NULL /*pvParam*/, 10000 /*ms*/);
     3959
     3960    /* Reset other stuff. */
    38403961    pThis->svga.cScratchRegion = VMSVGA_SCRATCH_SIZE;
    38413962    memset(pThis->svga.au32ScratchRegion, 0, sizeof(pThis->svga.au32ScratchRegion));
     
    38773998{
    38783999    PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
     4000
     4001    /*
     4002     * Ask the FIFO thread to terminate the 3d state and then terminate it.
     4003     */
     4004    if (pThis->svga.pFIFOIOThread)
     4005    {
     4006        int rc = vmsvgaR3RunExtCmdOnFifoThread(pThis, VMSVGA_FIFO_EXTCMD_TERMINATE, NULL /*pvParam*/, 30000 /*ms*/);
     4007        AssertLogRelRC(rc);
     4008
     4009        rc = PDMR3ThreadDestroy(pThis->svga.pFIFOIOThread, NULL);
     4010        AssertLogRelRC(rc);
     4011        pThis->svga.pFIFOIOThread = NULL;
     4012    }
     4013
     4014    /*
     4015     * Destroy the special SVGA state.
     4016     */
    38794017    PVMSVGASTATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;
    3880     int          rc;
    3881 
    3882     /* Stop the FIFO thread. */
    3883     pThis->svga.u8FIFOExtCommand = VMSVGA_FIFO_EXTCMD_TERMINATE;
    3884     /* Hack alert: resume the IO thread as it has been suspended before the destruct callback.
    3885      * The PowerOff notification isn't working, so not an option in this case.
    3886      */
    3887     PDMR3ThreadResume(pThis->svga.pFIFOIOThread);
    3888     SUPSemEventSignal(pThis->svga.pSupDrvSession, pThis->svga.FIFORequestSem);
    3889 
    3890     /* Wait for the end of the termination sequence. */
    3891     rc = RTSemEventWait(pThis->svga.FIFOExtCmdSem, 10000);
    3892     AssertRC(rc);
    3893     PDMR3ThreadSuspend(pThis->svga.pFIFOIOThread);
    3894 
    38954018    if (pSVGAState)
    38964019    {
     
    39064029
    39074030        for (unsigned i = 0; i < RT_ELEMENTS(pSVGAState->aGMR); i++)
    3908         {
    39094031            if (pSVGAState->aGMR[i].paDesc)
    39104032                RTMemFree(pSVGAState->aGMR[i].paDesc);
    3911         }
     4033
    39124034        RTMemFree(pSVGAState);
    3913     }
     4035        pThis->svga.pSVGAState = NULL;
     4036    }
     4037
     4038    /*
     4039     * Free our resources residing in the VGA state.
     4040     */
    39144041    if (pThis->svga.pFrameBufferBackup)
    39154042        RTMemFree(pThis->svga.pFrameBufferBackup);
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r56292 r57011  
    245245    R3PTRTYPE(void *)           pFrameBufferBackup;
    246246    /** R3 Opaque pointer to an external fifo cmd parameter. */
    247     R3PTRTYPE(void *)           pFIFOExtCmdParam;
     247    R3PTRTYPE(void * volatile)  pvFIFOExtCmdParam;
    248248
    249249    /** Guest physical address of the FIFO memory range. */
     
    316316    bool                        fVRAMTracking;
    317317    /** External command to be executed in the FIFO thread. */
    318     uint8_t                     u8FIFOExtCommand;
    319     bool                        Padding6;
     318    uint8_t volatile            u8FIFOExtCommand;
     319    /** Set by vmsvgaR3RunExtCmdOnFifoThread when it temporarily resumes the FIFO
     320     * thread and does not want it do anything but the command. */
     321    bool volatile               fFifoExtCommandWakeup;
    320322# if defined(DEBUG_GMR_ACCESS) || defined(DEBUG_FIFO_ACCESS)
    321323    /** GMR debug access handler type handle. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette