summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/hal/utils/stream_buffer_cache_manager.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/hal/utils/stream_buffer_cache_manager.cc b/common/hal/utils/stream_buffer_cache_manager.cc
index 3cde225..f0f9bea 100644
--- a/common/hal/utils/stream_buffer_cache_manager.cc
+++ b/common/hal/utils/stream_buffer_cache_manager.cc
@@ -19,8 +19,10 @@
#define ATRACE_TAG ATRACE_TAG_CAMERA
#include <cutils/native_handle.h>
+#include <cutils/properties.h>
#include <log/log.h>
#include <sync/sync.h>
+#include <sys/resource.h>
#include <utils/Trace.h>
#include <chrono>
@@ -33,6 +35,10 @@ using namespace std::chrono_literals;
namespace android {
namespace google_camera_hal {
+// setprop key for raising buffer allocation priority
+inline constexpr char kRaiseBufAllocationPriority[] =
+ "persist.vendor.camera.raise_buf_allocation_priority";
+
// For CTS testCameraDeviceCaptureFailure, it holds image buffers and hal hits
// refill buffer timeout. Large timeout time also results in close session time
// is larger than 5 second in this test case. Typical buffer request from
@@ -217,6 +223,10 @@ status_t StreamBufferCacheManager::AddStreamBufferCacheLocked(
}
void StreamBufferCacheManager::WorkloadThreadLoop() {
+ if (property_get_bool(kRaiseBufAllocationPriority, false)) {
+ pid_t tid = gettid();
+ setpriority(PRIO_PROCESS, tid, -20);
+ }
// max thread name len = 16
pthread_setname_np(pthread_self(), "StreamBufMgr");
while (1) {