File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2873,6 +2873,11 @@ void SurfaceComposerClient::getDynamicDisplayInfoInternal(gui::DynamicDisplayInf
28732873 outInfo->hasArrSupport = ginfo.hasArrSupport ;
28742874 outInfo->frameRateCategoryRate = ui::FrameRateCategoryRate (ginfo.frameRateCategoryRate .normal ,
28752875 ginfo.frameRateCategoryRate .high );
2876+ outInfo->supportedRefreshRates .clear ();
2877+ outInfo->supportedRefreshRates .reserve (ginfo.supportedRefreshRates .size ());
2878+ for (const auto rate : ginfo.supportedRefreshRates ) {
2879+ outInfo->supportedRefreshRates .push_back (static_cast <float >(rate));
2880+ }
28762881}
28772882
28782883status_t SurfaceComposerClient::getDynamicDisplayInfoFromId (int64_t displayId,
Original file line number Diff line number Diff line change @@ -50,4 +50,7 @@ parcelable DynamicDisplayInfo {
5050
5151 // Represents frame rate for FrameRateCategory Normal and High.
5252 FrameRateCategoryRate frameRateCategoryRate ;
53+
54+ // All the refresh rates supported for the default display mode.
55+ float [] supportedRefreshRates ;
5356}
Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ struct DynamicDisplayInfo {
5959
6060 // Represents frame rate for FrameRateCategory Normal and High.
6161 ui::FrameRateCategoryRate frameRateCategoryRate;
62+
63+ // All the refresh rates supported for the default display mode.
64+ std::vector<float > supportedRefreshRates;
6265};
6366
6467} // namespace android::ui
Original file line number Diff line number Diff line change @@ -1569,6 +1569,19 @@ Fps RefreshRateSelector::findClosestKnownFrameRate(Fps frameRate) const {
15691569 return distance1 < distance2 ? *lowerBound : *std::prev (lowerBound);
15701570}
15711571
1572+ std::vector<float > RefreshRateSelector::getSupportedFrameRates () const {
1573+ std::scoped_lock lock (mLock );
1574+ // TODO(b/356986687) Remove the limit once we have the anchor list implementation.
1575+ const size_t frameRatesSize = std::min<size_t >(11 , mPrimaryFrameRates .size ());
1576+ std::vector<float > supportedFrameRates;
1577+ supportedFrameRates.reserve (frameRatesSize);
1578+ std::transform (mPrimaryFrameRates .rbegin (),
1579+ mPrimaryFrameRates .rbegin () + static_cast <int >(frameRatesSize),
1580+ std::back_inserter (supportedFrameRates),
1581+ [](FrameRateMode mode) { return mode.fps .getValue (); });
1582+ return supportedFrameRates;
1583+ }
1584+
15721585auto RefreshRateSelector::getIdleTimerAction () const -> KernelIdleTimerAction {
15731586 std::lock_guard lock (mLock );
15741587
Original file line number Diff line number Diff line change @@ -441,6 +441,8 @@ class RefreshRateSelector {
441441
442442 std::pair<Fps, Fps> getFrameRateCategoryRates () const { return kFrameRateCategoryRates ; }
443443
444+ std::vector<float > getSupportedFrameRates () const EXCLUDES(mLock );
445+
444446private:
445447 friend struct TestableRefreshRateSelector ;
446448
Original file line number Diff line number Diff line change @@ -1229,6 +1229,8 @@ void SurfaceFlinger::getDynamicDisplayInfoInternal(ui::DynamicDisplayInfo*& info
12291229 const auto [normal, high] = display->refreshRateSelector ().getFrameRateCategoryRates ();
12301230 ui::FrameRateCategoryRate frameRateCategoryRate (normal.getValue (), high.getValue ());
12311231 info->frameRateCategoryRate = frameRateCategoryRate;
1232+
1233+ info->supportedRefreshRates = display->refreshRateSelector ().getSupportedFrameRates ();
12321234 info->activeColorMode = display->getCompositionDisplay ()->getState ().colorMode ;
12331235 info->hdrCapabilities = filterOut4k30 (display->getHdrCapabilities ());
12341236
@@ -8581,6 +8583,11 @@ void SurfaceComposerAIDL::getDynamicDisplayInfoInternal(ui::DynamicDisplayInfo&
85818583 gui::FrameRateCategoryRate& frameRateCategoryRate = outInfo->frameRateCategoryRate ;
85828584 frameRateCategoryRate.normal = info.frameRateCategoryRate .getNormal ();
85838585 frameRateCategoryRate.high = info.frameRateCategoryRate .getHigh ();
8586+ outInfo->supportedRefreshRates .clear ();
8587+ outInfo->supportedRefreshRates .reserve (info.supportedRefreshRates .size ());
8588+ for (float supportedRefreshRate : info.supportedRefreshRates ) {
8589+ outInfo->supportedRefreshRates .push_back (supportedRefreshRate);
8590+ }
85848591
85858592 outInfo->supportedColorModes .clear ();
85868593 outInfo->supportedColorModes .reserve (info.supportedColorModes .size ());
You can’t perform that action at this time.
0 commit comments