summaryrefslogtreecommitdiff
path: root/graphics/composer/2.1/default/service.cpp
diff options
context:
space:
mode:
authorAdy Abraham <adyabr@google.com>2020-09-25 14:28:36 -0700
committerAdy Abraham <adyabr@google.com>2020-10-01 20:12:38 +0000
commit43e42ff6ec685038921bc375bd660c245e4bc4e7 (patch)
tree616d7625a3b06181139fa9830cec6f74ea49e9ba /graphics/composer/2.1/default/service.cpp
parent224824b2dcb85bd4f7f8410e56209515f274acb6 (diff)
composer: hold a sp<IComposer> from the service itself
IComposerClient assumes that IComposer will outlive its life cycle and holds a simple pointer to HwcHal. This change is taking the same approach of newer composer versions (2.2, 2.3, and 2.4) to make sure that IComposer would outlive IComposerClient. Test: coral booting with this change Fixes: 155769496 Change-Id: I3962ede51ce823368c62c4e4e5fb30f7a5680bdf
Diffstat (limited to 'graphics/composer/2.1/default/service.cpp')
-rw-r--r--graphics/composer/2.1/default/service.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/graphics/composer/2.1/default/service.cpp b/graphics/composer/2.1/default/service.cpp
index 82a33f6a4e..1276d2df7e 100644
--- a/graphics/composer/2.1/default/service.cpp
+++ b/graphics/composer/2.1/default/service.cpp
@@ -21,10 +21,11 @@
#include <android/hardware/graphics/composer/2.1/IComposer.h>
#include <binder/ProcessState.h>
+#include <composer-passthrough/2.1/HwcLoader.h>
#include <hidl/LegacySupport.h>
using android::hardware::graphics::composer::V2_1::IComposer;
-using android::hardware::defaultPassthroughServiceImplementation;
+using android::hardware::graphics::composer::V2_1::passthrough::HwcLoader;
int main() {
// the conventional HAL might start binder services
@@ -40,5 +41,19 @@ int main() {
ALOGE("Couldn't set SCHED_FIFO: %d", errno);
}
- return defaultPassthroughServiceImplementation<IComposer>(4);
+ android::hardware::configureRpcThreadpool(4, true /* will join */);
+
+ android::sp<IComposer> composer = HwcLoader::load();
+ if (composer == nullptr) {
+ return 1;
+ }
+ if (composer->registerAsService() != android::NO_ERROR) {
+ ALOGE("failed to register service");
+ return 1;
+ }
+
+ android::hardware::joinRpcThreadpool();
+
+ ALOGE("service is terminating");
+ return 1;
}