diff options
author | vincechiu <vincechiu@google.com> | 2021-10-26 16:43:25 +0800 |
---|---|---|
committer | Vince Chiu <vincechiu@google.com> | 2021-12-01 01:37:12 +0000 |
commit | 2079123b6cc0a716d46b13342edd0d3829c47f2a (patch) | |
tree | a178201eeae68e3f2b5e12be9c46d03d83780a19 | |
parent | c28fda4924061e7874a68e63c36d44d7916d76db (diff) | |
download | camera-2079123b6cc0a716d46b13342edd0d3829c47f2a.tar.gz |
Camera: Support to raise priority of buffer allocationandroid12L-dev
Disable it by default and support it by property.
persist.vendor.camera.raise_buf_allocation_priority
Bug: 208362912
Test: P21 checklist
Change-Id: I47eea529e1a45eb04083ee7509f54e02790aeb92
-rw-r--r-- | common/hal/utils/stream_buffer_cache_manager.cc | 10 |
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) { |