Loading libs/gui/Surface.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -732,6 +732,8 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer, int* fenceFd) { mSharedBufferHasBeenQueued = false; } mDequeuedSlots.insert(buf); return OK; } Loading Loading @@ -760,6 +762,8 @@ int Surface::cancelBuffer(android_native_buffer_t* buffer, mSharedBufferHasBeenQueued = true; } mDequeuedSlots.erase(i); return OK; } Loading Loading @@ -895,6 +899,8 @@ int Surface::queueBuffer(android_native_buffer_t* buffer, int fenceFd) { ALOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err); } mDequeuedSlots.erase(i); if (mEnableFrameTimestamps) { mFrameEventHistory->applyDelta(output.frameTimestamps); // Update timestamps with the local acquire fence. Loading Loading @@ -1660,6 +1666,7 @@ int Surface::attachBuffer(ANativeWindowBuffer* buffer) mRemovedBuffers.push_back(mSlots[attachedSlot].buffer); } mSlots[attachedSlot].buffer = graphicBuffer; mDequeuedSlots.insert(attachedSlot); return NO_ERROR; } Loading Loading @@ -1926,6 +1933,10 @@ Dataspace Surface::getBuffersDataSpace() { } void Surface::freeAllBuffers() { if (!mDequeuedSlots.empty()) { ALOGE("%s: %zu buffers were freed while being dequeued!", __FUNCTION__, mDequeuedSlots.size()); } for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { mSlots[i].buffer = nullptr; } Loading @@ -1947,6 +1958,10 @@ status_t Surface::getAndFlushBuffersFromSlots(const std::vector<int32_t>& slots, ALOGW("%s: Discarded slot %d doesn't contain buffer!", __FUNCTION__, i); continue; } // Don't flush currently dequeued buffers if (mDequeuedSlots.count(i) > 0) { continue; } outBuffers->push_back(mSlots[i].buffer); mSlots[i].buffer = nullptr; } Loading libs/gui/include/gui/Surface.h +8 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <utils/RefBase.h> #include <shared_mutex> #include <unordered_set> namespace android { Loading Loading @@ -543,8 +544,15 @@ protected: int mMaxBufferCount; sp<IProducerListener> mListenerProxy; // Get and flush the buffers of given slots, if the buffer in the slot // is currently dequeued then it won't be flushed and won't be returned // in outBuffers. status_t getAndFlushBuffersFromSlots(const std::vector<int32_t>& slots, std::vector<sp<GraphicBuffer>>* outBuffers); // Buffers that are successfully dequeued/attached and handed to clients std::unordered_set<int> mDequeuedSlots; }; } // namespace android Loading services/inputflinger/reader/include/TouchVideoDevice.h +1 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ private: * How many buffers to keep for the internal queue. When the internal buffer * exceeds this capacity, oldest frames will be dropped. */ static constexpr size_t MAX_QUEUE_SIZE = 10; static constexpr size_t MAX_QUEUE_SIZE = 20; std::vector<TouchVideoFrame> mFrames; /** Loading services/surfaceflinger/SurfaceFlinger.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -2122,7 +2122,8 @@ void SurfaceFlinger::onMessageRefresh() { mTimeStats->incrementCompositionStrategyChanges(); } mVSyncModulator->onRefreshed(mHadClientComposition); // TODO: b/160583065 Enable skip validation when SF caches all client composition layers mVSyncModulator->onRefreshed(mHadClientComposition || mReusedClientComposition); mLayersWithQueuedFrames.clear(); if (mVisibleRegionsDirty) { Loading Loading
libs/gui/Surface.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -732,6 +732,8 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer, int* fenceFd) { mSharedBufferHasBeenQueued = false; } mDequeuedSlots.insert(buf); return OK; } Loading Loading @@ -760,6 +762,8 @@ int Surface::cancelBuffer(android_native_buffer_t* buffer, mSharedBufferHasBeenQueued = true; } mDequeuedSlots.erase(i); return OK; } Loading Loading @@ -895,6 +899,8 @@ int Surface::queueBuffer(android_native_buffer_t* buffer, int fenceFd) { ALOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err); } mDequeuedSlots.erase(i); if (mEnableFrameTimestamps) { mFrameEventHistory->applyDelta(output.frameTimestamps); // Update timestamps with the local acquire fence. Loading Loading @@ -1660,6 +1666,7 @@ int Surface::attachBuffer(ANativeWindowBuffer* buffer) mRemovedBuffers.push_back(mSlots[attachedSlot].buffer); } mSlots[attachedSlot].buffer = graphicBuffer; mDequeuedSlots.insert(attachedSlot); return NO_ERROR; } Loading Loading @@ -1926,6 +1933,10 @@ Dataspace Surface::getBuffersDataSpace() { } void Surface::freeAllBuffers() { if (!mDequeuedSlots.empty()) { ALOGE("%s: %zu buffers were freed while being dequeued!", __FUNCTION__, mDequeuedSlots.size()); } for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { mSlots[i].buffer = nullptr; } Loading @@ -1947,6 +1958,10 @@ status_t Surface::getAndFlushBuffersFromSlots(const std::vector<int32_t>& slots, ALOGW("%s: Discarded slot %d doesn't contain buffer!", __FUNCTION__, i); continue; } // Don't flush currently dequeued buffers if (mDequeuedSlots.count(i) > 0) { continue; } outBuffers->push_back(mSlots[i].buffer); mSlots[i].buffer = nullptr; } Loading
libs/gui/include/gui/Surface.h +8 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <utils/RefBase.h> #include <shared_mutex> #include <unordered_set> namespace android { Loading Loading @@ -543,8 +544,15 @@ protected: int mMaxBufferCount; sp<IProducerListener> mListenerProxy; // Get and flush the buffers of given slots, if the buffer in the slot // is currently dequeued then it won't be flushed and won't be returned // in outBuffers. status_t getAndFlushBuffersFromSlots(const std::vector<int32_t>& slots, std::vector<sp<GraphicBuffer>>* outBuffers); // Buffers that are successfully dequeued/attached and handed to clients std::unordered_set<int> mDequeuedSlots; }; } // namespace android Loading
services/inputflinger/reader/include/TouchVideoDevice.h +1 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ private: * How many buffers to keep for the internal queue. When the internal buffer * exceeds this capacity, oldest frames will be dropped. */ static constexpr size_t MAX_QUEUE_SIZE = 10; static constexpr size_t MAX_QUEUE_SIZE = 20; std::vector<TouchVideoFrame> mFrames; /** Loading
services/surfaceflinger/SurfaceFlinger.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -2122,7 +2122,8 @@ void SurfaceFlinger::onMessageRefresh() { mTimeStats->incrementCompositionStrategyChanges(); } mVSyncModulator->onRefreshed(mHadClientComposition); // TODO: b/160583065 Enable skip validation when SF caches all client composition layers mVSyncModulator->onRefreshed(mHadClientComposition || mReusedClientComposition); mLayersWithQueuedFrames.clear(); if (mVisibleRegionsDirty) { Loading