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

Commit ca35d8de authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I362ec1fc,I2d574855

* changes:
  SF: Introduce libsurfaceflinger_unittest
  SF: Convert to Android.bp
parents 68c082bd f58625d9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ sourceFiles = [
includeFiles = [ "include" ]

staticLibraries = [
    "libsurfaceflingerincludes",
    "libbufferhub",
    "libbufferhubqueue",
    "libdisplay",
@@ -63,8 +62,9 @@ sharedLibraries = [
]

headerLibraries = [
    "libdvr_headers",
    "android.hardware.graphics.composer@2.1-command-buffer",
    "libdvr_headers",
    "libsurfaceflinger_headers",
]

cc_library_static {
+204 −3
Original line number Diff line number Diff line
cc_library_static {
    name: "libsurfaceflingerincludes",
cc_defaults {
    name: "surfaceflinger_defaults",
    cflags: [
        "-DLOG_TAG=\"SurfaceFlinger\"",
        "-Wall",
        "-Werror",
        "-Wunused",
        "-Wunreachable-code",
    ],
    cppflags: ["-std=c++1z"],
}

cc_defaults {
    name: "libsurfaceflinger_defaults",
    defaults: ["surfaceflinger_defaults"],
    cflags: [
        "-DGL_GLEXT_PROTOTYPES",
        "-DEGL_EGLEXT_PROTOTYPES",
    ],
    shared_libs: [
        "android.frameworks.vr.composer@1.0",
        "android.hardware.configstore-utils",
        "android.hardware.configstore@1.0",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.composer@2.1",
        "android.hardware.power@1.0",
        "libbase",
        "libbinder",
        "libcutils",
        "libdl",
        "libEGL",
        "libfmq",
        "libGLESv1_CM",
        "libGLESv2",
        "libgui",
        "libhardware",
        "libhidlbase",
        "libhidltransport",
        "libhwbinder",
        "liblayers_proto",
        "liblog",
        "libprotobuf-cpp-lite",
        "libsync",
        "libui",
        "libutils",
        "libvulkan",
    ],
    static_libs: [
        "libserviceutils",
        "libtrace_proto",
        "libvkjson",
        "libvr_manager",
        "libvrflinger",
    ],
    header_libs: [
        "android.hardware.graphics.composer@2.1-command-buffer",
    ],
    export_static_lib_headers: [
        "libserviceutils",
    ],
    export_shared_lib_headers: [
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.composer@2.1",
        "libhidlbase",
        "libhidltransport",
        "libhwbinder",
    ],
}

cc_library_headers {
    name: "libsurfaceflinger_headers",
    export_include_dirs: ["."],
    static_libs = ["libserviceutils"],
    export_static_lib_headers = ["libserviceutils"],
}

subdirs = ["tests/fakehwc", "layerproto"]
 No newline at end of file
filegroup {
    name: "libsurfaceflinger_sources",
    srcs: [
        "BufferLayer.cpp",
        "BufferLayerConsumer.cpp",
        "Client.cpp",
        "ColorLayer.cpp",
        "DisplayDevice.cpp",
        "DisplayHardware/ComposerHal.cpp",
        "DisplayHardware/FramebufferSurface.cpp",
        "DisplayHardware/HWC2.cpp",
        "DisplayHardware/HWComposer.cpp",
        "DisplayHardware/HWComposerBufferCache.cpp",
        "DisplayHardware/VirtualDisplaySurface.cpp",
        "DispSync.cpp",
        "Effects/Daltonizer.cpp",
        "EventControlThread.cpp",
        "EventLog/EventLog.cpp",
        "EventThread.cpp",
        "FrameTracker.cpp",
        "GpuService.cpp",
        "Layer.cpp",
        "LayerProtoHelper.cpp",
        "LayerRejecter.cpp",
        "LayerVector.cpp",
        "MessageQueue.cpp",
        "MonitoredProducer.cpp",
        "RenderArea.cpp",
        "RenderEngine/Description.cpp",
        "RenderEngine/GLES20RenderEngine.cpp",
        "RenderEngine/GLExtensions.cpp",
        "RenderEngine/Image.cpp",
        "RenderEngine/Mesh.cpp",
        "RenderEngine/Program.cpp",
        "RenderEngine/ProgramCache.cpp",
        "RenderEngine/RenderEngine.cpp",
        "RenderEngine/Surface.cpp",
        "RenderEngine/Texture.cpp",
        "StartPropertySetThread.cpp",
        "SurfaceFlinger.cpp",
        "SurfaceInterceptor.cpp",
        "SurfaceTracing.cpp",
        "Transform.cpp",
    ],
}

cc_library_shared {
    name: "libsurfaceflinger",
    defaults: ["libsurfaceflinger_defaults"],
    cflags: [
        "-fvisibility=hidden",
        "-Werror=format",
    ],
    srcs: [
        ":libsurfaceflinger_sources",
    ],
    logtags: ["EventLog/EventLogTags.logtags"],
    include_dirs: [
        "external/vulkan-validation-layers/libs/vkjson",
        "frameworks/native/vulkan/include",
    ],
    cppflags: [
        "-fwhole-program-vtables",  // requires ThinLTO
    ],
    lto: {
        thin: true,
    },
}

cc_binary {
    name: "surfaceflinger",
    defaults: ["surfaceflinger_defaults"],
    init_rc: ["surfaceflinger.rc"],
    srcs: ["main_surfaceflinger.cpp"],
    whole_static_libs: [
        "libsigchain",
    ],
    shared_libs: [
        "android.frameworks.displayservice@1.0",
        "android.hardware.configstore-utils",
        "android.hardware.configstore@1.0",
        "android.hardware.graphics.allocator@2.0",
        "libbinder",
        "libcutils",
        "libdisplayservicehidl",
        "libhidlbase",
        "libhidltransport",
        "liblayers_proto",
        "liblog",
        "libsurfaceflinger",
        "libutils",
    ],
    static_libs: [
        "libserviceutils",
        "libtrace_proto",
    ],
    ldflags: ["-Wl,--export-dynamic"],

    // TODO(b/71715793): These version-scripts are required due to the use of
    // whole_static_libs to pull in libsigchain. To work, the files had to be
    // locally duplicated from their original location
    // $ANDROID_ROOT/art/sigchainlib/
    multilib: {
        lib32: {
            version_script: "version-script32.txt",
        },
        lib64: {
            version_script: "version-script64.txt",
        },
    },
}

cc_library_shared {
    name: "libsurfaceflinger_ddmconnection",
    defaults: ["surfaceflinger_defaults"],
    srcs: ["DdmConnection.cpp"],
    shared_libs: [
        "libcutils",
        "libdl",
        "liblog",
    ],
    product_variables: {
        // uses jni which may not be available in PDK
        pdk: {
            enabled: false,
        },
    },
}

subdirs = [
    "layerproto",
    "tests",
]
+0 −183
Original line number Diff line number Diff line
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_CLANG := true

LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_SRC_FILES := \
    Client.cpp \
    DisplayDevice.cpp \
    DispSync.cpp \
    EventControlThread.cpp \
    StartPropertySetThread.cpp \
    EventThread.cpp \
    FrameTracker.cpp \
    GpuService.cpp \
    Layer.cpp \
    BufferLayer.cpp \
    BufferLayerConsumer.cpp \
    ColorLayer.cpp \
    LayerRejecter.cpp \
    LayerVector.cpp \
    MessageQueue.cpp \
    MonitoredProducer.cpp \
    SurfaceFlinger.cpp \
    SurfaceInterceptor.cpp \
    SurfaceTracing.cpp \
    Transform.cpp \
    DisplayHardware/ComposerHal.cpp \
    DisplayHardware/FramebufferSurface.cpp \
    DisplayHardware/HWC2.cpp \
    DisplayHardware/HWComposer.cpp \
    DisplayHardware/HWComposerBufferCache.cpp \
    DisplayHardware/VirtualDisplaySurface.cpp \
    Effects/Daltonizer.cpp \
    EventLog/EventLogTags.logtags \
    EventLog/EventLog.cpp \
    RenderEngine/Description.cpp \
    RenderEngine/Image.cpp \
    RenderEngine/Mesh.cpp \
    RenderEngine/Program.cpp \
    RenderEngine/ProgramCache.cpp \
    RenderEngine/GLExtensions.cpp \
    RenderEngine/RenderEngine.cpp \
    RenderEngine/Surface.cpp \
    RenderEngine/Texture.cpp \
    RenderEngine/GLES20RenderEngine.cpp \
    LayerProtoHelper.cpp \
    RenderArea.cpp \

LOCAL_MODULE := libsurfaceflinger
LOCAL_C_INCLUDES := \
    frameworks/native/vulkan/include \
    external/vulkan-validation-layers/libs/vkjson \
    system/libhwbinder/fast_msgq/include \

LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES

LOCAL_CFLAGS += -fvisibility=hidden -Werror=format

LOCAL_STATIC_LIBRARIES := \
    libtrace_proto \
    libvkjson \
    libvr_manager \
    libvrflinger \
    libserviceutils

LOCAL_HEADER_LIBRARIES := \
    android.hardware.graphics.composer@2.1-command-buffer

LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := libserviceutils

LOCAL_SHARED_LIBRARIES := \
    android.frameworks.vr.composer@1.0 \
    android.hardware.graphics.allocator@2.0 \
    android.hardware.graphics.composer@2.1 \
    android.hardware.configstore@1.0 \
    android.hardware.configstore-utils \
    libcutils \
    liblog \
    libdl \
    libfmq \
    libhardware \
    libhidlbase \
    libhidltransport \
    libhwbinder \
    libutils \
    libEGL \
    libGLESv1_CM \
    libGLESv2 \
    libbinder \
    libui \
    libgui \
    libvulkan \
    libsync \
    libprotobuf-cpp-lite \
    libbase \
    android.hardware.power@1.0 \
    liblayers_proto

LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \
    android.hardware.graphics.allocator@2.0 \
    android.hardware.graphics.composer@2.1 \
    libhidlbase \
    libhidltransport \
    libhwbinder

LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code -std=c++1z

include $(BUILD_SHARED_LIBRARY)

###############################################################
# build surfaceflinger's executable
include $(CLEAR_VARS)

LOCAL_CLANG := true

LOCAL_LDFLAGS_32 := -Wl,--version-script,art/sigchainlib/version-script32.txt -Wl,--export-dynamic
LOCAL_LDFLAGS_64 := -Wl,--version-script,art/sigchainlib/version-script64.txt -Wl,--export-dynamic
LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"

LOCAL_INIT_RC := surfaceflinger.rc

LOCAL_SRC_FILES := \
    main_surfaceflinger.cpp

LOCAL_SHARED_LIBRARIES := \
    android.frameworks.displayservice@1.0 \
    android.hardware.configstore@1.0 \
    android.hardware.configstore-utils \
    android.hardware.graphics.allocator@2.0 \
    libsurfaceflinger \
    libcutils \
    libdisplayservicehidl \
    liblog \
    libbinder \
    libhidlbase \
    libhidltransport \
    libutils \
    libui \
    libgui \
    libdl \
    liblayers_proto

LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain
LOCAL_STATIC_LIBRARIES := libtrace_proto \
    libserviceutils

LOCAL_MODULE := surfaceflinger

ifdef TARGET_32_BIT_SURFACEFLINGER
LOCAL_32_BIT_ONLY := true
endif

LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code -std=c++1z

include $(BUILD_EXECUTABLE)

###############################################################
# uses jni which may not be available in PDK
ifneq ($(wildcard libnativehelper/include),)
include $(CLEAR_VARS)

LOCAL_CLANG := true

LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"

LOCAL_SRC_FILES := \
    DdmConnection.cpp

LOCAL_SHARED_LIBRARIES := \
    libcutils \
    liblog \
    libdl

LOCAL_MODULE := libsurfaceflinger_ddmconnection

LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code

include $(BUILD_SHARED_LIBRARY)
endif # libnativehelper

include $(call first-makefiles-under,$(LOCAL_PATH))
+3 −0
Original line number Diff line number Diff line
@@ -316,6 +316,9 @@ private:
    friend class BufferLayer;
    friend class MonitoredProducer;

    // For unit tests
    friend class TestableSurfaceFlinger;

    // This value is specified in number of frames.  Log frame stats at most
    // every half hour.
    enum { LOG_FRAME_STATS_PERIOD =  30*60*60 };
+50 −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_test {
    name: "SurfaceFlinger_test",
    defaults: ["surfaceflinger_defaults"],
    tags: ["test"],
    test_suites: ["device-tests"],
    srcs: [
        "Stress_test.cpp",
        "SurfaceInterceptor_test.cpp",
        "Transaction_test.cpp",
    ],
    data: ["SurfaceFlinger_test.filter"],
    static_libs: [
        "libtrace_proto",
    ],
    shared_libs: [
        "libandroid",
        "libbinder",
        "libcutils",
        "libEGL",
        "libGLESv2",
        "libgui",
        "liblog",
        "libprotobuf-cpp-full",
        "libui",
        "libutils",
    ]

}

subdirs = [
    "fakehwc",
    "hwc2",
    "unittests",
    "vsync",
    "waitforvsync",
]
Loading