Loading libs/gui/ISurfaceComposer.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -1281,6 +1281,9 @@ status_t BnSurfaceComposer::onTransact( std::unordered_set<sp<IBinder>, SpHash<IBinder>> excludeHandles; std::unordered_set<sp<IBinder>, SpHash<IBinder>> excludeHandles; int numExcludeHandles = data.readInt32(); int numExcludeHandles = data.readInt32(); if (numExcludeHandles >= static_cast<int>(MAX_LAYERS)) { return BAD_VALUE; } excludeHandles.reserve(numExcludeHandles); excludeHandles.reserve(numExcludeHandles); for (int i = 0; i < numExcludeHandles; i++) { for (int i = 0; i < numExcludeHandles; i++) { excludeHandles.emplace(data.readStrongBinder()); excludeHandles.emplace(data.readStrongBinder()); Loading libs/gui/include/gui/ISurfaceComposer.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -76,6 +76,8 @@ class ISurfaceComposer: public IInterface { public: public: DECLARE_META_INTERFACE(SurfaceComposer) DECLARE_META_INTERFACE(SurfaceComposer) static constexpr size_t MAX_LAYERS = 4096; // flags for setTransactionState() // flags for setTransactionState() enum { enum { eSynchronous = 0x01, eSynchronous = 0x01, Loading libs/nativedisplay/AChoreographer.cpp +12 −3 Original line number Original line Diff line number Diff line Loading @@ -185,9 +185,18 @@ void Choreographer::unregisterRefreshRateCallback(AChoreographer_refreshRateCall } } void Choreographer::scheduleCallbacks() { void Choreographer::scheduleCallbacks() { const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t dueTime; { AutoMutex _{mLock}; AutoMutex _{mLock}; nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); // If there are no pending callbacks then don't schedule a vsync if (mFrameCallbacks.top().dueTime <= now) { if (mFrameCallbacks.empty()) { return; } dueTime = mFrameCallbacks.top().dueTime; } if (dueTime <= now) { ALOGV("choreographer %p ~ scheduling vsync", this); ALOGV("choreographer %p ~ scheduling vsync", this); scheduleVsync(); scheduleVsync(); return; return; Loading services/surfaceflinger/SurfaceFlinger.cpp +6 −4 Original line number Original line Diff line number Diff line Loading @@ -367,7 +367,7 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI property_get("ro.sf.blurs_are_expensive", value, "0"); property_get("ro.sf.blurs_are_expensive", value, "0"); mBlursAreExpensive = atoi(value); mBlursAreExpensive = atoi(value); const size_t defaultListSize = MAX_LAYERS; const size_t defaultListSize = ISurfaceComposer::MAX_LAYERS; auto listSize = property_get_int32("debug.sf.max_igbp_list_size", int32_t(defaultListSize)); auto listSize = property_get_int32("debug.sf.max_igbp_list_size", int32_t(defaultListSize)); mMaxGraphicBufferProducerListSize = (listSize > 0) ? size_t(listSize) : defaultListSize; mMaxGraphicBufferProducerListSize = (listSize > 0) ? size_t(listSize) : defaultListSize; Loading Loading @@ -1074,7 +1074,9 @@ bool SurfaceFlinger::performSetActiveConfig() { mUpcomingActiveConfig.configId.value(), mUpcomingActiveConfig.configId.value(), constraints, &outTimeline); constraints, &outTimeline); if (status != NO_ERROR) { if (status != NO_ERROR) { LOG_ALWAYS_FATAL("setActiveConfigWithConstraints failed: %d", status); // setActiveConfigWithConstraints may fail if a hotplug event is just about // to be sent. We just log the error in this case. ALOGW("setActiveConfigWithConstraints failed: %d", status); return false; return false; } } Loading Loading @@ -3066,9 +3068,9 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client, const sp<IBind parent = parentLayer; parent = parentLayer; } } if (mNumLayers >= MAX_LAYERS) { if (mNumLayers >= ISurfaceComposer::MAX_LAYERS) { ALOGE("AddClientLayer failed, mNumLayers (%zu) >= MAX_LAYERS (%zu)", mNumLayers.load(), ALOGE("AddClientLayer failed, mNumLayers (%zu) >= MAX_LAYERS (%zu)", mNumLayers.load(), MAX_LAYERS); ISurfaceComposer::MAX_LAYERS); return NO_MEMORY; return NO_MEMORY; } } Loading services/surfaceflinger/SurfaceFlinger.h +1 −2 Original line number Original line Diff line number Diff line Loading @@ -351,7 +351,6 @@ private: // every half hour. // every half hour. enum { LOG_FRAME_STATS_PERIOD = 30*60*60 }; enum { LOG_FRAME_STATS_PERIOD = 30*60*60 }; static const size_t MAX_LAYERS = 4096; static const int MAX_TRACING_MEMORY = 100 * 1024 * 1024; // 100MB static const int MAX_TRACING_MEMORY = 100 * 1024 * 1024; // 100MB protected: protected: Loading Loading @@ -976,7 +975,7 @@ private: // Can't be unordered_set because wp<> isn't hashable // Can't be unordered_set because wp<> isn't hashable std::set<wp<IBinder>> mGraphicBufferProducerList; std::set<wp<IBinder>> mGraphicBufferProducerList; size_t mMaxGraphicBufferProducerListSize = MAX_LAYERS; size_t mMaxGraphicBufferProducerListSize = ISurfaceComposer::MAX_LAYERS; // protected by mStateLock (but we could use another lock) // protected by mStateLock (but we could use another lock) bool mLayersRemoved = false; bool mLayersRemoved = false; Loading Loading
libs/gui/ISurfaceComposer.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -1281,6 +1281,9 @@ status_t BnSurfaceComposer::onTransact( std::unordered_set<sp<IBinder>, SpHash<IBinder>> excludeHandles; std::unordered_set<sp<IBinder>, SpHash<IBinder>> excludeHandles; int numExcludeHandles = data.readInt32(); int numExcludeHandles = data.readInt32(); if (numExcludeHandles >= static_cast<int>(MAX_LAYERS)) { return BAD_VALUE; } excludeHandles.reserve(numExcludeHandles); excludeHandles.reserve(numExcludeHandles); for (int i = 0; i < numExcludeHandles; i++) { for (int i = 0; i < numExcludeHandles; i++) { excludeHandles.emplace(data.readStrongBinder()); excludeHandles.emplace(data.readStrongBinder()); Loading
libs/gui/include/gui/ISurfaceComposer.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -76,6 +76,8 @@ class ISurfaceComposer: public IInterface { public: public: DECLARE_META_INTERFACE(SurfaceComposer) DECLARE_META_INTERFACE(SurfaceComposer) static constexpr size_t MAX_LAYERS = 4096; // flags for setTransactionState() // flags for setTransactionState() enum { enum { eSynchronous = 0x01, eSynchronous = 0x01, Loading
libs/nativedisplay/AChoreographer.cpp +12 −3 Original line number Original line Diff line number Diff line Loading @@ -185,9 +185,18 @@ void Choreographer::unregisterRefreshRateCallback(AChoreographer_refreshRateCall } } void Choreographer::scheduleCallbacks() { void Choreographer::scheduleCallbacks() { const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t dueTime; { AutoMutex _{mLock}; AutoMutex _{mLock}; nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); // If there are no pending callbacks then don't schedule a vsync if (mFrameCallbacks.top().dueTime <= now) { if (mFrameCallbacks.empty()) { return; } dueTime = mFrameCallbacks.top().dueTime; } if (dueTime <= now) { ALOGV("choreographer %p ~ scheduling vsync", this); ALOGV("choreographer %p ~ scheduling vsync", this); scheduleVsync(); scheduleVsync(); return; return; Loading
services/surfaceflinger/SurfaceFlinger.cpp +6 −4 Original line number Original line Diff line number Diff line Loading @@ -367,7 +367,7 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI property_get("ro.sf.blurs_are_expensive", value, "0"); property_get("ro.sf.blurs_are_expensive", value, "0"); mBlursAreExpensive = atoi(value); mBlursAreExpensive = atoi(value); const size_t defaultListSize = MAX_LAYERS; const size_t defaultListSize = ISurfaceComposer::MAX_LAYERS; auto listSize = property_get_int32("debug.sf.max_igbp_list_size", int32_t(defaultListSize)); auto listSize = property_get_int32("debug.sf.max_igbp_list_size", int32_t(defaultListSize)); mMaxGraphicBufferProducerListSize = (listSize > 0) ? size_t(listSize) : defaultListSize; mMaxGraphicBufferProducerListSize = (listSize > 0) ? size_t(listSize) : defaultListSize; Loading Loading @@ -1074,7 +1074,9 @@ bool SurfaceFlinger::performSetActiveConfig() { mUpcomingActiveConfig.configId.value(), mUpcomingActiveConfig.configId.value(), constraints, &outTimeline); constraints, &outTimeline); if (status != NO_ERROR) { if (status != NO_ERROR) { LOG_ALWAYS_FATAL("setActiveConfigWithConstraints failed: %d", status); // setActiveConfigWithConstraints may fail if a hotplug event is just about // to be sent. We just log the error in this case. ALOGW("setActiveConfigWithConstraints failed: %d", status); return false; return false; } } Loading Loading @@ -3066,9 +3068,9 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client, const sp<IBind parent = parentLayer; parent = parentLayer; } } if (mNumLayers >= MAX_LAYERS) { if (mNumLayers >= ISurfaceComposer::MAX_LAYERS) { ALOGE("AddClientLayer failed, mNumLayers (%zu) >= MAX_LAYERS (%zu)", mNumLayers.load(), ALOGE("AddClientLayer failed, mNumLayers (%zu) >= MAX_LAYERS (%zu)", mNumLayers.load(), MAX_LAYERS); ISurfaceComposer::MAX_LAYERS); return NO_MEMORY; return NO_MEMORY; } } Loading
services/surfaceflinger/SurfaceFlinger.h +1 −2 Original line number Original line Diff line number Diff line Loading @@ -351,7 +351,6 @@ private: // every half hour. // every half hour. enum { LOG_FRAME_STATS_PERIOD = 30*60*60 }; enum { LOG_FRAME_STATS_PERIOD = 30*60*60 }; static const size_t MAX_LAYERS = 4096; static const int MAX_TRACING_MEMORY = 100 * 1024 * 1024; // 100MB static const int MAX_TRACING_MEMORY = 100 * 1024 * 1024; // 100MB protected: protected: Loading Loading @@ -976,7 +975,7 @@ private: // Can't be unordered_set because wp<> isn't hashable // Can't be unordered_set because wp<> isn't hashable std::set<wp<IBinder>> mGraphicBufferProducerList; std::set<wp<IBinder>> mGraphicBufferProducerList; size_t mMaxGraphicBufferProducerListSize = MAX_LAYERS; size_t mMaxGraphicBufferProducerListSize = ISurfaceComposer::MAX_LAYERS; // protected by mStateLock (but we could use another lock) // protected by mStateLock (but we could use another lock) bool mLayersRemoved = false; bool mLayersRemoved = false; Loading