From 3da8d2748580b2575e368e203ce2c7f8d34dea05 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 28 Jul 2016 16:20:47 -0700 Subject: Surface unit tests for getFrameTimestamps. Verifies the following: 1) The timestamps and fences aren't transferred if the feature isn't explicitly enabled. 2) Attempts to get the timestamps will fail if not enabled. 3) Timestamps are transferred if enabled. 4) The support for Present/Retire timestamps are properly queried from the ISurfaceComposer. 5) Timestamps correspond to the correct frame. 6) The consumer doesn't send the acquire fence back to the producer and a sync call isn't made to try and get it from the producer. 7) A sync call isn't made when no timestamps are requested. 8) If the consumer sent the producer fences, the consumer can get the timestamps without a sync call. 9) If there was no GL composite performed, a sync call isn't made to get a non-existant fence/time. 10) When asking for the retire or release time of the most recent frame, a sync call isn't made. 11) Requests for unsupported timestamps return an error and do not result in a sync call. Test: Test: adb shell /data/nativetest/libgui_test/libgui_test --gtest_filter=*GetFrameTimestamps* Change-Id: I6f728af0d4a0f431c9e47131da64584a589559e7 --- include/gui/Surface.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'include/gui/Surface.h') diff --git a/include/gui/Surface.h b/include/gui/Surface.h index 451bd68f66..43b8d965d2 100644 --- a/include/gui/Surface.h +++ b/include/gui/Surface.h @@ -33,6 +33,8 @@ struct ANativeWindow_Buffer; namespace android { +class ISurfaceComposer; + /* * An implementation of ANativeWindow that feeds graphics buffers into a * BufferQueue. @@ -66,7 +68,8 @@ public: * the controlledByApp flag indicates that this Surface (producer) is * controlled by the application. This flag is used at connect time. */ - explicit Surface(const sp& bufferProducer, bool controlledByApp = false); + explicit Surface(const sp& bufferProducer, + bool controlledByApp = false); /* getIGraphicBufferProducer() returns the IGraphicBufferProducer this * Surface was created with. Usually it's an error to use the @@ -152,6 +155,9 @@ public: protected: virtual ~Surface(); + // Virtual for testing. + virtual sp composerService() const; + private: // can't be copied Surface& operator = (const Surface& rhs); @@ -245,7 +251,6 @@ protected: enum { NUM_BUFFER_SLOTS = BufferQueue::NUM_BUFFER_SLOTS }; enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 }; -private: void querySupportedTimestampsLocked() const; void freeAllBuffers(); @@ -399,7 +404,7 @@ private: // A cached copy of the FrameEventHistory maintained by the consumer. bool mEnableFrameTimestamps = false; - ProducerFrameEventHistory mFrameEventHistory; + std::unique_ptr mFrameEventHistory; }; namespace view { -- cgit v1.2.3-59-g8ed1b