[Impeller] Remove work queues. (flutter/engine#40429)

[Impeller] Remove work queues.
This commit is contained in:
Chinmay Garde
2023-03-18 16:42:34 -07:00
committed by GitHub
parent fb267333fa
commit 5efbf9ae44
17 changed files with 0 additions and 258 deletions

View File

@@ -1040,8 +1040,6 @@ ORIGIN: ../../../flutter/impeller/base/backend_cast.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/comparable.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/comparable.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/config.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/platform/darwin/work_queue_darwin.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/platform/darwin/work_queue_darwin.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/promise.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/promise.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/strings.cc + ../../../flutter/LICENSE
@@ -1055,10 +1053,6 @@ ORIGIN: ../../../flutter/impeller/base/validation.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/validation.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/version.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/version.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/work_queue.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/work_queue.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/work_queue_common.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/base/work_queue_common.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/blobcat/blob.fbs + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/blobcat/blob_library.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/blobcat/blob_library.h + ../../../flutter/LICENSE
@@ -3577,8 +3571,6 @@ FILE: ../../../flutter/impeller/base/backend_cast.h
FILE: ../../../flutter/impeller/base/comparable.cc
FILE: ../../../flutter/impeller/base/comparable.h
FILE: ../../../flutter/impeller/base/config.h
FILE: ../../../flutter/impeller/base/platform/darwin/work_queue_darwin.cc
FILE: ../../../flutter/impeller/base/platform/darwin/work_queue_darwin.h
FILE: ../../../flutter/impeller/base/promise.cc
FILE: ../../../flutter/impeller/base/promise.h
FILE: ../../../flutter/impeller/base/strings.cc
@@ -3592,10 +3584,6 @@ FILE: ../../../flutter/impeller/base/validation.cc
FILE: ../../../flutter/impeller/base/validation.h
FILE: ../../../flutter/impeller/base/version.cc
FILE: ../../../flutter/impeller/base/version.h
FILE: ../../../flutter/impeller/base/work_queue.cc
FILE: ../../../flutter/impeller/base/work_queue.h
FILE: ../../../flutter/impeller/base/work_queue_common.cc
FILE: ../../../flutter/impeller/base/work_queue_common.h
FILE: ../../../flutter/impeller/blobcat/blob.fbs
FILE: ../../../flutter/impeller/blobcat/blob_library.cc
FILE: ../../../flutter/impeller/blobcat/blob_library.h

View File

@@ -25,19 +25,8 @@ impeller_component("base") {
"validation.h",
"version.cc",
"version.h",
"work_queue.cc",
"work_queue.h",
"work_queue_common.cc",
"work_queue_common.h",
]
if (is_ios || is_mac) {
sources += [
"platform/darwin/work_queue_darwin.cc",
"platform/darwin/work_queue_darwin.h",
]
}
deps = [ "//flutter/fml" ]
}

View File

@@ -1,38 +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/base/platform/darwin/work_queue_darwin.h"
namespace impeller {
std::shared_ptr<WorkQueueDarwin> WorkQueueDarwin::Create() {
auto queue = std::shared_ptr<WorkQueueDarwin>(new WorkQueueDarwin());
if (!queue->IsValid()) {
return nullptr;
}
return queue;
}
WorkQueueDarwin::WorkQueueDarwin()
: queue_(::dispatch_queue_create(
"io.flutter.impeller.wq",
::dispatch_queue_attr_make_with_qos_class(
DISPATCH_QUEUE_CONCURRENT_WITH_AUTORELEASE_POOL,
QOS_CLASS_USER_INITIATED,
-1))) {}
WorkQueueDarwin::~WorkQueueDarwin() = default;
bool WorkQueueDarwin::IsValid() const {
return queue_ != NULL;
}
// |WorkQueue|
void WorkQueueDarwin::PostTask(fml::closure task) {
dispatch_async(queue_, ^() {
task();
});
}
} // namespace impeller

View File

@@ -1,36 +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 <dispatch/dispatch.h>
#include <memory>
#include "flutter/fml/macros.h"
#include "impeller/base/work_queue.h"
namespace impeller {
class WorkQueueDarwin final : public WorkQueue {
public:
static std::shared_ptr<WorkQueueDarwin> Create();
// |WorkQueue|
~WorkQueueDarwin();
bool IsValid() const;
private:
dispatch_queue_t queue_ = NULL;
WorkQueueDarwin();
// |WorkQueue|
void PostTask(fml::closure task) override;
FML_DISALLOW_COPY_AND_ASSIGN(WorkQueueDarwin);
};
} // namespace impeller

View File

@@ -1,13 +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/impeller/base/work_queue.h"
namespace impeller {
WorkQueue::WorkQueue() = default;
WorkQueue::~WorkQueue() = default;
} // namespace impeller

View File

@@ -1,27 +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 <memory>
#include "flutter/fml/closure.h"
#include "flutter/fml/macros.h"
namespace impeller {
class WorkQueue : public std::enable_shared_from_this<WorkQueue> {
public:
virtual ~WorkQueue();
virtual void PostTask(fml::closure task) = 0;
protected:
WorkQueue();
private:
FML_DISALLOW_COPY_AND_ASSIGN(WorkQueue);
};
} // namespace impeller

View File

@@ -1,25 +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/base/work_queue_common.h"
namespace impeller {
std::shared_ptr<WorkQueueCommon> WorkQueueCommon::Create() {
return std::shared_ptr<WorkQueueCommon>(new WorkQueueCommon());
}
WorkQueueCommon::WorkQueueCommon()
: loop_(fml::ConcurrentMessageLoop::Create(2u)) {}
WorkQueueCommon::~WorkQueueCommon() {
loop_->Terminate();
}
// |WorkQueue|
void WorkQueueCommon::PostTask(fml::closure task) {
loop_->GetTaskRunner()->PostTask(task);
}
} // namespace impeller

View File

@@ -1,33 +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 <memory>
#include "flutter/fml/concurrent_message_loop.h"
#include "flutter/fml/macros.h"
#include "impeller/base/work_queue.h"
namespace impeller {
class WorkQueueCommon : public WorkQueue {
public:
static std::shared_ptr<WorkQueueCommon> Create();
// |WorkQueue|
~WorkQueueCommon();
private:
std::shared_ptr<fml::ConcurrentMessageLoop> loop_;
WorkQueueCommon();
// |WorkQueue|
void PostTask(fml::closure task) override;
FML_DISALLOW_COPY_AND_ASSIGN(WorkQueueCommon);
};
} // namespace impeller

View File

@@ -6,7 +6,6 @@
#include "impeller/base/config.h"
#include "impeller/base/validation.h"
#include "impeller/base/work_queue_common.h"
#include "impeller/renderer/device_capabilities.h"
namespace impeller {
@@ -60,15 +59,6 @@ ContextGLES::ContextGLES(std::unique_ptr<ProcTableGLES> gl,
std::shared_ptr<SamplerLibraryGLES>(new SamplerLibraryGLES());
}
// Create the work queue.
{
work_queue_ = WorkQueueCommon::Create();
if (!work_queue_) {
VALIDATION_LOG << "Could not create work queue.";
return;
}
}
// Create the device capabilities.
{
device_capabilities_ =
@@ -140,11 +130,6 @@ std::shared_ptr<CommandBuffer> ContextGLES::CreateCommandBuffer() const {
new CommandBufferGLES(weak_from_this(), reactor_));
}
// |Context|
std::shared_ptr<WorkQueue> ContextGLES::GetWorkQueue() const {
return work_queue_;
}
// |Context|
const IDeviceCapabilities& ContextGLES::GetDeviceCapabilities() const {
return *device_capabilities_;

View File

@@ -39,7 +39,6 @@ class ContextGLES final : public Context,
std::shared_ptr<ShaderLibraryGLES> shader_library_;
std::shared_ptr<PipelineLibraryGLES> pipeline_library_;
std::shared_ptr<SamplerLibraryGLES> sampler_library_;
std::shared_ptr<WorkQueue> work_queue_;
std::shared_ptr<AllocatorGLES> resource_allocator_;
std::unique_ptr<IDeviceCapabilities> device_capabilities_;
bool is_valid_ = false;
@@ -66,9 +65,6 @@ class ContextGLES final : public Context,
// |Context|
std::shared_ptr<CommandBuffer> CreateCommandBuffer() const override;
// |Context|
std::shared_ptr<WorkQueue> GetWorkQueue() const override;
// |Context|
const IDeviceCapabilities& GetDeviceCapabilities() const override;

View File

@@ -44,7 +44,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<WorkQueue> work_queue_;
std::shared_ptr<GPUTracerMTL> gpu_tracer_;
std::unique_ptr<IDeviceCapabilities> device_capabilities_;
bool is_valid_ = false;
@@ -71,9 +70,6 @@ class ContextMTL final : public Context,
// |Context|
std::shared_ptr<CommandBuffer> CreateCommandBuffer() const override;
// |Context|
std::shared_ptr<WorkQueue> GetWorkQueue() const override;
// |Context|
std::shared_ptr<GPUTracer> GetGPUTracer() const override;

View File

@@ -9,7 +9,6 @@
#include "flutter/fml/file.h"
#include "flutter/fml/logging.h"
#include "flutter/fml/paths.h"
#include "impeller/base/platform/darwin/work_queue_darwin.h"
#include "impeller/renderer/backend/metal/sampler_library_mtl.h"
#include "impeller/renderer/device_capabilities.h"
#include "impeller/renderer/sampler_descriptor.h"
@@ -74,15 +73,6 @@ ContextMTL::ContextMTL(id<MTLDevice> device,
}
}
// Setup the work queue.
{
work_queue_ = WorkQueueDarwin::Create();
if (!work_queue_) {
VALIDATION_LOG << "Could not setup the work queue.";
return;
}
}
#if (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) || \
(FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_PROFILE)
// Setup the gpu tracer.
@@ -257,11 +247,6 @@ std::shared_ptr<CommandBuffer> ContextMTL::CreateCommandBuffer() const {
return CreateCommandBufferInQueue(command_queue_);
}
// |Context|
std::shared_ptr<WorkQueue> ContextMTL::GetWorkQueue() const {
return work_queue_;
}
std::shared_ptr<GPUTracer> ContextMTL::GetGPUTracer() const {
return gpu_tracer_;
}

View File

@@ -15,7 +15,6 @@
#include "flutter/fml/string_conversion.h"
#include "flutter/fml/trace_event.h"
#include "impeller/base/validation.h"
#include "impeller/base/work_queue_common.h"
#include "impeller/renderer/backend/vulkan/allocator_vk.h"
#include "impeller/renderer/backend/vulkan/capabilities_vk.h"
#include "impeller/renderer/backend/vulkan/command_buffer_vk.h"
@@ -479,13 +478,6 @@ ContextVK::ContextVK(
return;
}
auto work_queue = WorkQueueCommon::Create();
if (!work_queue) {
VALIDATION_LOG << "Could not create workqueue.";
return;
}
//----------------------------------------------------------------------------
/// Setup the command pool.
///
@@ -541,7 +533,6 @@ ContextVK::ContextVK(
shader_library_ = std::move(shader_library);
sampler_library_ = std::move(sampler_library);
pipeline_library_ = std::move(pipeline_library);
work_queue_ = std::move(work_queue);
graphics_queue_ =
device_->getQueue(graphics_queue->family, graphics_queue->index);
compute_queue_ =
@@ -592,11 +583,6 @@ std::shared_ptr<PipelineLibrary> ContextVK::GetPipelineLibrary() const {
return pipeline_library_;
}
// |Context|
std::shared_ptr<WorkQueue> ContextVK::GetWorkQueue() const {
return work_queue_;
}
std::shared_ptr<CommandBuffer> ContextVK::CreateCommandBuffer() const {
return std::shared_ptr<CommandBufferVK>(
new CommandBufferVK(shared_from_this(), //

View File

@@ -67,9 +67,6 @@ class ContextVK final : public Context, public BackendCast<ContextVK, Context> {
// |Context|
PixelFormat GetColorAttachmentPixelFormat() const override;
// |Context|
std::shared_ptr<WorkQueue> GetWorkQueue() const override;
// |Context|
const IDeviceCapabilities& GetDeviceCapabilities() const override;
@@ -139,7 +136,6 @@ class ContextVK final : public Context, public BackendCast<ContextVK, Context> {
vk::Queue compute_queue_ = {};
vk::Queue transfer_queue_ = {};
std::shared_ptr<SwapchainVK> swapchain_;
std::shared_ptr<WorkQueue> work_queue_;
std::unique_ptr<IDeviceCapabilities> device_capabilities_;
vk::UniqueCommandPool graphics_command_pool_;
vk::UniqueDescriptorPool descriptor_pool_;

View File

@@ -19,7 +19,6 @@ class CommandBuffer;
class PipelineLibrary;
class Allocator;
class GPUTracer;
class WorkQueue;
class Context : public std::enable_shared_from_this<Context> {
public:
@@ -40,8 +39,6 @@ class Context : public std::enable_shared_from_this<Context> {
virtual std::shared_ptr<CommandBuffer> CreateCommandBuffer() const = 0;
virtual std::shared_ptr<WorkQueue> GetWorkQueue() const = 0;
//----------------------------------------------------------------------------
/// @return A GPU Tracer to trace gpu rendering.
///

View File

@@ -93,8 +93,6 @@ class MockImpellerContext : public Context {
MOCK_CONST_METHOD0(CreateCommandBuffer, std::shared_ptr<CommandBuffer>());
MOCK_CONST_METHOD0(GetWorkQueue, std::shared_ptr<WorkQueue>());
MOCK_CONST_METHOD0(GetGPUTracer, std::shared_ptr<GPUTracer>());
MOCK_CONST_METHOD0(GetColorAttachmentPixelFormat, PixelFormat());

View File

@@ -54,8 +54,6 @@ class CustomColorAttachmentPixelFormatContext final : public Context {
return context_->CreateCommandBuffer();
}
std::shared_ptr<WorkQueue> GetWorkQueue() const override { return context_->GetWorkQueue(); }
std::shared_ptr<GPUTracer> GetGPUTracer() const override { return context_->GetGPUTracer(); }
PixelFormat GetColorAttachmentPixelFormat() const override {