[Impeller] Remove GPUTracer. (flutter/engine#41079)

[Impeller] Remove GPUTracer.
This commit is contained in:
Chinmay Garde
2023-04-11 10:07:16 -07:00
committed by GitHub
parent 753f2a77b1
commit d56e587985
12 changed files with 0 additions and 252 deletions

View File

@@ -1442,8 +1442,6 @@ ORIGIN: ../../../flutter/impeller/renderer/backend/metal/device_buffer_mtl.h + .
ORIGIN: ../../../flutter/impeller/renderer/backend/metal/device_buffer_mtl.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/metal/formats_mtl.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/metal/formats_mtl.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/metal/gpu_tracer_mtl.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/metal/gpu_tracer_mtl.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/metal/pipeline_library_mtl.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/metal/pipeline_library_mtl.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/metal/pipeline_mtl.h + ../../../flutter/LICENSE
@@ -1547,8 +1545,6 @@ ORIGIN: ../../../flutter/impeller/renderer/compute_tessellator.cc + ../../../flu
ORIGIN: ../../../flutter/impeller/renderer/compute_tessellator.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/context.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/context.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/gpu_tracer.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/gpu_tracer.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/path_polyline.comp + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/pipeline.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/pipeline.h + ../../../flutter/LICENSE
@@ -4030,8 +4026,6 @@ FILE: ../../../flutter/impeller/renderer/backend/metal/device_buffer_mtl.h
FILE: ../../../flutter/impeller/renderer/backend/metal/device_buffer_mtl.mm
FILE: ../../../flutter/impeller/renderer/backend/metal/formats_mtl.h
FILE: ../../../flutter/impeller/renderer/backend/metal/formats_mtl.mm
FILE: ../../../flutter/impeller/renderer/backend/metal/gpu_tracer_mtl.h
FILE: ../../../flutter/impeller/renderer/backend/metal/gpu_tracer_mtl.mm
FILE: ../../../flutter/impeller/renderer/backend/metal/pipeline_library_mtl.h
FILE: ../../../flutter/impeller/renderer/backend/metal/pipeline_library_mtl.mm
FILE: ../../../flutter/impeller/renderer/backend/metal/pipeline_mtl.h
@@ -4135,8 +4129,6 @@ FILE: ../../../flutter/impeller/renderer/compute_tessellator.cc
FILE: ../../../flutter/impeller/renderer/compute_tessellator.h
FILE: ../../../flutter/impeller/renderer/context.cc
FILE: ../../../flutter/impeller/renderer/context.h
FILE: ../../../flutter/impeller/renderer/gpu_tracer.cc
FILE: ../../../flutter/impeller/renderer/gpu_tracer.h
FILE: ../../../flutter/impeller/renderer/path_polyline.comp
FILE: ../../../flutter/impeller/renderer/pipeline.cc
FILE: ../../../flutter/impeller/renderer/pipeline.h

View File

@@ -63,8 +63,6 @@ impeller_component("renderer") {
"compute_pipeline_descriptor.h",
"context.cc",
"context.h",
"gpu_tracer.cc",
"gpu_tracer.h",
"pipeline.cc",
"pipeline.h",
"pipeline_builder.cc",

View File

@@ -24,8 +24,6 @@ impeller_component("metal") {
"device_buffer_mtl.mm",
"formats_mtl.h",
"formats_mtl.mm",
"gpu_tracer_mtl.h",
"gpu_tracer_mtl.mm",
"pipeline_library_mtl.h",
"pipeline_library_mtl.mm",
"pipeline_mtl.h",

View File

@@ -14,7 +14,6 @@
#include "impeller/core/sampler.h"
#include "impeller/renderer/backend/metal/allocator_mtl.h"
#include "impeller/renderer/backend/metal/command_buffer_mtl.h"
#include "impeller/renderer/backend/metal/gpu_tracer_mtl.h"
#include "impeller/renderer/backend/metal/pipeline_library_mtl.h"
#include "impeller/renderer/backend/metal/shader_library_mtl.h"
#include "impeller/renderer/capabilities.h"
@@ -55,9 +54,6 @@ class ContextMTL final : public Context,
// |Context|
std::shared_ptr<CommandBuffer> CreateCommandBuffer() const override;
// |Context|
std::shared_ptr<GPUTracer> GetGPUTracer() const override;
// |Context|
const std::shared_ptr<const Capabilities>& GetCapabilities() const override;
@@ -71,7 +67,6 @@ class ContextMTL final : public Context,
std::shared_ptr<PipelineLibraryMTL> pipeline_library_;
std::shared_ptr<SamplerLibrary> sampler_library_;
std::shared_ptr<AllocatorMTL> resource_allocator_;
std::shared_ptr<GPUTracerMTL> gpu_tracer_;
std::shared_ptr<const Capabilities> device_capabilities_;
bool is_valid_ = false;

View File

@@ -120,12 +120,6 @@ ContextMTL::ContextMTL(id<MTLDevice> device,
}
}
#if (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) || \
(FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_PROFILE)
// Setup the gpu tracer.
{ gpu_tracer_ = std::shared_ptr<GPUTracerMTL>(new GPUTracerMTL(device_)); }
#endif
device_capabilities_ =
InferMetalCapabilities(device_, PixelFormat::kB8G8R8A8UNormInt);
@@ -255,10 +249,6 @@ std::shared_ptr<CommandBuffer> ContextMTL::CreateCommandBuffer() const {
return CreateCommandBufferInQueue(command_queue_);
}
std::shared_ptr<GPUTracer> ContextMTL::GetGPUTracer() const {
return gpu_tracer_;
}
std::shared_ptr<CommandBuffer> ContextMTL::CreateCommandBufferInQueue(
id<MTLCommandQueue> queue) const {
if (!IsValid()) {

View File

@@ -1,40 +0,0 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include <Metal/Metal.h>
#include "flutter/fml/macros.h"
#include "impeller/base/backend_cast.h"
#include "impeller/renderer/gpu_tracer.h"
namespace impeller {
class GPUTracerMTL final : public GPUTracer,
public BackendCast<GPUTracerMTL, GPUTracer> {
public:
// |GPUTracer|
~GPUTracerMTL() override;
// |GPUTracer|
bool StartCapturingFrame(GPUTracerConfiguration configuration) override;
// |GPUTracer|
bool StopCapturingFrame() override;
private:
friend class ContextMTL;
id<MTLDevice> device_;
GPUTracerMTL(id<MTLDevice> device);
NSURL* GetUniqueGPUTraceSavedURL() const;
NSURL* GetGPUTraceSavedDictionaryURL() const;
bool CreateGPUTraceSavedDictionaryIfNeeded() const;
FML_DISALLOW_COPY_AND_ASSIGN(GPUTracerMTL);
};
} // namespace impeller

View File

@@ -1,102 +0,0 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "impeller/renderer/backend/metal/gpu_tracer_mtl.h"
#include <fml/logging.h>
namespace impeller {
GPUTracerMTL::GPUTracerMTL(id<MTLDevice> device) : device_(device) {}
GPUTracerMTL::~GPUTracerMTL() = default;
bool GPUTracerMTL::StartCapturingFrame(GPUTracerConfiguration configuration) {
if (!device_) {
return false;
}
MTLCaptureManager* captureManager = [MTLCaptureManager sharedCaptureManager];
if (captureManager.isCapturing) {
return false;
}
if (@available(iOS 13.0, macOS 10.15, *)) {
MTLCaptureDescriptor* desc = [[MTLCaptureDescriptor alloc] init];
desc.captureObject = device_;
MTLCaptureDestination targetDestination =
configuration.mtl_frame_capture_save_trace_as_document
? MTLCaptureDestinationGPUTraceDocument
: MTLCaptureDestinationDeveloperTools;
if (![captureManager supportsDestination:targetDestination]) {
return false;
}
desc.destination = targetDestination;
if (configuration.mtl_frame_capture_save_trace_as_document) {
if (!CreateGPUTraceSavedDictionaryIfNeeded()) {
return false;
}
NSURL* outputURL = GetUniqueGPUTraceSavedURL();
desc.outputURL = outputURL;
}
return [captureManager startCaptureWithDescriptor:desc error:nil];
}
[captureManager startCaptureWithDevice:device_];
return captureManager.isCapturing;
}
bool GPUTracerMTL::StopCapturingFrame() {
if (!device_) {
return false;
}
MTLCaptureManager* captureManager = [MTLCaptureManager sharedCaptureManager];
if (!captureManager.isCapturing) {
return false;
}
[captureManager stopCapture];
return !captureManager.isCapturing;
}
NSURL* GPUTracerMTL::GetUniqueGPUTraceSavedURL() const {
NSURL* savedDictionaryURL = GetGPUTraceSavedDictionaryURL();
NSString* uniqueID = [NSUUID UUID].UUIDString;
return [[savedDictionaryURL URLByAppendingPathComponent:uniqueID]
URLByAppendingPathExtension:@"gputrace"];
}
bool GPUTracerMTL::CreateGPUTraceSavedDictionaryIfNeeded() const {
NSFileManager* fileManager = [NSFileManager defaultManager];
NSURL* gpuTraceSavedDictionaryURL = GetGPUTraceSavedDictionaryURL();
if ([fileManager fileExistsAtPath:gpuTraceSavedDictionaryURL.path]) {
return true;
}
NSError* error = nil;
[fileManager createDirectoryAtURL:gpuTraceSavedDictionaryURL
withIntermediateDirectories:NO
attributes:nil
error:&error];
if (error != nil) {
FML_LOG(ERROR) << "Metal frame capture "
"CreateGPUTraceSavedDictionaryIfNeeded failed.";
return false;
}
return true;
}
NSURL* GPUTracerMTL::GetGPUTraceSavedDictionaryURL() const {
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString* docPath = [paths objectAtIndex:0];
NSURL* docURL = [NSURL fileURLWithPath:docPath];
NSURL* gpuTraceDictionaryURL =
[docURL URLByAppendingPathComponent:@"MetalCaptureGPUTrace"];
return gpuTraceDictionaryURL;
}
} // namespace impeller

View File

@@ -10,10 +10,6 @@ Context::~Context() = default;
Context::Context() = default;
std::shared_ptr<GPUTracer> Context::GetGPUTracer() const {
return nullptr;
}
bool Context::UpdateOffscreenLayerPixelFormat(PixelFormat format) {
return false;
}

View File

@@ -18,7 +18,6 @@ class SamplerLibrary;
class CommandBuffer;
class PipelineLibrary;
class Allocator;
class GPUTracer;
class Context : public std::enable_shared_from_this<Context> {
public:
@@ -41,8 +40,6 @@ class Context : public std::enable_shared_from_this<Context> {
virtual std::shared_ptr<CommandBuffer> CreateCommandBuffer() const = 0;
virtual std::shared_ptr<GPUTracer> GetGPUTracer() const;
protected:
Context();

View File

@@ -1,21 +0,0 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gpu_tracer.h"
namespace impeller {
GPUTracer::GPUTracer() = default;
GPUTracer::~GPUTracer() = default;
bool GPUTracer::StartCapturingFrame(GPUTracerConfiguration configuration) {
return false;
}
bool GPUTracer::StopCapturingFrame() {
return false;
}
} // namespace impeller

View File

@@ -1,53 +0,0 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/fml/macros.h"
namespace impeller {
//------------------------------------------------------------------------------
/// @brief GPU tracer configuration.
///
struct GPUTracerConfiguration {
/// This param is for metal backend.
/// When this value is true, a gpu trace file will be saved in devices when
/// metal frame capture finishes. Otherwise, the Xcode will automatically open
/// and show trace result.
///
bool mtl_frame_capture_save_trace_as_document = false;
};
//------------------------------------------------------------------------------
/// @brief A GPU tracer to trace gpu workflow during rendering.
///
class GPUTracer {
public:
virtual ~GPUTracer();
//----------------------------------------------------------------------------
/// @brief Start capturing frame. This method should only be called when
/// developing.
///
/// @param[in] configuration The configuration passed in for capture.
///
/// @return The operation successful or not.
///
virtual bool StartCapturingFrame(GPUTracerConfiguration configuration);
//----------------------------------------------------------------------------
/// @brief Stop capturing frame. This should only be called when
/// developing.
///
/// @return The operation successful or not.
///
virtual bool StopCapturingFrame();
protected:
GPUTracer();
private:
FML_DISALLOW_COPY_AND_ASSIGN(GPUTracer);
};
} // namespace impeller

View File

@@ -97,8 +97,6 @@ class MockImpellerContext : public Context {
MOCK_CONST_METHOD0(CreateCommandBuffer, std::shared_ptr<CommandBuffer>());
MOCK_CONST_METHOD0(GetGPUTracer, std::shared_ptr<GPUTracer>());
MOCK_CONST_METHOD0(GetCapabilities,
const std::shared_ptr<const Capabilities>&());
};