am cd1806e2: libgui: improve some logging and dumping

* commit 'cd1806e210f2633423f0fb14d39fa00d03974223':
  libgui: improve some logging and dumping
This commit is contained in:
Jamie Gennis 2012-05-10 16:37:18 -07:00 committed by Android Git Automerger
commit 2b4eeac037
2 changed files with 22 additions and 8 deletions

View File

@ -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(&timestamp, &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<ConsumerListener> 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);

View File

@ -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);