From a099a24c93bfa599fc5c36a647e946c26f68514f Mon Sep 17 00:00:00 2001 From: Kalle Raita Date: Wed, 11 Jan 2017 11:17:29 -0800 Subject: Faked HWC for SurfaceFlinger testing Infrastructure and initial port of transaction tests. Faking the HWC allows exercising the real path through the SurfaceFlinger, not relying on screen captures. Faked HWC also opens up the possibility of faking interactions like display hotplugs. The tests are verifying the composition rectangles instead of a set of select pixels. GLES rendering differences won't affect the results. Also, the test expectations become clearer. The ported transaction tests ran roughly twice as fast when compared with the original transaction test. This is mostly due to the thighter control over the vsyncs. Test: Running the test on Marlin Change-Id: I1c876cda78db94c1965498af957e64fdd23459ce --- libs/gui/ISurfaceComposer.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'libs/gui/ISurfaceComposer.cpp') diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index 0a0d112af6..8e7f814313 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -469,6 +470,36 @@ public: return result; } + virtual status_t getLayerDebugInfo(std::vector* outLayers) const + { + if (!outLayers) { + return UNEXPECTED_NULL; + } + + Parcel data, reply; + + status_t err = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + if (err != NO_ERROR) { + return err; + } + + err = remote()->transact(BnSurfaceComposer::GET_LAYER_DEBUG_INFO, data, &reply); + if (err != NO_ERROR) { + return err; + } + + int32_t result = 0; + err = reply.readInt32(&result); + if (err != NO_ERROR) { + return err; + } + if (result != NO_ERROR) { + return result; + } + + outLayers->clear(); + return reply.readParcelableVector(outLayers); + } }; // Out-of-line virtual method definition to trigger vtable emission in this @@ -763,6 +794,17 @@ status_t BnSurfaceComposer::onTransact( } return injectVSync(when); } + case GET_LAYER_DEBUG_INFO: { + CHECK_INTERFACE(ISurfaceComposer, data, reply); + std::vector outLayers; + status_t result = getLayerDebugInfo(&outLayers); + reply->writeInt32(result); + if (result == NO_ERROR) + { + result = reply->writeParcelableVector(outLayers); + } + return result; + } default: { return BBinder::onTransact(code, data, reply, flags); } -- cgit v1.2.3-59-g8ed1b