Revert "SF: Flow DisplayModeRequest through mode set FSM"
This reverts commit aaab4c3b4f012f48bca428b9db1cd954a6fbc8e9.
Reason for revert: b/317378302
Change-Id: I516f52c41d27d9ea3eca969a3f786d2115521dac
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index 3090477..ac390cb 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -19,7 +19,6 @@
#include <memory>
#include <string>
#include <unordered_map>
-#include <variant>
#include <android-base/thread_annotations.h>
#include <android/native_window.h>
@@ -195,11 +194,12 @@
using DisplayModeRequestOpt = ftl::Optional<display::DisplayModeRequest>;
DisplayModeRequestOpt getDesiredMode() const EXCLUDES(mDesiredModeLock);
- DisplayModeRequestOpt takeDesiredMode() EXCLUDES(mDesiredModeLock);
+ void clearDesiredMode() EXCLUDES(mDesiredModeLock);
- bool isModeSetPending() const REQUIRES(kMainThreadContext) {
- return mPendingModeOpt.has_value();
+ DisplayModeRequestOpt getPendingMode() const REQUIRES(kMainThreadContext) {
+ return mPendingModeOpt;
}
+ bool isModeSetPending() const REQUIRES(kMainThreadContext) { return mIsModeSetPending; }
scheduler::FrameRateMode getActiveMode() const REQUIRES(kMainThreadContext) {
return mRefreshRateSelector->getActiveMode();
@@ -211,25 +211,8 @@
hal::VsyncPeriodChangeTimeline& outTimeline)
REQUIRES(kMainThreadContext);
- struct NoModeChange {
- const char* reason;
- };
-
- struct ResolutionChange {
- display::DisplayModeRequest activeMode;
- };
-
- struct RefreshRateChange {
- display::DisplayModeRequest activeMode;
- };
-
- using ModeChange = std::variant<NoModeChange, ResolutionChange, RefreshRateChange>;
-
- // Clears the pending DisplayModeRequest, and returns the ModeChange that occurred. If it was a
- // RefreshRateChange, the pending mode becomes the active mode. If it was a ResolutionChange,
- // the caller is responsible for resizing the framebuffer to match the active resolution by
- // recreating the DisplayDevice.
- ModeChange finalizeModeChange() REQUIRES(kMainThreadContext);
+ void finalizeModeChange(DisplayModeId, Fps vsyncRate, Fps renderFps)
+ REQUIRES(kMainThreadContext);
scheduler::RefreshRateSelector& refreshRateSelector() const { return *mRefreshRateSelector; }
@@ -266,8 +249,6 @@
void dump(utils::Dumper&) const;
private:
- friend class TestableSurfaceFlinger;
-
template <size_t N>
inline std::string concatId(const char (&str)[N]) const {
return std::string(ftl::Concat(str, ' ', getId().value).str());
@@ -318,15 +299,12 @@
// This parameter is only used for hdr/sdr ratio overlay
float mHdrSdrRatio = 1.0f;
- // A DisplayModeRequest flows through three states: desired, pending, and active. Requests
- // within a frame are merged into a single desired request. Unless cleared, the request is
- // relayed to HWC on the next frame, and becomes pending. The mode becomes active once HWC
- // signals the present fence to confirm the mode set.
mutable std::mutex mDesiredModeLock;
DisplayModeRequestOpt mDesiredModeOpt GUARDED_BY(mDesiredModeLock);
TracedOrdinal<bool> mHasDesiredModeTrace GUARDED_BY(mDesiredModeLock);
DisplayModeRequestOpt mPendingModeOpt GUARDED_BY(kMainThreadContext);
+ bool mIsModeSetPending GUARDED_BY(kMainThreadContext) = false;
};
struct DisplayDeviceState {