Loading cmds/atrace/atrace.rc +2 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,8 @@ on late-init chmod 0666 /sys/kernel/tracing/events/task/task_rename/enable chmod 0666 /sys/kernel/debug/tracing/events/task/task_newtask/enable chmod 0666 /sys/kernel/tracing/events/task/task_newtask/enable chmod 0666 /sys/kernel/debug/tracing/events/gpu_mem/gpu_mem_total/enable chmod 0666 /sys/kernel/tracing/events/gpu_mem/gpu_mem_total/enable # disk chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_get_data_block/enable Loading libs/adbd_auth/adbd_auth.cpp +11 −5 Original line number Diff line number Diff line Loading @@ -206,12 +206,18 @@ public: void AllowUsbDevice(std::string_view buf) EXCLUDES(mutex_) { std::lock_guard<std::mutex> lock(mutex_); CHECK(buf.empty()); CHECK(dispatched_prompt_.has_value()); if (dispatched_prompt_.has_value()) { // It's possible for the framework to send us a response without our having sent a // request to it: e.g. if adbd restarts while we have a pending request. auto& [id, key, arg] = *dispatched_prompt_; keys_.emplace(id, std::move(key)); callbacks_.key_authorized(arg, id); dispatched_prompt_ = std::nullopt; } else { LOG(WARNING) << "adbd_auth: received authorization for unknown prompt, ignoring"; } // We need to dispatch pending prompts here upon success as well, // since we might have multiple queued prompts. Loading services/surfaceflinger/Layer.cpp +13 −6 Original line number Diff line number Diff line Loading @@ -1325,6 +1325,10 @@ int32_t Layer::getFrameRateSelectionPriority() const { return Layer::PRIORITY_UNSET; } bool Layer::isLayerFocusedBasedOnPriority(int32_t priority) { return priority == PRIORITY_FOCUSED_WITH_MODE || priority == PRIORITY_FOCUSED_WITHOUT_MODE; }; uint32_t Layer::getLayerStack() const { auto p = mDrawingParent.promote(); if (p == nullptr) { Loading Loading @@ -1558,7 +1562,7 @@ void Layer::miniDumpHeader(std::string& result) { result.append("-------------------------------"); result.append("-------------------------------"); result.append("-------------------------------"); result.append("---------\n"); result.append("-------------------\n"); result.append(" Layer name\n"); result.append(" Z | "); result.append(" Window Type | "); Loading @@ -1566,12 +1570,12 @@ void Layer::miniDumpHeader(std::string& result) { result.append(" Transform | "); result.append(" Disp Frame (LTRB) | "); result.append(" Source Crop (LTRB) | "); result.append(" Frame Rate (Explicit)\n"); result.append(" Frame Rate (Explicit) [Focused]\n"); result.append("-------------------------------"); result.append("-------------------------------"); result.append("-------------------------------"); result.append("-------------------------------"); result.append("---------\n"); result.append("-------------------\n"); } std::string Layer::frameRateCompatibilityString(Layer::FrameRateCompatibility compatibility) { Loading Loading @@ -1622,17 +1626,20 @@ void Layer::miniDump(std::string& result, const DisplayDevice& display) const { crop.bottom); if (layerState.frameRate.rate != 0 || layerState.frameRate.type != FrameRateCompatibility::Default) { StringAppendF(&result, "% 6.2ffps %15s\n", layerState.frameRate.rate, StringAppendF(&result, "% 6.2ffps %15s", layerState.frameRate.rate, frameRateCompatibilityString(layerState.frameRate.type).c_str()); } else { StringAppendF(&result, "\n"); StringAppendF(&result, " "); } const auto focused = isLayerFocusedBasedOnPriority(getFrameRateSelectionPriority()); StringAppendF(&result, " [%s]\n", focused ? "*" : " "); result.append("- - - - - - - - - - - - - - - - "); result.append("- - - - - - - - - - - - - - - - "); result.append("- - - - - - - - - - - - - - - - "); result.append("- - - - - - - - - - - - - - - - "); result.append("- - -\n"); result.append("- - - - - - - -\n"); } void Layer::dumpFrameStats(std::string& result) const { Loading services/surfaceflinger/Layer.h +10 −0 Original line number Diff line number Diff line Loading @@ -94,7 +94,16 @@ struct LayerCreationArgs { class Layer : public virtual RefBase, compositionengine::LayerFE { static std::atomic<int32_t> sSequence; // The following constants represent priority of the window. SF uses this information when // deciding which window has a priority when deciding about the refresh rate of the screen. // Priority 0 is considered the highest priority. -1 means that the priority is unset. static constexpr int32_t PRIORITY_UNSET = -1; // Windows that are in focus and voted for the preferred mode ID static constexpr int32_t PRIORITY_FOCUSED_WITH_MODE = 0; // // Windows that are in focus, but have not requested a specific mode ID. static constexpr int32_t PRIORITY_FOCUSED_WITHOUT_MODE = 1; // Windows that are not in focus, but voted for a specific mode ID. static constexpr int32_t PRIORITY_NOT_FOCUSED_WITH_MODE = 2; public: mutable bool contentDirty{false}; Loading Loading @@ -400,6 +409,7 @@ public: // If the variable is not set on the layer, it traverses up the tree to inherit the frame // rate priority from its parent. virtual int32_t getFrameRateSelectionPriority() const; static bool isLayerFocusedBasedOnPriority(int32_t priority); virtual ui::Dataspace getDataSpace() const { return ui::Dataspace::UNKNOWN; } Loading services/surfaceflinger/Scheduler/LayerHistory.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -109,6 +109,8 @@ LayerHistory::Summary LayerHistory::summarize(nsecs_t now) { auto layer = weakLayer.promote(); // Only use the layer if the reference still exists. if (layer || CC_UNLIKELY(mTraceEnabled)) { const auto layerFocused = Layer::isLayerFocusedBasedOnPriority(layer->getFrameRateSelectionPriority()); // Check if frame rate was set on layer. const auto frameRate = layer->getFrameRateForLayerTree(); if (frameRate.rate > 0.f) { Loading @@ -122,11 +124,12 @@ LayerHistory::Summary LayerHistory::summarize(nsecs_t now) { return LayerVoteType::NoVote; } }(); summary.push_back({layer->getName(), voteType, frameRate.rate, /* weight */ 1.0f}); summary.push_back({layer->getName(), voteType, frameRate.rate, /* weight */ 1.0f, layerFocused}); } else if (recent) { summary.push_back({layer->getName(), LayerVoteType::Heuristic, info->getRefreshRate(now), /* weight */ 1.0f}); /* weight */ 1.0f, layerFocused}); } if (CC_UNLIKELY(mTraceEnabled)) { Loading Loading
cmds/atrace/atrace.rc +2 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,8 @@ on late-init chmod 0666 /sys/kernel/tracing/events/task/task_rename/enable chmod 0666 /sys/kernel/debug/tracing/events/task/task_newtask/enable chmod 0666 /sys/kernel/tracing/events/task/task_newtask/enable chmod 0666 /sys/kernel/debug/tracing/events/gpu_mem/gpu_mem_total/enable chmod 0666 /sys/kernel/tracing/events/gpu_mem/gpu_mem_total/enable # disk chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_get_data_block/enable Loading
libs/adbd_auth/adbd_auth.cpp +11 −5 Original line number Diff line number Diff line Loading @@ -206,12 +206,18 @@ public: void AllowUsbDevice(std::string_view buf) EXCLUDES(mutex_) { std::lock_guard<std::mutex> lock(mutex_); CHECK(buf.empty()); CHECK(dispatched_prompt_.has_value()); if (dispatched_prompt_.has_value()) { // It's possible for the framework to send us a response without our having sent a // request to it: e.g. if adbd restarts while we have a pending request. auto& [id, key, arg] = *dispatched_prompt_; keys_.emplace(id, std::move(key)); callbacks_.key_authorized(arg, id); dispatched_prompt_ = std::nullopt; } else { LOG(WARNING) << "adbd_auth: received authorization for unknown prompt, ignoring"; } // We need to dispatch pending prompts here upon success as well, // since we might have multiple queued prompts. Loading
services/surfaceflinger/Layer.cpp +13 −6 Original line number Diff line number Diff line Loading @@ -1325,6 +1325,10 @@ int32_t Layer::getFrameRateSelectionPriority() const { return Layer::PRIORITY_UNSET; } bool Layer::isLayerFocusedBasedOnPriority(int32_t priority) { return priority == PRIORITY_FOCUSED_WITH_MODE || priority == PRIORITY_FOCUSED_WITHOUT_MODE; }; uint32_t Layer::getLayerStack() const { auto p = mDrawingParent.promote(); if (p == nullptr) { Loading Loading @@ -1558,7 +1562,7 @@ void Layer::miniDumpHeader(std::string& result) { result.append("-------------------------------"); result.append("-------------------------------"); result.append("-------------------------------"); result.append("---------\n"); result.append("-------------------\n"); result.append(" Layer name\n"); result.append(" Z | "); result.append(" Window Type | "); Loading @@ -1566,12 +1570,12 @@ void Layer::miniDumpHeader(std::string& result) { result.append(" Transform | "); result.append(" Disp Frame (LTRB) | "); result.append(" Source Crop (LTRB) | "); result.append(" Frame Rate (Explicit)\n"); result.append(" Frame Rate (Explicit) [Focused]\n"); result.append("-------------------------------"); result.append("-------------------------------"); result.append("-------------------------------"); result.append("-------------------------------"); result.append("---------\n"); result.append("-------------------\n"); } std::string Layer::frameRateCompatibilityString(Layer::FrameRateCompatibility compatibility) { Loading Loading @@ -1622,17 +1626,20 @@ void Layer::miniDump(std::string& result, const DisplayDevice& display) const { crop.bottom); if (layerState.frameRate.rate != 0 || layerState.frameRate.type != FrameRateCompatibility::Default) { StringAppendF(&result, "% 6.2ffps %15s\n", layerState.frameRate.rate, StringAppendF(&result, "% 6.2ffps %15s", layerState.frameRate.rate, frameRateCompatibilityString(layerState.frameRate.type).c_str()); } else { StringAppendF(&result, "\n"); StringAppendF(&result, " "); } const auto focused = isLayerFocusedBasedOnPriority(getFrameRateSelectionPriority()); StringAppendF(&result, " [%s]\n", focused ? "*" : " "); result.append("- - - - - - - - - - - - - - - - "); result.append("- - - - - - - - - - - - - - - - "); result.append("- - - - - - - - - - - - - - - - "); result.append("- - - - - - - - - - - - - - - - "); result.append("- - -\n"); result.append("- - - - - - - -\n"); } void Layer::dumpFrameStats(std::string& result) const { Loading
services/surfaceflinger/Layer.h +10 −0 Original line number Diff line number Diff line Loading @@ -94,7 +94,16 @@ struct LayerCreationArgs { class Layer : public virtual RefBase, compositionengine::LayerFE { static std::atomic<int32_t> sSequence; // The following constants represent priority of the window. SF uses this information when // deciding which window has a priority when deciding about the refresh rate of the screen. // Priority 0 is considered the highest priority. -1 means that the priority is unset. static constexpr int32_t PRIORITY_UNSET = -1; // Windows that are in focus and voted for the preferred mode ID static constexpr int32_t PRIORITY_FOCUSED_WITH_MODE = 0; // // Windows that are in focus, but have not requested a specific mode ID. static constexpr int32_t PRIORITY_FOCUSED_WITHOUT_MODE = 1; // Windows that are not in focus, but voted for a specific mode ID. static constexpr int32_t PRIORITY_NOT_FOCUSED_WITH_MODE = 2; public: mutable bool contentDirty{false}; Loading Loading @@ -400,6 +409,7 @@ public: // If the variable is not set on the layer, it traverses up the tree to inherit the frame // rate priority from its parent. virtual int32_t getFrameRateSelectionPriority() const; static bool isLayerFocusedBasedOnPriority(int32_t priority); virtual ui::Dataspace getDataSpace() const { return ui::Dataspace::UNKNOWN; } Loading
services/surfaceflinger/Scheduler/LayerHistory.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -109,6 +109,8 @@ LayerHistory::Summary LayerHistory::summarize(nsecs_t now) { auto layer = weakLayer.promote(); // Only use the layer if the reference still exists. if (layer || CC_UNLIKELY(mTraceEnabled)) { const auto layerFocused = Layer::isLayerFocusedBasedOnPriority(layer->getFrameRateSelectionPriority()); // Check if frame rate was set on layer. const auto frameRate = layer->getFrameRateForLayerTree(); if (frameRate.rate > 0.f) { Loading @@ -122,11 +124,12 @@ LayerHistory::Summary LayerHistory::summarize(nsecs_t now) { return LayerVoteType::NoVote; } }(); summary.push_back({layer->getName(), voteType, frameRate.rate, /* weight */ 1.0f}); summary.push_back({layer->getName(), voteType, frameRate.rate, /* weight */ 1.0f, layerFocused}); } else if (recent) { summary.push_back({layer->getName(), LayerVoteType::Heuristic, info->getRefreshRate(now), /* weight */ 1.0f}); /* weight */ 1.0f, layerFocused}); } if (CC_UNLIKELY(mTraceEnabled)) { Loading