diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-01-08 01:47:38 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-01-08 01:47:38 +0000 |
commit | dd060ff0fd590700d279b9d298ca774cb2b067ca (patch) | |
tree | 34591a20aee2b4ce65c65c9313fe6c917ff56ee8 | |
parent | e6699a99b09b25c499800dd91883b9f0f4011855 (diff) | |
parent | e18cd19b7e991a7688751ad38f052363e550e055 (diff) | |
download | display-dd060ff0fd590700d279b9d298ca774cb2b067ca.tar.gz |
Merge "Create graphics composer service for pps socket" into qt-qpr1-dev
-rw-r--r-- | composer/Android.bp | 46 | ||||
-rw-r--r-- | composer/android.hardware.graphics.composer@2.3-service-sm7150.rc | 8 | ||||
-rw-r--r-- | composer/service.cpp | 55 | ||||
-rw-r--r-- | config/display-product.mk | 2 |
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, ¶m) != 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 615a88b9..eda2ed2e 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 \ |