diff options
| author | 2018-10-17 14:33:41 -0700 | |
|---|---|---|
| committer | 2018-11-08 18:22:09 -0800 | |
| commit | ce0ad96d3c23b6b7bc4d6a540141ea1111b4430e (patch) | |
| tree | f7bac71e1fa1ca197df8c8a4b537b5f7136f4256 | |
| parent | 8147b0ead81c2d26e38fb4d93bc6d2f499ebd470 (diff) | |
Remove gl surfaces from DisplayDevice.
These are already subverted by rendering to a FBO.
Bug: 117680609
Change-Id: Ib5b446f30a73a36d8f1c759edf458eb3d06a97ed
Test: libsurfaceflinger_unittest, SurfaceFlinger_test
6 files changed, 13 insertions, 59 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index ac51d53ba8..f51daf3dad 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -225,7 +225,6 @@ DisplayDevice::DisplayDevice(DisplayDeviceCreationArgs&& args) mNativeWindow(args.nativeWindow), mGraphicBuffer(nullptr), mDisplaySurface(args.displaySurface), - mSurface{std::move(args.renderSurface)}, mDisplayInstallOrientation(args.displayInstallOrientation), mPageFlipCount(0), mIsVirtual(args.isVirtual), @@ -247,7 +246,6 @@ DisplayDevice::DisplayDevice(DisplayDeviceCreationArgs&& args) ALOGE_IF(!mNativeWindow, "No native window was set for display"); ALOGE_IF(!mDisplaySurface, "No display surface was set for display"); - ALOGE_IF(!mSurface, "No render surface was set for display"); std::vector<Hdr> types = args.hdrCapabilities.getSupportedHdrTypes(); for (Hdr hdrType : types) { @@ -439,12 +437,6 @@ void DisplayDevice::onPresentDisplayCompleted() { mDisplaySurface->onFrameCommitted(); } -bool DisplayDevice::makeCurrent() const { - bool success = mFlinger->getRenderEngine().setCurrentSurface(*mSurface); - setViewportAndProjection(); - return success; -} - void DisplayDevice::setViewportAndProjection() const { size_t w = mDisplayWidth; size_t h = mDisplayHeight; @@ -607,12 +599,8 @@ status_t DisplayDevice::orientationToTransfrom( void DisplayDevice::setDisplaySize(const int newWidth, const int newHeight) { dirtyRegion.set(getBounds()); - mSurface->setNativeWindow(nullptr); - mDisplaySurface->resizeBuffers(newWidth, newHeight); - ANativeWindow* const window = mNativeWindow.get(); - mSurface->setNativeWindow(window); mDisplayWidth = newWidth; mDisplayHeight = newHeight; } @@ -728,12 +716,11 @@ void DisplayDevice::dump(String8& result) const { ANativeWindow* const window = mNativeWindow.get(); result.appendFormat("+ %s\n", getDebugName().c_str()); result.appendFormat(" layerStack=%u, (%4dx%4d), ANativeWindow=%p " - "(%d:%d:%d:%d), orient=%2d (type=%08x), " - "flips=%u, isSecure=%d, powerMode=%d, activeConfig=%d, numLayers=%zu\n", + "format=%d, orient=%2d (type=%08x), flips=%u, isSecure=%d, " + "powerMode=%d, activeConfig=%d, numLayers=%zu\n", mLayerStack, mDisplayWidth, mDisplayHeight, window, - mSurface->queryRedSize(), mSurface->queryGreenSize(), - mSurface->queryBlueSize(), mSurface->queryAlphaSize(), mOrientation, - tr.getType(), getPageFlipCount(), mIsSecure, mPowerMode, mActiveConfig, + ANativeWindow_getFormat(window), mOrientation, tr.getType(), + getPageFlipCount(), mIsSecure, mPowerMode, mActiveConfig, mVisibleLayersSortedByZ.size()); result.appendFormat(" v:[%d,%d,%d,%d], f:[%d,%d,%d,%d], s:[%d,%d,%d,%d]," "transform:[[%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f]]\n", @@ -744,9 +731,9 @@ void DisplayDevice::dump(String8& result) const { auto const surface = static_cast<Surface*>(window); ui::Dataspace dataspace = surface->getBuffersDataSpace(); result.appendFormat(" wideColorGamut=%d, hdr10=%d, colorMode=%s, dataspace: %s (%d)\n", - mHasWideColorGamut, mHasHdr10, - decodeColorMode(mActiveColorMode).c_str(), - dataspaceDetails(static_cast<android_dataspace>(dataspace)).c_str(), dataspace); + mHasWideColorGamut, mHasHdr10, decodeColorMode(mActiveColorMode).c_str(), + dataspaceDetails(static_cast<android_dataspace>(dataspace)).c_str(), + dataspace); String8 surfaceDump; mDisplaySurface->dumpAsString(surfaceDump); diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h index 560a9588b5..eb2c5c3f94 100644 --- a/services/surfaceflinger/DisplayDevice.h +++ b/services/surfaceflinger/DisplayDevice.h @@ -24,12 +24,13 @@ #include <string> #include <unordered_map> +#include <android/native_window.h> #include <binder/IBinder.h> #include <gui/LayerState.h> #include <hardware/hwcomposer_defs.h> #include <math/mat4.h> #include <renderengine/RenderEngine.h> -#include <renderengine/Surface.h> +#include <system/window.h> #include <ui/GraphicTypes.h> #include <ui/HdrCapabilities.h> #include <ui/Region.h> @@ -42,8 +43,6 @@ #include "DisplayHardware/DisplayIdentification.h" #include "RenderArea.h" -struct ANativeWindow; - namespace android { class DisplaySurface; @@ -163,7 +162,6 @@ public: void setDisplayName(const std::string& displayName); const std::string& getDisplayName() const { return mDisplayName; } - bool makeCurrent() const; // Acquires a new buffer for GPU composition. void readyNewBuffer(); // Marks the current buffer has finished, so that it can be presented and @@ -220,7 +218,6 @@ private: // that drawing to the buffer is now complete. base::unique_fd mBufferReady; - std::unique_ptr<renderengine::Surface> mSurface; int mDisplayWidth; int mDisplayHeight; const int mDisplayInstallOrientation; @@ -340,7 +337,6 @@ struct DisplayDeviceCreationArgs { bool isSecure{false}; sp<ANativeWindow> nativeWindow; sp<DisplaySurface> displaySurface; - std::unique_ptr<renderengine::Surface> renderSurface; int displayInstallOrientation{DisplayState::eOrientationDefault}; bool hasWideColorGamut{false}; HdrCapabilities hdrCapabilities; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 2858b7b8b7..7696758e99 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2330,14 +2330,6 @@ sp<DisplayDevice> SurfaceFlinger::setupNewDisplayDeviceInternal( auto nativeWindow = nativeWindowSurface->getNativeWindow(); creationArgs.nativeWindow = nativeWindow; - /* - * Create our display's surface - */ - std::unique_ptr<renderengine::Surface> renderSurface = getRenderEngine().createSurface(); - renderSurface->setCritical(isInternalDisplay); - renderSurface->setAsync(state.isVirtual()); - creationArgs.renderSurface = std::move(renderSurface); - // Make sure that composition can never be stalled by a virtual display // consumer that isn't processing buffers fast enough. We have to do this // here, in case the display is composed entirely by HWC. diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp index 2ea2654d45..f0f1d3dcc3 100644 --- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp +++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp @@ -94,6 +94,10 @@ public: EXPECT_CALL(*mPrimaryDispSync, computeNextRefresh(0)).WillRepeatedly(Return(0)); EXPECT_CALL(*mPrimaryDispSync, getPeriod()) .WillRepeatedly(Return(FakeHwcDisplayInjector::DEFAULT_REFRESH_RATE)); + EXPECT_CALL(*mNativeWindow, query(NATIVE_WINDOW_WIDTH, _)) + .WillRepeatedly(DoAll(SetArgPointee<1>(DEFAULT_DISPLAY_WIDTH), Return(0))); + EXPECT_CALL(*mNativeWindow, query(NATIVE_WINDOW_HEIGHT, _)) + .WillRepeatedly(DoAll(SetArgPointee<1>(DEFAULT_DISPLAY_HEIGHT), Return(0))); mFlinger.setupRenderEngine(std::unique_ptr<renderengine::RenderEngine>(mRenderEngine)); setupComposer(0); @@ -140,7 +144,6 @@ public: sp<DisplayDevice> mDisplay; sp<DisplayDevice> mExternalDisplay; sp<mock::DisplaySurface> mDisplaySurface = new mock::DisplaySurface(); - renderengine::mock::Surface* mRenderSurface = new renderengine::mock::Surface(); mock::NativeWindow* mNativeWindow = new mock::NativeWindow(); sp<GraphicBuffer> mBuffer = new GraphicBuffer(); @@ -246,8 +249,6 @@ struct BaseDisplayVariant { test->mDisplay = FakeDisplayDeviceInjector(test->mFlinger, DEFAULT_DISPLAY_ID, false /* isVirtual */, true /* isPrimary */) .setDisplaySurface(test->mDisplaySurface) - .setRenderSurface(std::unique_ptr<renderengine::Surface>( - test->mRenderSurface)) .setNativeWindow(test->mNativeWindow) .setSecure(Derived::IS_SECURE) .setPowerMode(Derived::INIT_POWER_MODE) diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp index e4eb1d5a93..aa1fc1a474 100644 --- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp +++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp @@ -135,7 +135,6 @@ public: sp<mock::GraphicBufferConsumer> mConsumer; sp<mock::GraphicBufferProducer> mProducer; surfaceflinger::mock::NativeWindowSurface* mNativeWindowSurface = nullptr; - renderengine::mock::Surface* mRenderSurface = nullptr; }; DisplayTransactionTest::DisplayTransactionTest() { @@ -342,22 +341,10 @@ struct DisplayVariant { EXPECT_CALL(*test->mNativeWindowSurface, getNativeWindow()) .WillOnce(Return(test->mNativeWindow)); - // For simplicity, we only expect to create a single render surface for - // each test. - ASSERT_TRUE(test->mRenderSurface == nullptr); - test->mRenderSurface = new renderengine::mock::Surface(); - EXPECT_CALL(*test->mRenderEngine, createSurface()) - .WillOnce(Return(ByMove( - std::unique_ptr<renderengine::Surface>(test->mRenderSurface)))); EXPECT_CALL(*test->mNativeWindow, query(NATIVE_WINDOW_WIDTH, _)) .WillRepeatedly(DoAll(SetArgPointee<1>(WIDTH), Return(0))); EXPECT_CALL(*test->mNativeWindow, query(NATIVE_WINDOW_HEIGHT, _)) .WillRepeatedly(DoAll(SetArgPointee<1>(HEIGHT), Return(0))); - - // Creating a DisplayDevice requires getting default dimensions from the - // native window. - EXPECT_CALL(*test->mRenderSurface, setAsync(static_cast<bool>(ASYNC))).Times(1); - EXPECT_CALL(*test->mRenderSurface, setCritical(static_cast<bool>(CRITICAL))).Times(1); } static void setupFramebufferConsumerBufferQueueCallExpectations(DisplayTransactionTest* test) { @@ -1944,12 +1931,10 @@ TEST_F(HandleTransactionLockedTest, processesDisplayWidthChanges) { // A display is set up auto nativeWindow = new mock::NativeWindow(); auto displaySurface = new mock::DisplaySurface(); - auto renderSurface = new renderengine::mock::Surface(); sp<GraphicBuffer> buf = new GraphicBuffer(); auto display = Case::Display::makeFakeExistingDisplayInjector(this); display.setNativeWindow(nativeWindow); display.setDisplaySurface(displaySurface); - display.setRenderSurface(std::unique_ptr<renderengine::Surface>(renderSurface)); // Setup injection expections EXPECT_CALL(*nativeWindow, query(NATIVE_WINDOW_WIDTH, _)) .WillOnce(DoAll(SetArgPointee<1>(oldWidth), Return(0))); @@ -1988,12 +1973,10 @@ TEST_F(HandleTransactionLockedTest, processesDisplayHeightChanges) { // A display is set up auto nativeWindow = new mock::NativeWindow(); auto displaySurface = new mock::DisplaySurface(); - auto renderSurface = new renderengine::mock::Surface(); sp<GraphicBuffer> buf = new GraphicBuffer(); auto display = Case::Display::makeFakeExistingDisplayInjector(this); display.setNativeWindow(nativeWindow); display.setDisplaySurface(displaySurface); - display.setRenderSurface(std::unique_ptr<renderengine::Surface>(renderSurface)); // Setup injection expections EXPECT_CALL(*nativeWindow, query(NATIVE_WINDOW_WIDTH, _)) .WillOnce(DoAll(SetArgPointee<1>(oldWidth), Return(0))); diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h index c5b60f17fa..dc42414cda 100644 --- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h +++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h @@ -473,11 +473,6 @@ public: return *this; } - auto& setRenderSurface(std::unique_ptr<renderengine::Surface> renderSurface) { - mCreationArgs.renderSurface = std::move(renderSurface); - return *this; - } - auto& setSecure(bool secure) { mCreationArgs.isSecure = secure; return *this; |