Skip to content

Commit

Permalink
Vulkan on Fuchsia performance tuning (flutter#3822)
Browse files Browse the repository at this point in the history
* increase Vulkan GrContext resource cache limits to match android

* [content handler] tune VulkanSurfaceProducer allocation and recycling heuristics
  • Loading branch information
freiling authored Jun 23, 2017
1 parent 8a2d337 commit 674b8f1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions content_handler/vulkan_rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ bool VulkanRasterizer::VulkanSurfaceProducer::Initialize() {
kVulkan_GrBackend,
reinterpret_cast<GrBackendContext>(backend_context_.get())));

context_->setResourceCacheLimits(vulkan::kGrCacheMaxCount,
vulkan::kGrCacheMaxByteSize);

FTL_DLOG(INFO) << "Successfully initialized VulkanRasterizer";
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions content_handler/vulkan_rasterizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class VulkanRasterizer : public Rasterizer {
struct Swapchain {
std::queue<std::unique_ptr<Surface>> queue;
uint32_t tick_count = 0;
static constexpr uint32_t kMaxSurfaces = 3;
static constexpr uint32_t kMaxTickBeforeDiscard = 3;
static constexpr uint32_t kMaxSurfaces = 16;
static constexpr uint32_t kMaxTickBeforeDiscard = 600;
};

using size_key_t = uint64_t;
Expand Down
3 changes: 3 additions & 0 deletions vulkan/vulkan_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

namespace vulkan {

static const int kGrCacheMaxCount = 8192;
static const size_t kGrCacheMaxByteSize = 512 * (1 << 20);

class VulkanDevice;
class VulkanProcTable;

Expand Down
2 changes: 2 additions & 0 deletions vulkan/vulkan_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ bool VulkanWindow::CreateSkiaGrContext() {
return false;
}

context->setResourceCacheLimits(kGrCacheMaxCount, kGrCacheMaxByteSize);

skia_vk_backend_context_ = backend_context;
skia_gr_context_ = context;

Expand Down

0 comments on commit 674b8f1

Please sign in to comment.