From dd912baf1c4eaafed50d97e6381f9d5093e8c11e Mon Sep 17 00:00:00 2001 From: Jamie Gennis Date: Thu, 10 May 2012 02:22:33 -0700 Subject: [PATCH] libgui: improve some logging and dumping This change updates some of the SurfaceTextureClient and BufferQueue logging and dumping to include the crop, transform and scaling mode. It also removes the uses of the NO_SCALE_CROP scaling mode enum, which was added by accident in a previous change. Change-Id: I62912716a1e48885fb22f12b92678aa13f10fcd9 Bug: 6470541 --- libs/gui/BufferQueue.cpp | 21 ++++++++++++++++----- libs/gui/SurfaceTextureClient.cpp | 9 ++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index e53162ba4..2d7c89b84 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -72,6 +72,15 @@ static int32_t createProcessUniqueId() { return android_atomic_inc(&globalCounter); } +static const char* scalingModeName(int scalingMode) { + switch (scalingMode) { + case NATIVE_WINDOW_SCALING_MODE_FREEZE: return "FREEZE"; + case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: return "SCALE_TO_WINDOW"; + case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: return "SCALE_CROP"; + default: return "Unknown"; + } +} + BufferQueue::BufferQueue( bool allowSynchronousMode, int bufferCount ) : mDefaultWidth(1), mDefaultHeight(1), @@ -543,8 +552,10 @@ status_t BufferQueue::queueBuffer(int buf, input.deflate(×tamp, &crop, &scalingMode, &transform); - ST_LOGV("queueBuffer: slot=%d time=%lld crop=[%d,%d,%d,%d]", - buf, timestamp, crop.left, crop.top, crop.right, crop.bottom); + ST_LOGV("queueBuffer: slot=%d time=%#llx crop=[%d,%d,%d,%d] tr=%#x " + "scale=%s", + buf, timestamp, crop.left, crop.top, crop.right, crop.bottom, + transform, scalingModeName(scalingMode)); sp listener; @@ -611,7 +622,6 @@ status_t BufferQueue::queueBuffer(int buf, case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: - case NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP: break; default: ST_LOGE("unknown scaling mode: %d (ignoring)", scalingMode); @@ -796,11 +806,12 @@ void BufferQueue::dump(String8& result, const char* prefix, snprintf(buffer, SIZE, "%s%s[%02d] " "state=%-8s, crop=[%d,%d,%d,%d], " - "transform=0x%02x, timestamp=%lld", + "xform=0x%02x, time=%#llx, scale=%s", prefix, (slot.mBufferState == BufferSlot::ACQUIRED)?">":" ", i, stateName(slot.mBufferState), slot.mCrop.left, slot.mCrop.top, slot.mCrop.right, - slot.mCrop.bottom, slot.mTransform, slot.mTimestamp + slot.mCrop.bottom, slot.mTransform, slot.mTimestamp, + scalingModeName(slot.mScalingMode) ); result.append(buffer); diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp index 9c3e28db3..5d3bd1a1c 100644 --- a/libs/gui/SurfaceTextureClient.cpp +++ b/libs/gui/SurfaceTextureClient.cpp @@ -522,7 +522,6 @@ int SurfaceTextureClient::setUsage(uint32_t reqUsage) int SurfaceTextureClient::setCrop(Rect const* rect) { ATRACE_CALL(); - ALOGV("SurfaceTextureClient::setCrop"); Rect realRect; if (rect == NULL || rect->isEmpty()) { @@ -531,6 +530,9 @@ int SurfaceTextureClient::setCrop(Rect const* rect) realRect = *rect; } + ALOGV("SurfaceTextureClient::setCrop rect=[%d %d %d %d]", + realRect.left, realRect.top, realRect.right, realRect.bottom); + Mutex::Autolock lock(mMutex); mCrop = realRect; mCropNeedsTransform = false; @@ -540,7 +542,6 @@ int SurfaceTextureClient::setCrop(Rect const* rect) int SurfaceTextureClient::setPostTransformCrop(Rect const* rect) { ATRACE_CALL(); - ALOGV("SurfaceTextureClient::setPostTransformCrop"); Rect realRect; if (rect == NULL || rect->isEmpty()) { @@ -549,6 +550,9 @@ int SurfaceTextureClient::setPostTransformCrop(Rect const* rect) realRect = *rect; } + ALOGV("SurfaceTextureClient::setPostTransformCrop rect=[%d %d %d %d]", + realRect.left, realRect.top, realRect.right, realRect.bottom); + Mutex::Autolock lock(mMutex); mCrop = realRect; mCropNeedsTransform = true; @@ -627,7 +631,6 @@ int SurfaceTextureClient::setScalingMode(int mode) case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: - case NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP: break; default: ALOGE("unknown scaling mode: %d", mode);