Switch from allowed display configs to refresh rate range
This completes the recent work to switch from a list of allowed display
configs to a default config + min/max frame rate.
Bug: 142507213
Test: Ran on a device with refresh rate switching, confirmed expected
60/90 switching behavior when touching the screen.
Test: Launched Google Maps on a device with 60/90 switching, confirmed
the device stays at 60fps.
Test: Checked dumpsys output, confirmed new display config specs
formatting looks good.
Test: Ran on a device with refresh rate switching disallowed via the
ro.surface_flinger.refresh_rate_switching sysprop, and confirmed
we don't do refresh rate switching.
Test: Ran on a device that doesn't support refresh rate switching, and
confirmed normal behavior.
Test: Tested surface flinger's display config back door, confirmed it
still works.
Test: Inspected log output, made sure there's nothing weird.
Test: Ran unit tests for DisplayModeDirector, LocalDisplayAdapter, and
RefreshRateConfigs.
Test: atest FrameworksServicesTests
Test: atest FrameworksMockingServicesTests
Test: adb shell /data/nativetest64/libgui_test/libgui_test
Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest
Change-Id: I53743a437bce1e3df79539caece0c423051c80a6
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 546757b..3ce7a4a 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -852,61 +852,8 @@
return error;
}
- virtual status_t setAllowedDisplayConfigs(const sp<IBinder>& displayToken,
- const std::vector<int32_t>& allowedConfigs) {
- Parcel data, reply;
- status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- if (result != NO_ERROR) {
- ALOGE("setAllowedDisplayConfigs failed to writeInterfaceToken: %d", result);
- return result;
- }
- result = data.writeStrongBinder(displayToken);
- if (result != NO_ERROR) {
- ALOGE("setAllowedDisplayConfigs failed to writeStrongBinder: %d", result);
- return result;
- }
- result = data.writeInt32Vector(allowedConfigs);
- if (result != NO_ERROR) {
- ALOGE("setAllowedDisplayConfigs failed to writeInt32Vector: %d", result);
- return result;
- }
- result = remote()->transact(BnSurfaceComposer::SET_ALLOWED_DISPLAY_CONFIGS, data, &reply);
- if (result != NO_ERROR) {
- ALOGE("setAllowedDisplayConfigs failed to transact: %d", result);
- return result;
- }
- return reply.readInt32();
- }
-
- virtual status_t getAllowedDisplayConfigs(const sp<IBinder>& displayToken,
- std::vector<int32_t>* outAllowedConfigs) {
- if (!outAllowedConfigs) return BAD_VALUE;
- Parcel data, reply;
- status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- if (result != NO_ERROR) {
- ALOGE("getAllowedDisplayConfigs failed to writeInterfaceToken: %d", result);
- return result;
- }
- result = data.writeStrongBinder(displayToken);
- if (result != NO_ERROR) {
- ALOGE("getAllowedDisplayConfigs failed to writeStrongBinder: %d", result);
- return result;
- }
- result = remote()->transact(BnSurfaceComposer::GET_ALLOWED_DISPLAY_CONFIGS, data, &reply);
- if (result != NO_ERROR) {
- ALOGE("getAllowedDisplayConfigs failed to transact: %d", result);
- return result;
- }
- result = reply.readInt32Vector(outAllowedConfigs);
- if (result != NO_ERROR) {
- ALOGE("getAllowedDisplayConfigs failed to readInt32Vector: %d", result);
- return result;
- }
- return reply.readInt32();
- }
-
virtual status_t setDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
- int32_t defaultModeId, float minRefreshRate,
+ int32_t defaultConfig, float minRefreshRate,
float maxRefreshRate) {
Parcel data, reply;
status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
@@ -919,9 +866,9 @@
ALOGE("setDesiredDisplayConfigSpecs: failed to write display token: %d", result);
return result;
}
- result = data.writeInt32(defaultModeId);
+ result = data.writeInt32(defaultConfig);
if (result != NO_ERROR) {
- ALOGE("setDesiredDisplayConfigSpecs failed to write defaultModeId: %d", result);
+ ALOGE("setDesiredDisplayConfigSpecs failed to write defaultConfig: %d", result);
return result;
}
result = data.writeFloat(minRefreshRate);
@@ -945,10 +892,10 @@
}
virtual status_t getDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
- int32_t* outDefaultModeId,
+ int32_t* outDefaultConfig,
float* outMinRefreshRate,
float* outMaxRefreshRate) {
- if (!outDefaultModeId || !outMinRefreshRate || !outMaxRefreshRate) return BAD_VALUE;
+ if (!outDefaultConfig || !outMinRefreshRate || !outMaxRefreshRate) return BAD_VALUE;
Parcel data, reply;
status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
if (result != NO_ERROR) {
@@ -966,9 +913,9 @@
ALOGE("getDesiredDisplayConfigSpecs failed to transact: %d", result);
return result;
}
- result = reply.readInt32(outDefaultModeId);
+ result = reply.readInt32(outDefaultConfig);
if (result != NO_ERROR) {
- ALOGE("getDesiredDisplayConfigSpecs failed to read defaultModeId: %d", result);
+ ALOGE("getDesiredDisplayConfigSpecs failed to read defaultConfig: %d", result);
return result;
}
result = reply.readFloat(outMinRefreshRate);
@@ -1644,31 +1591,13 @@
}
return removeRegionSamplingListener(listener);
}
- case SET_ALLOWED_DISPLAY_CONFIGS: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<IBinder> displayToken = data.readStrongBinder();
- std::vector<int32_t> allowedConfigs;
- data.readInt32Vector(&allowedConfigs);
- status_t result = setAllowedDisplayConfigs(displayToken, allowedConfigs);
- reply->writeInt32(result);
- return result;
- }
- case GET_ALLOWED_DISPLAY_CONFIGS: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<IBinder> displayToken = data.readStrongBinder();
- std::vector<int32_t> allowedConfigs;
- status_t result = getAllowedDisplayConfigs(displayToken, &allowedConfigs);
- reply->writeInt32Vector(allowedConfigs);
- reply->writeInt32(result);
- return result;
- }
case SET_DESIRED_DISPLAY_CONFIG_SPECS: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
sp<IBinder> displayToken = data.readStrongBinder();
- int32_t defaultModeId;
- status_t result = data.readInt32(&defaultModeId);
+ int32_t defaultConfig;
+ status_t result = data.readInt32(&defaultConfig);
if (result != NO_ERROR) {
- ALOGE("setDesiredDisplayConfigSpecs: failed to read defaultModeId: %d", result);
+ ALOGE("setDesiredDisplayConfigSpecs: failed to read defaultConfig: %d", result);
return result;
}
float minRefreshRate;
@@ -1683,7 +1612,7 @@
ALOGE("setDesiredDisplayConfigSpecs: failed to read maxRefreshRate: %d", result);
return result;
}
- result = setDesiredDisplayConfigSpecs(displayToken, defaultModeId, minRefreshRate,
+ result = setDesiredDisplayConfigSpecs(displayToken, defaultConfig, minRefreshRate,
maxRefreshRate);
if (result != NO_ERROR) {
ALOGE("setDesiredDisplayConfigSpecs: failed to call setDesiredDisplayConfigSpecs: "
@@ -1697,11 +1626,11 @@
case GET_DESIRED_DISPLAY_CONFIG_SPECS: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
sp<IBinder> displayToken = data.readStrongBinder();
- int32_t defaultModeId;
+ int32_t defaultConfig;
float minRefreshRate;
float maxRefreshRate;
- status_t result = getDesiredDisplayConfigSpecs(displayToken, &defaultModeId,
+ status_t result = getDesiredDisplayConfigSpecs(displayToken, &defaultConfig,
&minRefreshRate, &maxRefreshRate);
if (result != NO_ERROR) {
ALOGE("getDesiredDisplayConfigSpecs: failed to get getDesiredDisplayConfigSpecs: "
@@ -1710,9 +1639,9 @@
return result;
}
- result = reply->writeInt32(defaultModeId);
+ result = reply->writeInt32(defaultConfig);
if (result != NO_ERROR) {
- ALOGE("getDesiredDisplayConfigSpecs: failed to write defaultModeId: %d", result);
+ ALOGE("getDesiredDisplayConfigSpecs: failed to write defaultConfig: %d", result);
return result;
}
result = reply->writeFloat(minRefreshRate);