clean-up/simplify all dump() APIs
remove the scratch buffer parameter and use String8::appendFormat() instead. Change-Id: Ib96c91617c8e7292de87433d15cf6232b7d591b0
This commit is contained in:
parent
dfc11ac5c2
commit
74d211ae26
|
@ -229,7 +229,7 @@ public:
|
||||||
|
|
||||||
// dump our state in a String
|
// dump our state in a String
|
||||||
virtual void dump(String8& result) const;
|
virtual void dump(String8& result) const;
|
||||||
virtual void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const;
|
virtual void dump(String8& result, const char* prefix) const;
|
||||||
|
|
||||||
// public facing structure for BufferSlot
|
// public facing structure for BufferSlot
|
||||||
struct BufferItem {
|
struct BufferItem {
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
// their state to the dump by overriding the dumpLocked method, which is
|
// their state to the dump by overriding the dumpLocked method, which is
|
||||||
// called by these methods after locking the mutex.
|
// called by these methods after locking the mutex.
|
||||||
void dump(String8& result) const;
|
void dump(String8& result) const;
|
||||||
void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const;
|
void dump(String8& result, const char* prefix) const;
|
||||||
|
|
||||||
// setFrameAvailableListener sets the listener object that will be notified
|
// setFrameAvailableListener sets the listener object that will be notified
|
||||||
// when a new frame becomes available.
|
// when a new frame becomes available.
|
||||||
|
@ -143,8 +143,7 @@ protected:
|
||||||
// should call ConsumerBase::dumpLocked.
|
// should call ConsumerBase::dumpLocked.
|
||||||
//
|
//
|
||||||
// This method must be called with mMutex locked.
|
// This method must be called with mMutex locked.
|
||||||
virtual void dumpLocked(String8& result, const char* prefix, char* buffer,
|
virtual void dumpLocked(String8& result, const char* prefix) const;
|
||||||
size_t size) const;
|
|
||||||
|
|
||||||
// acquireBufferLocked fetches the next buffer from the BufferQueue and
|
// acquireBufferLocked fetches the next buffer from the BufferQueue and
|
||||||
// updates the buffer slot for the buffer returned.
|
// updates the buffer slot for the buffer returned.
|
||||||
|
|
|
@ -233,8 +233,7 @@ protected:
|
||||||
|
|
||||||
// dumpLocked overrides the ConsumerBase method to dump GLConsumer-
|
// dumpLocked overrides the ConsumerBase method to dump GLConsumer-
|
||||||
// specific info in addition to the ConsumerBase behavior.
|
// specific info in addition to the ConsumerBase behavior.
|
||||||
virtual void dumpLocked(String8& result, const char* prefix, char* buffer,
|
virtual void dumpLocked(String8& result, const char* prefix) const;
|
||||||
size_t size) const;
|
|
||||||
|
|
||||||
// acquireBufferLocked overrides the ConsumerBase method to update the
|
// acquireBufferLocked overrides the ConsumerBase method to update the
|
||||||
// mEglSlots array in addition to the ConsumerBase behavior.
|
// mEglSlots array in addition to the ConsumerBase behavior.
|
||||||
|
|
|
@ -707,36 +707,29 @@ status_t BufferQueue::disconnect(int api) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferQueue::dump(String8& result) const
|
void BufferQueue::dump(String8& result) const {
|
||||||
{
|
BufferQueue::dump(result, "");
|
||||||
char buffer[1024];
|
|
||||||
BufferQueue::dump(result, "", buffer, 1024);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferQueue::dump(String8& result, const char* prefix,
|
void BufferQueue::dump(String8& result, const char* prefix) const {
|
||||||
char* buffer, size_t SIZE) const
|
|
||||||
{
|
|
||||||
Mutex::Autolock _l(mMutex);
|
Mutex::Autolock _l(mMutex);
|
||||||
|
|
||||||
String8 fifo;
|
String8 fifo;
|
||||||
int fifoSize = 0;
|
int fifoSize = 0;
|
||||||
Fifo::const_iterator i(mQueue.begin());
|
Fifo::const_iterator i(mQueue.begin());
|
||||||
while (i != mQueue.end()) {
|
while (i != mQueue.end()) {
|
||||||
snprintf(buffer, SIZE, "%02d ", *i++);
|
fifo.appendFormat("%02d ", *i++);
|
||||||
fifoSize++;
|
fifoSize++;
|
||||||
fifo.append(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxBufferCount = getMaxBufferCountLocked();
|
int maxBufferCount = getMaxBufferCountLocked();
|
||||||
|
|
||||||
snprintf(buffer, SIZE,
|
result.appendFormat(
|
||||||
"%s-BufferQueue maxBufferCount=%d, mSynchronousMode=%d, default-size=[%dx%d], "
|
"%s-BufferQueue maxBufferCount=%d, mSynchronousMode=%d, default-size=[%dx%d], "
|
||||||
"default-format=%d, transform-hint=%02x, FIFO(%d)={%s}\n",
|
"default-format=%d, transform-hint=%02x, FIFO(%d)={%s}\n",
|
||||||
prefix, maxBufferCount, mSynchronousMode, mDefaultWidth,
|
prefix, maxBufferCount, mSynchronousMode, mDefaultWidth,
|
||||||
mDefaultHeight, mDefaultBufferFormat, mTransformHint,
|
mDefaultHeight, mDefaultBufferFormat, mTransformHint,
|
||||||
fifoSize, fifo.string());
|
fifoSize, fifo.string());
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
const char * operator()(int state) const {
|
const char * operator()(int state) const {
|
||||||
|
@ -752,7 +745,7 @@ void BufferQueue::dump(String8& result, const char* prefix,
|
||||||
|
|
||||||
for (int i=0 ; i<maxBufferCount ; i++) {
|
for (int i=0 ; i<maxBufferCount ; i++) {
|
||||||
const BufferSlot& slot(mSlots[i]);
|
const BufferSlot& slot(mSlots[i]);
|
||||||
snprintf(buffer, SIZE,
|
result.appendFormat(
|
||||||
"%s%s[%02d] "
|
"%s%s[%02d] "
|
||||||
"state=%-8s, crop=[%d,%d,%d,%d], "
|
"state=%-8s, crop=[%d,%d,%d,%d], "
|
||||||
"xform=0x%02x, time=%#llx, scale=%s",
|
"xform=0x%02x, time=%#llx, scale=%s",
|
||||||
|
@ -762,15 +755,13 @@ void BufferQueue::dump(String8& result, const char* prefix,
|
||||||
slot.mCrop.bottom, slot.mTransform, slot.mTimestamp,
|
slot.mCrop.bottom, slot.mTransform, slot.mTimestamp,
|
||||||
scalingModeName(slot.mScalingMode)
|
scalingModeName(slot.mScalingMode)
|
||||||
);
|
);
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
const sp<GraphicBuffer>& buf(slot.mGraphicBuffer);
|
const sp<GraphicBuffer>& buf(slot.mGraphicBuffer);
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
snprintf(buffer, SIZE,
|
result.appendFormat(
|
||||||
", %p [%4ux%4u:%4u,%3X]",
|
", %p [%4ux%4u:%4u,%3X]",
|
||||||
buf->handle, buf->width, buf->height, buf->stride,
|
buf->handle, buf->width, buf->height, buf->stride,
|
||||||
buf->format);
|
buf->format);
|
||||||
result.append(buffer);
|
|
||||||
}
|
}
|
||||||
result.append("\n");
|
result.append("\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,23 +165,19 @@ void ConsumerBase::setFrameAvailableListener(
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsumerBase::dump(String8& result) const {
|
void ConsumerBase::dump(String8& result) const {
|
||||||
char buffer[1024];
|
dump(result, "");
|
||||||
dump(result, "", buffer, 1024);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsumerBase::dump(String8& result, const char* prefix,
|
void ConsumerBase::dump(String8& result, const char* prefix) const {
|
||||||
char* buffer, size_t size) const {
|
|
||||||
Mutex::Autolock _l(mMutex);
|
Mutex::Autolock _l(mMutex);
|
||||||
dumpLocked(result, prefix, buffer, size);
|
dumpLocked(result, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsumerBase::dumpLocked(String8& result, const char* prefix,
|
void ConsumerBase::dumpLocked(String8& result, const char* prefix) const {
|
||||||
char* buffer, size_t SIZE) const {
|
result.appendFormat("%smAbandoned=%d\n", prefix, int(mAbandoned));
|
||||||
snprintf(buffer, SIZE, "%smAbandoned=%d\n", prefix, int(mAbandoned));
|
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
if (!mAbandoned) {
|
if (!mAbandoned) {
|
||||||
mBufferQueue->dump(result, prefix, buffer, SIZE);
|
mBufferQueue->dump(result, prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -884,18 +884,16 @@ status_t GLConsumer::setSynchronousMode(bool enabled) {
|
||||||
return mBufferQueue->setSynchronousMode(enabled);
|
return mBufferQueue->setSynchronousMode(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLConsumer::dumpLocked(String8& result, const char* prefix,
|
void GLConsumer::dumpLocked(String8& result, const char* prefix) const
|
||||||
char* buffer, size_t size) const
|
|
||||||
{
|
{
|
||||||
snprintf(buffer, size,
|
result.appendFormat(
|
||||||
"%smTexName=%d mCurrentTexture=%d\n"
|
"%smTexName=%d mCurrentTexture=%d\n"
|
||||||
"%smCurrentCrop=[%d,%d,%d,%d] mCurrentTransform=%#x\n",
|
"%smCurrentCrop=[%d,%d,%d,%d] mCurrentTransform=%#x\n",
|
||||||
prefix, mTexName, mCurrentTexture, prefix, mCurrentCrop.left,
|
prefix, mTexName, mCurrentTexture, prefix, mCurrentCrop.left,
|
||||||
mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom,
|
mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom,
|
||||||
mCurrentTransform);
|
mCurrentTransform);
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
ConsumerBase::dumpLocked(result, prefix, buffer, size);
|
ConsumerBase::dumpLocked(result, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mtxMul(float out[16], const float a[16], const float b[16]) {
|
static void mtxMul(float out[16], const float a[16], const float b[16]) {
|
||||||
|
|
|
@ -424,9 +424,9 @@ void DisplayDevice::setProjection(int orientation,
|
||||||
mFrame = frame;
|
mFrame = frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDevice::dump(String8& result, char* buffer, size_t SIZE) const {
|
void DisplayDevice::dump(String8& result) const {
|
||||||
const Transform& tr(mGlobalTransform);
|
const Transform& tr(mGlobalTransform);
|
||||||
snprintf(buffer, SIZE,
|
result.appendFormat(
|
||||||
"+ DisplayDevice: %s\n"
|
"+ DisplayDevice: %s\n"
|
||||||
" type=%x, hwcId=%d, layerStack=%u, (%4dx%4d), ANativeWindow=%p, orient=%2d (type=%08x), "
|
" type=%x, hwcId=%d, layerStack=%u, (%4dx%4d), ANativeWindow=%p, orient=%2d (type=%08x), "
|
||||||
"flips=%u, isSecure=%d, secureVis=%d, acquired=%d, numLayers=%u\n"
|
"flips=%u, isSecure=%d, secureVis=%d, acquired=%d, numLayers=%u\n"
|
||||||
|
@ -443,8 +443,6 @@ void DisplayDevice::dump(String8& result, char* buffer, size_t SIZE) const {
|
||||||
tr[0][1], tr[1][1], tr[2][1],
|
tr[0][1], tr[1][1], tr[2][1],
|
||||||
tr[0][2], tr[1][2], tr[2][2]);
|
tr[0][2], tr[1][2], tr[2][2]);
|
||||||
|
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
String8 surfaceDump;
|
String8 surfaceDump;
|
||||||
mDisplaySurface->dump(surfaceDump);
|
mDisplaySurface->dump(surfaceDump);
|
||||||
result.append(surfaceDump);
|
result.append(surfaceDump);
|
||||||
|
|
|
@ -153,7 +153,7 @@ public:
|
||||||
* Debugging
|
* Debugging
|
||||||
*/
|
*/
|
||||||
uint32_t getPageFlipCount() const;
|
uint32_t getPageFlipCount() const;
|
||||||
void dump(String8& result, char* buffer, size_t SIZE) const;
|
void dump(String8& result) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -175,11 +175,10 @@ void FramebufferSurface::dump(String8& result) const {
|
||||||
ConsumerBase::dump(result);
|
ConsumerBase::dump(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramebufferSurface::dumpLocked(String8& result, const char* prefix,
|
void FramebufferSurface::dumpLocked(String8& result, const char* prefix) const
|
||||||
char* buffer, size_t SIZE) const
|
|
||||||
{
|
{
|
||||||
mHwc.fbDump(result);
|
mHwc.fbDump(result);
|
||||||
ConsumerBase::dumpLocked(result, prefix, buffer, SIZE);
|
ConsumerBase::dumpLocked(result, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -55,8 +55,7 @@ private:
|
||||||
virtual void onFrameAvailable();
|
virtual void onFrameAvailable();
|
||||||
virtual void freeBufferLocked(int slotIndex);
|
virtual void freeBufferLocked(int slotIndex);
|
||||||
|
|
||||||
virtual void dumpLocked(String8& result, const char* prefix,
|
virtual void dumpLocked(String8& result, const char* prefix) const;
|
||||||
char* buffer, size_t SIZE) const;
|
|
||||||
|
|
||||||
// nextBuffer waits for and then latches the next buffer from the
|
// nextBuffer waits for and then latches the next buffer from the
|
||||||
// BufferQueue and releases the previously latched buffer to the
|
// BufferQueue and releases the previously latched buffer to the
|
||||||
|
|
|
@ -546,9 +546,6 @@ status_t HWComposer::setFramebufferTarget(int32_t id,
|
||||||
// triggers a Surface::queueBuffer() on some
|
// triggers a Surface::queueBuffer() on some
|
||||||
// devices (!?) -- log and ignore.
|
// devices (!?) -- log and ignore.
|
||||||
ALOGE("HWComposer: framebufferTarget is null");
|
ALOGE("HWComposer: framebufferTarget is null");
|
||||||
// CallStack stack;
|
|
||||||
// stack.update();
|
|
||||||
// stack.dump("");
|
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -958,7 +955,7 @@ HWComposer::LayerListIterator HWComposer::end(int32_t id) {
|
||||||
return getLayerIterator(id, numLayers);
|
return getLayerIterator(id, numLayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HWComposer::dump(String8& result, char* buffer, size_t SIZE) const {
|
void HWComposer::dump(String8& result) const {
|
||||||
if (mHwc) {
|
if (mHwc) {
|
||||||
result.appendFormat("Hardware Composer state (version %8x):\n", hwcApiVersion(mHwc));
|
result.appendFormat("Hardware Composer state (version %8x):\n", hwcApiVersion(mHwc));
|
||||||
result.appendFormat(" mDebugForceFakeVSync=%d\n", mDebugForceFakeVSync);
|
result.appendFormat(" mDebugForceFakeVSync=%d\n", mDebugForceFakeVSync);
|
||||||
|
@ -1026,6 +1023,8 @@ void HWComposer::dump(String8& result, char* buffer, size_t SIZE) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mHwc && mHwc->dump) {
|
if (mHwc && mHwc->dump) {
|
||||||
|
const size_t SIZE = 4096;
|
||||||
|
char buffer[SIZE];
|
||||||
mHwc->dump(mHwc, buffer, SIZE);
|
mHwc->dump(mHwc, buffer, SIZE);
|
||||||
result.append(buffer);
|
result.append(buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ public:
|
||||||
friend class VSyncThread;
|
friend class VSyncThread;
|
||||||
|
|
||||||
// for debugging ----------------------------------------------------------
|
// for debugging ----------------------------------------------------------
|
||||||
void dump(String8& out, char* scratch, size_t SIZE) const;
|
void dump(String8& out) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadHwcModule();
|
void loadHwcModule();
|
||||||
|
|
|
@ -320,7 +320,7 @@ void EventThread::disableVSyncLocked() {
|
||||||
mDebugVsyncEnabled = false;
|
mDebugVsyncEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventThread::dump(String8& result, char* buffer, size_t SIZE) const {
|
void EventThread::dump(String8& result) const {
|
||||||
Mutex::Autolock _l(mLock);
|
Mutex::Autolock _l(mLock);
|
||||||
result.appendFormat("VSYNC state: %s\n",
|
result.appendFormat("VSYNC state: %s\n",
|
||||||
mDebugVsyncEnabled?"enabled":"disabled");
|
mDebugVsyncEnabled?"enabled":"disabled");
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
Vector< sp<EventThread::Connection> > waitForEvent(
|
Vector< sp<EventThread::Connection> > waitForEvent(
|
||||||
DisplayEventReceiver::Event* event);
|
DisplayEventReceiver::Event* event);
|
||||||
|
|
||||||
void dump(String8& result, char* buffer, size_t SIZE) const;
|
void dump(String8& result) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool threadLoop();
|
virtual bool threadLoop();
|
||||||
|
|
|
@ -1178,21 +1178,19 @@ void Layer::updateTransformHint(const sp<const DisplayDevice>& hw) const {
|
||||||
// debugging
|
// debugging
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Layer::dump(String8& result, char* buffer, size_t SIZE) const
|
void Layer::dump(String8& result) const
|
||||||
{
|
{
|
||||||
const Layer::State& s(drawingState());
|
const Layer::State& s(drawingState());
|
||||||
|
|
||||||
snprintf(buffer, SIZE,
|
result.appendFormat(
|
||||||
"+ %s %p (%s)\n",
|
"+ %s %p (%s)\n",
|
||||||
getTypeId(), this, getName().string());
|
getTypeId(), this, getName().string());
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
s.activeTransparentRegion.dump(result, "transparentRegion");
|
s.activeTransparentRegion.dump(result, "transparentRegion");
|
||||||
visibleRegion.dump(result, "visibleRegion");
|
visibleRegion.dump(result, "visibleRegion");
|
||||||
sp<Client> client(mClientRef.promote());
|
sp<Client> client(mClientRef.promote());
|
||||||
|
|
||||||
snprintf(buffer, SIZE,
|
result.appendFormat( " "
|
||||||
" "
|
|
||||||
"layerStack=%4d, z=%9d, pos=(%g,%g), size=(%4d,%4d), crop=(%4d,%4d,%4d,%4d), "
|
"layerStack=%4d, z=%9d, pos=(%g,%g), size=(%4d,%4d), crop=(%4d,%4d,%4d,%4d), "
|
||||||
"isOpaque=%1d, invalidate=%1d, "
|
"isOpaque=%1d, invalidate=%1d, "
|
||||||
"alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n"
|
"alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n"
|
||||||
|
@ -1205,7 +1203,6 @@ void Layer::dump(String8& result, char* buffer, size_t SIZE) const
|
||||||
s.transform[0][0], s.transform[0][1],
|
s.transform[0][0], s.transform[0][1],
|
||||||
s.transform[1][0], s.transform[1][1],
|
s.transform[1][0], s.transform[1][1],
|
||||||
client.get());
|
client.get());
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
sp<const GraphicBuffer> buf0(mActiveBuffer);
|
sp<const GraphicBuffer> buf0(mActiveBuffer);
|
||||||
uint32_t w0=0, h0=0, s0=0, f0=0;
|
uint32_t w0=0, h0=0, s0=0, f0=0;
|
||||||
|
@ -1215,26 +1212,24 @@ void Layer::dump(String8& result, char* buffer, size_t SIZE) const
|
||||||
s0 = buf0->getStride();
|
s0 = buf0->getStride();
|
||||||
f0 = buf0->format;
|
f0 = buf0->format;
|
||||||
}
|
}
|
||||||
snprintf(buffer, SIZE,
|
result.appendFormat(
|
||||||
" "
|
" "
|
||||||
"format=%2d, activeBuffer=[%4ux%4u:%4u,%3X],"
|
"format=%2d, activeBuffer=[%4ux%4u:%4u,%3X],"
|
||||||
" queued-frames=%d, mRefreshPending=%d\n",
|
" queued-frames=%d, mRefreshPending=%d\n",
|
||||||
mFormat, w0, h0, s0,f0,
|
mFormat, w0, h0, s0,f0,
|
||||||
mQueuedFrames, mRefreshPending);
|
mQueuedFrames, mRefreshPending);
|
||||||
|
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
if (mSurfaceFlingerConsumer != 0) {
|
if (mSurfaceFlingerConsumer != 0) {
|
||||||
mSurfaceFlingerConsumer->dump(result, " ", buffer, SIZE);
|
mSurfaceFlingerConsumer->dump(result, " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Layer::shortDump(String8& result, char* scratch, size_t size) const {
|
void Layer::shortDump(String8& result) const {
|
||||||
Layer::dump(result, scratch, size);
|
Layer::dump(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layer::dumpStats(String8& result, char* buffer, size_t SIZE) const {
|
void Layer::dumpStats(String8& result) const {
|
||||||
mFrameTracker.dump(result);
|
mFrameTracker.dump(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -304,9 +304,9 @@ public:
|
||||||
|
|
||||||
|
|
||||||
/* always call base class first */
|
/* always call base class first */
|
||||||
virtual void dump(String8& result, char* scratch, size_t size) const;
|
virtual void dump(String8& result) const;
|
||||||
virtual void shortDump(String8& result, char* scratch, size_t size) const;
|
virtual void shortDump(String8& result) const;
|
||||||
virtual void dumpStats(String8& result, char* buffer, size_t SIZE) const;
|
virtual void dumpStats(String8& result) const;
|
||||||
virtual void clearStats();
|
virtual void clearStats();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -2141,19 +2141,15 @@ void SurfaceFlinger::blank(const sp<IBinder>& display) {
|
||||||
|
|
||||||
status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
|
status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
|
||||||
{
|
{
|
||||||
const size_t SIZE = 4096;
|
|
||||||
char buffer[SIZE];
|
|
||||||
String8 result;
|
String8 result;
|
||||||
|
|
||||||
|
|
||||||
IPCThreadState* ipc = IPCThreadState::self();
|
IPCThreadState* ipc = IPCThreadState::self();
|
||||||
const int pid = ipc->getCallingPid();
|
const int pid = ipc->getCallingPid();
|
||||||
const int uid = ipc->getCallingUid();
|
const int uid = ipc->getCallingUid();
|
||||||
if ((uid != AID_SHELL) &&
|
if ((uid != AID_SHELL) &&
|
||||||
!PermissionCache::checkPermission(sDump, pid, uid)) {
|
!PermissionCache::checkPermission(sDump, pid, uid)) {
|
||||||
snprintf(buffer, SIZE, "Permission Denial: "
|
result.appendFormat("Permission Denial: "
|
||||||
"can't dump SurfaceFlinger from pid=%d, uid=%d\n", pid, uid);
|
"can't dump SurfaceFlinger from pid=%d, uid=%d\n", pid, uid);
|
||||||
result.append(buffer);
|
|
||||||
} else {
|
} else {
|
||||||
// Try to get the main lock, but don't insist if we can't
|
// Try to get the main lock, but don't insist if we can't
|
||||||
// (this would indicate SF is stuck, but we want to be able to
|
// (this would indicate SF is stuck, but we want to be able to
|
||||||
|
@ -2164,10 +2160,9 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
|
||||||
}
|
}
|
||||||
const bool locked(retry >= 0);
|
const bool locked(retry >= 0);
|
||||||
if (!locked) {
|
if (!locked) {
|
||||||
snprintf(buffer, SIZE,
|
result.append(
|
||||||
"SurfaceFlinger appears to be unresponsive, "
|
"SurfaceFlinger appears to be unresponsive, "
|
||||||
"dumping anyways (no locks held)\n");
|
"dumping anyways (no locks held)\n");
|
||||||
result.append(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dumpAll = true;
|
bool dumpAll = true;
|
||||||
|
@ -2177,27 +2172,27 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
|
||||||
if ((index < numArgs) &&
|
if ((index < numArgs) &&
|
||||||
(args[index] == String16("--list"))) {
|
(args[index] == String16("--list"))) {
|
||||||
index++;
|
index++;
|
||||||
listLayersLocked(args, index, result, buffer, SIZE);
|
listLayersLocked(args, index, result);
|
||||||
dumpAll = false;
|
dumpAll = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((index < numArgs) &&
|
if ((index < numArgs) &&
|
||||||
(args[index] == String16("--latency"))) {
|
(args[index] == String16("--latency"))) {
|
||||||
index++;
|
index++;
|
||||||
dumpStatsLocked(args, index, result, buffer, SIZE);
|
dumpStatsLocked(args, index, result);
|
||||||
dumpAll = false;
|
dumpAll = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((index < numArgs) &&
|
if ((index < numArgs) &&
|
||||||
(args[index] == String16("--latency-clear"))) {
|
(args[index] == String16("--latency-clear"))) {
|
||||||
index++;
|
index++;
|
||||||
clearStatsLocked(args, index, result, buffer, SIZE);
|
clearStatsLocked(args, index, result);
|
||||||
dumpAll = false;
|
dumpAll = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dumpAll) {
|
if (dumpAll) {
|
||||||
dumpAllLocked(result, buffer, SIZE);
|
dumpAllLocked(args, index, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locked) {
|
if (locked) {
|
||||||
|
@ -2209,19 +2204,18 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceFlinger::listLayersLocked(const Vector<String16>& args, size_t& index,
|
void SurfaceFlinger::listLayersLocked(const Vector<String16>& args, size_t& index,
|
||||||
String8& result, char* buffer, size_t SIZE) const
|
String8& result) const
|
||||||
{
|
{
|
||||||
const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
|
const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
|
||||||
const size_t count = currentLayers.size();
|
const size_t count = currentLayers.size();
|
||||||
for (size_t i=0 ; i<count ; i++) {
|
for (size_t i=0 ; i<count ; i++) {
|
||||||
const sp<Layer>& layer(currentLayers[i]);
|
const sp<Layer>& layer(currentLayers[i]);
|
||||||
snprintf(buffer, SIZE, "%s\n", layer->getName().string());
|
result.appendFormat("%s\n", layer->getName().string());
|
||||||
result.append(buffer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceFlinger::dumpStatsLocked(const Vector<String16>& args, size_t& index,
|
void SurfaceFlinger::dumpStatsLocked(const Vector<String16>& args, size_t& index,
|
||||||
String8& result, char* buffer, size_t SIZE) const
|
String8& result) const
|
||||||
{
|
{
|
||||||
String8 name;
|
String8 name;
|
||||||
if (index < args.size()) {
|
if (index < args.size()) {
|
||||||
|
@ -2241,14 +2235,14 @@ void SurfaceFlinger::dumpStatsLocked(const Vector<String16>& args, size_t& index
|
||||||
for (size_t i=0 ; i<count ; i++) {
|
for (size_t i=0 ; i<count ; i++) {
|
||||||
const sp<Layer>& layer(currentLayers[i]);
|
const sp<Layer>& layer(currentLayers[i]);
|
||||||
if (name == layer->getName()) {
|
if (name == layer->getName()) {
|
||||||
layer->dumpStats(result, buffer, SIZE);
|
layer->dumpStats(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceFlinger::clearStatsLocked(const Vector<String16>& args, size_t& index,
|
void SurfaceFlinger::clearStatsLocked(const Vector<String16>& args, size_t& index,
|
||||||
String8& result, char* buffer, size_t SIZE)
|
String8& result)
|
||||||
{
|
{
|
||||||
String8 name;
|
String8 name;
|
||||||
if (index < args.size()) {
|
if (index < args.size()) {
|
||||||
|
@ -2288,8 +2282,8 @@ void SurfaceFlinger::clearStatsLocked(const Vector<String16>& args, size_t& inde
|
||||||
result.append(config);
|
result.append(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceFlinger::dumpAllLocked(
|
void SurfaceFlinger::dumpAllLocked(const Vector<String16>& args, size_t& index,
|
||||||
String8& result, char* buffer, size_t SIZE) const
|
String8& result) const
|
||||||
{
|
{
|
||||||
// figure out if we're stuck somewhere
|
// figure out if we're stuck somewhere
|
||||||
const nsecs_t now = systemTime();
|
const nsecs_t now = systemTime();
|
||||||
|
@ -2316,56 +2310,46 @@ void SurfaceFlinger::dumpAllLocked(
|
||||||
*/
|
*/
|
||||||
const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
|
const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
|
||||||
const size_t count = currentLayers.size();
|
const size_t count = currentLayers.size();
|
||||||
snprintf(buffer, SIZE, "Visible layers (count = %d)\n", count);
|
result.appendFormat("Visible layers (count = %d)\n", count);
|
||||||
result.append(buffer);
|
|
||||||
for (size_t i=0 ; i<count ; i++) {
|
for (size_t i=0 ; i<count ; i++) {
|
||||||
const sp<Layer>& layer(currentLayers[i]);
|
const sp<Layer>& layer(currentLayers[i]);
|
||||||
layer->dump(result, buffer, SIZE);
|
layer->dump(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dump Display state
|
* Dump Display state
|
||||||
*/
|
*/
|
||||||
|
|
||||||
snprintf(buffer, SIZE, "Displays (%d entries)\n", mDisplays.size());
|
result.appendFormat("Displays (%d entries)\n", mDisplays.size());
|
||||||
result.append(buffer);
|
|
||||||
for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
|
for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
|
||||||
const sp<const DisplayDevice>& hw(mDisplays[dpy]);
|
const sp<const DisplayDevice>& hw(mDisplays[dpy]);
|
||||||
hw->dump(result, buffer, SIZE);
|
hw->dump(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dump SurfaceFlinger global state
|
* Dump SurfaceFlinger global state
|
||||||
*/
|
*/
|
||||||
|
|
||||||
snprintf(buffer, SIZE, "SurfaceFlinger global state:\n");
|
result.append("SurfaceFlinger global state:\n");
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
HWComposer& hwc(getHwComposer());
|
HWComposer& hwc(getHwComposer());
|
||||||
sp<const DisplayDevice> hw(getDefaultDisplayDevice());
|
sp<const DisplayDevice> hw(getDefaultDisplayDevice());
|
||||||
const GLExtensions& extensions(GLExtensions::getInstance());
|
const GLExtensions& extensions(GLExtensions::getInstance());
|
||||||
|
|
||||||
snprintf(buffer, SIZE, "EGL implementation : %s\n",
|
result.appendFormat("EGL implementation : %s\n%s\n",
|
||||||
eglQueryStringImplementationANDROID(mEGLDisplay, EGL_VERSION));
|
eglQueryStringImplementationANDROID(mEGLDisplay, EGL_VERSION),
|
||||||
result.append(buffer);
|
|
||||||
snprintf(buffer, SIZE, "%s\n",
|
|
||||||
eglQueryStringImplementationANDROID(mEGLDisplay, EGL_EXTENSIONS));
|
eglQueryStringImplementationANDROID(mEGLDisplay, EGL_EXTENSIONS));
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
snprintf(buffer, SIZE, "GLES: %s, %s, %s\n",
|
result.appendFormat("GLES: %s, %s, %s\n",
|
||||||
extensions.getVendor(),
|
extensions.getVendor(),
|
||||||
extensions.getRenderer(),
|
extensions.getRenderer(),
|
||||||
extensions.getVersion());
|
extensions.getVersion());
|
||||||
result.append(buffer);
|
result.appendFormat("%s\n", extensions.getExtension());
|
||||||
snprintf(buffer, SIZE, "%s\n", extensions.getExtension());
|
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
hw->undefinedRegion.dump(result, "undefinedRegion");
|
hw->undefinedRegion.dump(result, "undefinedRegion");
|
||||||
snprintf(buffer, SIZE,
|
result.appendFormat(" orientation=%d, canDraw=%d\n",
|
||||||
" orientation=%d, canDraw=%d\n",
|
|
||||||
hw->getOrientation(), hw->canDraw());
|
hw->getOrientation(), hw->canDraw());
|
||||||
result.append(buffer);
|
result.appendFormat(
|
||||||
snprintf(buffer, SIZE,
|
|
||||||
" last eglSwapBuffers() time: %f us\n"
|
" last eglSwapBuffers() time: %f us\n"
|
||||||
" last transaction time : %f us\n"
|
" last transaction time : %f us\n"
|
||||||
" transaction-flags : %08x\n"
|
" transaction-flags : %08x\n"
|
||||||
|
@ -2383,31 +2367,26 @@ void SurfaceFlinger::dumpAllLocked(
|
||||||
hwc.getDpiY(HWC_DISPLAY_PRIMARY),
|
hwc.getDpiY(HWC_DISPLAY_PRIMARY),
|
||||||
mEGLNativeVisualId,
|
mEGLNativeVisualId,
|
||||||
!mGpuToCpuSupported);
|
!mGpuToCpuSupported);
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
snprintf(buffer, SIZE, " eglSwapBuffers time: %f us\n",
|
result.appendFormat(" eglSwapBuffers time: %f us\n",
|
||||||
inSwapBuffersDuration/1000.0);
|
inSwapBuffersDuration/1000.0);
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
snprintf(buffer, SIZE, " transaction time: %f us\n",
|
result.appendFormat(" transaction time: %f us\n",
|
||||||
inTransactionDuration/1000.0);
|
inTransactionDuration/1000.0);
|
||||||
result.append(buffer);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VSYNC state
|
* VSYNC state
|
||||||
*/
|
*/
|
||||||
mEventThread->dump(result, buffer, SIZE);
|
mEventThread->dump(result);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dump HWComposer state
|
* Dump HWComposer state
|
||||||
*/
|
*/
|
||||||
snprintf(buffer, SIZE, "h/w composer state:\n");
|
result.append("h/w composer state:\n");
|
||||||
result.append(buffer);
|
result.appendFormat(" h/w composer %s and %s\n",
|
||||||
snprintf(buffer, SIZE, " h/w composer %s and %s\n",
|
|
||||||
hwc.initCheck()==NO_ERROR ? "present" : "not present",
|
hwc.initCheck()==NO_ERROR ? "present" : "not present",
|
||||||
(mDebugDisableHWC || mDebugRegion) ? "disabled" : "enabled");
|
(mDebugDisableHWC || mDebugRegion) ? "disabled" : "enabled");
|
||||||
result.append(buffer);
|
hwc.dump(result);
|
||||||
hwc.dump(result, buffer, SIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dump gralloc state
|
* Dump gralloc state
|
||||||
|
|
|
@ -385,12 +385,13 @@ private:
|
||||||
* Debugging & dumpsys
|
* Debugging & dumpsys
|
||||||
*/
|
*/
|
||||||
void listLayersLocked(const Vector<String16>& args, size_t& index,
|
void listLayersLocked(const Vector<String16>& args, size_t& index,
|
||||||
String8& result, char* buffer, size_t SIZE) const;
|
String8& result) const;
|
||||||
void dumpStatsLocked(const Vector<String16>& args, size_t& index,
|
void dumpStatsLocked(const Vector<String16>& args, size_t& index,
|
||||||
String8& result, char* buffer, size_t SIZE) const;
|
String8& result) const;
|
||||||
void clearStatsLocked(const Vector<String16>& args, size_t& index,
|
void clearStatsLocked(const Vector<String16>& args, size_t& index,
|
||||||
String8& result, char* buffer, size_t SIZE);
|
String8& result);
|
||||||
void dumpAllLocked(String8& result, char* buffer, size_t SIZE) const;
|
void dumpAllLocked(const Vector<String16>& args, size_t& index,
|
||||||
|
String8& result) const;
|
||||||
bool startDdmConnection();
|
bool startDdmConnection();
|
||||||
static void appendSfConfigString(String8& result);
|
static void appendSfConfigString(String8& result);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue