Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0190e4d0 authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru
Browse files

Merge ee4618bc

Change-Id: Ie1dc6ad38e7c30636d80f6caef11cf6673144940
parents 88c42cf1 49c36b18
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@

#include <stdio.h>

//#undef LOGV
//#define LOGV(...) fprintf(stderr, __VA_ARGS__)
//#undef ALOGV
//#define ALOGV(...) fprintf(stderr, __VA_ARGS__)

namespace android {

@@ -73,7 +73,7 @@ void BpBinder::ObjectManager::detach(const void* objectID)
void BpBinder::ObjectManager::kill()
{
    const size_t N = mObjects.size();
    LOGV("Killing %d objects in manager %p", N, this);
    ALOGV("Killing %d objects in manager %p", N, this);
    for (size_t i=0; i<N; i++) {
        const entry_t& e = mObjects.valueAt(i);
        if (e.func != NULL) {
@@ -92,7 +92,7 @@ BpBinder::BpBinder(int32_t handle)
    , mObitsSent(0)
    , mObituaries(NULL)
{
    LOGV("Creating BpBinder %p handle %d\n", this, mHandle);
    ALOGV("Creating BpBinder %p handle %d\n", this, mHandle);

    extendObjectLifetime(OBJECT_LIFETIME_WEAK);
    IPCThreadState::self()->incWeakHandle(handle);
@@ -190,7 +190,7 @@ status_t BpBinder::linkToDeath(
                if (!mObituaries) {
                    return NO_MEMORY;
                }
                LOGV("Requesting death notification: %p handle %d\n", this, mHandle);
                ALOGV("Requesting death notification: %p handle %d\n", this, mHandle);
                getWeakRefs()->incWeak(this);
                IPCThreadState* self = IPCThreadState::self();
                self->requestDeathNotification(mHandle, this);
@@ -226,7 +226,7 @@ status_t BpBinder::unlinkToDeath(
            }
            mObituaries->removeAt(i);
            if (mObituaries->size() == 0) {
                LOGV("Clearing death notification: %p handle %d\n", this, mHandle);
                ALOGV("Clearing death notification: %p handle %d\n", this, mHandle);
                IPCThreadState* self = IPCThreadState::self();
                self->clearDeathNotification(mHandle, this);
                self->flushCommands();
@@ -242,7 +242,7 @@ status_t BpBinder::unlinkToDeath(

void BpBinder::sendObituary()
{
    LOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n",
    ALOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n",
        this, mHandle, mObitsSent ? "true" : "false");

    mAlive = 0;
@@ -251,7 +251,7 @@ void BpBinder::sendObituary()
    mLock.lock();
    Vector<Obituary>* obits = mObituaries;
    if(obits != NULL) {
        LOGV("Clearing sent death notification: %p handle %d\n", this, mHandle);
        ALOGV("Clearing sent death notification: %p handle %d\n", this, mHandle);
        IPCThreadState* self = IPCThreadState::self();
        self->clearDeathNotification(mHandle, this);
        self->flushCommands();
@@ -260,7 +260,7 @@ void BpBinder::sendObituary()
    mObitsSent = 1;
    mLock.unlock();

    LOGV("Reporting death of proxy %p for %d recipients\n",
    ALOGV("Reporting death of proxy %p for %d recipients\n",
        this, obits ? obits->size() : 0);

    if (obits != NULL) {
@@ -276,7 +276,7 @@ void BpBinder::sendObituary()
void BpBinder::reportOneDeath(const Obituary& obit)
{
    sp<DeathRecipient> recipient = obit.recipient.promote();
    LOGV("Reporting death to recipient: %p\n", recipient.get());
    ALOGV("Reporting death to recipient: %p\n", recipient.get());
    if (recipient == NULL) return;

    recipient->binderDied(this);
@@ -288,7 +288,7 @@ void BpBinder::attachObject(
    object_cleanup_func func)
{
    AutoMutex _l(mLock);
    LOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects);
    ALOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects);
    mObjects.attach(objectID, object, cleanupCookie, func);
}

@@ -311,7 +311,7 @@ BpBinder* BpBinder::remoteBinder()

BpBinder::~BpBinder()
{
    LOGV("Destroying BpBinder %p handle %d\n", this, mHandle);
    ALOGV("Destroying BpBinder %p handle %d\n", this, mHandle);

    IPCThreadState* ipc = IPCThreadState::self();

@@ -338,15 +338,15 @@ BpBinder::~BpBinder()

void BpBinder::onFirstRef()
{
    LOGV("onFirstRef BpBinder %p handle %d\n", this, mHandle);
    ALOGV("onFirstRef BpBinder %p handle %d\n", this, mHandle);
    IPCThreadState* ipc = IPCThreadState::self();
    if (ipc) ipc->incStrongHandle(mHandle);
}

void BpBinder::onLastStrongRef(const void* id)
{
    LOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle);
    IF_LOGV() {
    ALOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle);
    IF_ALOGV() {
        printRefs();
    }
    IPCThreadState* ipc = IPCThreadState::self();
@@ -355,7 +355,7 @@ void BpBinder::onLastStrongRef(const void* id)

bool BpBinder::onIncStrongAttempted(uint32_t flags, const void* id)
{
    LOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle);
    ALOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle);
    IPCThreadState* ipc = IPCThreadState::self();
    return ipc ? ipc->attemptIncStrongHandle(mHandle) == NO_ERROR : false;
}
+26 −26
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ status_t Parcel::setDataSize(size_t size)
    err = continueWrite(size);
    if (err == NO_ERROR) {
        mDataSize = size;
        LOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize);
        ALOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize);
    }
    return err;
}
@@ -534,10 +534,10 @@ status_t Parcel::finishWrite(size_t len)
{
    //printf("Finish write of %d\n", len);
    mDataPos += len;
    LOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos);
    ALOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos);
    if (mDataPos > mDataSize) {
        mDataSize = mDataPos;
        LOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize);
        ALOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize);
    }
    //printf("New pos=%d, size=%d\n", mDataPos, mDataSize);
    return NO_ERROR;
@@ -730,7 +730,7 @@ status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob)
    status_t status;

    if (!mAllowFds || len <= IN_PLACE_BLOB_LIMIT) {
        LOGV("writeBlob: write in place");
        ALOGV("writeBlob: write in place");
        status = writeInt32(0);
        if (status) return status;

@@ -741,7 +741,7 @@ status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob)
        return NO_ERROR;
    }

    LOGV("writeBlob: write to ashmem");
    ALOGV("writeBlob: write to ashmem");
    int fd = ashmem_create_region("Parcel Blob", len);
    if (fd < 0) return NO_MEMORY;

@@ -865,7 +865,7 @@ status_t Parcel::read(void* outData, size_t len) const
    if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
        memcpy(outData, mData+mDataPos, len);
        mDataPos += PAD_SIZE(len);
        LOGV("read Setting data pos of %p to %d\n", this, mDataPos);
        ALOGV("read Setting data pos of %p to %d\n", this, mDataPos);
        return NO_ERROR;
    }
    return NOT_ENOUGH_DATA;
@@ -876,7 +876,7 @@ const void* Parcel::readInplace(size_t len) const
    if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
        const void* data = mData+mDataPos;
        mDataPos += PAD_SIZE(len);
        LOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos);
        ALOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos);
        return data;
    }
    return NULL;
@@ -987,7 +987,7 @@ const char* Parcel::readCString() const
        if (eos) {
            const size_t len = eos - str;
            mDataPos += PAD_SIZE(len+1);
            LOGV("readCString Setting data pos of %p to %d\n", this, mDataPos);
            ALOGV("readCString Setting data pos of %p to %d\n", this, mDataPos);
            return str;
        }
    }
@@ -1102,7 +1102,7 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const
    if (status) return status;

    if (!useAshmem) {
        LOGV("readBlob: read in place");
        ALOGV("readBlob: read in place");
        const void* ptr = readInplace(len);
        if (!ptr) return BAD_VALUE;

@@ -1110,7 +1110,7 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const
        return NO_ERROR;
    }

    LOGV("readBlob: read from ashmem");
    ALOGV("readBlob: read from ashmem");
    int fd = readFileDescriptor();
    if (fd == int(BAD_TYPE)) return BAD_VALUE;

@@ -1164,7 +1164,7 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const
            // When transferring a NULL object, we don't write it into
            // the object list, so we don't want to check for it when
            // reading.
            LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
            ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
            return obj;
        }
        
@@ -1174,7 +1174,7 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const
        size_t opos = mNextObjectHint;
        
        if (N > 0) {
            LOGV("Parcel %p looking for obj at %d, hint=%d\n",
            ALOGV("Parcel %p looking for obj at %d, hint=%d\n",
                 this, DPOS, opos);
            
            // Start at the current hint position, looking for an object at
@@ -1188,10 +1188,10 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const
            }
            if (OBJS[opos] == DPOS) {
                // Found it!
                LOGV("Parcel found obj %d at index %d with forward search",
                ALOGV("Parcel found obj %d at index %d with forward search",
                     this, DPOS, opos);
                mNextObjectHint = opos+1;
                LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
                ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
                return obj;
            }
        
@@ -1201,10 +1201,10 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const
            }
            if (OBJS[opos] == DPOS) {
                // Found it!
                LOGV("Parcel found obj %d at index %d with backward search",
                ALOGV("Parcel found obj %d at index %d with backward search",
                     this, DPOS, opos);
                mNextObjectHint = opos+1;
                LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
                ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
                return obj;
            }
        }
@@ -1260,7 +1260,7 @@ void Parcel::ipcSetDataReference(const uint8_t* data, size_t dataSize,
    mDataSize = mDataCapacity = dataSize;
    //LOGI("setDataReference Setting data size of %p to %lu (pid=%d)\n", this, mDataSize, getpid());
    mDataPos = 0;
    LOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos);
    ALOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos);
    mObjects = const_cast<size_t*>(objects);
    mObjectsSize = mObjectsCapacity = objectsCount;
    mNextObjectHint = 0;
@@ -1370,8 +1370,8 @@ status_t Parcel::restartWrite(size_t desired)
    }
    
    mDataSize = mDataPos = 0;
    LOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize);
    LOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos);
    ALOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize);
    ALOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos);
        
    free(mObjects);
    mObjects = NULL;
@@ -1445,7 +1445,7 @@ status_t Parcel::continueWrite(size_t desired)
        mData = data;
        mObjects = objects;
        mDataSize = (mDataSize < desired) ? mDataSize : desired;
        LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
        ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
        mDataCapacity = desired;
        mObjectsSize = mObjectsCapacity = objectsSize;
        mNextObjectHint = 0;
@@ -1485,11 +1485,11 @@ status_t Parcel::continueWrite(size_t desired)
        } else {
            if (mDataSize > desired) {
                mDataSize = desired;
                LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
                ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
            }
            if (mDataPos > desired) {
                mDataPos = desired;
                LOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
                ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
            }
        }
        
@@ -1508,8 +1508,8 @@ status_t Parcel::continueWrite(size_t desired)
        
        mData = data;
        mDataSize = mDataPos = 0;
        LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
        LOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
        ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
        ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
        mDataCapacity = desired;
    }

@@ -1523,8 +1523,8 @@ void Parcel::initState()
    mDataSize = 0;
    mDataCapacity = 0;
    mDataPos = 0;
    LOGV("initState Setting data size of %p to %d\n", this, mDataSize);
    LOGV("initState Setting data pos of %p to %d\n", this, mDataPos);
    ALOGV("initState Setting data size of %p to %d\n", this, mDataSize);
    ALOGV("initState Setting data pos of %p to %d\n", this, mDataPos);
    mObjects = NULL;
    mObjectsSize = 0;
    mObjectsCapacity = 0;
+1 −1
Original line number Diff line number Diff line
@@ -288,7 +288,7 @@ void ProcessState::spawnPooledThread(bool isMain)
        int32_t s = android_atomic_add(1, &mThreadPoolSeq);
        char buf[32];
        sprintf(buf, "Binder Thread #%d", s);
        LOGV("Spawning new pooled thread, name=%s\n", buf);
        ALOGV("Spawning new pooled thread, name=%s\n", buf);
        sp<Thread> t = new PoolThread(isMain);
        t->run(buf);
    }
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@
#endif

// Macros for including the SurfaceTexture name in log messages
#define ST_LOGV(x, ...) LOGV("[%s] "x, mName.string(), ##__VA_ARGS__)
#define ST_LOGV(x, ...) ALOGV("[%s] "x, mName.string(), ##__VA_ARGS__)
#define ST_LOGD(x, ...) LOGD("[%s] "x, mName.string(), ##__VA_ARGS__)
#define ST_LOGI(x, ...) LOGI("[%s] "x, mName.string(), ##__VA_ARGS__)
#define ST_LOGW(x, ...) LOGW("[%s] "x, mName.string(), ##__VA_ARGS__)
+17 −17
Original line number Diff line number Diff line
@@ -136,13 +136,13 @@ int SurfaceTextureClient::setSwapInterval(int interval) {
}

int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) {
    LOGV("SurfaceTextureClient::dequeueBuffer");
    ALOGV("SurfaceTextureClient::dequeueBuffer");
    Mutex::Autolock lock(mMutex);
    int buf = -1;
    status_t result = mSurfaceTexture->dequeueBuffer(&buf, mReqWidth, mReqHeight,
            mReqFormat, mReqUsage);
    if (result < 0) {
        LOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)"
        ALOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)"
             "failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage,
             result);
        return result;
@@ -165,7 +165,7 @@ int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) {
}

int SurfaceTextureClient::cancelBuffer(android_native_buffer_t* buffer) {
    LOGV("SurfaceTextureClient::cancelBuffer");
    ALOGV("SurfaceTextureClient::cancelBuffer");
    Mutex::Autolock lock(mMutex);
    int i = getSlotFromBufferLocked(buffer);
    if (i < 0) {
@@ -205,18 +205,18 @@ int SurfaceTextureClient::getSlotFromBufferLocked(
}

int SurfaceTextureClient::lockBuffer(android_native_buffer_t* buffer) {
    LOGV("SurfaceTextureClient::lockBuffer");
    ALOGV("SurfaceTextureClient::lockBuffer");
    Mutex::Autolock lock(mMutex);
    return OK;
}

int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) {
    LOGV("SurfaceTextureClient::queueBuffer");
    ALOGV("SurfaceTextureClient::queueBuffer");
    Mutex::Autolock lock(mMutex);
    int64_t timestamp;
    if (mTimestamp == NATIVE_WINDOW_TIMESTAMP_AUTO) {
        timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
        LOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms",
        ALOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms",
             timestamp / 1000000.f);
    } else {
        timestamp = mTimestamp;
@@ -234,7 +234,7 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) {
}

int SurfaceTextureClient::query(int what, int* value) const {
    LOGV("SurfaceTextureClient::query");
    ALOGV("SurfaceTextureClient::query");
    { // scope for the lock
        Mutex::Autolock lock(mMutex);
        switch (what) {
@@ -402,7 +402,7 @@ int SurfaceTextureClient::dispatchUnlockAndPost(va_list args) {


int SurfaceTextureClient::connect(int api) {
    LOGV("SurfaceTextureClient::connect");
    ALOGV("SurfaceTextureClient::connect");
    Mutex::Autolock lock(mMutex);
    int err = mSurfaceTexture->connect(api,
            &mDefaultWidth, &mDefaultHeight, &mTransformHint);
@@ -413,7 +413,7 @@ int SurfaceTextureClient::connect(int api) {
}

int SurfaceTextureClient::disconnect(int api) {
    LOGV("SurfaceTextureClient::disconnect");
    ALOGV("SurfaceTextureClient::disconnect");
    Mutex::Autolock lock(mMutex);
    freeAllBuffers();
    int err = mSurfaceTexture->disconnect(api);
@@ -431,7 +431,7 @@ int SurfaceTextureClient::disconnect(int api) {

int SurfaceTextureClient::setUsage(uint32_t reqUsage)
{
    LOGV("SurfaceTextureClient::setUsage");
    ALOGV("SurfaceTextureClient::setUsage");
    Mutex::Autolock lock(mMutex);
    mReqUsage = reqUsage;
    return OK;
@@ -439,7 +439,7 @@ int SurfaceTextureClient::setUsage(uint32_t reqUsage)

int SurfaceTextureClient::setCrop(Rect const* rect)
{
    LOGV("SurfaceTextureClient::setCrop");
    ALOGV("SurfaceTextureClient::setCrop");
    Mutex::Autolock lock(mMutex);

    Rect realRect;
@@ -457,7 +457,7 @@ int SurfaceTextureClient::setCrop(Rect const* rect)

int SurfaceTextureClient::setBufferCount(int bufferCount)
{
    LOGV("SurfaceTextureClient::setBufferCount");
    ALOGV("SurfaceTextureClient::setBufferCount");
    Mutex::Autolock lock(mMutex);

    status_t err = mSurfaceTexture->setBufferCount(bufferCount);
@@ -473,7 +473,7 @@ int SurfaceTextureClient::setBufferCount(int bufferCount)

int SurfaceTextureClient::setBuffersDimensions(int w, int h)
{
    LOGV("SurfaceTextureClient::setBuffersDimensions");
    ALOGV("SurfaceTextureClient::setBuffersDimensions");
    Mutex::Autolock lock(mMutex);

    if (w<0 || h<0)
@@ -493,7 +493,7 @@ int SurfaceTextureClient::setBuffersDimensions(int w, int h)

int SurfaceTextureClient::setBuffersFormat(int format)
{
    LOGV("SurfaceTextureClient::setBuffersFormat");
    ALOGV("SurfaceTextureClient::setBuffersFormat");
    Mutex::Autolock lock(mMutex);

    if (format<0)
@@ -506,7 +506,7 @@ int SurfaceTextureClient::setBuffersFormat(int format)

int SurfaceTextureClient::setScalingMode(int mode)
{
    LOGV("SurfaceTextureClient::setScalingMode(%d)", mode);
    ALOGV("SurfaceTextureClient::setScalingMode(%d)", mode);
    Mutex::Autolock lock(mMutex);
    // mode is validated on the server
    status_t err = mSurfaceTexture->setScalingMode(mode);
@@ -518,7 +518,7 @@ int SurfaceTextureClient::setScalingMode(int mode)

int SurfaceTextureClient::setBuffersTransform(int transform)
{
    LOGV("SurfaceTextureClient::setBuffersTransform");
    ALOGV("SurfaceTextureClient::setBuffersTransform");
    Mutex::Autolock lock(mMutex);
    status_t err = mSurfaceTexture->setTransform(transform);
    return err;
@@ -526,7 +526,7 @@ int SurfaceTextureClient::setBuffersTransform(int transform)

int SurfaceTextureClient::setBuffersTimestamp(int64_t timestamp)
{
    LOGV("SurfaceTextureClient::setBuffersTimestamp");
    ALOGV("SurfaceTextureClient::setBuffersTimestamp");
    Mutex::Autolock lock(mMutex);
    mTimestamp = timestamp;
    return NO_ERROR;
Loading