Changeset 104799 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 28, 2024 11:03:27 AM (8 months ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/DisplayImpl.h
r98103 r104799 190 190 191 191 #ifdef VBOX_WITH_RECORDING 192 int i_recordingInvalidate(void); 192 int i_recordingStart(void); 193 int i_recordingStop(void); 194 int i_recordingInvalidate(bool fForce = false); 193 195 void i_recordingScreenChanged(unsigned uScreenId); 194 196 #endif … … 420 422 #endif 421 423 424 #ifdef VBOX_WITH_STATISTICS 425 struct 426 { 427 /** Profiling Display::i_displayRefreshCallback(). */ 428 STAMPROFILE profileDisplayRefreshCallback; 429 /** Statistics for monitor N. */ 430 struct 431 { 432 /** Statistics for recording of monitor N. */ 433 struct 434 { 435 /** Profiling recording code of monitor N. */ 436 STAMPROFILE profileRecording; 437 } Recording; 438 } Monitor[SchemaDefs::MaxGuestMonitors]; 439 /** Statistics for audio/video recording. */ 440 struct 441 { 442 /** Profiling recording code of all active monitors. */ 443 STAMPROFILE profileRecording; 444 } Recording; 445 } Stats; 446 #endif 447 422 448 public: 423 449 -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r104713 r104799 6137 6137 && mRecording.mCtx.IsReady()) /* Any video recording (audio and/or video) feature enabled? */ 6138 6138 { 6139 vrc = pDisplay->i_recordingInvalidate(); 6140 if (RT_SUCCESS(vrc)) 6141 { 6142 vrc = i_recordingStart(pAutoLock); 6143 if (RT_FAILURE(vrc)) 6144 setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Recording start failed (%Rrc) -- please consult log file for details"), vrc); 6145 } 6139 vrc = i_recordingStart(pAutoLock); 6140 if (RT_FAILURE(vrc)) 6141 setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Recording start failed (%Rrc) -- please consult log file for details"), vrc); 6146 6142 } 6147 6143 } … … 7643 7639 int vrc = mRecording.mCtx.Start(); 7644 7640 if (RT_SUCCESS(vrc)) 7645 { 7646 for (unsigned uScreen = 0; uScreen < mRecording.mCtx.GetStreamCount(); uScreen++) 7647 mDisplay->i_recordingScreenChanged(uScreen); 7648 } 7641 vrc = mDisplay->i_recordingStart(); 7649 7642 7650 7643 LogFlowFuncLeaveRC(vrc); … … 7667 7660 int vrc = mRecording.mCtx.Stop(); 7668 7661 if (RT_SUCCESS(vrc)) 7669 { 7670 const size_t cStreams = mRecording.mCtx.GetStreamCount(); 7671 for (unsigned uScreen = 0; uScreen < cStreams; ++uScreen) 7672 mDisplay->i_recordingScreenChanged(uScreen); 7673 } 7662 vrc = mDisplay->i_recordingStop(); 7674 7663 7675 7664 LogFlowFuncLeaveRC(vrc); -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r99912 r104799 1595 1595 1596 1596 Console::SafeVMPtrQuiet ptrVM(mParent); 1597 if (ptrVM.isOk()) 1597 if (ptrVM.isOk()) /** @todo r=andy This apparently *never* is true at this point? */ 1598 1598 ptrVM.vtable()->pfnVMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT, 1599 1599 3, this, aScreenId, false); … … 2096 2096 #ifdef VBOX_WITH_RECORDING 2097 2097 /** 2098 * Starts video (+ audio) recording. 2099 * 2100 * @returns VBox status code. 2101 */ 2102 int Display::i_recordingStart(void) 2103 { 2104 #ifdef VBOX_WITH_STATISTICS 2105 Console::SafeVMPtrQuiet ptrVM(mParent); 2106 if (ptrVM.isOk()) 2107 { 2108 ptrVM.vtable()->pfnSTAMR3RegisterFU(ptrVM.rawUVM(), &Stats.profileDisplayRefreshCallback, 2109 STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, 2110 "Profiling display refresh.", "/Main/Display/ProfRefresh"); 2111 ptrVM.vtable()->pfnSTAMR3RegisterFU(ptrVM.rawUVM(), &Stats.Recording.profileRecording, 2112 STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, 2113 "Profiling recording time for all monitors.", "/Main/Display/ProfRecording"); 2114 2115 for (unsigned i = 0; i < mcMonitors; i++) 2116 ptrVM.vtable()->pfnSTAMR3RegisterFU(ptrVM.rawUVM(), &Stats.Monitor[i].Recording.profileRecording, 2117 STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, 2118 "Profiling recording time for this monitor.", "/Main/Display/Monitor%RU32/ProfRecording", i); 2119 } 2120 #endif 2121 2122 return i_recordingInvalidate(true /* fForce */); 2123 } 2124 2125 /** 2126 * Stops video (+ audio) recording. 2127 * 2128 * @returns VBox status code. 2129 */ 2130 int Display::i_recordingStop(void) 2131 { 2132 #ifdef VBOX_WITH_STATISTICS 2133 Console::SafeVMPtrQuiet ptrVM(mParent); 2134 if (ptrVM.isOk()) 2135 { 2136 ptrVM.vtable()->pfnSTAMR3DeregisterF(ptrVM.rawUVM(), "/Main/Display/ProfRefresh"); 2137 ptrVM.vtable()->pfnSTAMR3DeregisterF(ptrVM.rawUVM(), "/Main/Display/ProfRecording"); 2138 2139 for (unsigned i = 0; i < mcMonitors; i++) 2140 ptrVM.vtable()->pfnSTAMR3DeregisterF(ptrVM.rawUVM(), "/Main/Display/Monitor%RU32/ProfRecording", i); 2141 } 2142 #endif 2143 2144 return i_recordingInvalidate(true /* fForce */); 2145 } 2146 2147 /** 2098 2148 * Invalidates the recording configuration. 2099 2149 * 2100 * @returns IPRT status code. 2150 * @returns VBox status code. 2151 * @param fForce Whether to force invalidation or not. Default is @c false. 2101 2152 */ 2102 int Display::i_recordingInvalidate( void)2153 int Display::i_recordingInvalidate(bool fForce /* = false */) 2103 2154 { 2104 2155 RecordingContext *pCtx = mParent->i_recordingGetContext(); 2105 if (!pCtx || !pCtx->IsStarted())2156 if (!pCtx) 2106 2157 return VINF_SUCCESS; 2107 2158 … … 2111 2162 for (unsigned uScreen = 0; uScreen < mcMonitors; uScreen++) 2112 2163 { 2113 RecordingStream *pRecordingStream = pCtx->GetStream(uScreen);2114 2115 const boolfStreamEnabled = pRecordingStream->IsReady();2116 bool fChanged = maRecordingEnabled[uScreen] != fStreamEnabled;2164 const RecordingStream *pRecordingStream = pCtx->GetStream(uScreen); 2165 2166 bool const fStreamEnabled = pRecordingStream->IsReady(); 2167 bool const fChanged = (maRecordingEnabled[uScreen] != fStreamEnabled) || fForce; 2117 2168 2118 2169 maRecordingEnabled[uScreen] = fStreamEnabled; … … 2125 2176 } 2126 2177 2178 /** 2179 * Called when the recording state of a screen got changed. 2180 * 2181 * @param uScreenId ID of screen for which the recording state got changed. 2182 */ 2127 2183 void Display::i_recordingScreenChanged(unsigned uScreenId) 2128 2184 { … … 2942 2998 PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface); 2943 2999 2944 #ifdef DEBUG_sunlover_2 2945 LogFlowFunc(("pDrv->pDisplay->mfVideoAccelEnabled = %d\n", 2946 pDrv->pDisplay->mfVideoAccelEnabled)); 2947 #endif /* DEBUG_sunlover_2 */ 3000 STAM_PROFILE_START(&pDisplay->Stats.profileDisplayRefreshCallback, a); 2948 3001 2949 3002 Display *pDisplay = pDrv->pDisplay; … … 2990 3043 } 2991 3044 3045 STAM_REL_PROFILE_START(&pDisplay->Stats.Recording.profileRecording, b); 3046 2992 3047 uint64_t tsNowMs = RTTimeProgramMilliTS(); 2993 3048 for (uScreenId = 0; uScreenId < pDisplay->mcMonitors; uScreenId++) … … 2998 3053 if (!pCtx->NeedsUpdate(uScreenId, tsNowMs)) 2999 3054 continue; 3055 3056 STAM_REL_PROFILE_START(&pDisplay->Stats.Monitor[uScreenId].Recording.profileRecording, c); 3000 3057 3001 3058 DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[uScreenId]; … … 3039 3096 break; 3040 3097 } 3098 3099 STAM_REL_PROFILE_STOP(&pDisplay->Stats.Monitor[uScreenId].Recording.profileRecording, c); 3041 3100 } 3101 3102 STAM_REL_PROFILE_STOP(&pDisplay->Stats.Recording.profileRecording, b); 3103 3042 3104 } while (0); 3043 3105 } 3044 3106 #endif /* VBOX_WITH_RECORDING */ 3045 3107 3046 #ifdef DEBUG_sunlover_2 3047 LogFlowFunc(("leave\n")); 3048 #endif /* DEBUG_sunlover_2 */ 3108 STAM_PROFILE_STOP(&pDisplay->Stats.profileDisplayRefreshCallback, a); 3049 3109 } 3050 3110
Note:
See TracChangeset
for help on using the changeset viewer.