diff options
| author | 2018-10-23 20:07:50 -0700 | |
|---|---|---|
| committer | 2018-11-08 18:22:35 -0800 | |
| commit | c956fa24bb8c1d433fd2ff62f69a03be8ecd59f3 (patch) | |
| tree | 8932e5dcbcb7fb819c08f1e30ae3b7731fd9eb24 | |
| parent | ce0ad96d3c23b6b7bc4d6a540141ea1111b4430e (diff) | |
Delete renderengine::Surface
It is now unused.
Bug: 117680609
Test: Builds
Change-Id: Ibe897696957a0b0f0813d40c9157868f72f02fd2
| -rw-r--r-- | libs/renderengine/Android.bp | 1 | ||||
| -rw-r--r-- | libs/renderengine/gl/GLES20RenderEngine.cpp | 38 | ||||
| -rw-r--r-- | libs/renderengine/gl/GLES20RenderEngine.h | 6 | ||||
| -rw-r--r-- | libs/renderengine/gl/GLSurface.cpp | 105 | ||||
| -rw-r--r-- | libs/renderengine/gl/GLSurface.h | 76 | ||||
| -rw-r--r-- | libs/renderengine/include/renderengine/RenderEngine.h | 4 | ||||
| -rw-r--r-- | libs/renderengine/include/renderengine/Surface.h | 46 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.cpp | 3 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.h | 21 |
9 files changed, 2 insertions, 298 deletions
diff --git a/libs/renderengine/Android.bp b/libs/renderengine/Android.bp index 7efc8bd64d..beaf9ee70d 100644 --- a/libs/renderengine/Android.bp +++ b/libs/renderengine/Android.bp @@ -50,7 +50,6 @@ filegroup { "gl/GLExtensions.cpp", "gl/GLFramebuffer.cpp", "gl/GLImage.cpp", - "gl/GLSurface.cpp", "gl/Program.cpp", "gl/ProgramCache.cpp", ], diff --git a/libs/renderengine/gl/GLES20RenderEngine.cpp b/libs/renderengine/gl/GLES20RenderEngine.cpp index e244a83c09..d35762d447 100644 --- a/libs/renderengine/gl/GLES20RenderEngine.cpp +++ b/libs/renderengine/gl/GLES20RenderEngine.cpp @@ -41,7 +41,6 @@ #include "GLExtensions.h" #include "GLFramebuffer.h" #include "GLImage.h" -#include "GLSurface.h" #include "Program.h" #include "ProgramCache.h" @@ -423,10 +422,6 @@ std::unique_ptr<Framebuffer> GLES20RenderEngine::createFramebuffer() { return std::make_unique<GLFramebuffer>(*this); } -std::unique_ptr<Surface> GLES20RenderEngine::createSurface() { - return std::make_unique<GLSurface>(*this); -} - std::unique_ptr<Image> GLES20RenderEngine::createImage() { return std::make_unique<GLImage>(*this); } @@ -439,31 +434,6 @@ bool GLES20RenderEngine::isCurrent() const { return mEGLDisplay == eglGetCurrentDisplay() && mEGLContext == eglGetCurrentContext(); } -bool GLES20RenderEngine::setCurrentSurface(const Surface& surface) { - // Surface is an abstract interface. GLES20RenderEngine only ever - // creates GLSurface's, so it is safe to just cast to the actual - // type. - bool success = true; - const GLSurface& glSurface = static_cast<const GLSurface&>(surface); - EGLSurface eglSurface = glSurface.getEGLSurface(); - if (eglSurface != eglGetCurrentSurface(EGL_DRAW)) { - success = eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext) == EGL_TRUE; - if (success && glSurface.getAsync()) { - eglSwapInterval(mEGLDisplay, 0); - } - if (success) { - mSurfaceHeight = glSurface.getHeight(); - } - } - - return success; -} - -void GLES20RenderEngine::resetCurrentSurface() { - eglMakeCurrent(mEGLDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - mSurfaceHeight = 0; -} - base::unique_fd GLES20RenderEngine::flush() { if (!GLExtensions::getInstance().hasNativeFenceSync()) { return base::unique_fd(); @@ -577,7 +547,7 @@ void GLES20RenderEngine::fillRegionWithColor(const Region& region, float red, fl void GLES20RenderEngine::setScissor(const Rect& region) { // Invert y-coordinate to map to GL-space. - int32_t canvasHeight = mRenderToFbo ? mFboHeight : mSurfaceHeight; + int32_t canvasHeight = mFboHeight; int32_t glBottom = canvasHeight - region.bottom; glScissor(region.left, glBottom, region.getWidth(), region.getHeight()); @@ -620,7 +590,6 @@ status_t GLES20RenderEngine::bindFrameBuffer(Framebuffer* framebuffer) { glBindFramebuffer(GL_FRAMEBUFFER, framebufferName); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureName, 0); - mRenderToFbo = true; mFboHeight = glFramebuffer->getBufferHeight(); uint32_t glStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER); @@ -632,7 +601,6 @@ status_t GLES20RenderEngine::bindFrameBuffer(Framebuffer* framebuffer) { } void GLES20RenderEngine::unbindFrameBuffer(Framebuffer* /* framebuffer */) { - mRenderToFbo = false; mFboHeight = 0; // back to main framebuffer @@ -661,9 +629,7 @@ void GLES20RenderEngine::setViewportAndProjection(size_t vpw, size_t vph, Rect s int32_t r = sourceCrop.right; int32_t b = sourceCrop.bottom; int32_t t = sourceCrop.top; - if (mRenderToFbo) { - std::swap(t, b); - } + std::swap(t, b); mat4 m = mat4::ortho(l, r, b, t, 0, 1); // Apply custom rotation to the projection. diff --git a/libs/renderengine/gl/GLES20RenderEngine.h b/libs/renderengine/gl/GLES20RenderEngine.h index aebb319a99..6c50938863 100644 --- a/libs/renderengine/gl/GLES20RenderEngine.h +++ b/libs/renderengine/gl/GLES20RenderEngine.h @@ -40,7 +40,6 @@ class Texture; namespace gl { class GLImage; -class GLSurface; class GLES20RenderEngine : public impl::RenderEngine { public: @@ -52,13 +51,10 @@ public: ~GLES20RenderEngine() override; std::unique_ptr<Framebuffer> createFramebuffer() override; - std::unique_ptr<Surface> createSurface() override; std::unique_ptr<Image> createImage() override; void primeCache() const override; bool isCurrent() const override; - bool setCurrentSurface(const Surface& surface) override; - void resetCurrentSurface() override; base::unique_fd flush() override; bool finish() override; bool waitFence(base::unique_fd fenceFd) override; @@ -147,8 +143,6 @@ private: mat4 mBt2020ToSrgb; mat4 mBt2020ToDisplayP3; - bool mRenderToFbo = false; - int32_t mSurfaceHeight = 0; int32_t mFboHeight = 0; // Current dataspace of layer being rendered diff --git a/libs/renderengine/gl/GLSurface.cpp b/libs/renderengine/gl/GLSurface.cpp deleted file mode 100644 index 2d694e9124..0000000000 --- a/libs/renderengine/gl/GLSurface.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "GLSurface.h" - -#include <android/native_window.h> -#include <log/log.h> -#include <ui/PixelFormat.h> -#include "GLES20RenderEngine.h" - -namespace android { -namespace renderengine { -namespace gl { - -GLSurface::GLSurface(const GLES20RenderEngine& engine) - : mEGLDisplay(engine.getEGLDisplay()), mEGLConfig(engine.getEGLConfig()) { - // RE does not assume any config when EGL_KHR_no_config_context is supported - if (mEGLConfig == EGL_NO_CONFIG_KHR) { - mEGLConfig = - GLES20RenderEngine::chooseEglConfig(mEGLDisplay, PIXEL_FORMAT_RGBA_8888, false); - } -} - -GLSurface::~GLSurface() { - setNativeWindow(nullptr); -} - -void GLSurface::setNativeWindow(ANativeWindow* window) { - if (mEGLSurface != EGL_NO_SURFACE) { - eglDestroySurface(mEGLDisplay, mEGLSurface); - mEGLSurface = EGL_NO_SURFACE; - mSurfaceWidth = 0; - mSurfaceHeight = 0; - } - - mWindow = window; - if (mWindow) { - mEGLSurface = eglCreateWindowSurface(mEGLDisplay, mEGLConfig, mWindow, nullptr); - mSurfaceWidth = ANativeWindow_getWidth(window); - mSurfaceHeight = ANativeWindow_getHeight(window); - } -} - -void GLSurface::swapBuffers() const { - if (!eglSwapBuffers(mEGLDisplay, mEGLSurface)) { - EGLint error = eglGetError(); - - const char format[] = "eglSwapBuffers(%p, %p) failed with 0x%08x"; - if (mCritical || error == EGL_CONTEXT_LOST) { - LOG_ALWAYS_FATAL(format, mEGLDisplay, mEGLSurface, error); - } else { - ALOGE(format, mEGLDisplay, mEGLSurface, error); - } - } -} - -EGLint GLSurface::queryConfig(EGLint attrib) const { - EGLint value; - if (!eglGetConfigAttrib(mEGLDisplay, mEGLConfig, attrib, &value)) { - value = 0; - } - - return value; -} - -int32_t GLSurface::queryRedSize() const { - return queryConfig(EGL_RED_SIZE); -} - -int32_t GLSurface::queryGreenSize() const { - return queryConfig(EGL_GREEN_SIZE); -} - -int32_t GLSurface::queryBlueSize() const { - return queryConfig(EGL_BLUE_SIZE); -} - -int32_t GLSurface::queryAlphaSize() const { - return queryConfig(EGL_ALPHA_SIZE); -} - -int32_t GLSurface::getWidth() const { - return mSurfaceWidth; -} - -int32_t GLSurface::getHeight() const { - return mSurfaceHeight; -} - -} // namespace gl -} // namespace renderengine -} // namespace android diff --git a/libs/renderengine/gl/GLSurface.h b/libs/renderengine/gl/GLSurface.h deleted file mode 100644 index 092d371ee9..0000000000 --- a/libs/renderengine/gl/GLSurface.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include <cstdint> - -#include <EGL/egl.h> -#include <android-base/macros.h> -#include <renderengine/Surface.h> - -struct ANativeWindow; - -namespace android { -namespace renderengine { -namespace gl { - -class GLES20RenderEngine; - -class GLSurface final : public renderengine::Surface { -public: - GLSurface(const GLES20RenderEngine& engine); - ~GLSurface() override; - - // renderengine::Surface implementation - void setCritical(bool enable) override { mCritical = enable; } - void setAsync(bool enable) override { mAsync = enable; } - - void setNativeWindow(ANativeWindow* window) override; - void swapBuffers() const override; - - int32_t queryRedSize() const override; - int32_t queryGreenSize() const override; - int32_t queryBlueSize() const override; - int32_t queryAlphaSize() const override; - - bool getAsync() const { return mAsync; } - EGLSurface getEGLSurface() const { return mEGLSurface; } - - int32_t getWidth() const override; - int32_t getHeight() const override; - -private: - EGLint queryConfig(EGLint attrib) const; - - EGLDisplay mEGLDisplay; - EGLConfig mEGLConfig; - - bool mCritical = false; - bool mAsync = false; - - int32_t mSurfaceWidth = 0; - int32_t mSurfaceHeight = 0; - - ANativeWindow* mWindow = nullptr; - EGLSurface mEGLSurface = EGL_NO_SURFACE; - - DISALLOW_COPY_AND_ASSIGN(GLSurface); -}; - -} // namespace gl -} // namespace renderengine -} // namespace android diff --git a/libs/renderengine/include/renderengine/RenderEngine.h b/libs/renderengine/include/renderengine/RenderEngine.h index becb3c3a10..22891c42c4 100644 --- a/libs/renderengine/include/renderengine/RenderEngine.h +++ b/libs/renderengine/include/renderengine/RenderEngine.h @@ -48,7 +48,6 @@ namespace renderengine { class BindNativeBufferAsFramebuffer; class Image; class Mesh; -class Surface; class Texture; namespace impl { @@ -72,7 +71,6 @@ public: // used to support legacy behavior. virtual std::unique_ptr<Framebuffer> createFramebuffer() = 0; - virtual std::unique_ptr<Surface> createSurface() = 0; virtual std::unique_ptr<Image> createImage() = 0; virtual void primeCache() const = 0; @@ -84,8 +82,6 @@ public: virtual bool useWaitSync() const = 0; virtual bool isCurrent() const = 0; - virtual bool setCurrentSurface(const Surface& surface) = 0; - virtual void resetCurrentSurface() = 0; // helpers // flush submits RenderEngine command stream for execution and returns a diff --git a/libs/renderengine/include/renderengine/Surface.h b/libs/renderengine/include/renderengine/Surface.h deleted file mode 100644 index ba7331daab..0000000000 --- a/libs/renderengine/include/renderengine/Surface.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include <cstdint> - -struct ANativeWindow; - -namespace android { -namespace renderengine { - -class Surface { -public: - virtual ~Surface() = default; - - virtual void setCritical(bool enable) = 0; - virtual void setAsync(bool enable) = 0; - - virtual void setNativeWindow(ANativeWindow* window) = 0; - virtual void swapBuffers() const = 0; - - virtual int32_t queryRedSize() const = 0; - virtual int32_t queryGreenSize() const = 0; - virtual int32_t queryBlueSize() const = 0; - virtual int32_t queryAlphaSize() const = 0; - - virtual int32_t getWidth() const = 0; - virtual int32_t getHeight() const = 0; -}; - -} // namespace renderengine -} // namespace android diff --git a/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.cpp b/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.cpp index af54df6d2b..fbfbc3fc99 100644 --- a/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.cpp +++ b/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.cpp @@ -26,9 +26,6 @@ namespace mock { RenderEngine::RenderEngine() = default; RenderEngine::~RenderEngine() = default; -Surface::Surface() = default; -Surface::~Surface() = default; - Image::Image() = default; Image::~Image() = default; diff --git a/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.h b/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.h index afca63ad39..90c3c20b68 100644 --- a/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.h +++ b/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.h @@ -23,7 +23,6 @@ #include <renderengine/LayerSettings.h> #include <renderengine/Mesh.h> #include <renderengine/RenderEngine.h> -#include <renderengine/Surface.h> #include <renderengine/Texture.h> #include <ui/GraphicBuffer.h> @@ -37,15 +36,12 @@ public: ~RenderEngine() override; MOCK_METHOD0(createFramebuffer, std::unique_ptr<Framebuffer>()); - MOCK_METHOD0(createSurface, std::unique_ptr<renderengine::Surface>()); MOCK_METHOD0(createImage, std::unique_ptr<renderengine::Image>()); MOCK_CONST_METHOD0(primeCache, void()); MOCK_METHOD1(dump, void(String8&)); MOCK_CONST_METHOD0(useNativeFenceSync, bool()); MOCK_CONST_METHOD0(useWaitSync, bool()); MOCK_CONST_METHOD0(isCurrent, bool()); - MOCK_METHOD1(setCurrentSurface, bool(const renderengine::Surface&)); - MOCK_METHOD0(resetCurrentSurface, void()); MOCK_METHOD0(flush, base::unique_fd()); MOCK_METHOD0(finish, bool()); MOCK_METHOD1(waitFence, bool(base::unique_fd*)); @@ -82,23 +78,6 @@ public: ANativeWindowBuffer* const, base::unique_fd*)); }; -class Surface : public renderengine::Surface { -public: - Surface(); - ~Surface() override; - - MOCK_METHOD1(setCritical, void(bool)); - MOCK_METHOD1(setAsync, void(bool)); - MOCK_METHOD1(setNativeWindow, void(ANativeWindow*)); - MOCK_CONST_METHOD0(swapBuffers, void()); - MOCK_CONST_METHOD0(queryRedSize, int32_t()); - MOCK_CONST_METHOD0(queryGreenSize, int32_t()); - MOCK_CONST_METHOD0(queryBlueSize, int32_t()); - MOCK_CONST_METHOD0(queryAlphaSize, int32_t()); - MOCK_CONST_METHOD0(getWidth, int32_t()); - MOCK_CONST_METHOD0(getHeight, int32_t()); -}; - class Image : public renderengine::Image { public: Image(); |