summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2013-08-24 00:12:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-24 00:12:05 +0000
commited127ea3834045597a072dcf31877ff3084582ff (patch)
tree6dac7b06a4154cb0a403ba99ab3b4f6a822c3599 /services
parentbcab7b17b1c5476935a6f2f916922b4eb57991a4 (diff)
parent9414d67f46d315873502b909ee51bab7abf3f9cc (diff)
downloadframeworks_native-ed127ea3834045597a072dcf31877ff3084582ff.zip
frameworks_native-ed127ea3834045597a072dcf31877ff3084582ff.tar.gz
frameworks_native-ed127ea3834045597a072dcf31877ff3084582ff.tar.bz2
Merge "make sure SF initialization is ran at target priority and correct thread group" into klp-dev
Diffstat (limited to 'services')
-rw-r--r--services/surfaceflinger/Android.mk1
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp7
-rw-r--r--services/surfaceflinger/main_surfaceflinger.cpp18
3 files changed, 15 insertions, 11 deletions
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
index 81b0d14..3888d7e 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -82,6 +82,7 @@ LOCAL_SRC_FILES:= \
LOCAL_SHARED_LIBRARIES := \
libsurfaceflinger \
+ libcutils \
liblog \
libbinder \
libutils
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index a151142..9fd3f25 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -22,10 +22,6 @@
#include <math.h>
#include <dlfcn.h>
-#if defined(HAVE_PTHREADS)
-#include <sys/resource.h>
-#endif
-
#include <EGL/egl.h>
#include <cutils/log.h>
@@ -640,9 +636,6 @@ status_t SurfaceFlinger::postMessageSync(const sp<MessageBase>& msg,
}
void SurfaceFlinger::run() {
-#if defined(HAVE_PTHREADS)
- setpriority(PRIO_PROCESS, 0, PRIORITY_URGENT_DISPLAY);
-#endif
do {
waitForEvent();
} while (true);
diff --git a/services/surfaceflinger/main_surfaceflinger.cpp b/services/surfaceflinger/main_surfaceflinger.cpp
index a609b6f..b161480 100644
--- a/services/surfaceflinger/main_surfaceflinger.cpp
+++ b/services/surfaceflinger/main_surfaceflinger.cpp
@@ -14,6 +14,11 @@
* limitations under the License.
*/
+#if defined(HAVE_PTHREADS)
+#include <sys/resource.h>
+#endif
+
+#include <cutils/sched_policy.h>
#include <binder/IServiceManager.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
@@ -27,16 +32,21 @@ int main(int argc, char** argv) {
// binder threads to 4.
ProcessState::self()->setThreadPoolMaxThreadCount(4);
+ // start the thread pool
+ sp<ProcessState> ps(ProcessState::self());
+ ps->startThreadPool();
+
// instantiate surfaceflinger
sp<SurfaceFlinger> flinger = new SurfaceFlinger();
+#if defined(HAVE_PTHREADS)
+ setpriority(PRIO_PROCESS, 0, PRIORITY_URGENT_DISPLAY);
+#endif
+ set_sched_policy(0, SP_FOREGROUND);
+
// initialize before clients can connect
flinger->init();
- // start the thread pool
- sp<ProcessState> ps(ProcessState::self());
- ps->startThreadPool();
-
// publish surface flinger
sp<IServiceManager> sm(defaultServiceManager());
sm->addService(String16(SurfaceFlinger::getServiceName()), flinger, false);