Loading libs/gui/Surface.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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__); Loading libs/gui/include/gui/Surface.h +1 −3 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -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: Loading libs/gui/tests/Surface_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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); } Loading libs/nativewindow/ANativeWindow.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -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; } libs/nativewindow/include/apex/window.h +9 −0 Original line number Diff line number Diff line Loading @@ -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
libs/gui/Surface.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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__); Loading
libs/gui/include/gui/Surface.h +1 −3 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -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: Loading
libs/gui/tests/Surface_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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); } Loading
libs/nativewindow/ANativeWindow.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -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; }
libs/nativewindow/include/apex/window.h +9 −0 Original line number Diff line number Diff line Loading @@ -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