test-hwc2: dump
Test: Add "#define HAVE_NO_SURFACE_FLINGER" to
frameworks/native/libs/gui/BufferQueueCore.cpp.
Recompile and flash.
Run "mm" in frameworks/native/services/surfaceflinger/tests/hwc2.
Push test-hwc2 to device.
Run "adb root && adb shell stop".
Run test case. Ex: "./test-hwc2"
Change-Id: I0215fea464fd126b5f9041435bef7e00b46c6ac8
diff --git a/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp b/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp
index 751a9cc..062485e 100644
--- a/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp
+++ b/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp
@@ -1022,6 +1022,23 @@
}
}
+ void dump(std::string* outBuffer)
+ {
+ auto pfn = reinterpret_cast<HWC2_PFN_DUMP>(
+ getFunction(HWC2_FUNCTION_DUMP));
+ ASSERT_TRUE(pfn) << "failed to get function";
+
+ uint32_t size = 0;
+
+ pfn(mHwc2Device, &size, nullptr);
+
+ std::vector<char> buffer(size);
+
+ pfn(mHwc2Device, &size, buffer.data());
+
+ outBuffer->assign(buffer.data());
+ }
+
void getBadDisplay(hwc2_display_t* outDisplay)
{
for (hwc2_display_t display = 0; display < UINT64_MAX; display++) {
@@ -4529,3 +4546,11 @@
} while (testVirtualDisplay.advance());
}
}
+
+/* TESTCASE: Tests that the HWC2 can dump debug information. */
+TEST_F(Hwc2Test, DUMP)
+{
+ std::string buffer;
+
+ ASSERT_NO_FATAL_FAILURE(dump(&buffer));
+}