Skip to content

Commit 8204da2

Browse files
author
ramindani
committed
Adds support for getSuggestedFrameRate api
BUG: 361433796 Flag: com.android.server.display.feature.flags.enable_get_suggested_frame_rate Test: atest android.display.cts.DisplayTest Test: Check value of the frameRateCategoryRate in the `adb shell dumpsys display` Change-Id: Iabd6040d09b3fdb5ec5aa42a8aeef01d02c2fd05
1 parent d004121 commit 8204da2

5 files changed

Lines changed: 70 additions & 0 deletions

File tree

libs/gui/SurfaceComposerClient.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include <ui/DisplayMode.h>
5757
#include <ui/DisplayState.h>
5858
#include <ui/DynamicDisplayInfo.h>
59+
#include <ui/FrameRateCategoryRate.h>
5960

6061
#include <android-base/thread_annotations.h>
6162
#include <gui/LayerStatePermissions.h>
@@ -2808,6 +2809,8 @@ void SurfaceComposerClient::getDynamicDisplayInfoInternal(gui::DynamicDisplayInf
28082809
outInfo->gameContentTypeSupported = ginfo.gameContentTypeSupported;
28092810
outInfo->preferredBootDisplayMode = ginfo.preferredBootDisplayMode;
28102811
outInfo->hasArrSupport = ginfo.hasArrSupport;
2812+
outInfo->frameRateCategoryRate = ui::FrameRateCategoryRate(ginfo.frameRateCategoryRate.normal,
2813+
ginfo.frameRateCategoryRate.high);
28112814
}
28122815

28132816
status_t SurfaceComposerClient::getDynamicDisplayInfoFromId(int64_t displayId,

libs/gui/aidl/android/gui/DynamicDisplayInfo.aidl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package android.gui;
1818

1919
import android.gui.DisplayMode;
20+
import android.gui.FrameRateCategoryRate;
2021
import android.gui.HdrCapabilities;
2122

2223
// Information about a physical display which may change on hotplug reconnect.
@@ -46,4 +47,7 @@ parcelable DynamicDisplayInfo {
4647

4748
// Represents whether display supports ARR.
4849
boolean hasArrSupport;
50+
51+
// Represents frame rate for FrameRateCategory Normal and High.
52+
FrameRateCategoryRate frameRateCategoryRate;
4953
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2024 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package android.gui;
18+
19+
/** @hide */
20+
// Represents frame rate for FrameRateCategory Normal and High.
21+
parcelable FrameRateCategoryRate {
22+
float normal;
23+
float high;
24+
}

libs/ui/include/ui/DynamicDisplayInfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <optional>
2323
#include <vector>
2424

25+
#include <ui/FrameRateCategoryRate.h>
2526
#include <ui/GraphicTypes.h>
2627
#include <ui/HdrCapabilities.h>
2728

@@ -55,6 +56,9 @@ struct DynamicDisplayInfo {
5556
std::optional<ui::DisplayMode> getActiveDisplayMode() const;
5657

5758
bool hasArrSupport;
59+
60+
// Represents frame rate for FrameRateCategory Normal and High.
61+
ui::FrameRateCategoryRate frameRateCategoryRate;
5862
};
5963

6064
} // namespace android::ui
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2024 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#pragma once
18+
19+
namespace android::ui {
20+
21+
// Represents frame rate for FrameRateCategory Normal and High.
22+
class FrameRateCategoryRate {
23+
public:
24+
FrameRateCategoryRate(float normal = 0, float high = 0) : mNormal(normal), mHigh(high) {}
25+
26+
float getNormal() const { return mNormal; }
27+
28+
float getHigh() const { return mHigh; }
29+
30+
private:
31+
float mNormal;
32+
float mHigh;
33+
};
34+
35+
} // namespace android::ui

0 commit comments

Comments
 (0)