summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraylinhsu <raylinhsu@google.com>2019-12-26 19:51:49 +0800
committerraylinhsu <raylinhsu@google.com>2020-01-03 19:49:27 +0800
commite18cd19b7e991a7688751ad38f052363e550e055 (patch)
treee616f0af18238c43fefbfd5922e61f1c3ad25be0
parent8563e04c08483bdeb5a8b789649a07191a6271d8 (diff)
downloaddisplay-e18cd19b7e991a7688751ad38f052363e550e055.tar.gz
Create graphics composer service for pps socket
The android.hardware.graphics.composer@2.3-service-sm8150 inherits from android.hardware.graphics.composer@2.3-service. Use it to enable pps socket. Bug: 146774711 Test: Boot to home Test: Check if the pps socket open successfully by using below command $adb shell ls /dev/socket/pps Test: Check FOSS status and it can enter running state $adb shell "ppd 'foss:on'" $adb shell "ppd 'foss:status'" Change-Id: I045c455d94c0862d79546004b8f3b56df6fbf5c2 Merged-In: I045c455d94c0862d79546004b8f3b56df6fbf5c2
-rw-r--r--composer/Android.bp46
-rw-r--r--composer/android.hardware.graphics.composer@2.3-service-sm7150.rc8
-rw-r--r--composer/service.cpp55
-rw-r--r--config/display-product.mk2
4 files changed, 110 insertions, 1 deletions
diff --git a/composer/Android.bp b/composer/Android.bp
new file mode 100644
index 00000000..66595d3e
--- /dev/null
+++ b/composer/Android.bp
@@ -0,0 +1,46 @@
+//
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_binary {
+ name: "android.hardware.graphics.composer@2.3-service-sm7150",
+ defaults: ["hidl_defaults"],
+ vendor: true,
+ relative_install_path: "hw",
+ srcs: ["service.cpp"],
+ init_rc: ["android.hardware.graphics.composer@2.3-service-sm7150.rc"],
+ header_libs: [
+ "android.hardware.graphics.composer@2.3-passthrough",
+ ],
+ shared_libs: [
+ "android.hardware.graphics.composer@2.1",
+ "android.hardware.graphics.composer@2.2",
+ "android.hardware.graphics.composer@2.3",
+ "android.hardware.graphics.mapper@2.0",
+ "android.hardware.graphics.mapper@3.0",
+ "libbase",
+ "libbinder",
+ "libcutils",
+ "libfmq",
+ "libhardware",
+ "libhidlbase",
+ "libhidltransport",
+ "libhwc2on1adapter",
+ "libhwc2onfbadapter",
+ "liblog",
+ "libsync",
+ "libutils",
+ ],
+}
diff --git a/composer/android.hardware.graphics.composer@2.3-service-sm7150.rc b/composer/android.hardware.graphics.composer@2.3-service-sm7150.rc
new file mode 100644
index 00000000..7fa8b559
--- /dev/null
+++ b/composer/android.hardware.graphics.composer@2.3-service-sm7150.rc
@@ -0,0 +1,8 @@
+service vendor.hwcomposer-2-3 /vendor/bin/hw/android.hardware.graphics.composer@2.3-service-sm7150
+ class hal animation
+ user system
+ group graphics drmrpc
+ capabilities SYS_NICE
+ onrestart restart surfaceflinger
+ writepid /dev/cpuset/system-background/tasks
+ socket pps stream 0660 system system
diff --git a/composer/service.cpp b/composer/service.cpp
new file mode 100644
index 00000000..f773da44
--- /dev/null
+++ b/composer/service.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sched.h>
+
+#include <android/hardware/graphics/composer/2.3/IComposer.h>
+#include <binder/ProcessState.h>
+#include <composer-passthrough/2.3/HwcLoader.h>
+#include <hidl/HidlTransportSupport.h>
+
+using android::hardware::graphics::composer::V2_3::IComposer;
+using android::hardware::graphics::composer::V2_3::passthrough::HwcLoader;
+
+int main() {
+ // the conventional HAL might start binder services
+ android::ProcessState::initWithDriver("/dev/vndbinder");
+ android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
+ android::ProcessState::self()->startThreadPool();
+
+ // same as SF main thread
+ struct sched_param param = {0};
+ param.sched_priority = 2;
+ if (sched_setscheduler(0, SCHED_FIFO | SCHED_RESET_ON_FORK, &param) != 0) {
+ ALOGE("Couldn't set SCHED_FIFO: %d", errno);
+ }
+
+ 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;
+}
diff --git a/config/display-product.mk b/config/display-product.mk
index aa22e725..a0fa0941 100644
--- a/config/display-product.mk
+++ b/config/display-product.mk
@@ -1,7 +1,7 @@
# Display product definitions
PRODUCT_PACKAGES += \
android.hardware.graphics.composer@2.3-impl \
- android.hardware.graphics.composer@2.3-service \
+ android.hardware.graphics.composer@2.3-service-sm7150 \
android.hardware.graphics.mapper@2.0-impl-qti-display \
vendor.qti.hardware.display.allocator-service \
android.hardware.memtrack@1.0-impl \