Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Increase host buffer arena count to 4. #54808

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion impeller/core/host_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
namespace impeller {

/// Approximately the same size as the max frames in flight.
static const constexpr size_t kHostBufferArenaSize = 3u;
static const constexpr size_t kHostBufferArenaSize = 4u;

/// The host buffer class manages one more 1024 Kb blocks of device buffer
/// allocations.
Expand Down
7 changes: 5 additions & 2 deletions impeller/entity/contents/host_buffer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ TEST_P(HostBufferTest, ResetIncrementsFrameCounter) {
buffer->Reset();
EXPECT_EQ(buffer->GetStateForTest().current_frame, 2u);

buffer->Reset();
EXPECT_EQ(buffer->GetStateForTest().current_frame, 3u);

buffer->Reset();
EXPECT_EQ(buffer->GetStateForTest().current_frame, 0u);
}
Expand Down Expand Up @@ -131,7 +134,7 @@ TEST_P(HostBufferTest, UnusedBuffersAreDiscardedWhenResetting) {
EXPECT_EQ(buffer->GetStateForTest().current_frame, 0u);

// Reset until we get back to this frame.
for (auto i = 0; i < 3; i++) {
for (auto i = 0; i < 4; i++) {
buffer->Reset();
}

Expand All @@ -141,7 +144,7 @@ TEST_P(HostBufferTest, UnusedBuffersAreDiscardedWhenResetting) {

// Now when we reset, the buffer should get dropped.
// Reset until we get back to this frame.
for (auto i = 0; i < 3; i++) {
for (auto i = 0; i < 4; i++) {
buffer->Reset();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "impeller/renderer/backend/vulkan/swapchain/surface_vk.h"
#include "impeller/toolkit/android/surface_transaction.h"
#include "impeller/toolkit/android/surface_transaction_stats.h"
#include "vulkan/vulkan_to_string.hpp"

namespace impeller {

Expand Down Expand Up @@ -111,20 +112,21 @@ std::unique_ptr<Surface> AHBSwapchainImplVK::AcquireNextDrawable() {
return nullptr;
}

auto context = transients_->GetContext().lock();
if (context) {
ContextVK::Cast(*context).GetGPUTracer()->MarkFrameStart();
}

// Ask the GPU to wait for the render ready semaphore to be signaled before
// performing rendering operations.
if (!SubmitWaitForRenderReady(pool_entry.render_ready_fence,
pool_entry.texture)) {
VALIDATION_LOG << "Could not submit a command to the GPU to wait on render "
"readiness.";
VALIDATION_LOG << "Could wait on render ready fence.";
return nullptr;
}

#if IMPELLER_DEBUG
auto context = transients_->GetContext().lock();
if (context) {
ContextVK::Cast(*context).GetGPUTracer()->MarkFrameStart();
}
#endif // IMPELLER_DEBUG

auto surface = SurfaceVK::WrapSwapchainImage(
transients_, pool_entry.texture,
[signaler = auto_sema_signaler, weak = weak_from_this(),
Expand Down Expand Up @@ -154,10 +156,12 @@ bool AHBSwapchainImplVK::Present(
return false;
}

#if IMPELLER_DEBUG
auto context = transients_->GetContext().lock();
if (context) {
ContextVK::Cast(*context).GetGPUTracer()->MarkFrameEnd();
}
#endif // IMPELLER_DEBUG

if (!texture) {
return false;
Expand Down Expand Up @@ -308,8 +312,8 @@ bool AHBSwapchainImplVK::SubmitWaitForRenderReady(
);

if (!(result == vk::Result::eSuccess || result == vk::Result::eTimeout)) {
VALIDATION_LOG << "Fence waiter encountered an unexpected error. Tearing "
"down the waiter thread.";
VALIDATION_LOG << "Encountered error while waiting on swapchain image: "
<< vk::to_string(result);
return false;
}

Expand Down