зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1033998 - Reduce log spam from camera code on KK, r=sotaro
This commit is contained in:
Родитель
cc8d7f4b9e
Коммит
41d3c79ae5
|
@ -17,7 +17,7 @@
|
|||
|
||||
#define LOG_TAG "GonkBufferQueue"
|
||||
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
|
||||
#define LOG_NDEBUG 0
|
||||
//#define LOG_NDEBUG 0
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
@ -31,13 +31,6 @@
|
|||
#include "mozilla/layers/ImageBridgeChild.h"
|
||||
#include "GonkBufferQueueKK.h"
|
||||
|
||||
// Macros for including the GonkBufferQueue name in log messages
|
||||
#define ST_LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
|
||||
#define ST_LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
||||
#define ST_LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
|
||||
#define ST_LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)
|
||||
#define ST_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
||||
|
||||
#define ATRACE_BUFFER_INDEX(index)
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -83,11 +76,11 @@ GonkBufferQueue::GonkBufferQueue(bool allowSynchronousMode,
|
|||
// Choose a name using the PID and a process-unique ID.
|
||||
mConsumerName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId());
|
||||
|
||||
ST_LOGV("GonkBufferQueue");
|
||||
ALOGV("GonkBufferQueue");
|
||||
}
|
||||
|
||||
GonkBufferQueue::~GonkBufferQueue() {
|
||||
ST_LOGV("~GonkBufferQueue");
|
||||
ALOGV("~GonkBufferQueue");
|
||||
}
|
||||
|
||||
status_t GonkBufferQueue::setDefaultMaxBufferCountLocked(int count) {
|
||||
|
@ -118,7 +111,7 @@ status_t GonkBufferQueue::setConsumerUsageBits(uint32_t usage) {
|
|||
}
|
||||
|
||||
status_t GonkBufferQueue::setTransformHint(uint32_t hint) {
|
||||
ST_LOGV("setTransformHint: %02x", hint);
|
||||
ALOGV("setTransformHint: %02x", hint);
|
||||
Mutex::Autolock lock(mMutex);
|
||||
mTransformHint = hint;
|
||||
return NO_ERROR;
|
||||
|
@ -129,7 +122,7 @@ GonkBufferQueue::getTextureClientFromBuffer(ANativeWindowBuffer* buffer)
|
|||
{
|
||||
Mutex::Autolock _l(mMutex);
|
||||
if (buffer == NULL) {
|
||||
ST_LOGE("getSlotFromBufferLocked: encountered NULL buffer");
|
||||
ALOGE("getSlotFromBufferLocked: encountered NULL buffer");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -138,7 +131,7 @@ GonkBufferQueue::getTextureClientFromBuffer(ANativeWindowBuffer* buffer)
|
|||
return mSlots[i].mTextureClient;
|
||||
}
|
||||
}
|
||||
ST_LOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle);
|
||||
ALOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -146,7 +139,7 @@ int GonkBufferQueue::getSlotFromTextureClientLocked(
|
|||
TextureClient* client) const
|
||||
{
|
||||
if (client == NULL) {
|
||||
ST_LOGE("getSlotFromBufferLocked: encountered NULL buffer");
|
||||
ALOGE("getSlotFromBufferLocked: encountered NULL buffer");
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
||||
|
@ -155,23 +148,23 @@ int GonkBufferQueue::getSlotFromTextureClientLocked(
|
|||
return i;
|
||||
}
|
||||
}
|
||||
ST_LOGE("getSlotFromBufferLocked: unknown TextureClient: %p", client);
|
||||
ALOGE("getSlotFromBufferLocked: unknown TextureClient: %p", client);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
||||
status_t GonkBufferQueue::setBufferCount(int bufferCount) {
|
||||
ST_LOGV("setBufferCount: count=%d", bufferCount);
|
||||
ALOGV("setBufferCount: count=%d", bufferCount);
|
||||
|
||||
sp<IConsumerListener> listener;
|
||||
{
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("setBufferCount: GonkBufferQueue has been abandoned!");
|
||||
ALOGE("setBufferCount: GonkBufferQueue has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
if (bufferCount > NUM_BUFFER_SLOTS) {
|
||||
ST_LOGE("setBufferCount: bufferCount too large (max %d)",
|
||||
ALOGE("setBufferCount: bufferCount too large (max %d)",
|
||||
NUM_BUFFER_SLOTS);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
@ -179,7 +172,7 @@ status_t GonkBufferQueue::setBufferCount(int bufferCount) {
|
|||
// Error out if the user has dequeued buffers
|
||||
for (int i=0 ; i<NUM_BUFFER_SLOTS; i++) {
|
||||
if (mSlots[i].mBufferState == BufferSlot::DEQUEUED) {
|
||||
ST_LOGE("setBufferCount: client owns some buffers");
|
||||
ALOGE("setBufferCount: client owns some buffers");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +186,7 @@ status_t GonkBufferQueue::setBufferCount(int bufferCount) {
|
|||
// fine to assume async to false before we're setting the buffer count
|
||||
const int minBufferSlots = getMinMaxBufferCountLocked(false);
|
||||
if (bufferCount < minBufferSlots) {
|
||||
ST_LOGE("setBufferCount: requested buffer count (%d) is less than "
|
||||
ALOGE("setBufferCount: requested buffer count (%d) is less than "
|
||||
"minimum (%d)", bufferCount, minBufferSlots);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
@ -221,7 +214,7 @@ int GonkBufferQueue::query(int what, int* outValue)
|
|||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("query: GonkBufferQueue has been abandoned!");
|
||||
ALOGE("query: GonkBufferQueue has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
|
||||
|
@ -254,18 +247,18 @@ int GonkBufferQueue::query(int what, int* outValue)
|
|||
|
||||
status_t GonkBufferQueue::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
|
||||
ATRACE_CALL();
|
||||
ST_LOGV("requestBuffer: slot=%d", slot);
|
||||
ALOGV("requestBuffer: slot=%d", slot);
|
||||
Mutex::Autolock lock(mMutex);
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("requestBuffer: GonkBufferQueue has been abandoned!");
|
||||
ALOGE("requestBuffer: GonkBufferQueue has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
if (slot < 0 || slot >= NUM_BUFFER_SLOTS) {
|
||||
ST_LOGE("requestBuffer: slot index out of range [0, %d]: %d",
|
||||
ALOGE("requestBuffer: slot index out of range [0, %d]: %d",
|
||||
NUM_BUFFER_SLOTS, slot);
|
||||
return BAD_VALUE;
|
||||
} else if (mSlots[slot].mBufferState != BufferSlot::DEQUEUED) {
|
||||
ST_LOGE("requestBuffer: slot %d is not owned by the client (state=%d)",
|
||||
ALOGE("requestBuffer: slot %d is not owned by the client (state=%d)",
|
||||
slot, mSlots[slot].mBufferState);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
@ -277,10 +270,10 @@ status_t GonkBufferQueue::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
|
|||
status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool async,
|
||||
uint32_t w, uint32_t h, uint32_t format, uint32_t usage) {
|
||||
ATRACE_CALL();
|
||||
ST_LOGV("dequeueBuffer: w=%d h=%d fmt=%#x usage=%#x", w, h, format, usage);
|
||||
ALOGV("dequeueBuffer: w=%d h=%d fmt=%#x usage=%#x", w, h, format, usage);
|
||||
|
||||
if ((w && !h) || (!w && h)) {
|
||||
ST_LOGE("dequeueBuffer: invalid size: w=%u, h=%u", w, h);
|
||||
ALOGE("dequeueBuffer: invalid size: w=%u, h=%u", w, h);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
||||
|
@ -300,7 +293,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool a
|
|||
bool tryAgain = true;
|
||||
while (tryAgain) {
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("dequeueBuffer: GonkBufferQueue has been abandoned!");
|
||||
ALOGE("dequeueBuffer: GonkBufferQueue has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
|
||||
|
@ -310,7 +303,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool a
|
|||
// shouldn't), so we do this extra test here to handle that case.
|
||||
// This is TEMPORARY, until we get this fixed.
|
||||
if (mOverrideMaxBufferCount < maxBufferCount) {
|
||||
ST_LOGE("dequeueBuffer: async mode is invalid with buffercount override");
|
||||
ALOGE("dequeueBuffer: async mode is invalid with buffercount override");
|
||||
return BAD_VALUE;
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +348,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool a
|
|||
// clients are not allowed to dequeue more than one buffer
|
||||
// if they didn't set a buffer count.
|
||||
if (!mOverrideMaxBufferCount && dequeuedCount) {
|
||||
ST_LOGE("dequeueBuffer: can't dequeue multiple buffers without "
|
||||
ALOGE("dequeueBuffer: can't dequeue multiple buffers without "
|
||||
"setting the buffer count");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -369,7 +362,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool a
|
|||
const int newUndequeuedCount = maxBufferCount - (dequeuedCount+1);
|
||||
const int minUndequeuedCount = getMinUndequeuedBufferCount(async);
|
||||
if (newUndequeuedCount < minUndequeuedCount) {
|
||||
ST_LOGE("dequeueBuffer: min undequeued buffer count (%d) "
|
||||
ALOGE("dequeueBuffer: min undequeued buffer count (%d) "
|
||||
"exceeded (dequeued=%d undequeudCount=%d)",
|
||||
minUndequeuedCount, dequeuedCount,
|
||||
newUndequeuedCount);
|
||||
|
@ -388,7 +381,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool a
|
|||
// if we dequeue a buffer while the consumer has acquired one but not released
|
||||
// the old one yet -- for e.g.: see GLConsumer::updateTexImage()).
|
||||
if (mDequeueBufferCannotBlock && (acquiredCount <= mMaxAcquiredBufferCount)) {
|
||||
ST_LOGE("dequeueBuffer: would block! returning an error instead.");
|
||||
ALOGE("dequeueBuffer: would block! returning an error instead.");
|
||||
return WOULD_BLOCK;
|
||||
}
|
||||
mDequeueCondition.wait(mMutex);
|
||||
|
@ -398,7 +391,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool a
|
|||
|
||||
if (found == INVALID_BUFFER_SLOT) {
|
||||
// This should not happen.
|
||||
ST_LOGE("dequeueBuffer: no available buffer slots");
|
||||
ALOGE("dequeueBuffer: no available buffer slots");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
@ -437,7 +430,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool a
|
|||
|
||||
|
||||
if (CC_UNLIKELY(mSlots[buf].mFence == NULL)) {
|
||||
ST_LOGE("dequeueBuffer: about to return a NULL fence from mSlot. "
|
||||
ALOGE("dequeueBuffer: about to return a NULL fence from mSlot. "
|
||||
"buf=%d, w=%d, h=%d, format=%d",
|
||||
buf, buffer->width, buffer->height, buffer->format);
|
||||
}
|
||||
|
@ -456,7 +449,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool a
|
|||
bool result = textureClient->AllocateGralloc(IntSize(w, h), format, usage);
|
||||
sp<GraphicBuffer> graphicBuffer = textureClient->GetGraphicBuffer();
|
||||
if (!result || !graphicBuffer.get()) {
|
||||
ST_LOGE("dequeueBuffer: failed to alloc gralloc buffer");
|
||||
ALOGE("dequeueBuffer: failed to alloc gralloc buffer");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -464,20 +457,20 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool a
|
|||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
|
||||
ALOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
|
||||
mSlots[buf].mGraphicBuffer = graphicBuffer;
|
||||
mSlots[buf].mTextureClient = textureClient;
|
||||
ST_LOGD("dequeueBuffer: returning slot=%d buf=%p ", buf,
|
||||
ALOGD("dequeueBuffer: returning slot=%d buf=%p ", buf,
|
||||
mSlots[buf].mGraphicBuffer->handle);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ST_LOGV("dequeueBuffer: returning slot=%d/%llu buf=%p flags=%#x", *outBuf,
|
||||
ALOGV("dequeueBuffer: returning slot=%d/%llu buf=%p flags=%#x", *outBuf,
|
||||
mSlots[*outBuf].mFrameNumber,
|
||||
mSlots[*outBuf].mGraphicBuffer->handle, returnFlags);
|
||||
|
||||
|
@ -500,11 +493,11 @@ status_t GonkBufferQueue::queueBuffer(int buf,
|
|||
&async, &fence);
|
||||
|
||||
if (fence == NULL) {
|
||||
ST_LOGE("queueBuffer: fence is NULL");
|
||||
ALOGE("queueBuffer: fence is NULL");
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
||||
ST_LOGV("queueBuffer: slot=%d time=%#llx crop=[%d,%d,%d,%d] tr=%#x "
|
||||
ALOGV("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));
|
||||
|
@ -516,7 +509,7 @@ status_t GonkBufferQueue::queueBuffer(int buf,
|
|||
case NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP:
|
||||
break;
|
||||
default:
|
||||
ST_LOGE("unknown scaling mode: %d", scalingMode);
|
||||
ALOGE("unknown scaling mode: %d", scalingMode);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -526,7 +519,7 @@ status_t GonkBufferQueue::queueBuffer(int buf,
|
|||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("queueBuffer: GonkBufferQueue has been abandoned!");
|
||||
ALOGE("queueBuffer: GonkBufferQueue has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
|
||||
|
@ -536,25 +529,25 @@ status_t GonkBufferQueue::queueBuffer(int buf,
|
|||
// shouldn't), so we do this extra test here to handle that case.
|
||||
// This is TEMPORARY, until we get this fixed.
|
||||
if (mOverrideMaxBufferCount < maxBufferCount) {
|
||||
ST_LOGE("queueBuffer: async mode is invalid with buffercount override");
|
||||
ALOGE("queueBuffer: async mode is invalid with buffercount override");
|
||||
return BAD_VALUE;
|
||||
}
|
||||
}
|
||||
if (buf < 0 || buf >= maxBufferCount) {
|
||||
ST_LOGE("queueBuffer: slot index out of range [0, %d]: %d",
|
||||
ALOGE("queueBuffer: slot index out of range [0, %d]: %d",
|
||||
maxBufferCount, buf);
|
||||
return -EINVAL;
|
||||
} else if (mSlots[buf].mBufferState != BufferSlot::DEQUEUED) {
|
||||
ST_LOGE("queueBuffer: slot %d is not owned by the client "
|
||||
ALOGE("queueBuffer: slot %d is not owned by the client "
|
||||
"(state=%d)", buf, mSlots[buf].mBufferState);
|
||||
return -EINVAL;
|
||||
} else if (!mSlots[buf].mRequestBufferCalled) {
|
||||
ST_LOGE("queueBuffer: slot %d was enqueued without requesting a "
|
||||
ALOGE("queueBuffer: slot %d was enqueued without requesting a "
|
||||
"buffer", buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ST_LOGV("queueBuffer: slot=%d/%llu time=%#llx crop=[%d,%d,%d,%d] "
|
||||
ALOGV("queueBuffer: slot=%d/%llu time=%#llx crop=[%d,%d,%d,%d] "
|
||||
"tr=%#x scale=%s",
|
||||
buf, mFrameCounter + 1, timestamp,
|
||||
crop.left, crop.top, crop.right, crop.bottom,
|
||||
|
@ -565,7 +558,7 @@ status_t GonkBufferQueue::queueBuffer(int buf,
|
|||
Rect croppedCrop;
|
||||
crop.intersect(bufferRect, &croppedCrop);
|
||||
if (croppedCrop != crop) {
|
||||
ST_LOGE("queueBuffer: crop rect is not contained within the "
|
||||
ALOGE("queueBuffer: crop rect is not contained within the "
|
||||
"buffer in slot %d", buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -631,24 +624,24 @@ status_t GonkBufferQueue::queueBuffer(int buf,
|
|||
|
||||
void GonkBufferQueue::cancelBuffer(int buf, const sp<Fence>& fence) {
|
||||
ATRACE_CALL();
|
||||
ST_LOGV("cancelBuffer: slot=%d", buf);
|
||||
ALOGV("cancelBuffer: slot=%d", buf);
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (mAbandoned) {
|
||||
ST_LOGW("cancelBuffer: GonkBufferQueue has been abandoned!");
|
||||
ALOGW("cancelBuffer: GonkBufferQueue has been abandoned!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (buf < 0 || buf >= NUM_BUFFER_SLOTS) {
|
||||
ST_LOGE("cancelBuffer: slot index out of range [0, %d]: %d",
|
||||
ALOGE("cancelBuffer: slot index out of range [0, %d]: %d",
|
||||
NUM_BUFFER_SLOTS, buf);
|
||||
return;
|
||||
} else if (mSlots[buf].mBufferState != BufferSlot::DEQUEUED) {
|
||||
ST_LOGE("cancelBuffer: slot %d is not owned by the client (state=%d)",
|
||||
ALOGE("cancelBuffer: slot %d is not owned by the client (state=%d)",
|
||||
buf, mSlots[buf].mBufferState);
|
||||
return;
|
||||
} else if (fence == NULL) {
|
||||
ST_LOGE("cancelBuffer: fence is NULL");
|
||||
ALOGE("cancelBuffer: fence is NULL");
|
||||
return;
|
||||
}
|
||||
mSlots[buf].mBufferState = BufferSlot::FREE;
|
||||
|
@ -661,23 +654,23 @@ void GonkBufferQueue::cancelBuffer(int buf, const sp<Fence>& fence) {
|
|||
status_t GonkBufferQueue::connect(const sp<IBinder>& token,
|
||||
int api, bool producerControlledByApp, QueueBufferOutput* output) {
|
||||
ATRACE_CALL();
|
||||
ST_LOGV("connect: api=%d producerControlledByApp=%s", api,
|
||||
ALOGV("connect: api=%d producerControlledByApp=%s", api,
|
||||
producerControlledByApp ? "true" : "false");
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
retry:
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("connect: GonkBufferQueue has been abandoned!");
|
||||
ALOGE("connect: GonkBufferQueue has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
|
||||
if (mConsumerListener == NULL) {
|
||||
ST_LOGE("connect: GonkBufferQueue has no consumer!");
|
||||
ALOGE("connect: GonkBufferQueue has no consumer!");
|
||||
return NO_INIT;
|
||||
}
|
||||
|
||||
if (mConnectedApi != NO_CONNECTED_API) {
|
||||
ST_LOGE("connect: already connected (cur=%d, req=%d)",
|
||||
ALOGE("connect: already connected (cur=%d, req=%d)",
|
||||
mConnectedApi, api);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -689,7 +682,7 @@ retry:
|
|||
int maxBufferCount = getMaxBufferCountLocked(false); // worst-case, i.e. largest value
|
||||
if (mQueue.size() > (size_t) maxBufferCount) {
|
||||
// TODO: make this bound tighter?
|
||||
ST_LOGV("queue size is %d, waiting", mQueue.size());
|
||||
ALOGV("queue size is %d, waiting", mQueue.size());
|
||||
mDequeueCondition.wait(mMutex);
|
||||
goto retry;
|
||||
}
|
||||
|
@ -737,7 +730,7 @@ void GonkBufferQueue::binderDied(const wp<IBinder>& who) {
|
|||
|
||||
status_t GonkBufferQueue::disconnect(int api) {
|
||||
ATRACE_CALL();
|
||||
ST_LOGV("disconnect: api=%d", api);
|
||||
ALOGV("disconnect: api=%d", api);
|
||||
|
||||
int err = NO_ERROR;
|
||||
sp<IConsumerListener> listener;
|
||||
|
@ -762,13 +755,13 @@ status_t GonkBufferQueue::disconnect(int api) {
|
|||
mDequeueCondition.broadcast();
|
||||
listener = mConsumerListener;
|
||||
} else {
|
||||
ST_LOGE("disconnect: connected to another api (cur=%d, req=%d)",
|
||||
ALOGE("disconnect: connected to another api (cur=%d, req=%d)",
|
||||
mConnectedApi, api);
|
||||
err = -EINVAL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ST_LOGE("disconnect: unknown API %d", api);
|
||||
ALOGE("disconnect: unknown API %d", api);
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
@ -889,7 +882,7 @@ status_t GonkBufferQueue::acquireBuffer(BufferItem *buffer, nsecs_t expectedPres
|
|||
}
|
||||
}
|
||||
if (numAcquiredBuffers >= mMaxAcquiredBufferCount+1) {
|
||||
ST_LOGE("acquireBuffer: max acquired buffer count reached: %d (max=%d)",
|
||||
ALOGE("acquireBuffer: max acquired buffer count reached: %d (max=%d)",
|
||||
numAcquiredBuffers, mMaxAcquiredBufferCount);
|
||||
return INVALID_OPERATION;
|
||||
}
|
||||
|
@ -947,12 +940,12 @@ status_t GonkBufferQueue::acquireBuffer(BufferItem *buffer, nsecs_t expectedPres
|
|||
// This buffer is set to display in the near future, or
|
||||
// desiredPresent is garbage. Either way we don't want to
|
||||
// drop the previous buffer just to get this on screen sooner.
|
||||
ST_LOGV("pts nodrop: des=%lld expect=%lld (%lld) now=%lld",
|
||||
ALOGV("pts nodrop: des=%lld expect=%lld (%lld) now=%lld",
|
||||
desiredPresent, expectedPresent, desiredPresent - expectedPresent,
|
||||
systemTime(CLOCK_MONOTONIC));
|
||||
break;
|
||||
}
|
||||
ST_LOGV("pts drop: queue1des=%lld expect=%lld size=%d",
|
||||
ALOGV("pts drop: queue1des=%lld expect=%lld size=%d",
|
||||
desiredPresent, expectedPresent, mQueue.size());
|
||||
if (stillTracking(front)) {
|
||||
// front buffer is still in mSlots, so mark the slot as free
|
||||
|
@ -966,13 +959,13 @@ status_t GonkBufferQueue::acquireBuffer(BufferItem *buffer, nsecs_t expectedPres
|
|||
nsecs_t desiredPresent = front->mTimestamp;
|
||||
if (desiredPresent > expectedPresent &&
|
||||
desiredPresent < expectedPresent + MAX_REASONABLE_NSEC) {
|
||||
ST_LOGV("pts defer: des=%lld expect=%lld (%lld) now=%lld",
|
||||
ALOGV("pts defer: des=%lld expect=%lld (%lld) now=%lld",
|
||||
desiredPresent, expectedPresent, desiredPresent - expectedPresent,
|
||||
systemTime(CLOCK_MONOTONIC));
|
||||
return PRESENT_LATER;
|
||||
}
|
||||
|
||||
ST_LOGV("pts accept: des=%lld expect=%lld (%lld) now=%lld",
|
||||
ALOGV("pts accept: des=%lld expect=%lld (%lld) now=%lld",
|
||||
desiredPresent, expectedPresent, desiredPresent - expectedPresent,
|
||||
systemTime(CLOCK_MONOTONIC));
|
||||
}
|
||||
|
@ -984,7 +977,7 @@ status_t GonkBufferQueue::acquireBuffer(BufferItem *buffer, nsecs_t expectedPres
|
|||
buffer->mFence = mSlots[buf].mFence;
|
||||
ATRACE_BUFFER_INDEX(buf);
|
||||
|
||||
ST_LOGV("acquireBuffer: acquiring { slot=%d/%llu, buffer=%p }",
|
||||
ALOGV("acquireBuffer: acquiring { slot=%d/%llu, buffer=%p }",
|
||||
front->mBuf, front->mFrameNumber,
|
||||
front->mGraphicBuffer->handle);
|
||||
// if front buffer still being tracked update slot state
|
||||
|
@ -1042,11 +1035,11 @@ status_t GonkBufferQueue::releaseBuffer(int buf, uint64_t frameNumber, const sp<
|
|||
mSlots[buf].mFence = fence;
|
||||
mSlots[buf].mBufferState = BufferSlot::FREE;
|
||||
} else if (mSlots[buf].mNeedsCleanupOnRelease) {
|
||||
ST_LOGV("releasing a stale buf %d its state was %d", buf, mSlots[buf].mBufferState);
|
||||
ALOGV("releasing a stale buf %d its state was %d", buf, mSlots[buf].mBufferState);
|
||||
mSlots[buf].mNeedsCleanupOnRelease = false;
|
||||
return STALE_BUFFER_SLOT;
|
||||
} else {
|
||||
ST_LOGE("attempted to release buf %d but its state was %d", buf, mSlots[buf].mBufferState);
|
||||
ALOGE("attempted to release buf %d but its state was %d", buf, mSlots[buf].mBufferState);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -1056,16 +1049,16 @@ status_t GonkBufferQueue::releaseBuffer(int buf, uint64_t frameNumber, const sp<
|
|||
|
||||
status_t GonkBufferQueue::consumerConnect(const sp<IConsumerListener>& consumerListener,
|
||||
bool controlledByApp) {
|
||||
ST_LOGV("consumerConnect controlledByApp=%s",
|
||||
ALOGV("consumerConnect controlledByApp=%s",
|
||||
controlledByApp ? "true" : "false");
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("consumerConnect: GonkBufferQueue has been abandoned!");
|
||||
ALOGE("consumerConnect: GonkBufferQueue has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
if (consumerListener == NULL) {
|
||||
ST_LOGE("consumerConnect: consumerListener may not be NULL");
|
||||
ALOGE("consumerConnect: consumerListener may not be NULL");
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
||||
|
@ -1076,11 +1069,11 @@ status_t GonkBufferQueue::consumerConnect(const sp<IConsumerListener>& consumerL
|
|||
}
|
||||
|
||||
status_t GonkBufferQueue::consumerDisconnect() {
|
||||
ST_LOGV("consumerDisconnect");
|
||||
ALOGV("consumerDisconnect");
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (mConsumerListener == NULL) {
|
||||
ST_LOGE("consumerDisconnect: No consumer is connected!");
|
||||
ALOGE("consumerDisconnect: No consumer is connected!");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -1093,11 +1086,11 @@ status_t GonkBufferQueue::consumerDisconnect() {
|
|||
}
|
||||
|
||||
status_t GonkBufferQueue::getReleasedBuffers(uint32_t* slotMask) {
|
||||
ST_LOGV("getReleasedBuffers");
|
||||
ALOGV("getReleasedBuffers");
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("getReleasedBuffers: GonkBufferQueue has been abandoned!");
|
||||
ALOGE("getReleasedBuffers: GonkBufferQueue has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
|
||||
|
@ -1120,14 +1113,14 @@ status_t GonkBufferQueue::getReleasedBuffers(uint32_t* slotMask) {
|
|||
|
||||
*slotMask = mask;
|
||||
|
||||
ST_LOGV("getReleasedBuffers: returning mask %#x", mask);
|
||||
ALOGV("getReleasedBuffers: returning mask %#x", mask);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
status_t GonkBufferQueue::setDefaultBufferSize(uint32_t w, uint32_t h) {
|
||||
ST_LOGV("setDefaultBufferSize: w=%d, h=%d", w, h);
|
||||
ALOGV("setDefaultBufferSize: w=%d, h=%d", w, h);
|
||||
if (!w || !h) {
|
||||
ST_LOGE("setDefaultBufferSize: dimensions cannot be 0 (w=%d, h=%d)",
|
||||
ALOGE("setDefaultBufferSize: dimensions cannot be 0 (w=%d, h=%d)",
|
||||
w, h);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
@ -1148,7 +1141,7 @@ status_t GonkBufferQueue::disableAsyncBuffer() {
|
|||
ATRACE_CALL();
|
||||
Mutex::Autolock lock(mMutex);
|
||||
if (mConsumerListener != NULL) {
|
||||
ST_LOGE("disableAsyncBuffer: consumer already connected!");
|
||||
ALOGE("disableAsyncBuffer: consumer already connected!");
|
||||
return INVALID_OPERATION;
|
||||
}
|
||||
mUseAsyncBuffer = false;
|
||||
|
@ -1159,7 +1152,7 @@ status_t GonkBufferQueue::setMaxAcquiredBufferCount(int maxAcquiredBuffers) {
|
|||
ATRACE_CALL();
|
||||
Mutex::Autolock lock(mMutex);
|
||||
if (maxAcquiredBuffers < 1 || maxAcquiredBuffers > MAX_MAX_ACQUIRED_BUFFERS) {
|
||||
ST_LOGE("setMaxAcquiredBufferCount: invalid count specified: %d",
|
||||
ALOGE("setMaxAcquiredBufferCount: invalid count specified: %d",
|
||||
maxAcquiredBuffers);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
@ -1217,7 +1210,7 @@ int GonkBufferQueue::getMaxBufferCountLocked(bool async) const {
|
|||
bool GonkBufferQueue::stillTracking(const BufferItem *item) const {
|
||||
const BufferSlot &slot = mSlots[item->mBuf];
|
||||
|
||||
ST_LOGV("stillTracking?: item: { slot=%d/%llu, buffer=%p }, "
|
||||
ALOGV("stillTracking?: item: { slot=%d/%llu, buffer=%p }, "
|
||||
"slot: { slot=%d/%llu, buffer=%p }",
|
||||
item->mBuf, item->mFrameNumber,
|
||||
(item->mGraphicBuffer.get() ? item->mGraphicBuffer->handle : 0),
|
||||
|
|
|
@ -29,13 +29,6 @@
|
|||
|
||||
#include "GonkConsumerBaseKK.h"
|
||||
|
||||
// Macros for including the GonkConsumerBase name in log messages
|
||||
#define CB_LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
|
||||
#define CB_LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
||||
#define CB_LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
|
||||
#define CB_LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)
|
||||
#define CB_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
||||
|
||||
namespace android {
|
||||
|
||||
// Get an ID that's unique within this process.
|
||||
|
@ -59,7 +52,7 @@ GonkConsumerBase::GonkConsumerBase(const sp<GonkBufferQueue>& bufferQueue, bool
|
|||
|
||||
status_t err = mConsumer->consumerConnect(proxy, controlledByApp);
|
||||
if (err != NO_ERROR) {
|
||||
CB_LOGE("GonkConsumerBase: error connecting to GonkBufferQueue: %s (%d)",
|
||||
ALOGE("GonkConsumerBase: error connecting to GonkBufferQueue: %s (%d)",
|
||||
strerror(-err), err);
|
||||
} else {
|
||||
mConsumer->setConsumerName(mName);
|
||||
|
@ -67,7 +60,7 @@ GonkConsumerBase::GonkConsumerBase(const sp<GonkBufferQueue>& bufferQueue, bool
|
|||
}
|
||||
|
||||
GonkConsumerBase::~GonkConsumerBase() {
|
||||
CB_LOGV("~GonkConsumerBase");
|
||||
ALOGV("~GonkConsumerBase");
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
// Verify that abandon() has been called before we get here. This should
|
||||
|
@ -83,7 +76,7 @@ void GonkConsumerBase::onLastStrongRef(const void* id) {
|
|||
}
|
||||
|
||||
void GonkConsumerBase::freeBufferLocked(int slotIndex) {
|
||||
CB_LOGV("freeBufferLocked: slotIndex=%d", slotIndex);
|
||||
ALOGV("freeBufferLocked: slotIndex=%d", slotIndex);
|
||||
mSlots[slotIndex].mGraphicBuffer = 0;
|
||||
mSlots[slotIndex].mFence = Fence::NO_FENCE;
|
||||
mSlots[slotIndex].mFrameNumber = 0;
|
||||
|
@ -96,7 +89,7 @@ sp<GonkBufferQueue> GonkConsumerBase::getBufferQueue() const {
|
|||
}
|
||||
|
||||
void GonkConsumerBase::onFrameAvailable() {
|
||||
CB_LOGV("onFrameAvailable");
|
||||
ALOGV("onFrameAvailable");
|
||||
|
||||
sp<FrameAvailableListener> listener;
|
||||
{ // scope for the lock
|
||||
|
@ -105,7 +98,7 @@ void GonkConsumerBase::onFrameAvailable() {
|
|||
}
|
||||
|
||||
if (listener != NULL) {
|
||||
CB_LOGV("actually calling onFrameAvailable");
|
||||
ALOGV("actually calling onFrameAvailable");
|
||||
listener->onFrameAvailable();
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +106,7 @@ void GonkConsumerBase::onFrameAvailable() {
|
|||
void GonkConsumerBase::onBuffersReleased() {
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
CB_LOGV("onBuffersReleased");
|
||||
ALOGV("onBuffersReleased");
|
||||
|
||||
if (mAbandoned) {
|
||||
// Nothing to do if we're already abandoned.
|
||||
|
@ -130,7 +123,7 @@ void GonkConsumerBase::onBuffersReleased() {
|
|||
}
|
||||
|
||||
void GonkConsumerBase::abandon() {
|
||||
CB_LOGV("abandon");
|
||||
ALOGV("abandon");
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (!mAbandoned) {
|
||||
|
@ -140,7 +133,7 @@ void GonkConsumerBase::abandon() {
|
|||
}
|
||||
|
||||
void GonkConsumerBase::abandonLocked() {
|
||||
CB_LOGV("abandonLocked");
|
||||
ALOGV("abandonLocked");
|
||||
for (int i =0; i < GonkBufferQueue::NUM_BUFFER_SLOTS; i++) {
|
||||
freeBufferLocked(i);
|
||||
}
|
||||
|
@ -151,7 +144,7 @@ void GonkConsumerBase::abandonLocked() {
|
|||
|
||||
void GonkConsumerBase::setFrameAvailableListener(
|
||||
const wp<FrameAvailableListener>& listener) {
|
||||
CB_LOGV("setFrameAvailableListener");
|
||||
ALOGV("setFrameAvailableListener");
|
||||
Mutex::Autolock lock(mMutex);
|
||||
mFrameAvailableListener = listener;
|
||||
}
|
||||
|
@ -187,7 +180,7 @@ status_t GonkConsumerBase::acquireBufferLocked(IGonkGraphicBufferConsumer::Buffe
|
|||
mSlots[item->mBuf].mFrameNumber = item->mFrameNumber;
|
||||
mSlots[item->mBuf].mFence = item->mFence;
|
||||
|
||||
CB_LOGV("acquireBufferLocked: -> slot=%d", item->mBuf);
|
||||
ALOGV("acquireBufferLocked: -> slot=%d", item->mBuf);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -200,7 +193,7 @@ status_t GonkConsumerBase::addReleaseFence(int slot,
|
|||
|
||||
status_t GonkConsumerBase::addReleaseFenceLocked(int slot,
|
||||
const sp<GraphicBuffer> graphicBuffer, const sp<Fence>& fence) {
|
||||
CB_LOGV("addReleaseFenceLocked: slot=%d", slot);
|
||||
ALOGV("addReleaseFenceLocked: slot=%d", slot);
|
||||
|
||||
// If consumer no longer tracks this graphicBuffer, we can safely
|
||||
// drop this fence, as it will never be received by the producer.
|
||||
|
@ -215,7 +208,7 @@ status_t GonkConsumerBase::addReleaseFenceLocked(int slot,
|
|||
String8::format("%.28s:%d", mName.string(), slot),
|
||||
mSlots[slot].mFence, fence);
|
||||
if (!mergedFence.get()) {
|
||||
CB_LOGE("failed to merge release fences");
|
||||
ALOGE("failed to merge release fences");
|
||||
// synchronization is broken, the best we can do is hope fences
|
||||
// signal in order so the new fence will act like a union
|
||||
mSlots[slot].mFence = fence;
|
||||
|
@ -235,7 +228,7 @@ status_t GonkConsumerBase::releaseBufferLocked(int slot, const sp<GraphicBuffer>
|
|||
return OK;
|
||||
}
|
||||
|
||||
CB_LOGV("releaseBufferLocked: slot=%d/%llu",
|
||||
ALOGV("releaseBufferLocked: slot=%d/%llu",
|
||||
slot, mSlots[slot].mFrameNumber);
|
||||
status_t err = mConsumer->releaseBuffer(slot, mSlots[slot].mFrameNumber, mSlots[slot].mFence);
|
||||
if (err == GonkBufferQueue::STALE_BUFFER_SLOT) {
|
||||
|
|
|
@ -23,12 +23,6 @@
|
|||
#include "GonkNativeWindowKK.h"
|
||||
#include "GrallocImages.h"
|
||||
|
||||
#define BI_LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
|
||||
#define BI_LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
||||
#define BI_LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
|
||||
#define BI_LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)
|
||||
#define BI_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
|
@ -68,7 +62,7 @@ status_t GonkNativeWindow::acquireBuffer(BufferItem *item,
|
|||
err = acquireBufferLocked(item, presentWhen);
|
||||
if (err != OK) {
|
||||
if (err != NO_BUFFER_AVAILABLE) {
|
||||
BI_LOGE("Error acquiring buffer: %s (%d)", strerror(err), err);
|
||||
ALOGE("Error acquiring buffer: %s (%d)", strerror(err), err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
@ -76,7 +70,7 @@ status_t GonkNativeWindow::acquireBuffer(BufferItem *item,
|
|||
if (waitForFence) {
|
||||
err = item->mFence->waitForever("GonkNativeWindow::acquireBuffer");
|
||||
if (err != OK) {
|
||||
BI_LOGE("Failed to wait for fence of acquired buffer: %s (%d)",
|
||||
ALOGE("Failed to wait for fence of acquired buffer: %s (%d)",
|
||||
strerror(-err), err);
|
||||
return err;
|
||||
}
|
||||
|
@ -97,7 +91,7 @@ status_t GonkNativeWindow::releaseBuffer(const BufferItem &item,
|
|||
|
||||
err = releaseBufferLocked(item.mBuf, item.mGraphicBuffer);
|
||||
if (err != OK) {
|
||||
BI_LOGE("Failed to release buffer: %s (%d)",
|
||||
ALOGE("Failed to release buffer: %s (%d)",
|
||||
strerror(-err), err);
|
||||
}
|
||||
return err;
|
||||
|
@ -144,7 +138,7 @@ GonkNativeWindow::RecycleCallback(TextureClient* client, void* closure) {
|
|||
}
|
||||
|
||||
void GonkNativeWindow::returnBuffer(TextureClient* client) {
|
||||
BI_LOGD("GonkNativeWindow::returnBuffer");
|
||||
ALOGD("GonkNativeWindow::returnBuffer");
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
int index = mConsumer->getSlotFromTextureClientLocked(client);
|
||||
|
@ -172,7 +166,7 @@ GonkNativeWindow::getTextureClientFromBuffer(ANativeWindowBuffer* buffer) {
|
|||
|
||||
void GonkNativeWindow::setNewFrameCallback(
|
||||
GonkNativeWindowNewFrameCallback* callback) {
|
||||
BI_LOGD("setNewFrameCallback");
|
||||
ALOGD("setNewFrameCallback");
|
||||
Mutex::Autolock lock(mMutex);
|
||||
mNewFrameCallback = callback;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче