summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author Kalle Raita <kraita@google.com> 2017-01-11 11:17:29 -0800
committer Kalle Raita <kraita@google.com> 2017-08-04 15:20:09 -0700
commita099a24c93bfa599fc5c36a647e946c26f68514f (patch)
treea28d284ac7ff816f6cd08a3710a65eb9fbe1e6ed /services/surfaceflinger/Layer.cpp
parentd9fd3caf92c541e1ba8120f1e95bfb855183b905 (diff)
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
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rwxr-xr-xservices/surfaceflinger/Layer.cpp107
1 files changed, 44 insertions, 63 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 8eb406747a..3903a5546f 100755
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -40,6 +40,7 @@
#include <gui/BufferItem.h>
#include <gui/BufferQueue.h>
+#include <gui/LayerDebugInfo.h>
#include <gui/Surface.h>
#include "clz.h"
@@ -2363,71 +2364,51 @@ void Layer::updateTransformHint(const sp<const DisplayDevice>& hw) const {
// debugging
// ----------------------------------------------------------------------------
-void Layer::dump(String8& result, Colorizer& colorizer) const
-{
- const Layer::State& s(getDrawingState());
-
- colorizer.colorize(result, Colorizer::GREEN);
- result.appendFormat(
- "+ %s %p (%s)\n",
- getTypeId(), this, getName().string());
- colorizer.reset(result);
-
- s.activeTransparentRegion.dump(result, "transparentRegion");
- visibleRegion.dump(result, "visibleRegion");
- surfaceDamageRegion.dump(result, "surfaceDamageRegion");
- sp<Client> client(mClientRef.promote());
- PixelFormat pf = PIXEL_FORMAT_UNKNOWN;
- const sp<GraphicBuffer>& buffer(getActiveBuffer());
- if (buffer != NULL) {
- pf = buffer->getPixelFormat();
- }
-
+LayerDebugInfo Layer::getLayerDebugInfo() const {
+ LayerDebugInfo info;
+ const Layer::State& ds = getDrawingState();
+ info.mName = getName();
sp<Layer> parent = getParent();
-
- result.appendFormat( " "
- "layerStack=%4d, z=%9d, pos=(%g,%g), size=(%4d,%4d), "
- "crop=(%4d,%4d,%4d,%4d), finalCrop=(%4d,%4d,%4d,%4d), "
- "isOpaque=%1d, invalidate=%1d, "
- "dataspace=%s, pixelformat=%s "
-#ifdef USE_HWC2
- "alpha=%.3f, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n"
-#else
- "alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n"
-#endif
- " client=%p parent=%s\n",
- getLayerStack(), s.z,
- s.active.transform.tx(), s.active.transform.ty(),
- s.active.w, s.active.h,
- s.crop.left, s.crop.top,
- s.crop.right, s.crop.bottom,
- s.finalCrop.left, s.finalCrop.top,
- s.finalCrop.right, s.finalCrop.bottom,
- isOpaque(s), contentDirty,
- dataspaceDetails(getDataSpace()).c_str(), decodePixelFormat(pf).c_str(),
- s.alpha, s.flags,
- s.active.transform[0][0], s.active.transform[0][1],
- s.active.transform[1][0], s.active.transform[1][1],
- client.get(), parent == nullptr ? "none" : parent->getName().string());
-
- sp<const GraphicBuffer> buf0(mActiveBuffer);
- uint32_t w0=0, h0=0, s0=0, f0=0;
- if (buf0 != 0) {
- w0 = buf0->getWidth();
- h0 = buf0->getHeight();
- s0 = buf0->getStride();
- f0 = buf0->format;
- }
- result.appendFormat(
- " "
- "format=%2d, activeBuffer=[%4ux%4u:%4u,%3X],"
- " queued-frames=%d, mRefreshPending=%d\n",
- mFormat, w0, h0, s0,f0,
- mQueuedFrames, mRefreshPending);
-
- if (mSurfaceFlingerConsumer != 0) {
- mSurfaceFlingerConsumer->dumpState(result, " ");
+ info.mParentName = (parent == nullptr ? std::string("none") : parent->getName().string());
+ info.mType = String8(getTypeId());
+ info.mTransparentRegion = ds.activeTransparentRegion;
+ info.mVisibleRegion = visibleRegion;
+ info.mSurfaceDamageRegion = surfaceDamageRegion;
+ info.mLayerStack = getLayerStack();
+ info.mX = ds.active.transform.tx();
+ info.mY = ds.active.transform.ty();
+ info.mZ = ds.z;
+ info.mWidth = ds.active.w;
+ info.mHeight = ds.active.h;
+ info.mCrop = ds.crop;
+ info.mFinalCrop = ds.finalCrop;
+ info.mAlpha = ds.alpha;
+ info.mFlags = ds.flags;
+ info.mPixelFormat = getPixelFormat();
+ info.mDataSpace = getDataSpace();
+ info.mMatrix[0][0] = ds.active.transform[0][0];
+ info.mMatrix[0][1] = ds.active.transform[0][1];
+ info.mMatrix[1][0] = ds.active.transform[1][0];
+ info.mMatrix[1][1] = ds.active.transform[1][1];
+ {
+ sp<const GraphicBuffer> activeBuffer = getActiveBuffer();
+ if (activeBuffer != 0) {
+ info.mActiveBufferWidth = activeBuffer->getWidth();
+ info.mActiveBufferHeight = activeBuffer->getHeight();
+ info.mActiveBufferStride = activeBuffer->getStride();
+ info.mActiveBufferFormat = activeBuffer->format;
+ } else {
+ info.mActiveBufferWidth = 0;
+ info.mActiveBufferHeight = 0;
+ info.mActiveBufferStride = 0;
+ info.mActiveBufferFormat = 0;
+ }
}
+ info.mNumQueuedFrames = getQueuedFrameCount();
+ info.mRefreshPending = isBufferLatched();
+ info.mIsOpaque = isOpaque(ds);
+ info.mContentDirty = contentDirty;
+ return info;
}
#ifdef USE_HWC2