From fb4d5d5726c172adbe62341d99a2148685a98379 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 20 Sep 2011 15:13:14 -0700 Subject: [PATCH] improve hwc dumpsys we now log the buffer's format Change-Id: I9d3ad8018e884240a153de3baefb6331cb014d0f --- .../DisplayHardware/HWComposer.cpp | 21 ++++++++++++++----- services/surfaceflinger/Layer.h | 2 ++ services/surfaceflinger/LayerBase.h | 2 ++ services/surfaceflinger/SurfaceFlinger.cpp | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index c9567d527..daefd5e32 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -143,18 +143,29 @@ void HWComposer::dump(String8& result, char* buffer, size_t SIZE, snprintf(buffer, SIZE, " numHwLayers=%u, flags=%08x\n", mList->numHwLayers, mList->flags); result.append(buffer); - + result.append( + " type | hints | flags | tr | blend | format | source rectangle | crop rectangle name \n" + "-----------+----------+----------+----+-------+----------+---------------------------+--------------------------------\n"); + // " ________ | ________ | ________ | __ | _____ | ________ | [_____,_____,_____,_____] | [_____,_____,_____,_____] for (size_t i=0 ; inumHwLayers ; i++) { const hwc_layer_t& l(mList->hwLayers[i]); - snprintf(buffer, SIZE, " %8s | %08x | %08x | %02x | %04x | [%5d,%5d,%5d,%5d] | [%5d,%5d,%5d,%5d] %s\n", + const sp layer(visibleLayersSortedByZ[i]); + int32_t format = -1; + if (layer->getLayer() != NULL) { + const sp& buffer(layer->getLayer()->getActiveBuffer()); + if (buffer != NULL) { + format = buffer->getPixelFormat(); + } + } + snprintf(buffer, SIZE, + " %8s | %08x | %08x | %02x | %05x | %08x | [%5d,%5d,%5d,%5d] | [%5d,%5d,%5d,%5d] %s\n", l.compositionType ? "OVERLAY" : "FB", - l.hints, l.flags, l.transform, l.blending, + l.hints, l.flags, l.transform, l.blending, format, l.sourceCrop.left, l.sourceCrop.top, l.sourceCrop.right, l.sourceCrop.bottom, l.displayFrame.left, l.displayFrame.top, l.displayFrame.right, l.displayFrame.bottom, - visibleLayersSortedByZ[i]->getName().string()); + layer->getName().string()); result.append(buffer); } - } if (mHwc && mHwc->common.version >= 1 && mHwc->dump) { mHwc->dump(mHwc, buffer, SIZE); diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index d06a35f01..ff389aece 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -73,12 +73,14 @@ public: virtual bool isSecure() const { return mSecure; } virtual bool isProtected() const; virtual void onRemoved(); + virtual sp getLayer() const { return const_cast(this); } // LayerBaseClient interface virtual wp getSurfaceTextureBinder() const; // only for debugging inline const sp& getFreezeLock() const { return mFreezeLock; } + inline const sp& getActiveBuffer() const { return mActiveBuffer; } protected: virtual void onFirstRef(); diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h index ee5042838..a14b397a8 100644 --- a/services/surfaceflinger/LayerBase.h +++ b/services/surfaceflinger/LayerBase.h @@ -46,6 +46,7 @@ class Client; class DisplayHardware; class GraphicBuffer; class GraphicPlane; +class Layer; class LayerBaseClient; class SurfaceFlinger; @@ -105,6 +106,7 @@ public: void invalidate(); virtual sp getLayerBaseClient() const { return 0; } + virtual sp getLayer() const { return 0; } virtual const char* getTypeId() const { return "LayerBase"; } diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index df13640b6..431cd1a1e 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -925,7 +925,7 @@ Region SurfaceFlinger::setupHardwareComposer(const Region& dirty) // what's happening here is tricky. // we want to clear all the layers with the CLEAR_FB flags // that are opaque. - // however, since some GPU have are efficient at preserving + // however, since some GPU are efficient at preserving // the backbuffer, we want to take advantage of that so we do the // clear only in the dirty region (other areas will be preserved // on those GPUs).