[Impeller] Vulkan GPU tracer cleanups (flutter/engine#46915)
Cleanups that seem to reduce occurance of SIGBUS crash, which It turns out I did not in fact fix.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace impeller {
|
||||
|
||||
static constexpr uint32_t kPoolSize = 128u;
|
||||
static constexpr uint32_t kPoolSize = 32u;
|
||||
|
||||
GPUTracerVK::GPUTracerVK(const std::weak_ptr<ContextVK>& context)
|
||||
: context_(context) {
|
||||
@@ -100,10 +100,9 @@ void GPUTracerVK::RecordEndFrameTime() {
|
||||
// On completion of the second time stamp recording, we read back this value
|
||||
// and the previous value. The difference is approximately the frame time.
|
||||
const auto device_holder = strong_context->GetDeviceHolder();
|
||||
if (!buffer->SubmitCommands([&, last_query,
|
||||
device_holder](CommandBuffer::Status status) {
|
||||
auto strong_context = context_.lock();
|
||||
if (!strong_context) {
|
||||
auto submitted = buffer->SubmitCommands(
|
||||
[&, last_query, device_holder](CommandBuffer::Status status) {
|
||||
if (status != CommandBuffer::Status::kCompleted) {
|
||||
return;
|
||||
}
|
||||
uint64_t bits[2] = {0, 0};
|
||||
@@ -111,19 +110,18 @@ void GPUTracerVK::RecordEndFrameTime() {
|
||||
query_pool_.get(), last_query, 2, sizeof(bits), &bits,
|
||||
sizeof(int64_t), vk::QueryResultFlagBits::e64);
|
||||
|
||||
if (result == vk::Result::eSuccess) {
|
||||
// This value should probably be available in some form besides a
|
||||
// timeline event but that is a job for a future Jonah.
|
||||
auto gpu_ms = (((bits[1] - bits[0]) * timestamp_period_) / 1000000);
|
||||
FML_TRACE_COUNTER(
|
||||
"flutter", "GPUTracer",
|
||||
reinterpret_cast<int64_t>(this), // Trace Counter ID
|
||||
"FrameTimeMS", gpu_ms);
|
||||
if (result != vk::Result::eSuccess) {
|
||||
return;
|
||||
}
|
||||
})) {
|
||||
if (!buffer->SubmitCommands()) {
|
||||
VALIDATION_LOG << "GPUTracerVK failed to record frame end time.";
|
||||
}
|
||||
// This value should probably be available in some form besides a
|
||||
// timeline event but that is a job for a future Jonah.
|
||||
auto gpu_ms = (((bits[1] - bits[0]) * timestamp_period_) / 1000000);
|
||||
FML_TRACE_COUNTER("flutter", "GPUTracer",
|
||||
reinterpret_cast<int64_t>(this), // Trace Counter ID
|
||||
"FrameTimeMS", gpu_ms);
|
||||
});
|
||||
if (!submitted) {
|
||||
VALIDATION_LOG << "GPUTracerVK failed to record frame end time.";
|
||||
}
|
||||
|
||||
if (current_index_ == kPoolSize - 1) {
|
||||
|
||||
Reference in New Issue
Block a user