diff options
| author | 2017-04-13 00:42:12 +0000 | |
|---|---|---|
| committer | 2017-04-13 00:42:13 +0000 | |
| commit | 7da46d06f078922c9883adc609ed1c1b83ef3e5f (patch) | |
| tree | bf12472f95a1ddf9a13d171892a4ad7f5c05f7a5 | |
| parent | d111a91cd1df9be4680f4c4f9a47b41ab9dff1ee (diff) | |
| parent | b278404c8766f04648b38a5f4da8872748f78a00 (diff) | |
Merge "surfaceflinger: start grahpics allocator when requested" into oc-dev
| -rw-r--r-- | services/surfaceflinger/Android.mk | 5 | ||||
| -rw-r--r-- | services/surfaceflinger/main_surfaceflinger.cpp | 27 |
2 files changed, 32 insertions, 0 deletions
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk index 76baa01f84..7bb20bac13 100644 --- a/services/surfaceflinger/Android.mk +++ b/services/surfaceflinger/Android.mk @@ -133,10 +133,15 @@ LOCAL_SRC_FILES := \ main_surfaceflinger.cpp LOCAL_SHARED_LIBRARIES := \ + android.hardware.configstore@1.0 \ + android.hardware.configstore-utils \ + android.hardware.graphics.allocator@2.0 \ libsurfaceflinger \ libcutils \ liblog \ libbinder \ + libhidlbase \ + libhidltransport \ libutils \ libui \ libgui \ diff --git a/services/surfaceflinger/main_surfaceflinger.cpp b/services/surfaceflinger/main_surfaceflinger.cpp index f151087676..d15376e6bb 100644 --- a/services/surfaceflinger/main_surfaceflinger.cpp +++ b/services/surfaceflinger/main_surfaceflinger.cpp @@ -18,17 +18,44 @@ #include <sched.h> +#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> +#include <android/hardware/graphics/allocator/2.0/IAllocator.h> #include <cutils/sched_policy.h> #include <binder/IServiceManager.h> #include <binder/IPCThreadState.h> #include <binder/ProcessState.h> #include <binder/IServiceManager.h> +#include <hidl/LegacySupport.h> +#include <configstore/Utils.h> #include "GpuService.h" #include "SurfaceFlinger.h" using namespace android; +using android::hardware::graphics::allocator::V2_0::IAllocator; +using android::hardware::configstore::V1_0::ISurfaceFlingerConfigs; +using android::hardware::configstore::getBool; +using android::hardware::configstore::getBool; + +static status_t startGraphicsAllocatorService() { + hardware::configureRpcThreadpool( 1 /* maxThreads */, + false /* callerWillJoin */); + status_t result = + hardware::registerPassthroughServiceImplementation<IAllocator>(); + if (result != OK) { + ALOGE("could not start graphics allocator service"); + return result; + } + + return OK; +} + int main(int, char**) { + if (getBool<ISurfaceFlingerConfigs, + &ISurfaceFlingerConfigs::startGraphicsAllocatorService>(false)) { + startGraphicsAllocatorService(); + } + signal(SIGPIPE, SIG_IGN); // When SF is launched in its own process, limit the number of // binder threads to 4. |