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

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

Snap for 7135433 from d486b821 to sc-release

Change-Id: I64d16f14b782de6083952b0d94d7b55e5ec41a68
parents e3c3fa0c d486b821
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -31,18 +31,8 @@
#include <stddef.h>
#include <jni.h>

#ifndef __ANDROID__
    // Value copied from 'bionic/libc/include/android/api-level.h' which is not available on
    // non Android systems. It is set to 10000 which is same as __ANDROID_API_FUTURE__ value.
    #ifndef __ANDROID_API__
        #define __ANDROID_API__ 10000
    #endif

    // Value copied from 'bionic/libc/include/android/versioning.h' which is not available on
    // non Android systems
    #ifndef __INTRODUCED_IN
        #define __INTRODUCED_IN(api_level)
    #endif
#if !defined(__INTRODUCED_IN)
#define __INTRODUCED_IN(__api_level) /* nothing */
#endif

#ifdef __cplusplus
+2 −12
Original line number Diff line number Diff line
@@ -51,18 +51,8 @@
#include <android/rect.h>
#include <stdint.h>

#ifndef __ANDROID__
    // Value copied from 'bionic/libc/include/android/api-level.h' which is not available on
    // non Android systems. It is set to 10000 which is same as __ANDROID_API_FUTURE__ value.
    #ifndef __ANDROID_API__
        #define __ANDROID_API__ 10000
    #endif

    // Value copied from 'bionic/libc/include/android/versioning.h' which is not available on
    // non Android systems
    #ifndef __INTRODUCED_IN
        #define __INTRODUCED_IN(api_level)
    #endif
#if !defined(__INTRODUCED_IN)
#define __INTRODUCED_IN(__api_level) /* nothing */
#endif

#ifdef __cplusplus
+4 −2
Original line number Diff line number Diff line
@@ -133,8 +133,10 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, const sp<SurfaceCont
    if (enableTripleBuffering) {
        mProducer->setMaxDequeuedBufferCount(2);
    }
    mBufferItemConsumer =
        new BLASTBufferItemConsumer(mConsumer, GraphicBuffer::USAGE_HW_COMPOSER, 1, false);
    mBufferItemConsumer = new BLASTBufferItemConsumer(mConsumer,
                                                      GraphicBuffer::USAGE_HW_COMPOSER |
                                                              GraphicBuffer::USAGE_HW_TEXTURE,
                                                      1, false);
    static int32_t id = 0;
    auto consumerName = mName + "(BLAST Consumer)" + std::to_string(id);
    id++;
+21 −49
Original line number Diff line number Diff line
@@ -36,9 +36,7 @@ static const size_t EVENT_BUFFER_SIZE = 100;
DisplayEventDispatcher::DisplayEventDispatcher(
        const sp<Looper>& looper, ISurfaceComposer::VsyncSource vsyncSource,
        ISurfaceComposer::EventRegistrationFlags eventRegistration)
      : mLooper(looper),
        mReceiver(vsyncSource, eventRegistration),
        mVsyncState(VsyncState::Unregistered) {
      : mLooper(looper), mReceiver(vsyncSource, eventRegistration), mWaitingForVsync(false) {
    ALOGV("dispatcher %p ~ Initializing display event dispatcher.", this);
}

@@ -68,8 +66,7 @@ void DisplayEventDispatcher::dispose() {
}

status_t DisplayEventDispatcher::scheduleVsync() {
    switch (mVsyncState) {
        case VsyncState::Unregistered: {
    if (!mWaitingForVsync) {
        ALOGV("dispatcher %p ~ Scheduling vsync.", this);

        // Drain all pending events.
@@ -77,28 +74,18 @@ status_t DisplayEventDispatcher::scheduleVsync() {
        PhysicalDisplayId vsyncDisplayId;
        uint32_t vsyncCount;
        VsyncEventData vsyncEventData;
            if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount,
                                     &vsyncEventData)) {
                ALOGE("dispatcher %p ~ last event processed while scheduling was for %" PRId64 "",
                      this, ns2ms(static_cast<nsecs_t>(vsyncTimestamp)));
        if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount, &vsyncEventData)) {
            ALOGE("dispatcher %p ~ last event processed while scheduling was for %" PRId64 "", this,
                  ns2ms(static_cast<nsecs_t>(vsyncTimestamp)));
        }

            status_t status = mReceiver.setVsyncRate(1);
        status_t status = mReceiver.requestNextVsync();
        if (status) {
                ALOGW("Failed to set vsync rate, status=%d", status);
            ALOGW("Failed to request next vsync, status=%d", status);
            return status;
        }

            mVsyncState = VsyncState::RegisteredAndWaitingForVsync;
            break;
        }
        case VsyncState::Registered: {
            mVsyncState = VsyncState::RegisteredAndWaitingForVsync;
            break;
        }
        case VsyncState::RegisteredAndWaitingForVsync: {
            break;
        }
        mWaitingForVsync = true;
    }
    return OK;
}
@@ -136,23 +123,8 @@ int DisplayEventDispatcher::handleEvent(int, int events, void*) {
              ", displayId=%s, count=%d, vsyncId=%" PRId64,
              this, ns2ms(vsyncTimestamp), to_string(vsyncDisplayId).c_str(), vsyncCount,
              vsyncEventData.id);
        switch (mVsyncState) {
            case VsyncState::Unregistered:
                ALOGW("Received unexpected VSYNC event");
                break;
            case VsyncState::RegisteredAndWaitingForVsync:
                mVsyncState = VsyncState::Registered;
        mWaitingForVsync = false;
        dispatchVsync(vsyncTimestamp, vsyncDisplayId, vsyncCount, vsyncEventData);
                break;
            case VsyncState::Registered:
                status_t status = mReceiver.setVsyncRate(0);
                if (status) {
                    ALOGW("Failed to reset vsync rate, status=%d", status);
                    return status;
                }
                mVsyncState = VsyncState::Unregistered;
                break;
        }
    }

    return 1; // keep the callback
+22 −0
Original line number Diff line number Diff line
@@ -1235,6 +1235,18 @@ public:
        }
        return reply.readInt32();
    }

    status_t getExtraBufferCount(int* extraBuffers) const override {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        status_t err = remote()->transact(BnSurfaceComposer::GET_EXTRA_BUFFER_COUNT, data, &reply);
        if (err != NO_ERROR) {
            ALOGE("getExtraBufferCount failed to read data:  %s (%d)", strerror(-err), err);
            return err;
        }

        return reply.readInt32(extraBuffers);
    }
};

// Out-of-line virtual method definition to trigger vtable emission in this
@@ -2107,6 +2119,16 @@ status_t BnSurfaceComposer::onTransact(
            SAFE_PARCEL(reply->writeInt32, priority);
            return NO_ERROR;
        }
        case GET_EXTRA_BUFFER_COUNT: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            int extraBuffers = 0;
            int err = getExtraBufferCount(&extraBuffers);
            if (err != NO_ERROR) {
                return err;
            }
            SAFE_PARCEL(reply->writeInt32, extraBuffers);
            return NO_ERROR;
        }
        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
Loading