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

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

Snap for 7188367 from dbefc04c to sc-release

Change-Id: I9745bb6c393942c459212bc3d5ce4f02289060c3
parents 69d82e22 dbefc04c
Loading
Loading
Loading
Loading
+25 −6
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <EGL/Platform.h>
#pragma GCC diagnostic pop

#include <android-base/properties.h>
#include <android/dlext.h>
#include <dlfcn.h>
#include <graphicsenv/GraphicsEnv.h>
@@ -33,7 +35,6 @@

namespace angle {

constexpr char kAngleEs2Lib[] = "libGLESv2_angle.so";
constexpr int kAngleDlFlags = RTLD_LOCAL | RTLD_NOW;

static GetDisplayPlatformFunc angleGetDisplayPlatform = nullptr;
@@ -107,19 +108,37 @@ bool initializeAnglePlatform(EGLDisplay dpy) {
    android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
    void* so = nullptr;
    if (ns) {
        // Loading from an APK, so hard-code the suffix to "_angle".
        constexpr char kAngleEs2Lib[] = "libGLESv2_angle.so";
        const android_dlextinfo dlextinfo = {
                .flags = ANDROID_DLEXT_USE_NAMESPACE,
                .library_namespace = ns,
        };
        so = android_dlopen_ext(kAngleEs2Lib, kAngleDlFlags, &dlextinfo);
        if (so) {
            ALOGD("dlopen_ext from APK (%s) success at %p", kAngleEs2Lib, so);
        } else {
            ALOGE("dlopen_ext(\"%s\") failed: %s", kAngleEs2Lib, dlerror());
            return false;
        }
    } else {
        // If we are here, ANGLE is loaded as built-in gl driver in the sphal.
        so = android_load_sphal_library(kAngleEs2Lib, kAngleDlFlags);
        // Get the specified ANGLE library filename suffix.
        std::string angleEs2LibSuffix = android::base::GetProperty("ro.hardware.egl", "");
        if (angleEs2LibSuffix.empty()) {
            ALOGE("%s failed to get valid ANGLE library filename suffix!", __FUNCTION__);
            return false;
        }
    if (!so) {
        ALOGE("%s failed to dlopen %s!", __FUNCTION__, kAngleEs2Lib);

        std::string angleEs2LibName = "libGLESv2_" + angleEs2LibSuffix + ".so";
        so = android_load_sphal_library(angleEs2LibName.c_str(), kAngleDlFlags);
        if (so) {
            ALOGD("dlopen (%s) success at %p", angleEs2LibName.c_str(), so);
        } else {
            ALOGE("%s failed to dlopen %s!", __FUNCTION__, angleEs2LibName.c_str());
            return false;
        }
    }

    angleGetDisplayPlatform =
            reinterpret_cast<GetDisplayPlatformFunc>(dlsym(so, "ANGLEGetDisplayPlatform"));
+40 −39
Original line number Diff line number Diff line
@@ -1412,28 +1412,29 @@ void TouchInputMapper::process(const RawEvent* rawEvent) {
}

void TouchInputMapper::sync(nsecs_t when, nsecs_t readTime) {
    const RawState* last =
            mRawStatesPending.empty() ? &mCurrentRawState : &mRawStatesPending.back();

    // Push a new state.
    mRawStatesPending.emplace_back();

    RawState* next = &mRawStatesPending.back();
    next->clear();
    next->when = when;
    next->readTime = readTime;
    RawState& next = mRawStatesPending.back();
    next.clear();
    next.when = when;
    next.readTime = readTime;

    // Sync button state.
    next->buttonState =
    next.buttonState =
            mTouchButtonAccumulator.getButtonState() | mCursorButtonAccumulator.getButtonState();

    // Sync scroll
    next->rawVScroll = mCursorScrollAccumulator.getRelativeVWheel();
    next->rawHScroll = mCursorScrollAccumulator.getRelativeHWheel();
    next.rawVScroll = mCursorScrollAccumulator.getRelativeVWheel();
    next.rawHScroll = mCursorScrollAccumulator.getRelativeHWheel();
    mCursorScrollAccumulator.finishSync();

    // Sync touch
    syncTouch(when, next);
    syncTouch(when, &next);

    // The last RawState is the actually second to last, since we just added a new state
    const RawState& last =
            mRawStatesPending.size() == 1 ? mCurrentRawState : mRawStatesPending.rbegin()[1];

    // Assign pointer ids.
    if (!mHavePointerIds) {
@@ -1443,10 +1444,10 @@ void TouchInputMapper::sync(nsecs_t when, nsecs_t readTime) {
#if DEBUG_RAW_EVENTS
    ALOGD("syncTouch: pointerCount %d -> %d, touching ids 0x%08x -> 0x%08x, "
          "hovering ids 0x%08x -> 0x%08x, canceled ids 0x%08x",
          last->rawPointerData.pointerCount, next->rawPointerData.pointerCount,
          last->rawPointerData.touchingIdBits.value, next->rawPointerData.touchingIdBits.value,
          last->rawPointerData.hoveringIdBits.value, next->rawPointerData.hoveringIdBits.value,
          next->rawPointerData.canceledIdBits.value);
          last.rawPointerData.pointerCount, next.rawPointerData.pointerCount,
          last.rawPointerData.touchingIdBits.value, next.rawPointerData.touchingIdBits.value,
          last.rawPointerData.hoveringIdBits.value, next.rawPointerData.hoveringIdBits.value,
          next.rawPointerData.canceledIdBits.value);
#endif

    processRawTouches(false /*timeout*/);
@@ -3731,11 +3732,11 @@ const TouchInputMapper::VirtualKey* TouchInputMapper::findVirtualKeyHit(int32_t
    return nullptr;
}

void TouchInputMapper::assignPointerIds(const RawState* last, RawState* current) {
    uint32_t currentPointerCount = current->rawPointerData.pointerCount;
    uint32_t lastPointerCount = last->rawPointerData.pointerCount;
void TouchInputMapper::assignPointerIds(const RawState& last, RawState& current) {
    uint32_t currentPointerCount = current.rawPointerData.pointerCount;
    uint32_t lastPointerCount = last.rawPointerData.pointerCount;

    current->rawPointerData.clearIdBits();
    current.rawPointerData.clearIdBits();

    if (currentPointerCount == 0) {
        // No pointers to assign.
@@ -3746,20 +3747,20 @@ void TouchInputMapper::assignPointerIds(const RawState* last, RawState* current)
        // All pointers are new.
        for (uint32_t i = 0; i < currentPointerCount; i++) {
            uint32_t id = i;
            current->rawPointerData.pointers[i].id = id;
            current->rawPointerData.idToIndex[id] = i;
            current->rawPointerData.markIdBit(id, current->rawPointerData.isHovering(i));
            current.rawPointerData.pointers[i].id = id;
            current.rawPointerData.idToIndex[id] = i;
            current.rawPointerData.markIdBit(id, current.rawPointerData.isHovering(i));
        }
        return;
    }

    if (currentPointerCount == 1 && lastPointerCount == 1 &&
        current->rawPointerData.pointers[0].toolType == last->rawPointerData.pointers[0].toolType) {
        current.rawPointerData.pointers[0].toolType == last.rawPointerData.pointers[0].toolType) {
        // Only one pointer and no change in count so it must have the same id as before.
        uint32_t id = last->rawPointerData.pointers[0].id;
        current->rawPointerData.pointers[0].id = id;
        current->rawPointerData.idToIndex[id] = 0;
        current->rawPointerData.markIdBit(id, current->rawPointerData.isHovering(0));
        uint32_t id = last.rawPointerData.pointers[0].id;
        current.rawPointerData.pointers[0].id = id;
        current.rawPointerData.idToIndex[id] = 0;
        current.rawPointerData.markIdBit(id, current.rawPointerData.isHovering(0));
        return;
    }

@@ -3777,9 +3778,9 @@ void TouchInputMapper::assignPointerIds(const RawState* last, RawState* current)
        for (uint32_t lastPointerIndex = 0; lastPointerIndex < lastPointerCount;
             lastPointerIndex++) {
            const RawPointerData::Pointer& currentPointer =
                    current->rawPointerData.pointers[currentPointerIndex];
                    current.rawPointerData.pointers[currentPointerIndex];
            const RawPointerData::Pointer& lastPointer =
                    last->rawPointerData.pointers[lastPointerIndex];
                    last.rawPointerData.pointers[lastPointerIndex];
            if (currentPointer.toolType == lastPointer.toolType) {
                int64_t deltaX = currentPointer.x - lastPointer.x;
                int64_t deltaY = currentPointer.y - lastPointer.y;
@@ -3883,11 +3884,11 @@ void TouchInputMapper::assignPointerIds(const RawState* last, RawState* current)
            matchedCurrentBits.markBit(currentPointerIndex);
            matchedLastBits.markBit(lastPointerIndex);

            uint32_t id = last->rawPointerData.pointers[lastPointerIndex].id;
            current->rawPointerData.pointers[currentPointerIndex].id = id;
            current->rawPointerData.idToIndex[id] = currentPointerIndex;
            current->rawPointerData.markIdBit(id,
                                              current->rawPointerData.isHovering(
            uint32_t id = last.rawPointerData.pointers[lastPointerIndex].id;
            current.rawPointerData.pointers[currentPointerIndex].id = id;
            current.rawPointerData.idToIndex[id] = currentPointerIndex;
            current.rawPointerData.markIdBit(id,
                                             current.rawPointerData.isHovering(
                                                     currentPointerIndex));
            usedIdBits.markBit(id);

@@ -3905,10 +3906,10 @@ void TouchInputMapper::assignPointerIds(const RawState* last, RawState* current)
        uint32_t currentPointerIndex = matchedCurrentBits.markFirstUnmarkedBit();
        uint32_t id = usedIdBits.markFirstUnmarkedBit();

        current->rawPointerData.pointers[currentPointerIndex].id = id;
        current->rawPointerData.idToIndex[id] = currentPointerIndex;
        current->rawPointerData.markIdBit(id,
                                          current->rawPointerData.isHovering(currentPointerIndex));
        current.rawPointerData.pointers[currentPointerIndex].id = id;
        current.rawPointerData.idToIndex[id] = currentPointerIndex;
        current.rawPointerData.markIdBit(id,
                                         current.rawPointerData.isHovering(currentPointerIndex));

#if DEBUG_POINTER_ASSIGNMENT
        ALOGD("assignPointerIds - assigned: cur=%" PRIu32 ", id=%" PRIu32, currentPointerIndex, id);
+1 −1
Original line number Diff line number Diff line
@@ -772,7 +772,7 @@ private:
    bool isPointInsideSurface(int32_t x, int32_t y);
    const VirtualKey* findVirtualKeyHit(int32_t x, int32_t y);

    static void assignPointerIds(const RawState* last, RawState* current);
    static void assignPointerIds(const RawState& last, RawState& current);

    const char* modeToString(DeviceMode deviceMode);
    void rotateAndScale(float& x, float& y);
+0 −1
Original line number Diff line number Diff line
@@ -1339,7 +1339,6 @@ bool Layer::setCrop_legacy(const Rect& crop) {

bool Layer::setMetadata(const LayerMetadata& data) {
    if (!mCurrentState.metadata.merge(data, true /* eraseEmpty */)) return false;
    mCurrentState.sequence++;
    mCurrentState.modified = true;
    setTransactionFlags(eTransactionNeeded);
    return true;
+2 −2
Original line number Diff line number Diff line
@@ -217,10 +217,10 @@ HalResult<milliseconds> HalController::performEffect(
    return apply(performEffectFn, "performEffect");
}

HalResult<void> HalController::performComposedEffect(
HalResult<milliseconds> HalController::performComposedEffect(
        const std::vector<CompositeEffect>& primitiveEffects,
        const std::function<void()>& completionCallback) {
    hal_fn<void> performComposedEffectFn = [&](std::shared_ptr<HalWrapper> hal) {
    hal_fn<milliseconds> performComposedEffectFn = [&](std::shared_ptr<HalWrapper> hal) {
        return hal->performComposedEffect(primitiveEffects, completionCallback);
    };
    return apply(performComposedEffectFn, "performComposedEffect");
Loading