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

Commit 70d91368 authored by Lloyd Pique's avatar Lloyd Pique
Browse files

SF: Introduce a minimal CompositionEngine

Start with minimal sources for CompositionEngine, which is otherwise
blank. This sets up a library for the implementation, a library for
CompositionEngine owned test mocks, and a minimal test.

SurfaceFlinger will also create an instance via its factory, and
provides an accessor to obtain it.

Test: atest libsurfaceflinger_unittest libcompositionengine_test
Bug: 121291683
Change-Id: I4be49254d2cea82adfbafc6108891347d49d3f17
parent 1bb1eb01
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
cc_defaults {
    name: "surfaceflinger_defaults",
    cflags: [
        "-DLOG_TAG=\"SurfaceFlinger\"",
        "-Wall",
        "-Werror",
        "-Wformat",
@@ -15,6 +14,7 @@ cc_defaults {
    name: "libsurfaceflinger_defaults",
    defaults: ["surfaceflinger_defaults"],
    cflags: [
        "-DLOG_TAG=\"SurfaceFlinger\"",
        "-DGL_GLEXT_PROTOTYPES",
        "-DEGL_EGLEXT_PROTOTYPES",
    ],
@@ -57,6 +57,7 @@ cc_defaults {
        "libutils",
    ],
    static_libs: [
        "libcompositionengine",
        "librenderengine",
        "libserviceutils",
        "libtrace_proto",
@@ -69,6 +70,7 @@ cc_defaults {
        "android.hardware.graphics.composer@2.3-command-buffer",
    ],
    export_static_lib_headers: [
        "libcompositionengine",
        "librenderengine",
        "libserviceutils",
    ],
@@ -171,6 +173,9 @@ cc_library_shared {
cc_defaults {
    name: "libsurfaceflinger_binary",
    defaults: ["surfaceflinger_defaults"],
    cflags: [
        "-DLOG_TAG=\"SurfaceFlinger\"",
    ],
    whole_static_libs: [
        "libsigchain",
    ],
+62 −0
Original line number Diff line number Diff line
cc_defaults {
    name: "libcompositionengine_defaults",
    defaults: ["surfaceflinger_defaults"],
    cflags: [
        "-DLOG_TAG=\"CompositionEngine\"",
    ],
}

cc_library {
    name: "libcompositionengine",
    defaults: ["libcompositionengine_defaults"],
    srcs: [
        "src/CompositionEngine.cpp",
    ],
    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
}

cc_library {
    name: "libcompositionengine_mocks",
    defaults: ["libcompositionengine_defaults"],
    srcs: [
        "mock/CompositionEngine.cpp",
    ],
    static_libs: [
        "libgtest",
        "libgmock",
        "libcompositionengine",
    ],
    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
}

cc_test {
    name: "libcompositionengine_test",
    test_suites: ["device-tests"],
    defaults: ["libcompositionengine_defaults"],
    srcs: [
        "tests/CompositionEngineTest.cpp",
    ],
    static_libs: [
        "libcompositionengine",
        "libcompositionengine_mocks",
        "libgmock",
        "libgtest",
    ],
    sanitize: {
        // By using the address sanitizer, we not only uncover any issues
        // with the test, but also any issues with the code under test.
        //
        // Note: If you get an runtime link error like:
        //
        //   CANNOT LINK EXECUTABLE "/data/local/tmp/libcompositionengine_test": library "libclang_rt.asan-aarch64-android.so" not found
        //
        // it is because the address sanitizer shared objects are not installed
        // by default in the system image.
        //
        // You can either "make dist tests" before flashing, or set this
        // option to false temporarily.
        address: true,
    },
}
+35 −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.
 */

#pragma once

namespace android {

class HWComposer;

namespace compositionengine {

/**
 * Encapsulates all the interfaces and implementation details for performing
 * display output composition.
 */
class CompositionEngine {
public:
    virtual ~CompositionEngine();
};

} // namespace compositionengine
} // namespace android
+33 −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.
 */

#pragma once

#include <memory>

#include <compositionengine/CompositionEngine.h>

namespace android::compositionengine::impl {

class CompositionEngine : public compositionengine::CompositionEngine {
public:
    CompositionEngine();
    ~CompositionEngine() override;
};

std::unique_ptr<compositionengine::CompositionEngine> createCompositionEngine();

} // namespace android::compositionengine::impl
+30 −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.
 */

#pragma once

#include <compositionengine/CompositionEngine.h>
#include <gmock/gmock.h>

namespace android::compositionengine::mock {

class CompositionEngine : public compositionengine::CompositionEngine {
public:
    CompositionEngine();
    ~CompositionEngine() override;
};

} // namespace android::compositionengine::mock
Loading