[Impeller] remove frame counter that was unused in Vulkan allocator. (flutter/engine#49913)

This was from a previous attempt to reduce allocation pressure using per-thread pools, but they don't actually work since as soon as a pool needs to allocate a new block we end up locking on some vk device calls,
This commit is contained in:
Jonah Williams
2024-01-22 14:35:13 -08:00
committed by GitHub
parent 81277b90ed
commit 2505092c79
5 changed files with 1 additions and 21 deletions

View File

@@ -58,8 +58,6 @@ std::shared_ptr<Texture> Allocator::CreateTexture(
return OnCreateTexture(desc);
}
void Allocator::DidAcquireSurfaceFrame() {}
uint16_t Allocator::MinimumBytesPerRow(PixelFormat format) const {
return BytesPerPixelForPixelFormat(format);
}

View File

@@ -44,10 +44,6 @@ class Allocator {
virtual ISize GetMaxTextureSizeSupported() const = 0;
/// @brief Increment an internal frame used to cycle through a ring buffer of
/// allocation pools.
virtual void DidAcquireSurfaceFrame();
protected:
Allocator();

View File

@@ -424,11 +424,6 @@ std::shared_ptr<Texture> AllocatorVK::OnCreateTexture(
return std::make_shared<TextureVK>(context_, std::move(source));
}
void AllocatorVK::DidAcquireSurfaceFrame() {
frame_count_++;
raster_thread_id_ = std::this_thread::get_id();
}
// |Allocator|
std::shared_ptr<DeviceBuffer> AllocatorVK::OnCreateBuffer(
const DeviceBufferDescriptor& desc) {
@@ -449,8 +444,7 @@ std::shared_ptr<DeviceBuffer> AllocatorVK::OnCreateBuffer(
allocation_info.preferredFlags = static_cast<VkMemoryPropertyFlags>(
ToVKBufferMemoryPropertyFlags(desc.storage_mode));
allocation_info.flags = ToVmaAllocationBufferCreateFlags(desc.storage_mode);
if (created_buffer_pool_ && desc.storage_mode == StorageMode::kHostVisible &&
raster_thread_id_ == std::this_thread::get_id()) {
if (created_buffer_pool_ && desc.storage_mode == StorageMode::kHostVisible) {
allocation_info.pool = staging_buffer_pool_.get().pool;
}

View File

@@ -37,8 +37,6 @@ class AllocatorVK final : public Allocator {
bool supports_framebuffer_fetch_ = false;
// TODO(jonahwilliams): figure out why CI can't create these buffer pools.
bool created_buffer_pool_ = true;
uint32_t frame_count_ = 0;
std::thread::id raster_thread_id_;
AllocatorVK(std::weak_ptr<Context> context,
uint32_t vulkan_api_version,
@@ -50,9 +48,6 @@ class AllocatorVK final : public Allocator {
// |Allocator|
bool IsValid() const;
// |Allocator|
void DidAcquireSurfaceFrame() override;
// |Allocator|
std::shared_ptr<DeviceBuffer> OnCreateBuffer(
const DeviceBufferDescriptor& desc) override;

View File

@@ -81,9 +81,6 @@ std::unique_ptr<Surface> SurfaceContextVK::AcquireNextSurface() {
impeller::PipelineLibraryVK::Cast(*pipeline_library)
.DidAcquireSurfaceFrame();
}
if (auto allocator = parent_->GetResourceAllocator()) {
allocator->DidAcquireSurfaceFrame();
}
parent_->GetCommandPoolRecycler()->Dispose();
return surface;
}