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

Commit 9f7e1871 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6440900 from eeff9de9 to rvc-release

Change-Id: I09d39bcdcf991ba2e59a808db7d457feb665df85
parents 2ad86e65 eeff9de9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ cc_test {
    shared_libs: [
        "android.hardware.configstore@1.0",
        "android.hardware.configstore-utils",
        "libSurfaceFlingerProp",
        "libbase",
        "liblog",
        "libEGL",
@@ -53,6 +54,8 @@ cc_test {
        "libutils",
        "libnativewindow"
    ],

    header_libs: ["libsurfaceflinger_headers"],
}

// Build a separate binary to $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
+4 −5
Original line number Diff line number Diff line
@@ -18,17 +18,18 @@

#include <gtest/gtest.h>

#include <SurfaceFlingerProperties.h>
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
#include <binder/ProcessState.h>
#include <configstore/Utils.h>
#include <cutils/properties.h>
#include <inttypes.h>
#include <gui/BufferItemConsumer.h>
#include <gui/IDisplayEventConnection.h>
#include <gui/IProducerListener.h>
#include <gui/ISurfaceComposer.h>
#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>
#include <inttypes.h>
#include <private/gui/ComposerService.h>
#include <ui/Rect.h>
#include <utils/String8.h>
@@ -46,11 +47,9 @@ using ui::ColorMode;

using Transaction = SurfaceComposerClient::Transaction;

static bool hasWideColorDisplay =
        getBool<ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasWideColorDisplay>(false);
static bool hasWideColorDisplay = android::sysprop::has_wide_color_display(false);

static bool hasHdrDisplay =
        getBool<ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasHDRDisplay>(false);
static bool hasHdrDisplay = android::sysprop::has_HDR_display(false);

class FakeSurfaceComposer;
class FakeProducerFrameEventHistory;
+2 −2
Original line number Diff line number Diff line
@@ -468,7 +468,7 @@ status_t InputPublisher::publishKeyEvent(uint32_t seq, int32_t eventId, int32_t
    msg.body.key.deviceId = deviceId;
    msg.body.key.source = source;
    msg.body.key.displayId = displayId;
    msg.body.key.hmac = hmac;
    msg.body.key.hmac = std::move(hmac);
    msg.body.key.action = action;
    msg.body.key.flags = flags;
    msg.body.key.keyCode = keyCode;
@@ -526,7 +526,7 @@ status_t InputPublisher::publishMotionEvent(
    msg.body.motion.deviceId = deviceId;
    msg.body.motion.source = source;
    msg.body.motion.displayId = displayId;
    msg.body.motion.hmac = hmac;
    msg.body.motion.hmac = std::move(hmac);
    msg.body.motion.action = action;
    msg.body.motion.actionButton = actionButton;
    msg.body.motion.flags = flags;
+2 −0
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ cc_library_shared {
        "libnativebridge_lazy",
        "libnativeloader_lazy",
        "libutils",
        "libSurfaceFlingerProp",
    ],
    static_libs: [
        "libEGL_getProcAddress",
@@ -165,6 +166,7 @@ cc_library_shared {
        symbol_file: "libEGL.map.txt",
        versions: ["29"],
    },
    header_libs: ["libsurfaceflinger_headers"],
}

cc_test {
+25 −64
Original line number Diff line number Diff line
@@ -271,6 +271,12 @@ void* Loader::open(egl_connection_t* cnx)
    if (!hnd) {
        android::GraphicsEnv::getInstance().setDriverLoaded(android::GpuStatsInfo::Api::API_GL,
                                                            false, systemTime() - openTime);
    } else {
        // init_angle_backend will check if loaded driver is ANGLE or not,
        // will set cnx->useAngle appropriately.
        // Do this here so that we use ANGLE path when driver is ANGLE (e.g. loaded as native),
        // not just loading ANGLE as option.
        init_angle_backend(hnd->dso[0], cnx);
    }

    LOG_ALWAYS_FATAL_IF(!hnd,
@@ -311,11 +317,6 @@ void Loader::close(egl_connection_t* cnx)
    cnx->dso = nullptr;

    cnx->useAngle = false;

    if (cnx->vendorEGL) {
        dlclose(cnx->vendorEGL);
        cnx->vendorEGL = nullptr;
    }
}

void Loader::init_api(void* dso,
@@ -482,7 +483,7 @@ static void* load_system_driver(const char* kind, const char* suffix, const bool
    return dso;
}

static void* load_angle_from_namespace(const char* kind, android_namespace_t* ns) {
static void* load_angle(const char* kind, android_namespace_t* ns) {
    const android_dlextinfo dlextinfo = {
            .flags = ANDROID_DLEXT_USE_NAMESPACE,
            .library_namespace = ns,
@@ -502,61 +503,6 @@ static void* load_angle_from_namespace(const char* kind, android_namespace_t* ns
    return nullptr;
}

static void* load_angle(const char* kind, android_namespace_t* ns, egl_connection_t* cnx) {
    void* so = load_angle_from_namespace(kind, ns);

    if (so) {
        ALOGV("Loaded ANGLE %s library for '%s' (instead of native)", kind,
            android::GraphicsEnv::getInstance().getAngleAppName().c_str());
        cnx->useAngle = true;

        char prop[PROPERTY_VALUE_MAX];

        property_get("debug.hwui.renderer", prop, "UNSET");
        ALOGV("Skia's renderer set to %s", prop);

        EGLint angleBackendDefault = EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE;
        property_get("debug.angle.backend", prop, "0");
        switch (atoi(prop)) {
            case 1:
                ALOGV("%s: Requesting OpenGLES back-end", __FUNCTION__);
                angleBackendDefault = EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE;
                break;
            case 2:
                ALOGV("%s: Requesting Vulkan back-end", __FUNCTION__);
                angleBackendDefault = EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE;
                break;
            default:
                break;
        }

        cnx->angleBackend = angleBackendDefault;
        if (!cnx->vendorEGL && (cnx->angleBackend == EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE)) {
            // Find and load vendor libEGL for ANGLE's GL back-end to use.
            char prop[PROPERTY_VALUE_MAX + 1];
            for (auto key : HAL_SUBNAME_KEY_PROPERTIES) {
                if (property_get(key, prop, nullptr) <= 0) {
                    continue;
                }
                void* dso = load_system_driver("EGL", prop, true);
                if (dso) {
                    cnx->vendorEGL = dso;
                    break;
                }
            }
            if (!cnx->vendorEGL) {
                cnx->vendorEGL = load_system_driver("EGL", nullptr, true);
            }
        }
    } else {
        ALOGV("Loaded native %s library for '%s' (instead of ANGLE)", kind,
            android::GraphicsEnv::getInstance().getAngleAppName().c_str());
        cnx->useAngle = false;
    }

    return so;
}

static void* load_updated_driver(const char* kind, android_namespace_t* ns) {
    ATRACE_CALL();
    const android_dlextinfo dlextinfo = {
@@ -594,22 +540,37 @@ Loader::driver_t* Loader::attempt_to_load_angle(egl_connection_t* cnx) {
    driver_t* hnd = nullptr;

    // ANGLE doesn't ship with GLES library, and thus we skip GLES driver.
    void* dso = load_angle("EGL", ns, cnx);
    void* dso = load_angle("EGL", ns);
    if (dso) {
        initialize_api(dso, cnx, EGL);
        hnd = new driver_t(dso);

        dso = load_angle("GLESv1_CM", ns, cnx);
        dso = load_angle("GLESv1_CM", ns);
        initialize_api(dso, cnx, GLESv1_CM);
        hnd->set(dso, GLESv1_CM);

        dso = load_angle("GLESv2", ns, cnx);
        dso = load_angle("GLESv2", ns);
        initialize_api(dso, cnx, GLESv2);
        hnd->set(dso, GLESv2);
    }
    return hnd;
}

void Loader::init_angle_backend(void* dso, egl_connection_t* cnx) {
    void* eglCreateDeviceANGLE = nullptr;

    ALOGV("dso: %p", dso);
    eglCreateDeviceANGLE = dlsym(dso, "eglCreateDeviceANGLE");
    ALOGV("eglCreateDeviceANGLE: %p", eglCreateDeviceANGLE);
    if (eglCreateDeviceANGLE) {
        ALOGV("ANGLE GLES library in use");
        cnx->useAngle = true;
    } else {
        ALOGV("Native GLES library in use");
        cnx->useAngle = false;
    }
}

Loader::driver_t* Loader::attempt_to_load_updated_driver(egl_connection_t* cnx) {
    ATRACE_CALL();
#ifndef __ANDROID_VNDK__
Loading