Commit d5cef305 by Jamie Madill Committed by Commit Bot

Vulkan: Add more trace events.

This captures a bit more information about where the call time goes during a flush. It can show at least on desktop NVIDIA that we spend a fair amount of time in vkQueuePresentKHR. Bug: angleproject:3117 Change-Id: I2d0195b9338bcac80e8dd8cfb550402271f286f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1650787 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 44168468
......@@ -1431,8 +1431,14 @@ angle::Result RendererVk::queueWaitIdle(vk::Context *context)
VkResult RendererVk::queuePresent(const VkPresentInfoKHR &presentInfo)
{
ANGLE_TRACE_EVENT0("gpu.angle", "RendererVk::queuePresent");
std::lock_guard<decltype(mQueueMutex)> lock(mQueueMutex);
return vkQueuePresentKHR(mQueue, &presentInfo);
{
ANGLE_TRACE_EVENT0("gpu.angle", "vkQueuePresentKHR");
return vkQueuePresentKHR(mQueue, &presentInfo);
}
}
Serial RendererVk::nextSerial()
......
......@@ -866,6 +866,8 @@ angle::Result WindowSurfaceVk::present(ContextVk *contextVk,
EGLint n_rects,
bool &swapchainOutOfDate)
{
ANGLE_TRACE_EVENT0("gpu.angle", "WindowSurfaceVk::present");
// Throttle the submissions to avoid getting too far ahead of the GPU.
SwapHistory &swap = mSwapHistory[mCurrentSwapHistoryIndex];
{
......@@ -982,6 +984,8 @@ angle::Result WindowSurfaceVk::present(ContextVk *contextVk,
angle::Result WindowSurfaceVk::swapImpl(const gl::Context *context, EGLint *rects, EGLint n_rects)
{
ANGLE_TRACE_EVENT0("gpu.angle", "WindowSurfaceVk::swapImpl");
ContextVk *contextVk = vk::GetImpl(context);
DisplayVk *displayVk = vk::GetImpl(context->getDisplay());
......
......@@ -2,67 +2,60 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
angle_perf_tests_sources = [
_angle_perf_test_common_sources = [
"../third_party/trace_event/trace_event.h",
"perf_tests/ANGLEPerfTest.cpp",
"perf_tests/ANGLEPerfTest.h",
"perf_tests/ANGLEPerfTestArgs.cpp",
"perf_tests/ANGLEPerfTestArgs.h",
"perf_tests/BlitFramebufferPerf.cpp",
"perf_tests/BindingPerf.cpp",
"perf_tests/BufferSubData.cpp",
"perf_tests/ClearPerf.cpp",
"perf_tests/DispatchComputePerf.cpp",
"perf_tests/DrawCallPerf.cpp",
"perf_tests/DrawCallPerfParams.cpp",
"perf_tests/DrawCallPerfParams.h",
"perf_tests/DrawElementsPerf.cpp",
"perf_tests/DynamicPromotionPerfTest.cpp",
"perf_tests/EGLMakeCurrentPerf.cpp",
"perf_tests/IndexConversionPerf.cpp",
"perf_tests/InstancingPerf.cpp",
"perf_tests/InterleavedAttributeData.cpp",
"perf_tests/LinkProgramPerfTest.cpp",
"perf_tests/MultiviewPerf.cpp",
"perf_tests/PointSprites.cpp",
"perf_tests/TextureSampling.cpp",
"perf_tests/TextureUploadPerf.cpp",
"perf_tests/TexturesPerf.cpp",
"perf_tests/UniformsPerf.cpp",
"perf_tests/VulkanBarriersPerf.cpp",
"perf_tests/glmark2Benchmark.cpp",
"perf_tests/third_party/perf/perf_test.cc",
"perf_tests/third_party/perf/perf_test.h",
"test_utils/ANGLETest.cpp",
"test_utils/ANGLETest.h",
"test_utils/MultiviewTest.cpp",
"test_utils/MultiviewTest.h",
"test_utils/angle_test_configs.cpp",
"test_utils/angle_test_configs.h",
"test_utils/angle_test_instantiate.cpp",
"test_utils/angle_test_instantiate.h",
"test_utils/draw_call_perf_utils.cpp",
"test_utils/draw_call_perf_utils.h",
"test_utils/gl_raii.h",
]
angle_white_box_perf_tests_sources = [
"angle_unittests_utils.h",
"perf_tests/ANGLEPerfTest.cpp",
"perf_tests/ANGLEPerfTest.h",
"perf_tests/ANGLEPerfTestArgs.cpp",
"perf_tests/ANGLEPerfTestArgs.h",
"perf_tests/BitSetIteratorPerf.cpp",
"perf_tests/CompilerPerf.cpp",
"perf_tests/EGLInitializePerf.cpp", # Uses ANGLEGetDisplayPlatform, a non-standard EP.
"perf_tests/ResultPerf.cpp",
"perf_tests/third_party/perf/perf_test.cc",
"perf_tests/third_party/perf/perf_test.h",
"test_utils/angle_test_configs.cpp",
"test_utils/angle_test_configs.h",
"test_utils/angle_test_instantiate.cpp",
"test_utils/angle_test_instantiate.h",
"test_utils/gl_raii.h",
]
angle_perf_tests_sources = _angle_perf_test_common_sources + [
"perf_tests/BlitFramebufferPerf.cpp",
"perf_tests/BindingPerf.cpp",
"perf_tests/BufferSubData.cpp",
"perf_tests/ClearPerf.cpp",
"perf_tests/DispatchComputePerf.cpp",
"perf_tests/DrawCallPerf.cpp",
"perf_tests/DrawCallPerfParams.cpp",
"perf_tests/DrawCallPerfParams.h",
"perf_tests/DrawElementsPerf.cpp",
"perf_tests/DynamicPromotionPerfTest.cpp",
"perf_tests/EGLMakeCurrentPerf.cpp",
"perf_tests/IndexConversionPerf.cpp",
"perf_tests/InstancingPerf.cpp",
"perf_tests/InterleavedAttributeData.cpp",
"perf_tests/LinkProgramPerfTest.cpp",
"perf_tests/MultiviewPerf.cpp",
"perf_tests/PointSprites.cpp",
"perf_tests/TextureSampling.cpp",
"perf_tests/TextureUploadPerf.cpp",
"perf_tests/TexturesPerf.cpp",
"perf_tests/UniformsPerf.cpp",
"perf_tests/VulkanBarriersPerf.cpp",
"perf_tests/glmark2Benchmark.cpp",
"test_utils/ANGLETest.cpp",
"test_utils/ANGLETest.h",
"test_utils/MultiviewTest.cpp",
"test_utils/MultiviewTest.h",
"test_utils/draw_call_perf_utils.cpp",
"test_utils/draw_call_perf_utils.h",
]
angle_white_box_perf_tests_sources = _angle_perf_test_common_sources + [
"angle_unittests_utils.h",
"perf_tests/BitSetIteratorPerf.cpp",
"perf_tests/CompilerPerf.cpp",
"perf_tests/EGLInitializePerf.cpp", # Uses ANGLEGetDisplayPlatform, a non-standard EP.
"perf_tests/ResultPerf.cpp",
]
angle_white_box_perf_tests_win_sources =
[ "perf_tests/IndexDataManagerTest.cpp" ]
......
......@@ -12,6 +12,7 @@
#include "ANGLEPerfTestArgs.h"
#include "common/platform.h"
#include "third_party/perf/perf_test.h"
#include "third_party/trace_event/trace_event.h"
#include "util/shader_utils.h"
#include "util/system_utils.h"
......@@ -57,17 +58,17 @@ void OverrideWorkaroundsD3D(angle::PlatformMethods *platform, angle::FeaturesD3D
angleRenderTest->overrideWorkaroundsD3D(featuresD3D);
}
angle::TraceEventHandle AddTraceEvent(angle::PlatformMethods *platform,
char phase,
const unsigned char *categoryEnabledFlag,
const char *name,
unsigned long long id,
double timestamp,
int numArgs,
const char **argNames,
const unsigned char *argTypes,
const unsigned long long *argValues,
unsigned char flags)
angle::TraceEventHandle AddPerfTraceEvent(angle::PlatformMethods *platform,
char phase,
const unsigned char *categoryEnabledFlag,
const char *name,
unsigned long long id,
double timestamp,
int numArgs,
const char **argNames,
const unsigned char *argTypes,
const unsigned long long *argValues,
unsigned char flags)
{
if (!gEnableTrace)
return 0;
......@@ -84,7 +85,7 @@ angle::TraceEventHandle AddTraceEvent(angle::PlatformMethods *platform,
return buffer.size();
}
const unsigned char *GetTraceCategoryEnabledFlag(angle::PlatformMethods *platform,
const unsigned char *GetPerfTraceCategoryEnabled(angle::PlatformMethods *platform,
const char *categoryName)
{
if (gEnableTrace)
......@@ -420,8 +421,8 @@ void ANGLERenderTest::SetUp()
mPlatformMethods.logError = EmptyPlatformMethod;
mPlatformMethods.logWarning = EmptyPlatformMethod;
mPlatformMethods.logInfo = EmptyPlatformMethod;
mPlatformMethods.addTraceEvent = AddTraceEvent;
mPlatformMethods.getTraceCategoryEnabledFlag = GetTraceCategoryEnabledFlag;
mPlatformMethods.addTraceEvent = AddPerfTraceEvent;
mPlatformMethods.getTraceCategoryEnabledFlag = GetPerfTraceCategoryEnabled;
mPlatformMethods.updateTraceEventDuration = UpdateTraceEventDuration;
mPlatformMethods.monotonicallyIncreasingTime = MonotonicallyIncreasingTime;
mPlatformMethods.context = this;
......@@ -500,8 +501,28 @@ void ANGLERenderTest::TearDown()
ANGLEPerfTest::TearDown();
}
void ANGLERenderTest::beginInternalTraceEvent(const char *name)
{
if (gEnableTrace)
{
mTraceEventBuffer.emplace_back(TRACE_EVENT_PHASE_BEGIN, gTraceCategories[0].name, name,
MonotonicallyIncreasingTime(&mPlatformMethods));
}
}
void ANGLERenderTest::endInternalTraceEvent(const char *name)
{
if (gEnableTrace)
{
mTraceEventBuffer.emplace_back(TRACE_EVENT_PHASE_END, gTraceCategories[0].name, name,
MonotonicallyIncreasingTime(&mPlatformMethods));
}
}
void ANGLERenderTest::step()
{
beginInternalTraceEvent("step");
// Clear events that the application did not process from this frame
Event event;
bool closed = false;
......@@ -528,6 +549,8 @@ void ANGLERenderTest::step()
mGLWindow->swap();
mOSWindow->messageLoop();
}
endInternalTraceEvent("step");
}
void ANGLERenderTest::startGpuTimer()
......
......@@ -147,6 +147,9 @@ class ANGLERenderTest : public ANGLEPerfTest
void startGpuTimer();
void stopGpuTimer();
void beginInternalTraceEvent(const char *name);
void endInternalTraceEvent(const char *name);
private:
void SetUp() override;
void TearDown() override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment