[SurfaceFlinger] add setDisplayContentSamplingEnabled i/f
Add interface to ISurfaceComposer that can enable or disable
the graphics.composer's collection of the displayed content
statistics.
Bug: 116028618
Test: Boot
Test: ran test client against prototype, see enable/disable working.
Test: Ran new tests './libgui_test --gtest_filter="DisplayedContentSamp*"'
Test: on hwc with and without new function hook.
Change-Id: Ifb487e2bfbd8e0db6178ccbf762aa968c34576b9
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 80d435f..7d26151 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -636,6 +636,21 @@
*outComponentMask = static_cast<uint8_t>(value);
return error;
}
+
+ virtual status_t setDisplayContentSamplingEnabled(const sp<IBinder>& display, bool enable,
+ uint8_t componentMask,
+ uint64_t maxFrames) const {
+ Parcel data, reply;
+ data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
+ data.writeStrongBinder(display);
+ data.writeBool(enable);
+ data.writeByte(static_cast<int8_t>(componentMask));
+ data.writeUint64(maxFrames);
+ status_t result =
+ remote()->transact(BnSurfaceComposer::SET_DISPLAY_CONTENT_SAMPLING_ENABLED, data,
+ &reply);
+ return result;
+ }
};
// Out-of-line virtual method definition to trigger vtable emission in this
@@ -1004,6 +1019,42 @@
}
return result;
}
+ case SET_DISPLAY_CONTENT_SAMPLING_ENABLED: {
+ CHECK_INTERFACE(ISurfaceComposer, data, reply);
+
+ sp<IBinder> display = nullptr;
+ bool enable = false;
+ int8_t componentMask = 0;
+ uint64_t maxFrames = 0;
+ status_t result = data.readStrongBinder(&display);
+ if (result != NO_ERROR) {
+ ALOGE("setDisplayContentSamplingEnabled failure in reading Display token: %d",
+ result);
+ return result;
+ }
+
+ result = data.readBool(&enable);
+ if (result != NO_ERROR) {
+ ALOGE("setDisplayContentSamplingEnabled failure in reading enable: %d", result);
+ return result;
+ }
+
+ result = data.readByte(static_cast<int8_t*>(&componentMask));
+ if (result != NO_ERROR) {
+ ALOGE("setDisplayContentSamplingEnabled failure in reading component mask: %d",
+ result);
+ return result;
+ }
+
+ result = data.readUint64(&maxFrames);
+ if (result != NO_ERROR) {
+ ALOGE("setDisplayContentSamplingEnabled failure in reading max frames: %d", result);
+ return result;
+ }
+
+ return setDisplayContentSamplingEnabled(display, enable,
+ static_cast<uint8_t>(componentMask), maxFrames);
+ }
default: {
return BBinder::onTransact(code, data, reply, flags);
}