Loading libs/gui/BufferQueueCore.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ BufferQueueCore::BufferQueueCore() : mActiveBuffers(), mDequeueCondition(), mDequeueBufferCannotBlock(false), mQueueBufferCanDrop(false), mLegacyBufferDrop(true), mDefaultBufferFormat(PIXEL_FORMAT_RGBA_8888), mDefaultWidth(1), mDefaultHeight(1), Loading Loading @@ -117,6 +119,8 @@ void BufferQueueCore::dumpState(const String8& prefix, String8* outResult) const mMaxAcquiredBufferCount, mMaxDequeuedBufferCount); outResult->appendFormat("%s mDequeueBufferCannotBlock=%d mAsyncMode=%d\n", prefix.string(), mDequeueBufferCannotBlock, mAsyncMode); outResult->appendFormat("%s mQueueBufferCanDrop=%d mLegacyBufferDrop=%d\n", prefix.string(), mQueueBufferCanDrop, mLegacyBufferDrop); outResult->appendFormat("%s default-size=[%dx%d] default-format=%d ", prefix.string(), mDefaultWidth, mDefaultHeight, mDefaultBufferFormat); outResult->appendFormat("transform-hint=%02x frame-counter=%" PRIu64, mTransformHint, Loading libs/gui/BufferQueueProducer.cpp +22 −5 Original line number Diff line number Diff line Loading @@ -889,7 +889,8 @@ status_t BufferQueueProducer::queueBuffer(int slot, item.mFence = acquireFence; item.mFenceTime = acquireFenceTime; item.mIsDroppable = mCore->mAsyncMode || mCore->mDequeueBufferCannotBlock || (!mCore->mLegacyBufferDrop && mConsumerIsSurfaceFlinger) || (mCore->mLegacyBufferDrop && mCore->mQueueBufferCanDrop) || (mCore->mSharedBufferMode && mCore->mSharedBufferSlot == slot); item.mSurfaceDamage = surfaceDamage; item.mQueuedBuffer = true; Loading Loading @@ -1230,9 +1231,11 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener, mCore->mConnectedPid = BufferQueueThreadState::getCallingPid(); mCore->mBufferHasBeenQueued = false; mCore->mDequeueBufferCannotBlock = false; if (mDequeueTimeout < 0) { mCore->mDequeueBufferCannotBlock = mCore->mConsumerControlledByApp && producerControlledByApp; mCore->mQueueBufferCanDrop = false; mCore->mLegacyBufferDrop = true; if (mCore->mConsumerControlledByApp && producerControlledByApp) { mCore->mDequeueBufferCannotBlock = mDequeueTimeout < 0; mCore->mQueueBufferCanDrop = mDequeueTimeout <= 0; } mCore->mAllowAllocation = true; Loading Loading @@ -1516,12 +1519,26 @@ status_t BufferQueueProducer::setDequeueTimeout(nsecs_t timeout) { } mDequeueTimeout = timeout; if (timeout >= 0) { mCore->mDequeueBufferCannotBlock = false; if (timeout != 0) { mCore->mQueueBufferCanDrop = false; } } VALIDATE_CONSISTENCY(); return NO_ERROR; } status_t BufferQueueProducer::setLegacyBufferDrop(bool drop) { ATRACE_CALL(); BQ_LOGV("setLegacyBufferDrop: drop = %d", drop); std::lock_guard<std::mutex> lock(mCore->mMutex); mCore->mLegacyBufferDrop = drop; return NO_ERROR; } status_t BufferQueueProducer::getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence, float outTransformMatrix[16]) { ATRACE_CALL(); Loading libs/gui/IGraphicBufferProducer.cpp +32 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ enum { GET_FRAME_TIMESTAMPS, GET_UNIQUE_ID, GET_CONSUMER_USAGE, SET_LEGACY_BUFFER_DROP, }; class BpGraphicBufferProducer : public BpInterface<IGraphicBufferProducer> Loading Loading @@ -437,6 +438,20 @@ public: return reply.readInt32(); } virtual status_t setLegacyBufferDrop(bool drop) { Parcel data, reply; data.writeInterfaceToken( IGraphicBufferProducer::getInterfaceDescriptor()); data.writeInt32(drop); status_t result = remote()->transact(SET_LEGACY_BUFFER_DROP, data, &reply); if (result != NO_ERROR) { return result; } result = reply.readInt32(); return result; } virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence, float outTransformMatrix[16]) override { Parcel data, reply; Loading Loading @@ -637,6 +652,10 @@ public: return mBase->setDequeueTimeout(timeout); } status_t setLegacyBufferDrop(bool drop) override { return mBase->setLegacyBufferDrop(drop); } status_t getLastQueuedBuffer( sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence, Loading @@ -663,6 +682,12 @@ IMPLEMENT_HYBRID_META_INTERFACE(GraphicBufferProducer, // ---------------------------------------------------------------------- status_t IGraphicBufferProducer::setLegacyBufferDrop(bool drop) { // No-op for IGBP other than BufferQueue. (void) drop; return INVALID_OPERATION; } status_t IGraphicBufferProducer::exportToParcel(Parcel* parcel) { status_t res = OK; res = parcel->writeUint32(USE_BUFFER_QUEUE); Loading Loading @@ -1018,6 +1043,13 @@ status_t BnGraphicBufferProducer::onTransact( } return NO_ERROR; } case SET_LEGACY_BUFFER_DROP: { CHECK_INTERFACE(IGraphicBufferProducer, data, reply); bool drop = data.readInt32(); int result = setLegacyBufferDrop(drop); reply->writeInt32(result); return NO_ERROR; } } return BBinder::onTransact(code, data, reply, flags); } Loading libs/gui/include/gui/BufferQueueCore.h +10 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,16 @@ private: // consumer are controlled by the application. bool mDequeueBufferCannotBlock; // mQueueBufferCanDrop indicates whether queueBuffer is allowed to drop // buffers in non-async mode. This flag is set during connect when both the // producer and consumer are controlled by application. bool mQueueBufferCanDrop; // mLegacyBufferDrop indicates whether mQueueBufferCanDrop is in effect. // If this flag is set mQueueBufferCanDrop is working as explained. If not // queueBuffer will not drop buffers unless consumer is SurfaceFlinger. bool mLegacyBufferDrop; // mDefaultBufferFormat can be set so it will override the buffer format // when it isn't specified in dequeueBuffer. PixelFormat mDefaultBufferFormat; Loading libs/gui/include/gui/BufferQueueProducer.h +3 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,9 @@ public: // See IGraphicBufferProducer::setDequeueTimeout virtual status_t setDequeueTimeout(nsecs_t timeout) override; // see IGraphicBufferProducer::setLegacyBufferDrop virtual status_t setLegacyBufferDrop(bool drop); // See IGraphicBufferProducer::getLastQueuedBuffer virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence, float outTransformMatrix[16]) override; Loading Loading
libs/gui/BufferQueueCore.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ BufferQueueCore::BufferQueueCore() : mActiveBuffers(), mDequeueCondition(), mDequeueBufferCannotBlock(false), mQueueBufferCanDrop(false), mLegacyBufferDrop(true), mDefaultBufferFormat(PIXEL_FORMAT_RGBA_8888), mDefaultWidth(1), mDefaultHeight(1), Loading Loading @@ -117,6 +119,8 @@ void BufferQueueCore::dumpState(const String8& prefix, String8* outResult) const mMaxAcquiredBufferCount, mMaxDequeuedBufferCount); outResult->appendFormat("%s mDequeueBufferCannotBlock=%d mAsyncMode=%d\n", prefix.string(), mDequeueBufferCannotBlock, mAsyncMode); outResult->appendFormat("%s mQueueBufferCanDrop=%d mLegacyBufferDrop=%d\n", prefix.string(), mQueueBufferCanDrop, mLegacyBufferDrop); outResult->appendFormat("%s default-size=[%dx%d] default-format=%d ", prefix.string(), mDefaultWidth, mDefaultHeight, mDefaultBufferFormat); outResult->appendFormat("transform-hint=%02x frame-counter=%" PRIu64, mTransformHint, Loading
libs/gui/BufferQueueProducer.cpp +22 −5 Original line number Diff line number Diff line Loading @@ -889,7 +889,8 @@ status_t BufferQueueProducer::queueBuffer(int slot, item.mFence = acquireFence; item.mFenceTime = acquireFenceTime; item.mIsDroppable = mCore->mAsyncMode || mCore->mDequeueBufferCannotBlock || (!mCore->mLegacyBufferDrop && mConsumerIsSurfaceFlinger) || (mCore->mLegacyBufferDrop && mCore->mQueueBufferCanDrop) || (mCore->mSharedBufferMode && mCore->mSharedBufferSlot == slot); item.mSurfaceDamage = surfaceDamage; item.mQueuedBuffer = true; Loading Loading @@ -1230,9 +1231,11 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener, mCore->mConnectedPid = BufferQueueThreadState::getCallingPid(); mCore->mBufferHasBeenQueued = false; mCore->mDequeueBufferCannotBlock = false; if (mDequeueTimeout < 0) { mCore->mDequeueBufferCannotBlock = mCore->mConsumerControlledByApp && producerControlledByApp; mCore->mQueueBufferCanDrop = false; mCore->mLegacyBufferDrop = true; if (mCore->mConsumerControlledByApp && producerControlledByApp) { mCore->mDequeueBufferCannotBlock = mDequeueTimeout < 0; mCore->mQueueBufferCanDrop = mDequeueTimeout <= 0; } mCore->mAllowAllocation = true; Loading Loading @@ -1516,12 +1519,26 @@ status_t BufferQueueProducer::setDequeueTimeout(nsecs_t timeout) { } mDequeueTimeout = timeout; if (timeout >= 0) { mCore->mDequeueBufferCannotBlock = false; if (timeout != 0) { mCore->mQueueBufferCanDrop = false; } } VALIDATE_CONSISTENCY(); return NO_ERROR; } status_t BufferQueueProducer::setLegacyBufferDrop(bool drop) { ATRACE_CALL(); BQ_LOGV("setLegacyBufferDrop: drop = %d", drop); std::lock_guard<std::mutex> lock(mCore->mMutex); mCore->mLegacyBufferDrop = drop; return NO_ERROR; } status_t BufferQueueProducer::getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence, float outTransformMatrix[16]) { ATRACE_CALL(); Loading
libs/gui/IGraphicBufferProducer.cpp +32 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ enum { GET_FRAME_TIMESTAMPS, GET_UNIQUE_ID, GET_CONSUMER_USAGE, SET_LEGACY_BUFFER_DROP, }; class BpGraphicBufferProducer : public BpInterface<IGraphicBufferProducer> Loading Loading @@ -437,6 +438,20 @@ public: return reply.readInt32(); } virtual status_t setLegacyBufferDrop(bool drop) { Parcel data, reply; data.writeInterfaceToken( IGraphicBufferProducer::getInterfaceDescriptor()); data.writeInt32(drop); status_t result = remote()->transact(SET_LEGACY_BUFFER_DROP, data, &reply); if (result != NO_ERROR) { return result; } result = reply.readInt32(); return result; } virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence, float outTransformMatrix[16]) override { Parcel data, reply; Loading Loading @@ -637,6 +652,10 @@ public: return mBase->setDequeueTimeout(timeout); } status_t setLegacyBufferDrop(bool drop) override { return mBase->setLegacyBufferDrop(drop); } status_t getLastQueuedBuffer( sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence, Loading @@ -663,6 +682,12 @@ IMPLEMENT_HYBRID_META_INTERFACE(GraphicBufferProducer, // ---------------------------------------------------------------------- status_t IGraphicBufferProducer::setLegacyBufferDrop(bool drop) { // No-op for IGBP other than BufferQueue. (void) drop; return INVALID_OPERATION; } status_t IGraphicBufferProducer::exportToParcel(Parcel* parcel) { status_t res = OK; res = parcel->writeUint32(USE_BUFFER_QUEUE); Loading Loading @@ -1018,6 +1043,13 @@ status_t BnGraphicBufferProducer::onTransact( } return NO_ERROR; } case SET_LEGACY_BUFFER_DROP: { CHECK_INTERFACE(IGraphicBufferProducer, data, reply); bool drop = data.readInt32(); int result = setLegacyBufferDrop(drop); reply->writeInt32(result); return NO_ERROR; } } return BBinder::onTransact(code, data, reply, flags); } Loading
libs/gui/include/gui/BufferQueueCore.h +10 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,16 @@ private: // consumer are controlled by the application. bool mDequeueBufferCannotBlock; // mQueueBufferCanDrop indicates whether queueBuffer is allowed to drop // buffers in non-async mode. This flag is set during connect when both the // producer and consumer are controlled by application. bool mQueueBufferCanDrop; // mLegacyBufferDrop indicates whether mQueueBufferCanDrop is in effect. // If this flag is set mQueueBufferCanDrop is working as explained. If not // queueBuffer will not drop buffers unless consumer is SurfaceFlinger. bool mLegacyBufferDrop; // mDefaultBufferFormat can be set so it will override the buffer format // when it isn't specified in dequeueBuffer. PixelFormat mDefaultBufferFormat; Loading
libs/gui/include/gui/BufferQueueProducer.h +3 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,9 @@ public: // See IGraphicBufferProducer::setDequeueTimeout virtual status_t setDequeueTimeout(nsecs_t timeout) override; // see IGraphicBufferProducer::setLegacyBufferDrop virtual status_t setLegacyBufferDrop(bool drop); // See IGraphicBufferProducer::getLastQueuedBuffer virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence, float outTransformMatrix[16]) override; Loading