Changeset 53783 in vbox for trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
- Timestamp:
- Jan 13, 2015 12:31:52 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
r53780 r53783 109 109 STAMPROFILE StatR3CmdDrawPrimitive; 110 110 STAMPROFILE StatR3CmdSurfaceDMA; 111 112 STAMCOUNTER StatFifoCommands; 113 STAMCOUNTER StatFifoErrors; 114 STAMCOUNTER StatFifoUnkCmds; 115 STAMCOUNTER StatFifoTodoTimeout; 116 STAMCOUNTER StatFifoTodoWoken; 117 STAMPROFILE StatFifoStalls; 118 111 119 } VMSVGASTATE, *PVMSVGASTATE; 112 120 … … 1041 1049 1042 1050 case SVGA_REG_DEPTH: 1043 /* @todo read-only?? */1051 /** @todo read-only?? */ 1044 1052 break; 1045 1053 … … 1874 1882 * @retval NULL on FIFO error. 1875 1883 * 1876 * @param pThread The calling PDM thread handle.1877 1884 * @param cbPayloadReq The number of bytes of payload requested. 1878 1885 * @param pFIFO The FIFO. … … 1884 1891 * @param pcbAlreadyRead How much payload we've already read into the bounce 1885 1892 * buffer. (We will NEVER re-read anything.) 1893 * @param pThread The calling PDM thread handle. 1894 * @param pSVGAState Pointer to the ring-3 only SVGA state data. For 1895 * statistics collection. 1886 1896 */ 1887 static void *vmsvgaFIFOGetCmdPayload(PPDMTHREAD pThread, uint32_t cbPayloadReq, uint32_t volatile *pFIFO, 1888 uint32_t offCurrentCmd, uint32_t offFifoMin, uint32_t offFifoMax, 1889 uint8_t *pbBounceBuf, uint32_t *pcbAlreadyRead) 1897 static void *vmsvgaFIFOGetCmdPayload(uint32_t cbPayloadReq, uint32_t volatile *pFIFO, 1898 uint32_t offCurrentCmd, uint32_t offFifoMin, uint32_t offFifoMax, 1899 uint8_t *pbBounceBuf, uint32_t *pcbAlreadyRead, 1900 PPDMTHREAD pThread, PVGASTATE pThis, PVMSVGASTATE pSVGAState) 1890 1901 { 1891 1902 Assert(pbBounceBuf); … … 1913 1924 */ 1914 1925 uint32_t const cbFifoCmd = offFifoMax - offFifoMin; 1915 AssertMsgReturn(cbPayloadReq <= cbFifoCmd, ("cbPayloadReq=%#x cbFifoCmd=%#x\n", cbPayloadReq, cbFifoCmd), NULL); 1926 AssertMsgReturnStmt(cbPayloadReq <= cbFifoCmd, ("cbPayloadReq=%#x cbFifoCmd=%#x\n", cbPayloadReq, cbFifoCmd), 1927 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoErrors), 1928 NULL); 1916 1929 1917 1930 /* … … 1933 1946 else 1934 1947 { 1948 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoErrors); 1935 1949 LogRelMax(16, ("vmsvgaFIFOGetCmdPayload: Invalid offNextCmd=%#x (offFifoMin=%#x offFifoMax=%#x)\n", 1936 1950 offNextCmd, offFifoMin, offFifoMax)); … … 1947 1961 else 1948 1962 { 1963 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoErrors); 1949 1964 LogRelMax(16, ("vmsvgaFIFOGetCmdPayload: Invalid offNextCmd=%#x (offFifoMin=%#x offFifoMax=%#x)\n", 1950 1965 offNextCmd, offFifoMin, offFifoMax)); … … 1958 1973 * Insufficient, must wait for it to arrive. 1959 1974 */ 1960 for (;;) 1975 STAM_REL_PROFILE_START(&pSVGAState->StatFifoStalls, Stall); 1976 for (uint32_t i = 0;; i++) 1961 1977 { 1962 1978 if (pThread->enmState != PDMTHREADSTATE_RUNNING) 1979 { 1980 STAM_REL_PROFILE_STOP(&pSVGAState->StatFifoStalls, Stall); 1963 1981 return (void *)(uintptr_t)1; 1964 Log(("Guest still copying (%x vs %x) current %x next %x stop %x; sleep a bit\n", 1965 cbPayloadReq, cbAfter + cbBefore, offCurrentCmd, offNextCmd, pFIFO[SVGA_FIFO_STOP])); 1966 RTThreadSleep(1); 1967 /** @todo release counter. */ 1982 } 1983 Log(("Guest still copying (%x vs %x) current %x next %x stop %x loop %u; sleep a bit\n", 1984 cbPayloadReq, cbAfter + cbBefore, offCurrentCmd, offNextCmd, pFIFO[SVGA_FIFO_STOP], i)); 1985 1986 SUPSemEventWaitNoResume(pThis->svga.pSupDrvSession, pThis->svga.FIFORequestSem, i < 16 ? 1 : 2); 1968 1987 1969 1988 offNextCmd = pFIFO[SVGA_FIFO_NEXT_CMD]; … … 1982 2001 break; 1983 2002 } 2003 STAM_REL_PROFILE_STOP(&pSVGAState->StatFifoStalls, Stall); 1984 2004 } 1985 2005 … … 2030 2050 2031 2051 /* 2052 * Signal the semaphore to make sure we don't wait for 250 after a 2053 * suspend & resume scenario (see vmsvgaFIFOGetCmdPayload). 2054 */ 2055 SUPSemEventSignal(pThis->svga.pSupDrvSession, pThis->svga.FIFORequestSem); 2056 2057 /* 2032 2058 * Allocate a bounce buffer for command we get from the FIFO. 2033 2059 * (All code must return via the end of the function to free this buffer.) … … 2053 2079 if (pFIFO[SVGA_FIFO_NEXT_CMD] == pFIFO[SVGA_FIFO_STOP]) 2054 2080 continue; 2081 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoTodoTimeout); 2055 2082 2056 2083 Log(("vmsvgaFIFOLoop: timeout\n")); 2057 2084 } 2085 else if (pFIFO[SVGA_FIFO_NEXT_CMD] != pFIFO[SVGA_FIFO_STOP]) 2086 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoTodoWoken); 2087 2058 2088 Log(("vmsvgaFIFOLoop: enabled=%d configured=%d busy=%d\n", pThis->svga.fEnabled, pThis->svga.fConfigured, pThis->svga.pFIFOR3[SVGA_FIFO_BUSY])); 2059 2089 Log(("vmsvgaFIFOLoop: min %x max %x\n", pFIFO[SVGA_FIFO_MIN], pFIFO[SVGA_FIFO_MAX])); … … 2137 2167 LogRelMax(8, ("vmsvgaFIFOLoop: Bad fifo: min=%#x stop=%#x max=%#x\n", offFifoMin, offCurrentCmd, offFifoMax)); 2138 2168 /** @todo Should we clear SVGA_FIFO_BUSY here like we do above? */ 2169 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoErrors); 2139 2170 continue; 2140 2171 } … … 2156 2187 # define VMSVGAFIFO_GET_CMD_BUFFER_BREAK(a_PtrVar, a_Type, a_cbPayloadReq) \ 2157 2188 if (1) { \ 2158 (a_PtrVar) = (a_Type *)vmsvgaFIFOGetCmdPayload(pThread, (a_cbPayloadReq), pFIFO, \ 2159 offCurrentCmd, offFifoMin, offFifoMax, \ 2160 pbBounceBuf, &cbPayload); \ 2189 (a_PtrVar) = (a_Type *)vmsvgaFIFOGetCmdPayload((a_cbPayloadReq), pFIFO, offCurrentCmd, offFifoMin, offFifoMax, \ 2190 pbBounceBuf, &cbPayload, pThread, pThis, pSVGAState); \ 2161 2191 if (RT_UNLIKELY((uintptr_t)(a_PtrVar) < 2)) { if ((uintptr_t)(a_PtrVar) == 1) continue; break; } \ 2162 2192 } else do {} while (0) … … 2423 2453 PGMR pGMR = &pSVGAState->aGMR[pCmd->gmrId]; 2424 2454 AssertBreak(pCmd->offsetPages + pCmd->numPages <= pGMR->cMaxPages); 2425 AssertBreak(!pCmd->offsetPages || pGMR->paDesc); /* @todo */2455 AssertBreak(!pCmd->offsetPages || pGMR->paDesc); /** @todo */ 2426 2456 2427 2457 /* Save the old page descriptors as an array of page addresses (>> PAGE_SHIFT) */ … … 2652 2682 } 2653 2683 2684 /** @todo SVGA_CMD_RECT_COPY - see with ubuntu */ 2685 2654 2686 default: 2655 2687 # ifdef VBOX_WITH_VMSVGA3D … … 2995 3027 /* context id + surface id? */ 2996 3028 break; 3029 3030 default: 3031 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoUnkCmds); 3032 AssertFailed(); 3033 break; 2997 3034 } 2998 3035 } 2999 3036 else 3000 3037 # endif // VBOX_WITH_VMSVGA3D 3038 { 3039 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoUnkCmds); 3001 3040 AssertFailed(); 3041 } 3002 3042 } 3003 3043 … … 3012 3052 } 3013 3053 ASMAtomicWriteU32(&pFIFO[SVGA_FIFO_STOP], offCurrentCmd); 3054 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoCommands); 3014 3055 3015 3056 /* FIFO progress might trigger an interrupt. */ … … 3747 3788 * Statistics. 3748 3789 */ 3749 STAM_REG(pVM, &pSVGAState->StatR3CmdPresent, STAMTYPE_PROFILE, "/Devices/VMSVGA/3d/Cmd/Present", STAMUNIT_TICKS_PER_CALL, "Profiling of Present."); 3750 STAM_REG(pVM, &pSVGAState->StatR3CmdDrawPrimitive, STAMTYPE_PROFILE, "/Devices/VMSVGA/3d/Cmd/DrawPrimitive", STAMUNIT_TICKS_PER_CALL, "Profiling of DrawPrimitive."); 3751 STAM_REG(pVM, &pSVGAState->StatR3CmdSurfaceDMA, STAMTYPE_PROFILE, "/Devices/VMSVGA/3d/Cmd/SurfaceDMA", STAMUNIT_TICKS_PER_CALL, "Profiling of SurfaceDMA."); 3790 STAM_REG(pVM, &pSVGAState->StatR3CmdPresent, STAMTYPE_PROFILE, "/Devices/VMSVGA/3d/Cmd/Present", STAMUNIT_TICKS_PER_CALL, "Profiling of Present."); 3791 STAM_REG(pVM, &pSVGAState->StatR3CmdDrawPrimitive, STAMTYPE_PROFILE, "/Devices/VMSVGA/3d/Cmd/DrawPrimitive", STAMUNIT_TICKS_PER_CALL, "Profiling of DrawPrimitive."); 3792 STAM_REG(pVM, &pSVGAState->StatR3CmdSurfaceDMA, STAMTYPE_PROFILE, "/Devices/VMSVGA/3d/Cmd/SurfaceDMA", STAMUNIT_TICKS_PER_CALL, "Profiling of SurfaceDMA."); 3793 STAM_REL_REG(pVM, &pSVGAState->StatFifoCommands, STAMTYPE_COUNTER, "/Devices/VMSVGA/FifoCommands", STAMUNIT_OCCURENCES, "FIFO command counter."); 3794 STAM_REL_REG(pVM, &pSVGAState->StatFifoErrors, STAMTYPE_COUNTER, "/Devices/VMSVGA/FifoErrors", STAMUNIT_OCCURENCES, "FIFO error counter."); 3795 STAM_REL_REG(pVM, &pSVGAState->StatFifoUnkCmds, STAMTYPE_COUNTER, "/Devices/VMSVGA/FifoUnknownCommands", STAMUNIT_OCCURENCES, "FIFO unknown command counter."); 3796 STAM_REL_REG(pVM, &pSVGAState->StatFifoTodoTimeout, STAMTYPE_COUNTER, "/Devices/VMSVGA/FifoTodoTimeout", STAMUNIT_OCCURENCES, "Number of times we discovered pending work after a wait timeout."); 3797 STAM_REL_REG(pVM, &pSVGAState->StatFifoTodoWoken, STAMTYPE_COUNTER, "/Devices/VMSVGA/FifoTodoWoken", STAMUNIT_OCCURENCES, "Number of times we discovered pending work after being woken up."); 3798 STAM_REL_REG(pVM, &pSVGAState->StatFifoStalls, STAMTYPE_PROFILE, "/Devices/VMSVGA/FifoStalls", STAMUNIT_TICKS_PER_CALL, "Profiling of FIFO stalls (waiting for guest to finish copying data)."); 3752 3799 3753 3800 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.