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
This commit is contained in:
Jamie Gennis 2012-05-10 02:22:33 -07:00 committed by The Android Automerger
parent 8bed04d82b
commit 322495411d
2 changed files with 22 additions and 8 deletions

View File

@ -72,6 +72,15 @@ static int32_t createProcessUniqueId() {
return android_atomic_inc(&globalCounter); 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 ) : BufferQueue::BufferQueue( bool allowSynchronousMode, int bufferCount ) :
mDefaultWidth(1), mDefaultWidth(1),
mDefaultHeight(1), mDefaultHeight(1),
@ -543,8 +552,10 @@ status_t BufferQueue::queueBuffer(int buf,
input.deflate(&timestamp, &crop, &scalingMode, &transform); input.deflate(&timestamp, &crop, &scalingMode, &transform);
ST_LOGV("queueBuffer: slot=%d time=%lld crop=[%d,%d,%d,%d]", ST_LOGV("queueBuffer: slot=%d time=%#llx crop=[%d,%d,%d,%d] tr=%#x "
buf, timestamp, crop.left, crop.top, crop.right, crop.bottom); "scale=%s",
buf, timestamp, crop.left, crop.top, crop.right, crop.bottom,
transform, scalingModeName(scalingMode));
sp<ConsumerListener> listener; sp<ConsumerListener> listener;
@ -611,7 +622,6 @@ status_t BufferQueue::queueBuffer(int buf,
case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_FREEZE:
case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW:
case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP:
case NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP:
break; break;
default: default:
ST_LOGE("unknown scaling mode: %d (ignoring)", scalingMode); ST_LOGE("unknown scaling mode: %d (ignoring)", scalingMode);
@ -796,11 +806,12 @@ void BufferQueue::dump(String8& result, const char* prefix,
snprintf(buffer, SIZE, snprintf(buffer, SIZE,
"%s%s[%02d] " "%s%s[%02d] "
"state=%-8s, crop=[%d,%d,%d,%d], " "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, prefix, (slot.mBufferState == BufferSlot::ACQUIRED)?">":" ", i,
stateName(slot.mBufferState), stateName(slot.mBufferState),
slot.mCrop.left, slot.mCrop.top, slot.mCrop.right, 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); result.append(buffer);

View File

@ -522,7 +522,6 @@ int SurfaceTextureClient::setUsage(uint32_t reqUsage)
int SurfaceTextureClient::setCrop(Rect const* rect) int SurfaceTextureClient::setCrop(Rect const* rect)
{ {
ATRACE_CALL(); ATRACE_CALL();
ALOGV("SurfaceTextureClient::setCrop");
Rect realRect; Rect realRect;
if (rect == NULL || rect->isEmpty()) { if (rect == NULL || rect->isEmpty()) {
@ -531,6 +530,9 @@ int SurfaceTextureClient::setCrop(Rect const* rect)
realRect = *rect; realRect = *rect;
} }
ALOGV("SurfaceTextureClient::setCrop rect=[%d %d %d %d]",
realRect.left, realRect.top, realRect.right, realRect.bottom);
Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex);
mCrop = realRect; mCrop = realRect;
mCropNeedsTransform = false; mCropNeedsTransform = false;
@ -540,7 +542,6 @@ int SurfaceTextureClient::setCrop(Rect const* rect)
int SurfaceTextureClient::setPostTransformCrop(Rect const* rect) int SurfaceTextureClient::setPostTransformCrop(Rect const* rect)
{ {
ATRACE_CALL(); ATRACE_CALL();
ALOGV("SurfaceTextureClient::setPostTransformCrop");
Rect realRect; Rect realRect;
if (rect == NULL || rect->isEmpty()) { if (rect == NULL || rect->isEmpty()) {
@ -549,6 +550,9 @@ int SurfaceTextureClient::setPostTransformCrop(Rect const* rect)
realRect = *rect; realRect = *rect;
} }
ALOGV("SurfaceTextureClient::setPostTransformCrop rect=[%d %d %d %d]",
realRect.left, realRect.top, realRect.right, realRect.bottom);
Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex);
mCrop = realRect; mCrop = realRect;
mCropNeedsTransform = true; mCropNeedsTransform = true;
@ -627,7 +631,6 @@ int SurfaceTextureClient::setScalingMode(int mode)
case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_FREEZE:
case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW:
case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP:
case NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP:
break; break;
default: default:
ALOGE("unknown scaling mode: %d", mode); ALOGE("unknown scaling mode: %d", mode);