Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de0bd95d authored by Chia-I Wu's avatar Chia-I Wu
Browse files

graphics: add composer 2.2 default impl

This adds

  android.hardware.graphics.composer@2.2-hal
  android.hardware.graphics.composer@2.2-passthrough
  android.hardware.graphics.composer@2.2-service

The -hal module makes it easier to write composer 2.2 HAL and is
reusable by vendors.  The -passthrough module provides a HwcHal
class that implements ComposerHal 2.2 on top of hwcomposer2, and is
also resuable by vendors.  Finally, the -service module provides a
(stub) default implementation.

Test: boots and VTS
Change-Id: I4f940a9dea656abc7d9d485bf48d852c13d2ed56
parent be99ad6e
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
cc_binary {
    name: "android.hardware.graphics.composer@2.2-service",
    defaults: ["hidl_defaults"],
    vendor: true,
    relative_install_path: "hw",
    srcs: ["service.cpp"],
    init_rc: ["android.hardware.graphics.composer@2.2-service.rc"],
    header_libs: [
        "android.hardware.graphics.composer@2.2-passthrough",
    ],
    shared_libs: [
        "android.hardware.graphics.composer@2.1",
        "android.hardware.graphics.composer@2.2",
        "android.hardware.graphics.mapper@2.0",
        "libbase",
        "libbinder",
        "libcutils",
        "libfmq",
        "libhardware",
        "libhidlbase",
        "libhidltransport",
        "libhwc2on1adapter",
        "libhwc2onfbadapter",
        "liblog",
        "libsync",
        "libutils",
    ],
    cflags: [
        "-DLOG_TAG=\"ComposerHal\""
    ],
}
+5 −0
Original line number Diff line number Diff line
# Graphics team
courtneygo@google.com
jessehall@google.com
olv@google.com
stoza@google.com
+6 −0
Original line number Diff line number Diff line
service vendor.hwcomposer-2-2 /vendor/bin/hw/android.hardware.graphics.composer@2.2-service
    class hal animation
    user system
    group graphics drmrpc
    capabilities SYS_NICE
    onrestart restart surfaceflinger
+55 −0
Original line number Diff line number Diff line
/*
 * Copyright 2018 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.2/IComposer.h>
#include <binder/ProcessState.h>
#include <composer-passthrough/2.2/HwcLoader.h>
#include <hidl/HidlTransportSupport.h>

using android::hardware::graphics::composer::V2_2::IComposer;
using android::hardware::graphics::composer::V2_2::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;
}
+35 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2018 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_library_headers {
    name: "android.hardware.graphics.composer@2.2-hal",
    defaults: ["hidl_defaults"],
    vendor_available: true,
    shared_libs: [
        "android.hardware.graphics.composer@2.2",
    ],
    export_shared_lib_headers: [
        "android.hardware.graphics.composer@2.2",
    ],
    header_libs: [
        "android.hardware.graphics.composer@2.2-command-buffer",
        "android.hardware.graphics.composer@2.1-hal",
    ],
    export_header_lib_headers: [
        "android.hardware.graphics.composer@2.2-command-buffer",
        "android.hardware.graphics.composer@2.1-hal",
    ],
    export_include_dirs: ["include"],
}
Loading