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

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

Merge "[ANativeWindow] Add apex stub for getLastDequeueStartTime"

parents 5371c022 a161966a
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -1081,6 +1081,9 @@ int Surface::perform(int operation, va_list args)
    case NATIVE_WINDOW_SET_AUTO_PREROTATION:
        res = dispatchSetAutoPrerotation(args);
        break;
    case NATIVE_WINDOW_GET_LAST_DEQUEUE_START:
        res = dispatchGetLastDequeueStartTime(args);
        break;
    default:
        res = NAME_NOT_FOUND;
        break;
@@ -1286,6 +1289,12 @@ int Surface::dispatchSetAutoPrerotation(va_list args) {
    return setAutoPrerotation(autoPrerotation);
}

int Surface::dispatchGetLastDequeueStartTime(va_list args) {
    int64_t* lastDequeueStartTime = va_arg(args, int64_t*);
    *lastDequeueStartTime = mLastDequeueStartTime;
    return NO_ERROR;
}

bool Surface::transformToDisplayInverse() {
    return (mTransform & NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY) ==
            NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
@@ -1950,11 +1959,6 @@ int Surface::getConsumerUsage(uint64_t* outUsage) const {
    return mGraphicBufferProducer->getConsumerUsage(outUsage);
}

nsecs_t Surface::getLastDequeueStartTime() const {
    Mutex::Autolock lock(mMutex);
    return mLastDequeueStartTime;
}

status_t Surface::getAndFlushRemovedBuffers(std::vector<sp<GraphicBuffer>>* out) {
    if (out == nullptr) {
        ALOGE("%s: out must not be null!", __FUNCTION__);
+1 −3
Original line number Diff line number Diff line
@@ -179,9 +179,6 @@ public:
    status_t getUniqueId(uint64_t* outId) const;
    status_t getConsumerUsage(uint64_t* outUsage) const;

    // Returns the CLOCK_MONOTONIC start time of the last dequeueBuffer call
    nsecs_t getLastDequeueStartTime() const;

protected:
    virtual ~Surface();

@@ -247,6 +244,7 @@ private:
    int dispatchGetHdrSupport(va_list args);
    int dispatchGetConsumerUsage64(va_list args);
    int dispatchSetAutoPrerotation(va_list args);
    int dispatchGetLastDequeueStartTime(va_list args);
    bool transformToDisplayInverse();

protected:
+1 −1
Original line number Diff line number Diff line
@@ -617,7 +617,7 @@ TEST_F(SurfaceTest, TestGetLastDequeueStartTime) {
    anw->dequeueBuffer(anw.get(), &buffer, &fenceFd);
    nsecs_t after = systemTime(CLOCK_MONOTONIC);

    nsecs_t lastDequeueTime = mSurface->getLastDequeueStartTime();
    nsecs_t lastDequeueTime = ANativeWindow_getLastDequeueStartTime(anw.get());
    ASSERT_LE(before, lastDequeueTime);
    ASSERT_GE(after, lastDequeueTime);
}
+6 −0
Original line number Diff line number Diff line
@@ -278,3 +278,9 @@ int ANativeWindow_getLastDequeueDuration(ANativeWindow* window) {
int ANativeWindow_getLastQueueDuration(ANativeWindow* window) {
    return query(window, NATIVE_WINDOW_LAST_QUEUE_DURATION);
}

int64_t ANativeWindow_getLastDequeueStartTime(ANativeWindow* window) {
    int64_t time;
    int success = window->perform(window, NATIVE_WINDOW_GET_LAST_DEQUEUE_START, &time);
    return success < 0 ? success : time;
}
+9 −0
Original line number Diff line number Diff line
@@ -39,4 +39,13 @@ int ANativeWindow_getLastDequeueDuration(ANativeWindow* window);
 */
int ANativeWindow_getLastQueueDuration(ANativeWindow* window);

/**
 * Retrieves the system time in nanoseconds when the last time a buffer
 * was dequeued.
 *
 * \return a negative value on error, otherwise returns the duration in
 * nanoseconds.
 */
int64_t ANativeWindow_getLastDequeueStartTime(ANativeWindow* window);

__END_DECLS
Loading