summaryrefslogtreecommitdiff
path: root/libs/hwui/tests/TestContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/tests/TestContext.cpp')
-rw-r--r--libs/hwui/tests/TestContext.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/libs/hwui/tests/TestContext.cpp b/libs/hwui/tests/TestContext.cpp
index 3687a5003471..ba763a8def62 100644
--- a/libs/hwui/tests/TestContext.cpp
+++ b/libs/hwui/tests/TestContext.cpp
@@ -22,16 +22,35 @@ namespace test {
static const int IDENT_DISPLAYEVENT = 1;
-static DisplayInfo getBuiltInDisplay() {
+static android::DisplayInfo DUMMY_DISPLAY {
+ 1080, //w
+ 1920, //h
+ 320.0, // xdpi
+ 320.0, // ydpi
+ 60.0, // fps
+ 2.0, // density
+ 0, // orientation
+ false, // secure?
+ 0, // appVsyncOffset
+ 0, // presentationDeadline
+ 0, // colorTransform
+};
+
+DisplayInfo getBuiltInDisplay() {
+#if !HWUI_NULL_GPU
DisplayInfo display;
sp<IBinder> dtoken(SurfaceComposerClient::getBuiltInDisplay(
ISurfaceComposer::eDisplayIdMain));
status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &display);
LOG_ALWAYS_FATAL_IF(status, "Failed to get display info\n");
return display;
+#else
+ return DUMMY_DISPLAY;
+#endif
}
-android::DisplayInfo gDisplay = getBuiltInDisplay();
+// Initialize to a dummy default
+android::DisplayInfo gDisplay = DUMMY_DISPLAY;
TestContext::TestContext() {
mLooper = new Looper(true);
@@ -57,10 +76,7 @@ sp<Surface> TestContext::surface() {
}
void TestContext::waitForVsync() {
-#if HWUI_NULL_GPU
- return;
-#endif
-
+#if !HWUI_NULL_GPU
// Request vsync
mDisplayEventReceiver.requestNextVsync();
@@ -70,6 +86,7 @@ void TestContext::waitForVsync() {
// Drain it
DisplayEventReceiver::Event buf[100];
while (mDisplayEventReceiver.getEvents(buf, 100) > 0) { }
+#endif
}
} // namespace test