From 4bc77f901b1597b7cbc9ab7f4e0e354a7c93ed43 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 14 Feb 2024 16:56:49 +1100 Subject: Tweak opus build flags and allocs This gets us to ~40% of one core cpu usage during playback. Good enough for a while I reckon! Paid for the internal ram usage by reclaiming some stack size headroom. --- src/dev_console/include/console.hpp | 2 +- src/tasks/tasks.cpp | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/dev_console/include/console.hpp b/src/dev_console/include/console.hpp index fd4050c2..fedf3632 100644 --- a/src/dev_console/include/console.hpp +++ b/src/dev_console/include/console.hpp @@ -18,7 +18,7 @@ class Console { auto Launch() -> void; protected: - virtual auto GetStackSizeKiB() -> uint16_t { return 16; } + virtual auto GetStackSizeKiB() -> uint16_t { return 8; } virtual auto RegisterExtraComponents() -> void {} private: diff --git a/src/tasks/tasks.cpp b/src/tasks/tasks.cpp index d53eface..aa382655 100644 --- a/src/tasks/tasks.cpp +++ b/src/tasks/tasks.cpp @@ -39,22 +39,20 @@ auto AllocateStack() -> cpp::span; // usually written with embedded use cases in mind. template <> auto AllocateStack() -> cpp::span { - constexpr std::size_t size = 24 * 1024; + constexpr std::size_t size = 20 * 1024; static StackType_t sStack[size]; return {sStack, size}; } -// LVGL requires only a relatively small stack. However, it can be allocated in -// PSRAM so we give it a bit of headroom for safety. +// LVGL requires only a relatively small stack. Lua's stack is allocated +// separately. template <> auto AllocateStack() -> cpp::span { - constexpr std::size_t size = 16 * 1024; + constexpr std::size_t size = 14 * 1024; static StackType_t sStack[size]; return {sStack, size}; } template <> -// PCM conversion and resampling uses a very small amount of stack. It works -// entirely with PSRAM-allocated buffers, so no real speed gain from allocating -// it internally. +// PCM conversion and resampling uses a very small amount of stack. auto AllocateStack() -> cpp::span { constexpr std::size_t size = 4 * 1024; static StackType_t sStack[size]; -- cgit v1.2.3