libgui: 64 bit compile issues (part deux)

- nsecs_t printed with PRId64
- int64_t/uint64_t print issues
- some size_t printing issues.
- missing argument to BQ_LOGV

Change-Id: I493f2b578e801dc38c44f8c536faa45266720402
This commit is contained in:
Mark Salyzyn 2014-06-09 14:32:04 -07:00
parent cb29225a5e
commit 8f515ce1c5
5 changed files with 38 additions and 23 deletions

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
#include <inttypes.h>
#define LOG_TAG "BufferQueueConsumer"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0
@ -104,14 +106,16 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
// 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 the screen sooner.
BQ_LOGV("acquireBuffer: nodrop desire=%lld expect=%lld "
"(%lld) now=%lld", desiredPresent, expectedPresent,
BQ_LOGV("acquireBuffer: nodrop desire=%" PRId64 " expect=%"
PRId64 " (%" PRId64 ") now=%" PRId64,
desiredPresent, expectedPresent,
desiredPresent - expectedPresent,
systemTime(CLOCK_MONOTONIC));
break;
}
BQ_LOGV("acquireBuffer: drop desire=%lld expect=%lld size=%d",
BQ_LOGV("acquireBuffer: drop desire=%" PRId64 " expect=%" PRId64
" size=%zu",
desiredPresent, expectedPresent, mCore->mQueue.size());
if (mCore->stillTracking(front)) {
// Front buffer is still in mSlots, so mark the slot as free
@ -125,15 +129,16 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
nsecs_t desiredPresent = front->mTimestamp;
if (desiredPresent > expectedPresent &&
desiredPresent < expectedPresent + MAX_REASONABLE_NSEC) {
BQ_LOGV("acquireBuffer: defer desire=%lld expect=%lld "
"(%lld) now=%lld", desiredPresent, expectedPresent,
BQ_LOGV("acquireBuffer: defer desire=%" PRId64 " expect=%" PRId64
" (%" PRId64 ") now=%" PRId64,
desiredPresent, expectedPresent,
desiredPresent - expectedPresent,
systemTime(CLOCK_MONOTONIC));
return PRESENT_LATER;
}
BQ_LOGV("acquireBuffer: accept desire=%lld expect=%lld "
"(%lld) now=%lld", desiredPresent, expectedPresent,
BQ_LOGV("acquireBuffer: accept desire=%" PRId64 " expect=%" PRId64 " "
"(%" PRId64 ") now=%" PRId64, desiredPresent, expectedPresent,
desiredPresent - expectedPresent,
systemTime(CLOCK_MONOTONIC));
}
@ -142,7 +147,7 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
*outBuffer = *front;
ATRACE_BUFFER_INDEX(slot);
BQ_LOGV("acquireBuffer: acquiring { slot=%d/%llu buffer=%p }",
BQ_LOGV("acquireBuffer: acquiring { slot=%d/%" PRIu64 " buffer=%p }",
slot, front->mFrameNumber, front->mGraphicBuffer->handle);
// If the front buffer is still being tracked, update its slot state
if (mCore->stillTracking(front)) {

View File

@ -173,7 +173,8 @@ status_t BufferQueueCore::setDefaultMaxBufferCountLocked(int count) {
const int minBufferCount = mUseAsyncBuffer ? 2 : 1;
if (count < minBufferCount || count > BufferQueueDefs::NUM_BUFFER_SLOTS) {
BQ_LOGV("setDefaultMaxBufferCount: invalid count %d, should be in "
"[%d, %d]", minBufferCount, BufferQueueDefs::NUM_BUFFER_SLOTS);
"[%d, %d]",
count, minBufferCount, BufferQueueDefs::NUM_BUFFER_SLOTS);
return BAD_VALUE;
}
@ -212,8 +213,8 @@ void BufferQueueCore::freeAllBuffersLocked() {
bool BufferQueueCore::stillTracking(const BufferItem* item) const {
const BufferSlot& slot = mSlots[item->mSlot];
BQ_LOGV("stillTracking: item { slot=%d/%llu buffer=%p } "
"slot { slot=%d/%llu buffer=%p }",
BQ_LOGV("stillTracking: item { slot=%d/%" PRIu64 " buffer=%p } "
"slot { slot=%d/%" PRIu64 " buffer=%p }",
item->mSlot, item->mFrameNumber,
(item->mGraphicBuffer.get() ? item->mGraphicBuffer->handle : 0),
item->mSlot, slot.mFrameNumber,

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
#include <inttypes.h>
#define LOG_TAG "BufferQueueProducer"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0
@ -209,9 +211,10 @@ status_t BufferQueueProducer::waitForFreeSlotThenRelock(const char* caller,
// our slots are empty but we have many buffers in the queue. This can
// cause us to run out of memory if we outrun the consumer. Wait here if
// it looks like we have too many buffers queued up.
bool tooManyBuffers = mCore->mQueue.size() > maxBufferCount;
bool tooManyBuffers = mCore->mQueue.size()
> static_cast<size_t>(maxBufferCount);
if (tooManyBuffers) {
BQ_LOGV("%s: queue size is %d, waiting", caller,
BQ_LOGV("%s: queue size is %zu, waiting", caller,
mCore->mQueue.size());
}
@ -367,7 +370,8 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot,
eglDestroySyncKHR(eglDisplay, eglFence);
}
BQ_LOGV("dequeueBuffer: returning slot=%d/%llu buf=%p flags=%#x", *outSlot,
BQ_LOGV("dequeueBuffer: returning slot=%d/%" PRIu64 " buf=%p flags=%#x",
*outSlot,
mSlots[*outSlot].mFrameNumber,
mSlots[*outSlot].mGraphicBuffer->handle, returnFlags);
@ -560,8 +564,8 @@ status_t BufferQueueProducer::queueBuffer(int slot,
return BAD_VALUE;
}
BQ_LOGV("queueBuffer: slot=%d/%llu time=%llu crop=[%d,%d,%d,%d] "
"transform=%#x scale=%s",
BQ_LOGV("queueBuffer: slot=%d/%" PRIu64 " time=%" PRIu64
" crop=[%d,%d,%d,%d] transform=%#x scale=%s",
slot, mCore->mFrameCounter + 1, timestamp,
crop.left, crop.top, crop.right, crop.bottom,
transform, BufferItem::scalingModeName(scalingMode));

View File

@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <inttypes.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/limits.h>
@ -67,7 +68,8 @@ Sensor::Sensor(struct sensor_t const* hwSensor, int halVersion)
if (hwSensor->maxDelay > INT_MAX) {
// Max delay is declared as a 64 bit integer for 64 bit architectures. But it should
// always fit in a 32 bit integer, log error and cap it to INT_MAX.
ALOGE("Sensor maxDelay overflow error %s %lld", mName.string(), hwSensor->maxDelay);
ALOGE("Sensor maxDelay overflow error %s %" PRId64, mName.string(),
static_cast<int64_t>(hwSensor->maxDelay));
mMaxDelay = INT_MAX;
} else {
mMaxDelay = (int32_t) hwSensor->maxDelay;

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
#include <inttypes.h>
#define LOG_TAG "StreamSplitter"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0
@ -63,7 +65,7 @@ StreamSplitter::~StreamSplitter() {
}
if (mBuffers.size() > 0) {
ALOGE("%d buffers still being tracked", mBuffers.size());
ALOGE("%zu buffers still being tracked", mBuffers.size());
}
}
@ -126,7 +128,7 @@ void StreamSplitter::onFrameAvailable() {
LOG_ALWAYS_FATAL_IF(status != NO_ERROR,
"acquiring buffer from input failed (%d)", status);
ALOGV("acquired buffer %#llx from input",
ALOGV("acquired buffer %#" PRIx64 " from input",
bufferItem.mGraphicBuffer->getId());
status = mInput->detachBuffer(bufferItem.mBuf);
@ -176,7 +178,7 @@ void StreamSplitter::onFrameAvailable() {
"queueing buffer to output failed (%d)", status);
}
ALOGV("queued buffer %#llx to output %p",
ALOGV("queued buffer %#" PRIx64 " to output %p",
bufferItem.mGraphicBuffer->getId(), output->get());
}
}
@ -199,7 +201,8 @@ void StreamSplitter::onBufferReleasedByOutput(
"detaching buffer from output failed (%d)", status);
}
ALOGV("detached buffer %#llx from output %p", buffer->getId(), from.get());
ALOGV("detached buffer %#" PRIx64 " from output %p",
buffer->getId(), from.get());
const sp<BufferTracker>& tracker = mBuffers.editValueFor(buffer->getId());
@ -209,7 +212,7 @@ void StreamSplitter::onBufferReleasedByOutput(
// Check to see if this is the last outstanding reference to this buffer
size_t releaseCount = tracker->incrementReleaseCountLocked();
ALOGV("buffer %#llx reference count %d (of %d)", buffer->getId(),
ALOGV("buffer %#" PRIx64 " reference count %zu (of %zu)", buffer->getId(),
releaseCount, mOutputs.size());
if (releaseCount < mOutputs.size()) {
return;
@ -233,7 +236,7 @@ void StreamSplitter::onBufferReleasedByOutput(
LOG_ALWAYS_FATAL_IF(status != NO_ERROR,
"releasing buffer to input failed (%d)", status);
ALOGV("released buffer %#llx to input", buffer->getId());
ALOGV("released buffer %#" PRIx64 " to input", buffer->getId());
// We no longer need to track the buffer once it has been returned to the
// input