From c64159ca25100e9e3c4be57cdde3431341861359 Mon Sep 17 00:00:00 2001 From: Yuly Novikov Date: Tue, 25 Jan 2022 22:13:03 +0000 Subject: [PATCH] Revert "Recording timing info in trace events when D3D12 queue submit" This reverts commit 8e9fbbe7caa414f7006d0568d918561b5ca9a94f. Reason for revert: crashes on Win7 Original change's description: > Recording timing info in trace events when D3D12 queue submit > > Add a toggle RecordDetailedTimingInTraceEvents. When this toggle is > enabled, record detailed timing information in trace events right > before calling ExecuteCommandLists on a D3D12 command queue, and the > information includes system time, CPU timestamp, GPU timestamp, and > their frequency. > > Bug: dawn:1264 > Change-Id: Ie06d3f2b7eb25c641ee00476334bd276227c3678 > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/77381 > Reviewed-by: Corentin Wallez > Commit-Queue: Zhaoming Jiang TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org,zhaoming.jiang@intel.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com Change-Id: I7884e1c9cb580237bfa65790e12879a075720b18 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: dawn:1264, chromium:1290964 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/78250 Bot-Commit: rubber-stamper@appspot.gserviceaccount.com Reviewed-by: Austin Eng Commit-Queue: Yuly Novikov --- src/dawn_native/Toggles.cpp | 7 --- src/dawn_native/Toggles.h | 1 - .../d3d12/CommandRecordingContext.cpp | 43 ------------------- 3 files changed, 51 deletions(-) diff --git a/src/dawn_native/Toggles.cpp b/src/dawn_native/Toggles.cpp index 757d4ffddc..63dcdda036 100644 --- a/src/dawn_native/Toggles.cpp +++ b/src/dawn_native/Toggles.cpp @@ -230,13 +230,6 @@ namespace dawn::native { "Enable optimizations when compiling with FXC. Disabled by default because FXC " "miscompiles in many cases when optimizations are enabled.", "https://crbug.com/dawn/1203"}}, - {Toggle::RecordDetailedTimingInTraceEvents, - {"record_detailed_timing_in_trace_events", - "Record detailed timing information in trace events at certain point. Currently the " - "timing information is recorded right before calling ExecuteCommandLists on a D3D12 " - "command queue, and the information includes system time, CPU timestamp, GPU " - "timestamp, and their frequency.", - "https://crbug.com/dawn/1264"}}, // Dummy comment to separate the }} so it is clearer what to copy-paste to add a toggle. }}; diff --git a/src/dawn_native/Toggles.h b/src/dawn_native/Toggles.h index 5b7e97c907..0fc748ffd5 100644 --- a/src/dawn_native/Toggles.h +++ b/src/dawn_native/Toggles.h @@ -61,7 +61,6 @@ namespace dawn::native { DisableR8RG8Mipmaps, UseDummyFragmentInVertexOnlyPipeline, FxcOptimizations, - RecordDetailedTimingInTraceEvents, EnumCount, InvalidEnum = EnumCount, diff --git a/src/dawn_native/d3d12/CommandRecordingContext.cpp b/src/dawn_native/d3d12/CommandRecordingContext.cpp index f6f00108fb..6749c2c30f 100644 --- a/src/dawn_native/d3d12/CommandRecordingContext.cpp +++ b/src/dawn_native/d3d12/CommandRecordingContext.cpp @@ -12,18 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "dawn_native/d3d12/CommandRecordingContext.h" - #include "dawn_native/d3d12/CommandAllocatorManager.h" #include "dawn_native/d3d12/D3D12Error.h" #include "dawn_native/d3d12/DeviceD3D12.h" #include "dawn_native/d3d12/HeapD3D12.h" #include "dawn_native/d3d12/ResidencyManagerD3D12.h" -#include "dawn_platform/DawnPlatform.h" -#include "dawn_platform/tracing/TraceEvent.h" - -#include -#include -#include namespace dawn::native::d3d12 { @@ -81,42 +74,6 @@ namespace dawn::native::d3d12 { DAWN_TRY(device->GetResidencyManager()->EnsureHeapsAreResident( mHeapsPendingUsage.data(), mHeapsPendingUsage.size())); - if (device->IsToggleEnabled(Toggle::RecordDetailedTimingInTraceEvents)) { - // We assume that all WIN32 APIs used here are available. Windows 8 or above support - // all of them, and using D3D12 requires Windows 10 or above, so it should be safe. - FILETIME systemTimePrecise; - uint64_t gpuTimestamp; - uint64_t cpuTimestamp; - - GetSystemTimePreciseAsFileTime(&systemTimePrecise); - device->GetCommandQueue()->GetClockCalibration(&gpuTimestamp, &cpuTimestamp); - - uint64_t gpuFrequency; - uint64_t cpuFrequency; - LARGE_INTEGER cpuFrequencyLargeInteger; - device->GetCommandQueue()->GetTimestampFrequency(&gpuFrequency); - QueryPerformanceFrequency(&cpuFrequencyLargeInteger); - cpuFrequency = cpuFrequencyLargeInteger.QuadPart; - - SYSTEMTIME systemTime; - FileTimeToSystemTime(&systemTimePrecise, &systemTime); - - std::string timingInfo = absl::StrFormat( - "Time of Day: %u/%u/%u %02u:%02u:%02u.%03u, Precise System Time: %u, CPU " - "Timestamp: %u, GPU Timestamp: %u, CPU Tick Frequency: %u, GPU Tick Frequency: " - "%u", - systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour, - systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds, - (static_cast(systemTimePrecise.dwHighDateTime) << 32) + - systemTimePrecise.dwLowDateTime, - cpuTimestamp, gpuTimestamp, cpuFrequency, gpuFrequency); - - TRACE_EVENT_INSTANT1( - device->GetPlatform(), General, - "d3d12::CommandRecordingContext::ExecuteCommandList Detailed Timing", "Timing", - timingInfo.c_str()); - } - ID3D12CommandList* d3d12CommandList = GetCommandList(); device->GetCommandQueue()->ExecuteCommandLists(1, &d3d12CommandList);