Loading libs/renderengine/gl/GLESRenderEngine.cpp +9 −13 Original line number Diff line number Diff line Loading @@ -639,13 +639,8 @@ void GLESRenderEngine::bindExternalTextureImage(uint32_t texName, const Image& i } } status_t GLESRenderEngine::bindExternalTextureBuffer(uint32_t texName, const sp<GraphicBuffer>& buffer, void GLESRenderEngine::bindExternalTextureBuffer(uint32_t texName, const sp<GraphicBuffer>& buffer, const sp<Fence>& bufferFence) { if (buffer == nullptr) { return BAD_VALUE; } ATRACE_CALL(); bool found = false; Loading @@ -661,7 +656,8 @@ status_t GLESRenderEngine::bindExternalTextureBuffer(uint32_t texName, if (!found) { status_t cacheResult = mImageManager->cache(buffer); if (cacheResult != NO_ERROR) { return cacheResult; ALOGE("Error with caching buffer: %d", cacheResult); return; } } Loading @@ -678,7 +674,7 @@ status_t GLESRenderEngine::bindExternalTextureBuffer(uint32_t texName, // We failed creating the image if we got here, so bail out. ALOGE("Failed to create an EGLImage when rendering"); bindExternalTextureImage(texName, *createImage()); return NO_INIT; return; } bindExternalTextureImage(texName, *cachedImage->second); Loading @@ -691,22 +687,22 @@ status_t GLESRenderEngine::bindExternalTextureBuffer(uint32_t texName, base::unique_fd fenceFd(bufferFence->dup()); if (fenceFd == -1) { ALOGE("error dup'ing fence fd: %d", errno); return -errno; return; } if (!waitFence(std::move(fenceFd))) { ALOGE("failed to wait on fence fd"); return UNKNOWN_ERROR; return; } } else { status_t err = bufferFence->waitForever("RenderEngine::bindExternalTextureBuffer"); if (err != NO_ERROR) { ALOGE("error waiting for fence: %d", err); return err; return; } } } return NO_ERROR; return; } void GLESRenderEngine::cacheExternalTextureBuffer(const sp<GraphicBuffer>& buffer) { Loading libs/renderengine/gl/GLESRenderEngine.h +2 −2 Original line number Diff line number Diff line Loading @@ -60,8 +60,6 @@ public: void primeCache() const override; void genTextures(size_t count, uint32_t* names) override; void deleteTextures(size_t count, uint32_t const* names) override; status_t bindExternalTextureBuffer(uint32_t texName, const sp<GraphicBuffer>& buffer, const sp<Fence>& fence) EXCLUDES(mRenderingMutex); void cacheExternalTextureBuffer(const sp<GraphicBuffer>& buffer) EXCLUDES(mRenderingMutex); void unbindExternalTextureBuffer(uint64_t bufferId) EXCLUDES(mRenderingMutex); Loading Loading @@ -135,6 +133,8 @@ private: status_t bindFrameBuffer(Framebuffer* framebuffer); void unbindFrameBuffer(Framebuffer* framebuffer); void bindExternalTextureImage(uint32_t texName, const Image& image); void bindExternalTextureBuffer(uint32_t texName, const sp<GraphicBuffer>& buffer, const sp<Fence>& fence) EXCLUDES(mRenderingMutex); void cleanFramebufferCache() EXCLUDES(mFramebufferImageCacheMutex) override; // A data space is considered HDR data space if it has BT2020 color space Loading libs/renderengine/include/renderengine/RenderEngine.h +0 −5 Original line number Diff line number Diff line Loading @@ -92,11 +92,6 @@ public: virtual bool useNativeFenceSync() const = 0; virtual void genTextures(size_t count, uint32_t* names) = 0; virtual void deleteTextures(size_t count, uint32_t const* names) = 0; // Legacy public method used by devices that don't support native fence // synchronization in their GPU driver, as this method provides implicit // synchronization for latching buffers. virtual status_t bindExternalTextureBuffer(uint32_t texName, const sp<GraphicBuffer>& buffer, const sp<Fence>& fence) = 0; // Caches Image resources for this buffer, but does not bind the buffer to // a particular texture. // Note that work is deferred to an additional thread, i.e. this call Loading libs/renderengine/tests/RenderEngineTest.cpp +0 −25 Original line number Diff line number Diff line Loading @@ -1242,31 +1242,6 @@ TEST_F(RenderEngineTest, drawLayers_fillsBufferAndCachesImages) { EXPECT_EQ(NO_ERROR, barrier->result); } TEST_F(RenderEngineTest, bindExternalBuffer_withNullBuffer) { status_t result = sRE->bindExternalTextureBuffer(0, nullptr, nullptr); ASSERT_EQ(BAD_VALUE, result); } TEST_F(RenderEngineTest, bindExternalBuffer_cachesImages) { sp<GraphicBuffer> buf = allocateSourceBuffer(1, 1); uint32_t texName; sRE->genTextures(1, &texName); mTexNames.push_back(texName); sRE->bindExternalTextureBuffer(texName, buf, nullptr); uint64_t bufferId = buf->getId(); EXPECT_TRUE(sRE->isImageCachedForTesting(bufferId)); std::shared_ptr<renderengine::gl::ImageManager::Barrier> barrier = sRE->unbindExternalTextureBufferForTesting(bufferId); std::lock_guard<std::mutex> lock(barrier->mutex); ASSERT_TRUE(barrier->condition.wait_for(barrier->mutex, std::chrono::seconds(5), [&]() REQUIRES(barrier->mutex) { return barrier->isOpen; })); EXPECT_EQ(NO_ERROR, barrier->result); EXPECT_FALSE(sRE->isImageCachedForTesting(bufferId)); } TEST_F(RenderEngineTest, cacheExternalBuffer_withNullBuffer) { std::shared_ptr<renderengine::gl::ImageManager::Barrier> barrier = sRE->cacheExternalTextureBufferForTesting(nullptr); Loading libs/renderengine/tests/RenderEngineThreadedTest.cpp +0 −15 Original line number Diff line number Diff line Loading @@ -62,21 +62,6 @@ TEST_F(RenderEngineThreadedTest, deleteTextures) { mThreadedRE->deleteTextures(1, &texName); } TEST_F(RenderEngineThreadedTest, bindExternalBuffer_nullptrBuffer) { EXPECT_CALL(*mRenderEngine, bindExternalTextureBuffer(0, Eq(nullptr), Eq(nullptr))) .WillOnce(Return(BAD_VALUE)); status_t result = mThreadedRE->bindExternalTextureBuffer(0, nullptr, nullptr); ASSERT_EQ(BAD_VALUE, result); } TEST_F(RenderEngineThreadedTest, bindExternalBuffer_withBuffer) { sp<GraphicBuffer> buf = new GraphicBuffer(); EXPECT_CALL(*mRenderEngine, bindExternalTextureBuffer(0, buf, Eq(nullptr))) .WillOnce(Return(NO_ERROR)); status_t result = mThreadedRE->bindExternalTextureBuffer(0, buf, nullptr); ASSERT_EQ(NO_ERROR, result); } TEST_F(RenderEngineThreadedTest, cacheExternalTextureBuffer_nullptr) { EXPECT_CALL(*mRenderEngine, cacheExternalTextureBuffer(Eq(nullptr))); mThreadedRE->cacheExternalTextureBuffer(nullptr); Loading Loading
libs/renderengine/gl/GLESRenderEngine.cpp +9 −13 Original line number Diff line number Diff line Loading @@ -639,13 +639,8 @@ void GLESRenderEngine::bindExternalTextureImage(uint32_t texName, const Image& i } } status_t GLESRenderEngine::bindExternalTextureBuffer(uint32_t texName, const sp<GraphicBuffer>& buffer, void GLESRenderEngine::bindExternalTextureBuffer(uint32_t texName, const sp<GraphicBuffer>& buffer, const sp<Fence>& bufferFence) { if (buffer == nullptr) { return BAD_VALUE; } ATRACE_CALL(); bool found = false; Loading @@ -661,7 +656,8 @@ status_t GLESRenderEngine::bindExternalTextureBuffer(uint32_t texName, if (!found) { status_t cacheResult = mImageManager->cache(buffer); if (cacheResult != NO_ERROR) { return cacheResult; ALOGE("Error with caching buffer: %d", cacheResult); return; } } Loading @@ -678,7 +674,7 @@ status_t GLESRenderEngine::bindExternalTextureBuffer(uint32_t texName, // We failed creating the image if we got here, so bail out. ALOGE("Failed to create an EGLImage when rendering"); bindExternalTextureImage(texName, *createImage()); return NO_INIT; return; } bindExternalTextureImage(texName, *cachedImage->second); Loading @@ -691,22 +687,22 @@ status_t GLESRenderEngine::bindExternalTextureBuffer(uint32_t texName, base::unique_fd fenceFd(bufferFence->dup()); if (fenceFd == -1) { ALOGE("error dup'ing fence fd: %d", errno); return -errno; return; } if (!waitFence(std::move(fenceFd))) { ALOGE("failed to wait on fence fd"); return UNKNOWN_ERROR; return; } } else { status_t err = bufferFence->waitForever("RenderEngine::bindExternalTextureBuffer"); if (err != NO_ERROR) { ALOGE("error waiting for fence: %d", err); return err; return; } } } return NO_ERROR; return; } void GLESRenderEngine::cacheExternalTextureBuffer(const sp<GraphicBuffer>& buffer) { Loading
libs/renderengine/gl/GLESRenderEngine.h +2 −2 Original line number Diff line number Diff line Loading @@ -60,8 +60,6 @@ public: void primeCache() const override; void genTextures(size_t count, uint32_t* names) override; void deleteTextures(size_t count, uint32_t const* names) override; status_t bindExternalTextureBuffer(uint32_t texName, const sp<GraphicBuffer>& buffer, const sp<Fence>& fence) EXCLUDES(mRenderingMutex); void cacheExternalTextureBuffer(const sp<GraphicBuffer>& buffer) EXCLUDES(mRenderingMutex); void unbindExternalTextureBuffer(uint64_t bufferId) EXCLUDES(mRenderingMutex); Loading Loading @@ -135,6 +133,8 @@ private: status_t bindFrameBuffer(Framebuffer* framebuffer); void unbindFrameBuffer(Framebuffer* framebuffer); void bindExternalTextureImage(uint32_t texName, const Image& image); void bindExternalTextureBuffer(uint32_t texName, const sp<GraphicBuffer>& buffer, const sp<Fence>& fence) EXCLUDES(mRenderingMutex); void cleanFramebufferCache() EXCLUDES(mFramebufferImageCacheMutex) override; // A data space is considered HDR data space if it has BT2020 color space Loading
libs/renderengine/include/renderengine/RenderEngine.h +0 −5 Original line number Diff line number Diff line Loading @@ -92,11 +92,6 @@ public: virtual bool useNativeFenceSync() const = 0; virtual void genTextures(size_t count, uint32_t* names) = 0; virtual void deleteTextures(size_t count, uint32_t const* names) = 0; // Legacy public method used by devices that don't support native fence // synchronization in their GPU driver, as this method provides implicit // synchronization for latching buffers. virtual status_t bindExternalTextureBuffer(uint32_t texName, const sp<GraphicBuffer>& buffer, const sp<Fence>& fence) = 0; // Caches Image resources for this buffer, but does not bind the buffer to // a particular texture. // Note that work is deferred to an additional thread, i.e. this call Loading
libs/renderengine/tests/RenderEngineTest.cpp +0 −25 Original line number Diff line number Diff line Loading @@ -1242,31 +1242,6 @@ TEST_F(RenderEngineTest, drawLayers_fillsBufferAndCachesImages) { EXPECT_EQ(NO_ERROR, barrier->result); } TEST_F(RenderEngineTest, bindExternalBuffer_withNullBuffer) { status_t result = sRE->bindExternalTextureBuffer(0, nullptr, nullptr); ASSERT_EQ(BAD_VALUE, result); } TEST_F(RenderEngineTest, bindExternalBuffer_cachesImages) { sp<GraphicBuffer> buf = allocateSourceBuffer(1, 1); uint32_t texName; sRE->genTextures(1, &texName); mTexNames.push_back(texName); sRE->bindExternalTextureBuffer(texName, buf, nullptr); uint64_t bufferId = buf->getId(); EXPECT_TRUE(sRE->isImageCachedForTesting(bufferId)); std::shared_ptr<renderengine::gl::ImageManager::Barrier> barrier = sRE->unbindExternalTextureBufferForTesting(bufferId); std::lock_guard<std::mutex> lock(barrier->mutex); ASSERT_TRUE(barrier->condition.wait_for(barrier->mutex, std::chrono::seconds(5), [&]() REQUIRES(barrier->mutex) { return barrier->isOpen; })); EXPECT_EQ(NO_ERROR, barrier->result); EXPECT_FALSE(sRE->isImageCachedForTesting(bufferId)); } TEST_F(RenderEngineTest, cacheExternalBuffer_withNullBuffer) { std::shared_ptr<renderengine::gl::ImageManager::Barrier> barrier = sRE->cacheExternalTextureBufferForTesting(nullptr); Loading
libs/renderengine/tests/RenderEngineThreadedTest.cpp +0 −15 Original line number Diff line number Diff line Loading @@ -62,21 +62,6 @@ TEST_F(RenderEngineThreadedTest, deleteTextures) { mThreadedRE->deleteTextures(1, &texName); } TEST_F(RenderEngineThreadedTest, bindExternalBuffer_nullptrBuffer) { EXPECT_CALL(*mRenderEngine, bindExternalTextureBuffer(0, Eq(nullptr), Eq(nullptr))) .WillOnce(Return(BAD_VALUE)); status_t result = mThreadedRE->bindExternalTextureBuffer(0, nullptr, nullptr); ASSERT_EQ(BAD_VALUE, result); } TEST_F(RenderEngineThreadedTest, bindExternalBuffer_withBuffer) { sp<GraphicBuffer> buf = new GraphicBuffer(); EXPECT_CALL(*mRenderEngine, bindExternalTextureBuffer(0, buf, Eq(nullptr))) .WillOnce(Return(NO_ERROR)); status_t result = mThreadedRE->bindExternalTextureBuffer(0, buf, nullptr); ASSERT_EQ(NO_ERROR, result); } TEST_F(RenderEngineThreadedTest, cacheExternalTextureBuffer_nullptr) { EXPECT_CALL(*mRenderEngine, cacheExternalTextureBuffer(Eq(nullptr))); mThreadedRE->cacheExternalTextureBuffer(nullptr); Loading