Loading libs/binder/IPCThreadState.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -997,7 +997,11 @@ status_t IPCThreadState::talkWithDriver(bool doReceive) if (err >= NO_ERROR) { if (bwr.write_consumed > 0) { if (bwr.write_consumed < mOut.dataSize()) LOG_ALWAYS_FATAL("Driver did not consume write buffer"); LOG_ALWAYS_FATAL("Driver did not consume write buffer. " "err: %s consumed: %zu of %zu", statusToString(err).c_str(), (size_t)bwr.write_consumed, mOut.dataSize()); else { mOut.setDataSize(0); processPostWriteDerefs(); Loading libs/gui/BufferQueueProducer.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -1121,8 +1121,9 @@ status_t BufferQueueProducer::cancelBuffer(int slot, const sp<Fence>& fence) { mCore->mFreeBuffers.push_back(slot); } if (mCore->mConsumerListener != nullptr) { mCore->mConsumerListener->onFrameCancelled(mSlots[slot].mGraphicBuffer->getId()); auto gb = mSlots[slot].mGraphicBuffer; if (mCore->mConsumerListener != nullptr && gb != nullptr) { mCore->mConsumerListener->onFrameCancelled(gb->getId()); } mSlots[slot].mFence = fence; mCore->mDequeueCondition.notify_all(); Loading libs/renderengine/gl/GLESRenderEngine.cpp +26 −1 Original line number Diff line number Diff line Loading @@ -876,6 +876,25 @@ void GLESRenderEngine::unbindFrameBuffer(Framebuffer* /* framebuffer */) { glBindFramebuffer(GL_FRAMEBUFFER, 0); } bool GLESRenderEngine::cleanupPostRender() { ATRACE_CALL(); if (mPriorResourcesCleaned || (mLastDrawFence != nullptr && mLastDrawFence->getStatus() != Fence::Status::Signaled)) { // If we don't have a prior frame needing cleanup, then don't do anything. return false; } // Bind the texture to dummy data so that backing image data can be freed. GLFramebuffer* glFramebuffer = static_cast<GLFramebuffer*>(getFramebufferForDrawing()); glFramebuffer->allocateBuffers(1, 1, mPlaceholderDrawBuffer); // Release the cached fence here, so that we don't churn reallocations when // we could no-op repeated calls of this method instead. mLastDrawFence = nullptr; mPriorResourcesCleaned = true; return true; } void GLESRenderEngine::checkErrors() const { checkErrors(nullptr); } Loading Loading @@ -1161,7 +1180,13 @@ status_t GLESRenderEngine::drawLayers(const DisplaySettings& display, // us bad parameters, or we messed up our shader generation). return INVALID_OPERATION; } mLastDrawFence = nullptr; } else { // The caller takes ownership of drawFence, so we need to duplicate the // fd here. mLastDrawFence = new Fence(dup(drawFence->get())); } mPriorResourcesCleaned = false; checkErrors(); return NO_ERROR; Loading libs/renderengine/gl/GLESRenderEngine.h +12 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ #ifndef SF_GLESRENDERENGINE_H_ #define SF_GLESRENDERENGINE_H_ #include <stdint.h> #include <condition_variable> #include <deque> #include <mutex> Loading Loading @@ -76,6 +75,7 @@ public: const std::vector<const LayerSettings*>& layers, ANativeWindowBuffer* buffer, const bool useFramebufferCache, base::unique_fd&& bufferFence, base::unique_fd* drawFence) override; bool cleanupPostRender() override; EGLDisplay getEGLDisplay() const { return mEGLDisplay; } // Creates an output image for rendering to Loading Loading @@ -231,6 +231,17 @@ private: std::mutex mRenderingMutex; std::unique_ptr<Framebuffer> mDrawingBuffer; // this is a 1x1 RGB buffer, but over-allocate in case a driver wants more // memory or if it needs to satisfy alignment requirements. In this case: // assume that each channel requires 4 bytes, and add 3 additional bytes to // ensure that we align on a word. Allocating 16 bytes will provide a // guarantee that we don't clobber memory. uint32_t mPlaceholderDrawBuffer[4]; sp<Fence> mLastDrawFence; // Store a separate boolean checking if prior resources were cleaned up, as // devices that don't support native sync fences can't rely on a last draw // fence that doesn't exist. bool mPriorResourcesCleaned = true; // Blur effect processor, only instantiated when a layer requests it. BlurFilter* mBlurFilter = nullptr; Loading libs/renderengine/gl/GLFramebuffer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -68,11 +68,11 @@ bool GLFramebuffer::setNativeWindowBuffer(ANativeWindowBuffer* nativeBuffer, boo return true; } void GLFramebuffer::allocateBuffers(uint32_t width, uint32_t height) { void GLFramebuffer::allocateBuffers(uint32_t width, uint32_t height, void* data) { ATRACE_CALL(); glBindTexture(GL_TEXTURE_2D, mTextureName); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); Loading Loading
libs/binder/IPCThreadState.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -997,7 +997,11 @@ status_t IPCThreadState::talkWithDriver(bool doReceive) if (err >= NO_ERROR) { if (bwr.write_consumed > 0) { if (bwr.write_consumed < mOut.dataSize()) LOG_ALWAYS_FATAL("Driver did not consume write buffer"); LOG_ALWAYS_FATAL("Driver did not consume write buffer. " "err: %s consumed: %zu of %zu", statusToString(err).c_str(), (size_t)bwr.write_consumed, mOut.dataSize()); else { mOut.setDataSize(0); processPostWriteDerefs(); Loading
libs/gui/BufferQueueProducer.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -1121,8 +1121,9 @@ status_t BufferQueueProducer::cancelBuffer(int slot, const sp<Fence>& fence) { mCore->mFreeBuffers.push_back(slot); } if (mCore->mConsumerListener != nullptr) { mCore->mConsumerListener->onFrameCancelled(mSlots[slot].mGraphicBuffer->getId()); auto gb = mSlots[slot].mGraphicBuffer; if (mCore->mConsumerListener != nullptr && gb != nullptr) { mCore->mConsumerListener->onFrameCancelled(gb->getId()); } mSlots[slot].mFence = fence; mCore->mDequeueCondition.notify_all(); Loading
libs/renderengine/gl/GLESRenderEngine.cpp +26 −1 Original line number Diff line number Diff line Loading @@ -876,6 +876,25 @@ void GLESRenderEngine::unbindFrameBuffer(Framebuffer* /* framebuffer */) { glBindFramebuffer(GL_FRAMEBUFFER, 0); } bool GLESRenderEngine::cleanupPostRender() { ATRACE_CALL(); if (mPriorResourcesCleaned || (mLastDrawFence != nullptr && mLastDrawFence->getStatus() != Fence::Status::Signaled)) { // If we don't have a prior frame needing cleanup, then don't do anything. return false; } // Bind the texture to dummy data so that backing image data can be freed. GLFramebuffer* glFramebuffer = static_cast<GLFramebuffer*>(getFramebufferForDrawing()); glFramebuffer->allocateBuffers(1, 1, mPlaceholderDrawBuffer); // Release the cached fence here, so that we don't churn reallocations when // we could no-op repeated calls of this method instead. mLastDrawFence = nullptr; mPriorResourcesCleaned = true; return true; } void GLESRenderEngine::checkErrors() const { checkErrors(nullptr); } Loading Loading @@ -1161,7 +1180,13 @@ status_t GLESRenderEngine::drawLayers(const DisplaySettings& display, // us bad parameters, or we messed up our shader generation). return INVALID_OPERATION; } mLastDrawFence = nullptr; } else { // The caller takes ownership of drawFence, so we need to duplicate the // fd here. mLastDrawFence = new Fence(dup(drawFence->get())); } mPriorResourcesCleaned = false; checkErrors(); return NO_ERROR; Loading
libs/renderengine/gl/GLESRenderEngine.h +12 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ #ifndef SF_GLESRENDERENGINE_H_ #define SF_GLESRENDERENGINE_H_ #include <stdint.h> #include <condition_variable> #include <deque> #include <mutex> Loading Loading @@ -76,6 +75,7 @@ public: const std::vector<const LayerSettings*>& layers, ANativeWindowBuffer* buffer, const bool useFramebufferCache, base::unique_fd&& bufferFence, base::unique_fd* drawFence) override; bool cleanupPostRender() override; EGLDisplay getEGLDisplay() const { return mEGLDisplay; } // Creates an output image for rendering to Loading Loading @@ -231,6 +231,17 @@ private: std::mutex mRenderingMutex; std::unique_ptr<Framebuffer> mDrawingBuffer; // this is a 1x1 RGB buffer, but over-allocate in case a driver wants more // memory or if it needs to satisfy alignment requirements. In this case: // assume that each channel requires 4 bytes, and add 3 additional bytes to // ensure that we align on a word. Allocating 16 bytes will provide a // guarantee that we don't clobber memory. uint32_t mPlaceholderDrawBuffer[4]; sp<Fence> mLastDrawFence; // Store a separate boolean checking if prior resources were cleaned up, as // devices that don't support native sync fences can't rely on a last draw // fence that doesn't exist. bool mPriorResourcesCleaned = true; // Blur effect processor, only instantiated when a layer requests it. BlurFilter* mBlurFilter = nullptr; Loading
libs/renderengine/gl/GLFramebuffer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -68,11 +68,11 @@ bool GLFramebuffer::setNativeWindowBuffer(ANativeWindowBuffer* nativeBuffer, boo return true; } void GLFramebuffer::allocateBuffers(uint32_t width, uint32_t height) { void GLFramebuffer::allocateBuffers(uint32_t width, uint32_t height, void* data) { ATRACE_CALL(); glBindTexture(GL_TEXTURE_2D, mTextureName); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); Loading