Camera3Device: make request thread SCHED_FIFO for all cases
To mitigate the request thread CPU starvation for system highly loaded
situation.
Bug: 30357698
Bug: 28313712
Change-Id: Ied30103ce7245e139580219cce99d743b657307e
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index 3b51239..bf94aca 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -2042,19 +2042,15 @@
// across configure_streams() calls
mRequestThread->configurationComplete(mIsConstrainedHighSpeedConfiguration);
- // Boost priority of request thread for high speed recording to SCHED_FIFO
- if (mIsConstrainedHighSpeedConfiguration) {
- pid_t requestThreadTid = mRequestThread->getTid();
- res = requestPriority(getpid(), requestThreadTid,
- kConstrainedHighSpeedThreadPriority, /*asynchronous*/ false);
- if (res != OK) {
- ALOGW("Can't set realtime priority for request processing thread: %s (%d)",
- strerror(-res), res);
- } else {
- ALOGD("Set real time priority for request queue thread (tid %d)", requestThreadTid);
- }
+ // Boost priority of request thread to SCHED_FIFO.
+ pid_t requestThreadTid = mRequestThread->getTid();
+ res = requestPriority(getpid(), requestThreadTid,
+ kRequestThreadPriority, /*asynchronous*/ false);
+ if (res != OK) {
+ ALOGW("Can't set realtime priority for request processing thread: %s (%d)",
+ strerror(-res), res);
} else {
- // TODO: Set/restore normal priority for normal use cases
+ ALOGD("Set real time priority for request queue thread (tid %d)", requestThreadTid);
}
// Update device state
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index bbb6563..430ee6c 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -178,7 +178,7 @@
static const size_t kInFlightWarnLimit = 20;
static const size_t kInFlightWarnLimitHighSpeed = 256; // batch size 32 * pipe depth 8
// SCHED_FIFO priority for request submission thread in HFR mode
- static const int kConstrainedHighSpeedThreadPriority = 1;
+ static const int kRequestThreadPriority = 1;
struct RequestTrigger;
// minimal jpeg buffer size: 256KB + blob header