summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2015-09-25 16:52:55 -0700
committerEino-Ville Talvala <etalvala@google.com>2015-09-26 11:22:20 -0700
commitf99498ee4de7123e2fd71778c6877be44fbd1506 (patch)
tree76fc5f13ab660c053101f09a701187259952e90a /services/camera/libcameraservice
parent8595eaab5884bb74d884d366ad6e371a296bf576 (diff)
downloadframeworks_av-f99498ee4de7123e2fd71778c6877be44fbd1506.zip
frameworks_av-f99498ee4de7123e2fd71778c6877be44fbd1506.tar.gz
frameworks_av-f99498ee4de7123e2fd71778c6877be44fbd1506.tar.bz2
CameraService: Use SCHED_FIFO for request queue thread in HFR
- Move SchedulingPolicyService from audioservice to mediautils - When starting up a high speed stream config, set request queue thread to SCHED_FIFO using SchedulingPolicyService Bug: 24227252 Change-Id: I224b59142bd111caf563779f55cddd62385b9bac
Diffstat (limited to 'services/camera/libcameraservice')
-rw-r--r--services/camera/libcameraservice/Android.mk2
-rw-r--r--services/camera/libcameraservice/device3/Camera3Device.cpp16
-rw-r--r--services/camera/libcameraservice/device3/Camera3Device.h2
3 files changed, 19 insertions, 1 deletions
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index e8ef24e..45900c4 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -53,7 +53,7 @@ LOCAL_SRC_FILES:= \
device3/StatusTracker.cpp \
gui/RingBufferConsumer.cpp \
utils/CameraTraces.cpp \
- utils/AutoConditionLock.cpp \
+ utils/AutoConditionLock.cpp
LOCAL_SHARED_LIBRARIES:= \
libui \
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index 433a745..1a3a770 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -44,6 +44,7 @@
#include <utils/Timers.h>
#include "utils/CameraTraces.h"
+#include "mediautils/SchedulingPolicyService.h"
#include "device3/Camera3Device.h"
#include "device3/Camera3OutputStream.h"
#include "device3/Camera3InputStream.h"
@@ -1766,6 +1767,21 @@ status_t Camera3Device::configureStreamsLocked() {
// across configure_streams() calls
mRequestThread->configurationComplete();
+ // Boost priority of request thread for high speed recording to SCHED_FIFO
+ if (mIsConstrainedHighSpeedConfiguration) {
+ pid_t requestThreadTid = mRequestThread->getTid();
+ res = requestPriority(getpid(), requestThreadTid,
+ kConstrainedHighSpeedThreadPriority, true);
+ 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);
+ }
+ } else {
+ // TODO: Set/restore normal priority for normal use cases
+ }
+
// Update device state
mNeedConfig = false;
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index 9d3c533..402cb1d 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -161,6 +161,8 @@ class Camera3Device :
static const nsecs_t kActiveTimeout = 500000000; // 500 ms
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 = 3;
struct RequestTrigger;
// minimal jpeg buffer size: 256KB + blob header