From f527548dd751bd62b1302cf357fdb4840bc115a9 Mon Sep 17 00:00:00 2001 From: Lloyd Pique Date: Tue, 29 Jan 2019 18:42:42 -0800 Subject: SF: Move/Refactor Layer::setPerFrameData Moves functionality out of ColorLayer, BufferLayer, BufferStateLayer and BufferQueueLayer related to setting the per-frame data. Instead each of the front-end classes now implements a minimal function to set the per-frame state into the LayerFECompositionState structure. compositionengine::OutputLayer now takes care of sending the state to the HWC, and in particular with detecting when client composition needs to be forced due to lack of HWC support (though the front-end can also set a flag to force client composition for a few things it knows about). SurfaceFlinger::calculateWorkingSet is also refactored to work with the changes made, and prepare it to be moved over to CompositionEngine. Test: atest libsurfaceflinger_unittest libcompositionengine_test Test: atest CtsColorModeTestCases Test: atest CtsDisplayTestCases Test: atest CtsGraphicsTestCases Test: atest CtsUiRenderingTestCases Test: atest CtsViewTestCases Test: atest android.media.cts.EncodeVirtualDisplayWithCompositionTest Bug: 121291683 Change-Id: I2cb0442f68ec5c5f65f5b4cb418dda4c42e5dc39 --- services/surfaceflinger/ContainerLayer.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'services/surfaceflinger/ContainerLayer.cpp') diff --git a/services/surfaceflinger/ContainerLayer.cpp b/services/surfaceflinger/ContainerLayer.cpp index 7927fa95b6..3a5f3faa20 100644 --- a/services/surfaceflinger/ContainerLayer.cpp +++ b/services/surfaceflinger/ContainerLayer.cpp @@ -39,7 +39,4 @@ bool ContainerLayer::canReceiveInput() const { return !isHiddenByPolicy(); } -void ContainerLayer::setPerFrameData(const sp&, const ui::Transform&, - const Rect&, int32_t, const ui::Dataspace) {} - } // namespace android -- cgit v1.2.3-59-g8ed1b From f16688fcebb22193b555e24c329155f6f0a2f372 Mon Sep 17 00:00:00 2001 From: Lloyd Pique Date: Tue, 19 Feb 2019 17:47:57 -0800 Subject: SF: Introduce LayerFE::prepareClientComposition Renames Layer::prepareClientLayer, and alters it to not take a RenderArea. Test: atest libsurfaceflinger_unittest libcompositionengine_test Bug: 121291683 Change-Id: I6da6005c2e34e6e44692043cdc7adf9c4aa57cf5 --- services/surfaceflinger/BufferLayer.cpp | 42 ++++++++-------- services/surfaceflinger/BufferLayer.h | 17 +++---- services/surfaceflinger/ColorLayer.cpp | 18 +++---- services/surfaceflinger/ColorLayer.h | 13 ++--- .../include/compositionengine/LayerFE.h | 31 ++++++++++++ .../include/compositionengine/mock/LayerFE.h | 3 ++ services/surfaceflinger/ContainerLayer.cpp | 5 -- services/surfaceflinger/ContainerLayer.h | 8 --- services/surfaceflinger/Layer.cpp | 57 ++++++++-------------- services/surfaceflinger/Layer.h | 21 ++------ services/surfaceflinger/SurfaceFlinger.cpp | 56 ++++++++++++++------- 11 files changed, 141 insertions(+), 130 deletions(-) (limited to 'services/surfaceflinger/ContainerLayer.cpp') diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index 59ea9afa97..87bec11609 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -132,13 +132,15 @@ static constexpr mat4 inverseOrientation(uint32_t transform) { return inverse(tr); } -bool BufferLayer::prepareClientLayer(const RenderArea& renderArea, const Region& clip, - bool useIdentityTransform, Region& clearRegion, - const bool supportProtectedContent, - renderengine::LayerSettings& layer) { +std::optional BufferLayer::prepareClientComposition( + compositionengine::LayerFE::ClientCompositionTargetSettings& targetSettings) { ATRACE_CALL(); - Layer::prepareClientLayer(renderArea, clip, useIdentityTransform, clearRegion, - supportProtectedContent, layer); + + auto result = Layer::prepareClientComposition(targetSettings); + if (!result) { + return result; + } + if (CC_UNLIKELY(mActiveBuffer == 0)) { // the texture has not been created yet, this Layer has // in fact never been drawn into. This happens frequently with @@ -159,15 +161,16 @@ bool BufferLayer::prepareClientLayer(const RenderArea& renderArea, const Region& under.orSelf(layer->visibleRegion); }); // if not everything below us is covered, we plug the holes! - Region holes(clip.subtract(under)); + Region holes(targetSettings.clip.subtract(under)); if (!holes.isEmpty()) { - clearRegion.orSelf(holes); + targetSettings.clearRegion.orSelf(holes); } - return false; + return std::nullopt; } - bool blackOutLayer = - (isProtected() && !supportProtectedContent) || (isSecure() && !renderArea.isSecure()); + bool blackOutLayer = (isProtected() && !targetSettings.supportProtectedContent) || + (isSecure() && !targetSettings.isSecure); const State& s(getDrawingState()); + auto& layer = *result; if (!blackOutLayer) { layer.source.buffer.buffer = mActiveBuffer; layer.source.buffer.isOpaque = isOpaque(s); @@ -176,8 +179,7 @@ bool BufferLayer::prepareClientLayer(const RenderArea& renderArea, const Region& layer.source.buffer.usePremultipliedAlpha = getPremultipledAlpha(); layer.source.buffer.isY410BT2020 = isHdrY410(); // TODO: we could be more subtle with isFixedSize() - const bool useFiltering = needsFiltering(renderArea.getDisplayDevice()) || - renderArea.needsFiltering() || isFixedSize(); + const bool useFiltering = targetSettings.needsFiltering || mNeedsFiltering || isFixedSize(); // Query the texture matrix given our current filtering mode. float textureMatrix[16]; @@ -244,7 +246,7 @@ bool BufferLayer::prepareClientLayer(const RenderArea& renderArea, const Region& layer.alpha = 1.0; } - return true; + return result; } bool BufferLayer::isHdrY410() const { @@ -572,21 +574,23 @@ bool BufferLayer::getOpacityForFormat(uint32_t format) { } bool BufferLayer::needsFiltering(const sp& displayDevice) const { - // If we are not capturing based on the state of a known display device, we - // only return mNeedsFiltering + // If we are not capturing based on the state of a known display device, + // just return false. if (displayDevice == nullptr) { - return mNeedsFiltering; + return false; } const auto outputLayer = findOutputLayerForDisplay(displayDevice); if (outputLayer == nullptr) { - return mNeedsFiltering; + return false; } + // We need filtering if the sourceCrop rectangle size does not match the + // displayframe rectangle size (not a 1:1 render) const auto& compositionState = outputLayer->getState(); const auto displayFrame = compositionState.displayFrame; const auto sourceCrop = compositionState.sourceCrop; - return mNeedsFiltering || sourceCrop.getHeight() != displayFrame.getHeight() || + return sourceCrop.getHeight() != displayFrame.getHeight() || sourceCrop.getWidth() != displayFrame.getWidth(); } diff --git a/services/surfaceflinger/BufferLayer.h b/services/surfaceflinger/BufferLayer.h index bb0205de3e..c86acf08f8 100644 --- a/services/surfaceflinger/BufferLayer.h +++ b/services/surfaceflinger/BufferLayer.h @@ -82,7 +82,6 @@ public: bool isHdrY410() const override; - bool onPreComposition(nsecs_t refreshStartTime) override; bool onPostComposition(const std::optional& displayId, const std::shared_ptr& glDoneFence, const std::shared_ptr& presentFence, @@ -146,7 +145,13 @@ private: virtual status_t updateFrameNumber(nsecs_t latchTime) = 0; protected: - void latchPerFrameState(compositionengine::LayerFECompositionState& outState) const override; + /* + * compositionengine::LayerFE overrides + */ + bool onPreComposition(nsecs_t) override; + void latchPerFrameState(compositionengine::LayerFECompositionState&) const override; + std::optional prepareClientComposition( + compositionengine::LayerFE::ClientCompositionTargetSettings&) override; // Loads the corresponding system property once per process static bool latchUnsignaledBuffers(); @@ -163,15 +168,9 @@ protected: bool mRefreshPending{false}; - // prepareClientLayer - constructs a RenderEngine layer for GPU composition. - bool prepareClientLayer(const RenderArea& renderArea, const Region& clip, - bool useIdentityTransform, Region& clearRegion, - const bool supportProtectedContent, - renderengine::LayerSettings& layer) override; - private: // Returns true if this layer requires filtering - bool needsFiltering(const sp& displayDevice) const; + bool needsFiltering(const sp& displayDevice) const override; uint64_t getHeadFrameNumber(nsecs_t expectedPresentTime) const; diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp index f15957adf9..b65d351263 100644 --- a/services/surfaceflinger/ColorLayer.cpp +++ b/services/surfaceflinger/ColorLayer.cpp @@ -50,16 +50,14 @@ ColorLayer::ColorLayer(const LayerCreationArgs& args) ColorLayer::~ColorLayer() = default; -bool ColorLayer::prepareClientLayer(const RenderArea& renderArea, const Region& clip, - bool useIdentityTransform, Region& clearRegion, - const bool supportProtectedContent, - renderengine::LayerSettings& layer) { - Layer::prepareClientLayer(renderArea, clip, useIdentityTransform, clearRegion, - supportProtectedContent, layer); - half4 color(getColor()); - half3 solidColor(color.r, color.g, color.b); - layer.source.solidColor = solidColor; - return true; +std::optional ColorLayer::prepareClientComposition( + compositionengine::LayerFE::ClientCompositionTargetSettings& targetSettings) { + auto result = Layer::prepareClientComposition(targetSettings); + if (!result) { + return result; + } + result->source.solidColor = getColor().rgb; + return result; } bool ColorLayer::isVisible() const { diff --git a/services/surfaceflinger/ColorLayer.h b/services/surfaceflinger/ColorLayer.h index 2483ff0bfb..015b939457 100644 --- a/services/surfaceflinger/ColorLayer.h +++ b/services/surfaceflinger/ColorLayer.h @@ -39,16 +39,13 @@ public: void commitTransaction(const State& stateToCommit) override; - bool onPreComposition(nsecs_t /*refreshStartTime*/) override { return false; } - protected: - virtual bool prepareClientLayer(const RenderArea& renderArea, const Region& clip, - bool useIdentityTransform, Region& clearRegion, - const bool supportProtectedContent, - renderengine::LayerSettings& layer); - -private: + /* + * compositionengine::LayerFE overrides + */ void latchPerFrameState(compositionengine::LayerFECompositionState&) const override; + std::optional prepareClientComposition( + compositionengine::LayerFE::ClientCompositionTargetSettings&) override; std::shared_ptr mCompositionLayer; }; diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h index 1f2cae9c2b..94fab1fdf6 100644 --- a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h +++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h @@ -16,6 +16,9 @@ #pragma once +#include + +#include #include #include @@ -40,6 +43,34 @@ public: // geometry state can be skipped. virtual void latchCompositionState(LayerFECompositionState&, bool includeGeometry) const = 0; + struct ClientCompositionTargetSettings { + // The clip region, or visible region that is being rendered to + const Region& clip; + + // If true, the layer should use an identity transform for its position + // transform. Used only by the captureScreen API call. + const bool useIdentityTransform; + + // If set to true, the layer should enable filtering when rendering. + const bool needsFiltering; + + // If set to true, the buffer is being sent to a destination that is + // expected to treat the buffer contents as secure. + const bool isSecure; + + // If set to true, the target buffer has protected content support. + const bool supportProtectedContent; + + // Modified by each call to prepareClientComposition to indicate the + // region of the target buffer that should be cleared. + Region& clearRegion; + }; + + // Returns the LayerSettings to pass to RenderEngine::drawLayers, or + // nullopt_t if the layer does not render + virtual std::optional prepareClientComposition( + ClientCompositionTargetSettings&) = 0; + // Called after the layer is displayed to update the presentation fence virtual void onLayerDisplayed(const sp&) = 0; diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h index 952f702e1c..48c2dbf3d6 100644 --- a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h +++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h @@ -33,6 +33,9 @@ public: MOCK_METHOD1(onPreComposition, bool(nsecs_t)); MOCK_CONST_METHOD2(latchCompositionState, void(LayerFECompositionState&, bool)); + MOCK_METHOD1(prepareClientComposition, + std::optional( + compositionengine::LayerFE::ClientCompositionTargetSettings&)); MOCK_METHOD1(onLayerDisplayed, void(const sp&)); MOCK_CONST_METHOD0(getDebugName, const char*()); diff --git a/services/surfaceflinger/ContainerLayer.cpp b/services/surfaceflinger/ContainerLayer.cpp index 3a5f3faa20..d40a38c811 100644 --- a/services/surfaceflinger/ContainerLayer.cpp +++ b/services/surfaceflinger/ContainerLayer.cpp @@ -26,11 +26,6 @@ ContainerLayer::ContainerLayer(const LayerCreationArgs& args) : Layer(args) {} ContainerLayer::~ContainerLayer() = default; -bool ContainerLayer::prepareClientLayer(const RenderArea&, const Region&, bool, Region&, const bool, - renderengine::LayerSettings&) { - return false; -} - bool ContainerLayer::isVisible() const { return false; } diff --git a/services/surfaceflinger/ContainerLayer.h b/services/surfaceflinger/ContainerLayer.h index 57267c70c8..a1607ffabb 100644 --- a/services/surfaceflinger/ContainerLayer.h +++ b/services/surfaceflinger/ContainerLayer.h @@ -34,14 +34,6 @@ public: bool canReceiveInput() const override; bool isCreatedFromMainThread() const override { return true; } - - bool onPreComposition(nsecs_t /*refreshStartTime*/) override { return false; } - -protected: - bool prepareClientLayer(const RenderArea& renderArea, const Region& clip, - bool useIdentityTransform, Region& clearRegion, - const bool supportProtectedContent, - renderengine::LayerSettings& layer) override; }; } // namespace android diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 8150ca7dfc..a2eeea545b 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -458,6 +458,10 @@ void Layer::latchPerFrameState(compositionengine::LayerFECompositionState& compo } } +bool Layer::onPreComposition(nsecs_t) { + return false; +} + void Layer::latchCompositionState(compositionengine::LayerFECompositionState& compositionState, bool includeGeometry) const { if (includeGeometry) { @@ -507,54 +511,33 @@ void Layer::updateCursorPosition(const sp& display) { // drawing... // --------------------------------------------------------------------------- -bool Layer::prepareClientLayer(const RenderArea& renderArea, const Region& clip, - Region& clearRegion, const bool supportProtectedContent, - renderengine::LayerSettings& layer) { - return prepareClientLayer(renderArea, clip, false, clearRegion, supportProtectedContent, layer); -} - -bool Layer::prepareClientLayer(const RenderArea& renderArea, bool useIdentityTransform, - Region& clearRegion, const bool supportProtectedContent, - renderengine::LayerSettings& layer) { - return prepareClientLayer(renderArea, Region(renderArea.getBounds()), useIdentityTransform, - clearRegion, supportProtectedContent, layer); -} +std::optional Layer::prepareClientComposition( + compositionengine::LayerFE::ClientCompositionTargetSettings& targetSettings) { + if (!getCompositionLayer()) { + return {}; + } -bool Layer::prepareClientLayer(const RenderArea& /*renderArea*/, const Region& /*clip*/, - bool useIdentityTransform, Region& /*clearRegion*/, - const bool /*supportProtectedContent*/, - renderengine::LayerSettings& layer) { FloatRect bounds = getBounds(); half alpha = getAlpha(); - layer.geometry.boundaries = bounds; - if (useIdentityTransform) { - layer.geometry.positionTransform = mat4(); + renderengine::LayerSettings layerSettings; + layerSettings.geometry.boundaries = bounds; + if (targetSettings.useIdentityTransform) { + layerSettings.geometry.positionTransform = mat4(); } else { - const ui::Transform transform = getTransform(); - mat4 m; - m[0][0] = transform[0][0]; - m[0][1] = transform[0][1]; - m[0][3] = transform[0][2]; - m[1][0] = transform[1][0]; - m[1][1] = transform[1][1]; - m[1][3] = transform[1][2]; - m[3][0] = transform[2][0]; - m[3][1] = transform[2][1]; - m[3][3] = transform[2][2]; - layer.geometry.positionTransform = m; + layerSettings.geometry.positionTransform = getTransform().asMatrix4(); } if (hasColorTransform()) { - layer.colorTransform = getColorTransform(); + layerSettings.colorTransform = getColorTransform(); } const auto roundedCornerState = getRoundedCornerState(); - layer.geometry.roundedCornersRadius = roundedCornerState.radius; - layer.geometry.roundedCornersCrop = roundedCornerState.cropRect; + layerSettings.geometry.roundedCornersRadius = roundedCornerState.radius; + layerSettings.geometry.roundedCornersCrop = roundedCornerState.cropRect; - layer.alpha = alpha; - layer.sourceDataspace = mCurrentDataSpace; - return true; + layerSettings.alpha = alpha; + layerSettings.sourceDataspace = mCurrentDataSpace; + return layerSettings; } Hwc2::IComposerClient::Composition Layer::getCompositionType( diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index aa7e2f1ec3..953f25ddf1 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -461,19 +461,17 @@ public: return s.activeTransparentRegion_legacy; } virtual Rect getCrop(const Layer::State& s) const { return s.crop_legacy; } - -protected: - virtual bool prepareClientLayer(const RenderArea& renderArea, const Region& clip, - bool useIdentityTransform, Region& clearRegion, - const bool supportProtectedContent, - renderengine::LayerSettings& layer); + virtual bool needsFiltering(const sp&) const { return false; } public: /* * compositionengine::LayerFE overrides */ + bool onPreComposition(nsecs_t) override; void latchCompositionState(compositionengine::LayerFECompositionState&, bool includeGeometry) const override; + std::optional prepareClientComposition( + compositionengine::LayerFE::ClientCompositionTargetSettings&) override; void onLayerDisplayed(const sp& releaseFence) override; const char* getDebugName() const override; @@ -508,17 +506,6 @@ public: // If a buffer was replaced this frame, release the former buffer virtual void releasePendingBuffer(nsecs_t /*dequeueReadyTime*/) { } - /* - * prepareClientLayer - populates a renderengine::LayerSettings to passed to - * RenderEngine::drawLayers. Returns true if the layer can be used, and - * false otherwise. - */ - bool prepareClientLayer(const RenderArea& renderArea, const Region& clip, Region& clearRegion, - const bool supportProtectedContent, renderengine::LayerSettings& layer); - bool prepareClientLayer(const RenderArea& renderArea, bool useIdentityTransform, - Region& clearRegion, const bool supportProtectedContent, - renderengine::LayerSettings& layer); - /* * doTransaction - process the transaction. This is a good place to figure * out which attributes of the surface have changed. diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 1aec0c5389..d877e77832 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3319,6 +3319,7 @@ bool SurfaceFlinger::doComposeSurfaces(const sp& displayDevice, */ ALOGV("Rendering client layers"); + const bool useIdentityTransform = false; bool firstLayer = true; Region clearRegion = Region::INVALID_REGION; for (auto& layer : displayDevice->getVisibleLayersSortedByZ()) { @@ -3339,13 +3340,20 @@ bool SurfaceFlinger::doComposeSurfaces(const sp& displayDevice, layer->getRoundedCornerState().radius == 0.0f && hasClientComposition) { // never clear the very first layer since we're // guaranteed the FB is already cleared - renderengine::LayerSettings layerSettings; Region dummyRegion; - bool prepared = - layer->prepareClientLayer(renderArea, clip, dummyRegion, - supportProtectedContent, layerSettings); - - if (prepared) { + compositionengine::LayerFE::ClientCompositionTargetSettings targetSettings{ + clip, + useIdentityTransform, + layer->needsFiltering(renderArea.getDisplayDevice()) || + renderArea.needsFiltering(), + renderArea.isSecure(), + supportProtectedContent, + dummyRegion, + }; + auto result = layer->prepareClientComposition(targetSettings); + + if (result) { + auto& layerSettings = *result; layerSettings.source.buffer.buffer = nullptr; layerSettings.source.solidColor = half3(0.0, 0.0, 0.0); layerSettings.alpha = half(0.0); @@ -3356,12 +3364,18 @@ bool SurfaceFlinger::doComposeSurfaces(const sp& displayDevice, break; } case Hwc2::IComposerClient::Composition::CLIENT: { - renderengine::LayerSettings layerSettings; - bool prepared = - layer->prepareClientLayer(renderArea, clip, clearRegion, - supportProtectedContent, layerSettings); - if (prepared) { - clientCompositionLayers.push_back(layerSettings); + compositionengine::LayerFE::ClientCompositionTargetSettings targetSettings{ + clip, + useIdentityTransform, + layer->needsFiltering(renderArea.getDisplayDevice()) || + renderArea.needsFiltering(), + renderArea.isSecure(), + supportProtectedContent, + clearRegion, + }; + auto result = layer->prepareClientComposition(targetSettings); + if (result) { + clientCompositionLayers.push_back(*result); } break; } @@ -5902,11 +5916,19 @@ void SurfaceFlinger::renderScreenImplLocked(const RenderArea& renderArea, Region clearRegion = Region::INVALID_REGION; traverseLayers([&](Layer* layer) { - renderengine::LayerSettings layerSettings; - bool prepared = layer->prepareClientLayer(renderArea, useIdentityTransform, clearRegion, - false, layerSettings); - if (prepared) { - clientCompositionLayers.push_back(layerSettings); + const bool supportProtectedContent = false; + Region clip(renderArea.getBounds()); + compositionengine::LayerFE::ClientCompositionTargetSettings targetSettings{ + clip, + useIdentityTransform, + layer->needsFiltering(renderArea.getDisplayDevice()) || renderArea.needsFiltering(), + renderArea.isSecure(), + supportProtectedContent, + clearRegion, + }; + auto result = layer->prepareClientComposition(targetSettings); + if (result) { + clientCompositionLayers.push_back(*result); } }); -- cgit v1.2.3-59-g8ed1b From 82353e993cd4889a231a0b2d243dccc98e323395 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 12 Sep 2019 12:38:47 -0700 Subject: Changed BufferLayer's canReceiveInput to check if its hidden by policy WM does not consider window size or alpha value when setting it as the focused window. However, SF will check if the window has a buffer and that its alpha is not 0. Because of this difference, Input Dispatcher will not be able to send input to the window while WM thinks the window is focused. This will cause apps to stop responding. While we define what the intended behavior should be, this fix reverts to previous behavior in P. Bug: 139494112 Test: adb shell monkey 10000; make sure monkey does not get stuck Test: check test app from can receive input b/140478820 Change-Id: I4160b49161dd1780713980707a5c911034f414b5 --- libs/gui/tests/EndToEndNativeInputTest.cpp | 4 ++++ services/surfaceflinger/ContainerLayer.cpp | 4 ---- services/surfaceflinger/ContainerLayer.h | 2 -- services/surfaceflinger/Layer.cpp | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) (limited to 'services/surfaceflinger/ContainerLayer.cpp') diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp index 386f731d23..2ab34da5ec 100644 --- a/libs/gui/tests/EndToEndNativeInputTest.cpp +++ b/libs/gui/tests/EndToEndNativeInputTest.cpp @@ -435,6 +435,9 @@ TEST_F(InputSurfacesTest, input_ignores_transparent_region) { surface->expectTap(1, 1); } +/** + * TODO(b/139494112) fix tests once we define expected behavior + * // Ensure we send the input to the right surface when the surface visibility changes due to the // first buffer being submitted. ref: b/120839715 TEST_F(InputSurfacesTest, input_respects_buffer_layer_buffer) { @@ -486,6 +489,7 @@ TEST_F(InputSurfacesTest, input_respects_color_layer_alpha) { injectTap(11, 11); bgSurface->expectTap(1, 1); } +*/ TEST_F(InputSurfacesTest, input_respects_container_layer_visiblity) { std::unique_ptr bgSurface = makeSurface(100, 100); diff --git a/services/surfaceflinger/ContainerLayer.cpp b/services/surfaceflinger/ContainerLayer.cpp index d40a38c811..4a1130365a 100644 --- a/services/surfaceflinger/ContainerLayer.cpp +++ b/services/surfaceflinger/ContainerLayer.cpp @@ -30,8 +30,4 @@ bool ContainerLayer::isVisible() const { return false; } -bool ContainerLayer::canReceiveInput() const { - return !isHiddenByPolicy(); -} - } // namespace android diff --git a/services/surfaceflinger/ContainerLayer.h b/services/surfaceflinger/ContainerLayer.h index f0fbb6104f..c3624f6d7d 100644 --- a/services/surfaceflinger/ContainerLayer.h +++ b/services/surfaceflinger/ContainerLayer.h @@ -31,8 +31,6 @@ public: const char* getType() const override { return "ContainerLayer"; } bool isVisible() const override; - bool canReceiveInput() const override; - bool isCreatedFromMainThread() const override { return true; } }; diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 79ee827f0d..d117c1bb70 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -2020,7 +2020,7 @@ std::shared_ptr Layer::getCompositionLayer() const { } bool Layer::canReceiveInput() const { - return isVisible(); + return !isHiddenByPolicy(); } compositionengine::OutputLayer* Layer::findOutputLayerForDisplay( -- cgit v1.2.3-59-g8ed1b From b4c6e5850f16d045abcb4e3308b7556749a61be0 Mon Sep 17 00:00:00 2001 From: chaviw Date: Fri, 16 Aug 2019 14:35:07 -0700 Subject: [Mirror Layers] Added clone function to layers (1/4) Added a cloning function to each layer in preparation for mirroring Test: Nothing to test yet since no calls Bug: 131622422 Change-Id: Iba0692b75c4d99841de48f40ed55b3dbccf2b9b9 --- services/surfaceflinger/BufferLayer.cpp | 19 +++++++++++++-- services/surfaceflinger/BufferLayer.h | 1 + services/surfaceflinger/BufferQueueLayer.cpp | 20 ++++++++++------ services/surfaceflinger/BufferQueueLayer.h | 2 ++ services/surfaceflinger/BufferStateLayer.cpp | 27 ++++++++++++++-------- services/surfaceflinger/BufferStateLayer.h | 2 +- services/surfaceflinger/ColorLayer.cpp | 8 +++++++ services/surfaceflinger/ColorLayer.h | 2 ++ services/surfaceflinger/ContainerLayer.cpp | 7 ++++++ services/surfaceflinger/ContainerLayer.h | 3 +++ services/surfaceflinger/Layer.cpp | 9 ++++++++ services/surfaceflinger/Layer.h | 15 ++++++++++++ services/surfaceflinger/SurfaceFlinger.cpp | 21 +++++++++++++---- .../tests/unittests/CompositionTest.cpp | 13 +++++++---- 14 files changed, 121 insertions(+), 28 deletions(-) (limited to 'services/surfaceflinger/ContainerLayer.cpp') diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index fba235d397..d189846dd5 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -58,7 +58,7 @@ namespace android { BufferLayer::BufferLayer(const LayerCreationArgs& args) : Layer(args), - mTextureName(args.flinger->getNewTexture()), + mTextureName(args.textureName), mCompositionLayer{mFlinger->getCompositionEngine().createLayer( compositionengine::LayerCreationArgs{this})} { ALOGV("Creating Layer %s", args.name.string()); @@ -70,7 +70,13 @@ BufferLayer::BufferLayer(const LayerCreationArgs& args) } BufferLayer::~BufferLayer() { - mFlinger->deleteTextureAsync(mTextureName); + if (!isClone()) { + // The original layer and the clone layer share the same texture. Therefore, only one of + // the layers, in this case the original layer, needs to handle the deletion. The original + // layer and the clone should be removed at the same time so there shouldn't be any issue + // with the clone layer trying to use the deleted texture. + mFlinger->deleteTextureAsync(mTextureName); + } const int32_t layerID = getSequence(); mFlinger->mTimeStats->onDestroy(layerID); mFlinger->mFrameTracer->onDestroy(layerID); @@ -722,6 +728,15 @@ void BufferLayer::getDrawingTransformMatrix(bool filteringEnabled, float outMatr mBufferInfo.mTransform, filteringEnabled); } +void BufferLayer::setInitialValuesForClone(const sp& clonedFrom) { + Layer::setInitialValuesForClone(clonedFrom); + + sp bufferClonedFrom = static_cast(clonedFrom.get()); + mPremultipliedAlpha = bufferClonedFrom->mPremultipliedAlpha; + mPotentialCursor = bufferClonedFrom->mPotentialCursor; + mProtectedByApp = bufferClonedFrom->mProtectedByApp; +} + } // namespace android #if defined(__gl_h_) diff --git a/services/surfaceflinger/BufferLayer.h b/services/surfaceflinger/BufferLayer.h index f0a30e319a..b2c06183a6 100644 --- a/services/surfaceflinger/BufferLayer.h +++ b/services/surfaceflinger/BufferLayer.h @@ -194,6 +194,7 @@ protected: bool mRefreshPending{false}; ui::Dataspace translateDataspace(ui::Dataspace dataspace); + void setInitialValuesForClone(const sp& clonedFrom); private: // Returns true if this layer requires filtering diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp index fcabedf63e..eb13f658d9 100644 --- a/services/surfaceflinger/BufferQueueLayer.cpp +++ b/services/surfaceflinger/BufferQueueLayer.cpp @@ -461,12 +461,7 @@ void BufferQueueLayer::onFirstRef() { sp consumer; BufferQueue::createBufferQueue(&producer, &consumer, true); mProducer = new MonitoredProducer(producer, mFlinger, this); - { - // Grab the SF state lock during this since it's the only safe way to access RenderEngine - Mutex::Autolock lock(mFlinger->mStateLock); - mConsumer = - new BufferLayerConsumer(consumer, mFlinger->getRenderEngine(), mTextureName, this); - } + mConsumer = new BufferLayerConsumer(consumer, mFlinger->getRenderEngine(), mTextureName, this); mConsumer->setConsumerUsageBits(getEffectiveUsage(0)); mConsumer->setContentsChangedListener(this); mConsumer->setName(mName); @@ -476,7 +471,7 @@ void BufferQueueLayer::onFirstRef() { mProducer->setMaxDequeuedBufferCount(2); } - if (const auto display = mFlinger->getDefaultDisplayDevice()) { + if (const auto display = mFlinger->getDefaultDisplayDeviceLocked()) { updateTransformHint(display); } } @@ -531,4 +526,15 @@ void BufferQueueLayer::gatherBufferInfo() { mBufferInfo.mTransformToDisplayInverse = mConsumer->getTransformToDisplayInverse(); } +sp BufferQueueLayer::createClone() { + const String8 name = mName + " (Mirror)"; + LayerCreationArgs args = + LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata()); + args.textureName = mTextureName; + sp layer = new BufferQueueLayer(args); + layer->setInitialValuesForClone(this); + + return layer; +} + } // namespace android diff --git a/services/surfaceflinger/BufferQueueLayer.h b/services/surfaceflinger/BufferQueueLayer.h index 9374741ddb..36dff156e1 100644 --- a/services/surfaceflinger/BufferQueueLayer.h +++ b/services/surfaceflinger/BufferQueueLayer.h @@ -31,6 +31,7 @@ namespace android { */ class BufferQueueLayer : public BufferLayer, public BufferLayerConsumer::ContentsChangedListener { public: + // Only call while mStateLock is held explicit BufferQueueLayer(const LayerCreationArgs&); ~BufferQueueLayer() override; @@ -81,6 +82,7 @@ private: status_t updateFrameNumber(nsecs_t latchTime) override; void latchPerFrameState(compositionengine::LayerFECompositionState&) const override; + sp createClone() override; // ----------------------------------------------------------------------- // Interface implementation for BufferLayerConsumer::ContentsChangedListener diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp index ad05bc8671..30fdbe14e8 100644 --- a/services/surfaceflinger/BufferStateLayer.cpp +++ b/services/surfaceflinger/BufferStateLayer.cpp @@ -48,10 +48,17 @@ BufferStateLayer::BufferStateLayer(const LayerCreationArgs& args) : BufferLayer(args), mHwcSlotGenerator(new HwcSlotGenerator()) { mOverrideScalingMode = NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW; mCurrentState.dataspace = ui::Dataspace::V0_SRGB; + if (const auto display = args.displayDevice) { + updateTransformHint(display); + } } BufferStateLayer::~BufferStateLayer() { - if (mBufferInfo.mBuffer != nullptr) { + // The original layer and the clone layer share the same texture and buffer. Therefore, only + // one of the layers, in this case the original layer, needs to handle the deletion. The + // original layer and the clone should be removed at the same time so there shouldn't be any + // issue with the clone layer trying to use the texture. + if (mBufferInfo.mBuffer != nullptr && !isClone()) { // Ensure that mBuffer is uncached from RenderEngine here, as // RenderEngine may have been using the buffer as an external texture // after the client uncached the buffer. @@ -545,14 +552,6 @@ void BufferStateLayer::latchPerFrameState( mFrameNumber++; } -void BufferStateLayer::onFirstRef() { - BufferLayer::onFirstRef(); - - if (const auto display = mFlinger->getDefaultDisplayDevice()) { - updateTransformHint(display); - } -} - void BufferStateLayer::HwcSlotGenerator::bufferErased(const client_cache_t& clientCacheId) { std::lock_guard lock(mMutex); if (!clientCacheId.isValid()) { @@ -668,4 +667,14 @@ Rect BufferStateLayer::computeCrop(const State& s) { return s.crop; } +sp BufferStateLayer::createClone() { + const String8 name = mName + " (Mirror)"; + LayerCreationArgs args = + LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata()); + args.textureName = mTextureName; + sp layer = new BufferStateLayer(args); + layer->mHwcSlotGenerator = mHwcSlotGenerator; + layer->setInitialValuesForClone(this); + return layer; +} } // namespace android diff --git a/services/surfaceflinger/BufferStateLayer.h b/services/surfaceflinger/BufferStateLayer.h index 52063fcc58..e951ccf97a 100644 --- a/services/surfaceflinger/BufferStateLayer.h +++ b/services/surfaceflinger/BufferStateLayer.h @@ -124,13 +124,13 @@ private: status_t updateFrameNumber(nsecs_t latchTime) override; void latchPerFrameState(compositionengine::LayerFECompositionState&) const override; + sp createClone() override; // Crop that applies to the buffer Rect computeCrop(const State& s); private: friend class SlotGenerationTest; - void onFirstRef() override; bool willPresentCurrentTransaction() const; static const std::array IDENTITY_MATRIX; diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp index 99805d9da2..5b620543ac 100644 --- a/services/surfaceflinger/ColorLayer.cpp +++ b/services/surfaceflinger/ColorLayer.cpp @@ -107,6 +107,14 @@ ui::Dataspace ColorLayer::getDataSpace() const { return mDrawingState.dataspace; } +sp ColorLayer::createClone() { + String8 name = mName + " (Mirror)"; + sp layer = new ColorLayer( + LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata())); + layer->setInitialValuesForClone(this); + return layer; +} + // --------------------------------------------------------------------------- }; // namespace android diff --git a/services/surfaceflinger/ColorLayer.h b/services/surfaceflinger/ColorLayer.h index 16921df356..634a80003a 100644 --- a/services/surfaceflinger/ColorLayer.h +++ b/services/surfaceflinger/ColorLayer.h @@ -50,6 +50,8 @@ protected: compositionengine::LayerFE::ClientCompositionTargetSettings&) override; std::shared_ptr mCompositionLayer; + + sp createClone() override; }; } // namespace android diff --git a/services/surfaceflinger/ContainerLayer.cpp b/services/surfaceflinger/ContainerLayer.cpp index 4a1130365a..cb50d9ff6d 100644 --- a/services/surfaceflinger/ContainerLayer.cpp +++ b/services/surfaceflinger/ContainerLayer.cpp @@ -30,4 +30,11 @@ bool ContainerLayer::isVisible() const { return false; } +sp ContainerLayer::createClone() { + String8 name = mName + " (Mirror)"; + sp layer = new ContainerLayer( + LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata())); + layer->setInitialValuesForClone(this); + return layer; +} } // namespace android diff --git a/services/surfaceflinger/ContainerLayer.h b/services/surfaceflinger/ContainerLayer.h index c3624f6d7d..b48d471bde 100644 --- a/services/surfaceflinger/ContainerLayer.h +++ b/services/surfaceflinger/ContainerLayer.h @@ -32,6 +32,9 @@ public: bool isVisible() const override; bool isCreatedFromMainThread() const override { return true; } + +protected: + sp createClone() override; }; } // namespace android diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index ba948cfdbc..52a09b35d1 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -2015,6 +2015,15 @@ Region Layer::debugGetVisibleRegionOnDefaultDisplay() const { return outputLayer->getState().visibleRegion; } +void Layer::setInitialValuesForClone(const sp& clonedFrom) { + // copy drawing state from cloned layer + mDrawingState = clonedFrom->mDrawingState; + mClonedFrom = clonedFrom; + + // TODO: (b/140756730) Ignore input for now since InputDispatcher doesn't support multiple + // InputWindows per client token yet. + mDrawingState.inputInfo.token = nullptr; +} // --------------------------------------------------------------------------- }; // namespace android diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 8771ccd08e..96970ace89 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -91,6 +91,8 @@ struct LayerCreationArgs { LayerMetadata metadata; pid_t callingPid; uid_t callingUid; + sp displayDevice; + uint32_t textureName; }; class Layer : public compositionengine::LayerFE { @@ -465,6 +467,13 @@ public: virtual Rect getCrop(const Layer::State& s) const { return s.crop_legacy; } virtual bool needsFiltering(const sp&) const { return false; } +protected: + virtual sp createClone() = 0; + sp getClonedFrom() { return mClonedFrom != nullptr ? mClonedFrom.promote() : nullptr; } + + bool isClone() { return getClonedFrom() != nullptr; } + virtual void setInitialValuesForClone(const sp& clonedFrom); + public: /* * compositionengine::LayerFE overrides @@ -912,6 +921,12 @@ private: // to help debugging. pid_t mCallingPid; uid_t mCallingUid; + + // The current layer is a clone of mClonedFrom. This means that this layer will update it's + // properties based on mClonedFrom. When mClonedFrom latches a new buffer for BufferLayers, + // this layer will update it's buffer. When mClonedFrom updates it's drawing state, children, + // and relatives, this layer will update as well. + wp mClonedFrom; }; } // namespace android diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 41afb5da55..e3cf84aa1a 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3532,8 +3532,18 @@ status_t SurfaceFlinger::createBufferQueueLayer(const sp& client, const break; } - sp layer = getFactory().createBufferQueueLayer( - LayerCreationArgs(this, client, name, w, h, flags, std::move(metadata))); + sp layer; + LayerCreationArgs args = + LayerCreationArgs(this, client, name, w, h, flags, std::move(metadata)); + args.textureName = getNewTexture(); + { + // Grab the SF state lock during this since it's the only safe way to access + // RenderEngine when creating a BufferLayerConsumer + // TODO: Check if this lock is still needed here + Mutex::Autolock lock(mStateLock); + layer = getFactory().createBufferQueueLayer(args); + } + status_t err = layer->setDefaultBufferProperties(w, h, format); if (err == NO_ERROR) { *handle = layer->getHandle(); @@ -3549,8 +3559,11 @@ status_t SurfaceFlinger::createBufferStateLayer(const sp& client, const uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata, sp* handle, sp* outLayer) { - sp layer = getFactory().createBufferStateLayer( - LayerCreationArgs(this, client, name, w, h, flags, std::move(metadata))); + LayerCreationArgs args = + LayerCreationArgs(this, client, name, w, h, flags, std::move(metadata)); + args.displayDevice = getDefaultDisplayDevice(); + args.textureName = getNewTexture(); + sp layer = getFactory().createBufferStateLayer(args); *handle = layer->getHandle(); *outLayer = layer; diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp index 20dfed65e2..f29e2ddd33 100644 --- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp +++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp @@ -883,11 +883,14 @@ struct BufferLayerVariant : public BaseLayerVariant { FlingerLayerType layer = Base::template createLayerWithFactory(test, [test]() { - return new BufferQueueLayer( - LayerCreationArgs(test->mFlinger.mFlinger.get(), sp(), - String8("test-layer"), LayerProperties::WIDTH, - LayerProperties::HEIGHT, - LayerProperties::LAYER_FLAGS, LayerMetadata())); + sp client; + String8 name("test-layer"); + LayerCreationArgs args = + LayerCreationArgs(test->mFlinger.mFlinger.get(), client, name, + LayerProperties::WIDTH, LayerProperties::HEIGHT, + LayerProperties::LAYER_FLAGS, LayerMetadata()); + args.textureName = test->mFlinger.mutableTexturePool().back(); + return new BufferQueueLayer(args); }); LayerProperties::setupLayerState(test, layer); -- cgit v1.2.3-59-g8ed1b From 1c3a5eb0a4adb44adce52ea4a7b2005d18dc86e6 Mon Sep 17 00:00:00 2001 From: Lloyd Pique Date: Thu, 3 Oct 2019 13:07:08 -0700 Subject: SF: Switch Layer::createClone to using the factory Using the factory ensures the intended actual types are used for the clone. Test: atest libsurfaceflinger_unittest Test: go/wm_smoke Bug: None Change-Id: I64138724aed2d8c61dc5d59bba247d132291da0c --- services/surfaceflinger/BufferQueueLayer.cpp | 2 +- services/surfaceflinger/BufferStateLayer.cpp | 2 +- services/surfaceflinger/ColorLayer.cpp | 2 +- services/surfaceflinger/ContainerLayer.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'services/surfaceflinger/ContainerLayer.cpp') diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp index eb13f658d9..d80a70e4c6 100644 --- a/services/surfaceflinger/BufferQueueLayer.cpp +++ b/services/surfaceflinger/BufferQueueLayer.cpp @@ -531,7 +531,7 @@ sp BufferQueueLayer::createClone() { LayerCreationArgs args = LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata()); args.textureName = mTextureName; - sp layer = new BufferQueueLayer(args); + sp layer = mFlinger->getFactory().createBufferQueueLayer(args); layer->setInitialValuesForClone(this); return layer; diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp index fa4539ab91..75fc0e9c06 100644 --- a/services/surfaceflinger/BufferStateLayer.cpp +++ b/services/surfaceflinger/BufferStateLayer.cpp @@ -673,7 +673,7 @@ sp BufferStateLayer::createClone() { LayerCreationArgs args = LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata()); args.textureName = mTextureName; - sp layer = new BufferStateLayer(args); + sp layer = mFlinger->getFactory().createBufferStateLayer(args); layer->mHwcSlotGenerator = mHwcSlotGenerator; layer->setInitialValuesForClone(this); return layer; diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp index 5b620543ac..172d44556a 100644 --- a/services/surfaceflinger/ColorLayer.cpp +++ b/services/surfaceflinger/ColorLayer.cpp @@ -109,7 +109,7 @@ ui::Dataspace ColorLayer::getDataSpace() const { sp ColorLayer::createClone() { String8 name = mName + " (Mirror)"; - sp layer = new ColorLayer( + sp layer = mFlinger->getFactory().createColorLayer( LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata())); layer->setInitialValuesForClone(this); return layer; diff --git a/services/surfaceflinger/ContainerLayer.cpp b/services/surfaceflinger/ContainerLayer.cpp index cb50d9ff6d..e58e6f425e 100644 --- a/services/surfaceflinger/ContainerLayer.cpp +++ b/services/surfaceflinger/ContainerLayer.cpp @@ -32,7 +32,7 @@ bool ContainerLayer::isVisible() const { sp ContainerLayer::createClone() { String8 name = mName + " (Mirror)"; - sp layer = new ContainerLayer( + sp layer = mFlinger->getFactory().createContainerLayer( LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata())); layer->setInitialValuesForClone(this); return layer; -- cgit v1.2.3-59-g8ed1b From 87a07e42dd60a748cbf82be7e82b07b0326ea469 Mon Sep 17 00:00:00 2001 From: Dominik Laskowski Date: Thu, 10 Oct 2019 20:38:02 -0700 Subject: SF: Use std::string for layer names Bug: 130554049 Test: Build Change-Id: Id083a85fcb838da4138c39a55b12cf10ff0cdddb --- services/surfaceflinger/BufferLayer.cpp | 2 +- services/surfaceflinger/BufferQueueLayer.cpp | 16 ++-- services/surfaceflinger/BufferStateLayer.cpp | 8 +- services/surfaceflinger/ColorLayer.cpp | 8 +- services/surfaceflinger/ContainerLayer.cpp | 5 +- services/surfaceflinger/EventLog/EventLog.cpp | 27 +++--- services/surfaceflinger/EventLog/EventLog.h | 38 +++------ services/surfaceflinger/FrameTracker.cpp | 5 +- services/surfaceflinger/FrameTracker.h | 21 ++--- services/surfaceflinger/Layer.cpp | 45 +++++----- services/surfaceflinger/Layer.h | 11 ++- services/surfaceflinger/LayerRejecter.cpp | 7 +- services/surfaceflinger/LayerRejecter.h | 37 ++++---- services/surfaceflinger/RegionSamplingThread.cpp | 2 +- services/surfaceflinger/SurfaceFlinger.cpp | 98 +++++++++++----------- services/surfaceflinger/SurfaceFlinger.h | 14 ++-- services/surfaceflinger/SurfaceInterceptor.cpp | 6 +- services/surfaceflinger/SurfaceInterceptor.h | 1 - .../tests/unittests/CompositionTest.cpp | 10 +-- 19 files changed, 159 insertions(+), 202 deletions(-) (limited to 'services/surfaceflinger/ContainerLayer.cpp') diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index b500ad3eee..603a9f7f70 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -61,7 +61,7 @@ BufferLayer::BufferLayer(const LayerCreationArgs& args) mTextureName(args.textureName), mCompositionLayer{mFlinger->getCompositionEngine().createLayer( compositionengine::LayerCreationArgs{this})} { - ALOGV("Creating Layer %s", args.name.string()); + ALOGV("Creating Layer %s", getDebugName()); mPremultipliedAlpha = !(args.flags & ISurfaceComposerClient::eNonPremultiplied); diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp index d80a70e4c6..cd0d87cb82 100644 --- a/services/surfaceflinger/BufferQueueLayer.cpp +++ b/services/surfaceflinger/BufferQueueLayer.cpp @@ -62,7 +62,7 @@ std::vector BufferQueueLayer::getOccupancyHistory(boo std::vector history; status_t result = mConsumer->getOccupancyHistory(forceFlush, &history); if (result != NO_ERROR) { - ALOGW("[%s] Failed to obtain occupancy history (%d)", mName.string(), result); + ALOGW("[%s] Failed to obtain occupancy history (%d)", getDebugName(), result); return {}; } return history; @@ -110,7 +110,7 @@ bool BufferQueueLayer::shouldPresentNow(nsecs_t expectedPresentTime) const { ALOGW_IF(!isPlausible, "[%s] Timestamp %" PRId64 " seems implausible " "relative to expectedPresent %" PRId64, - mName.string(), addedTime, expectedPresentTime); + getDebugName(), addedTime, expectedPresentTime); const bool isDue = addedTime < expectedPresentTime; return isDue || !isPlausible; @@ -225,7 +225,7 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t bool queuedBuffer = false; const int32_t layerID = getSequence(); LayerRejecter r(mDrawingState, getCurrentState(), recomputeVisibleRegions, - getProducerStickyTransform() != 0, mName.string(), mOverrideScalingMode, + getProducerStickyTransform() != 0, mName, mOverrideScalingMode, getTransformToDisplayInverse()); if (isRemovedFromCurrentState()) { @@ -398,7 +398,7 @@ void BufferQueueLayer::onFrameAvailable(const BufferItem& item) { while (item.mFrameNumber != mLastFrameNumberReceived + 1) { status_t result = mQueueItemCondition.waitRelative(mQueueItemLock, ms2ns(500)); if (result != NO_ERROR) { - ALOGE("[%s] Timed out waiting on callback", mName.string()); + ALOGE("[%s] Timed out waiting on callback", getDebugName()); } } @@ -426,7 +426,7 @@ void BufferQueueLayer::onFrameReplaced(const BufferItem& item) { while (item.mFrameNumber != mLastFrameNumberReceived + 1) { status_t result = mQueueItemCondition.waitRelative(mQueueItemLock, ms2ns(500)); if (result != NO_ERROR) { - ALOGE("[%s] Timed out waiting on callback", mName.string()); + ALOGE("[%s] Timed out waiting on callback", getDebugName()); } } @@ -464,7 +464,7 @@ void BufferQueueLayer::onFirstRef() { mConsumer = new BufferLayerConsumer(consumer, mFlinger->getRenderEngine(), mTextureName, this); mConsumer->setConsumerUsageBits(getEffectiveUsage(0)); mConsumer->setContentsChangedListener(this); - mConsumer->setName(mName); + mConsumer->setName(String8(mName.data(), mName.size())); // BufferQueueCore::mMaxDequeuedBufferCount is default to 1 if (!mFlinger->isLayerTripleBufferingDisabled()) { @@ -527,9 +527,7 @@ void BufferQueueLayer::gatherBufferInfo() { } sp BufferQueueLayer::createClone() { - const String8 name = mName + " (Mirror)"; - LayerCreationArgs args = - LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata()); + LayerCreationArgs args(mFlinger.get(), nullptr, mName + " (Mirror)", 0, 0, 0, LayerMetadata()); args.textureName = mTextureName; sp layer = mFlinger->getFactory().createBufferQueueLayer(args); layer->setInitialValuesForClone(this); diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp index 75fc0e9c06..6fe89c41b5 100644 --- a/services/surfaceflinger/BufferStateLayer.cpp +++ b/services/surfaceflinger/BufferStateLayer.cpp @@ -136,7 +136,7 @@ void BufferStateLayer::pushPendingState() { return; } mPendingStates.push_back(mCurrentState); - ATRACE_INT(mTransactionName.string(), mPendingStates.size()); + ATRACE_INT(mTransactionName.c_str(), mPendingStates.size()); } bool BufferStateLayer::applyPendingStates(Layer::State* stateToCommit) { @@ -479,7 +479,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse (s.active.w != bufferWidth || s.active.h != bufferHeight)) { ALOGE("[%s] rejecting buffer: " "bufferWidth=%d, bufferHeight=%d, front.active.{w=%d, h=%d}", - mName.string(), bufferWidth, bufferHeight, s.active.w, s.active.h); + getDebugName(), bufferWidth, bufferHeight, s.active.w, s.active.h); mFlinger->mTimeStats->removeTimeRecord(layerID, mFrameNumber); return BAD_VALUE; } @@ -669,9 +669,7 @@ Rect BufferStateLayer::computeCrop(const State& s) { } sp BufferStateLayer::createClone() { - const String8 name = mName + " (Mirror)"; - LayerCreationArgs args = - LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata()); + LayerCreationArgs args(mFlinger.get(), nullptr, mName + " (Mirror)", 0, 0, 0, LayerMetadata()); args.textureName = mTextureName; sp layer = mFlinger->getFactory().createBufferStateLayer(args); layer->mHwcSlotGenerator = mHwcSlotGenerator; diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp index 172d44556a..8bfa569eeb 100644 --- a/services/surfaceflinger/ColorLayer.cpp +++ b/services/surfaceflinger/ColorLayer.cpp @@ -108,13 +108,11 @@ ui::Dataspace ColorLayer::getDataSpace() const { } sp ColorLayer::createClone() { - String8 name = mName + " (Mirror)"; sp layer = mFlinger->getFactory().createColorLayer( - LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata())); + LayerCreationArgs(mFlinger.get(), nullptr, mName + " (Mirror)", 0, 0, 0, + LayerMetadata())); layer->setInitialValuesForClone(this); return layer; } -// --------------------------------------------------------------------------- - -}; // namespace android +} // namespace android diff --git a/services/surfaceflinger/ContainerLayer.cpp b/services/surfaceflinger/ContainerLayer.cpp index e58e6f425e..ab664be5e2 100644 --- a/services/surfaceflinger/ContainerLayer.cpp +++ b/services/surfaceflinger/ContainerLayer.cpp @@ -31,10 +31,11 @@ bool ContainerLayer::isVisible() const { } sp ContainerLayer::createClone() { - String8 name = mName + " (Mirror)"; sp layer = mFlinger->getFactory().createContainerLayer( - LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, 0, LayerMetadata())); + LayerCreationArgs(mFlinger.get(), nullptr, mName + " (Mirror)", 0, 0, 0, + LayerMetadata())); layer->setInitialValuesForClone(this); return layer; } + } // namespace android diff --git a/services/surfaceflinger/EventLog/EventLog.cpp b/services/surfaceflinger/EventLog/EventLog.cpp index 365a0bd868..a532fc130f 100644 --- a/services/surfaceflinger/EventLog/EventLog.cpp +++ b/services/surfaceflinger/EventLog/EventLog.cpp @@ -17,13 +17,10 @@ #include #include #include -#include #include "EventLog.h" -// --------------------------------------------------------------------------- namespace android { -// --------------------------------------------------------------------------- ANDROID_SINGLETON_STATIC_INSTANCE(EventLog) @@ -31,11 +28,11 @@ ANDROID_SINGLETON_STATIC_INSTANCE(EventLog) EventLog::EventLog() { } -void EventLog::doLogFrameDurations(const String8& window, - const int32_t* durations, size_t numDurations) { +void EventLog::doLogFrameDurations(const std::string_view& name, const int32_t* durations, + size_t numDurations) { EventLog::TagBuffer buffer(LOGTAG_SF_FRAME_DUR); buffer.startList(1 + numDurations); - buffer.writeString8(window); + buffer.writeString(name); for (size_t i = 0; i < numDurations; i++) { buffer.writeInt32(durations[i]); } @@ -43,10 +40,9 @@ void EventLog::doLogFrameDurations(const String8& window, buffer.log(); } -void EventLog::logFrameDurations(const String8& window, - const int32_t* durations, size_t numDurations) { - EventLog::getInstance().doLogFrameDurations(window, durations, - numDurations); +void EventLog::logFrameDurations(const std::string_view& name, const int32_t* durations, + size_t numDurations) { + EventLog::getInstance().doLogFrameDurations(name, durations, numDurations); } // --------------------------------------------------------------------------- @@ -113,9 +109,9 @@ void EventLog::TagBuffer::writeInt64(int64_t value) { mPos += needed; } -void EventLog::TagBuffer::writeString8(const String8& value) { +void EventLog::TagBuffer::writeString(const std::string_view& value) { if (mOverflow) return; - const int32_t stringLen = value.length(); + const size_t stringLen = value.length(); const size_t needed = 1 + sizeof(int32_t) + stringLen; if (mPos + needed > STORAGE_MAX_SIZE) { mOverflow = true; @@ -123,11 +119,8 @@ void EventLog::TagBuffer::writeString8(const String8& value) { } mStorage[mPos + 0] = EVENT_TYPE_STRING; memcpy(&mStorage[mPos + 1], &stringLen, sizeof(int32_t)); - memcpy(&mStorage[mPos + 5], value.string(), stringLen); + memcpy(&mStorage[mPos + 5], value.data(), stringLen); mPos += needed; } -// --------------------------------------------------------------------------- -}// namespace android - -// --------------------------------------------------------------------------- +} // namespace android diff --git a/services/surfaceflinger/EventLog/EventLog.h b/services/surfaceflinger/EventLog/EventLog.h index efc5d70cd3..ee3587ef8a 100644 --- a/services/surfaceflinger/EventLog/EventLog.h +++ b/services/surfaceflinger/EventLog/EventLog.h @@ -14,24 +14,21 @@ * limitations under the License. */ -#include +#pragma once + #include #include -#ifndef ANDROID_SF_EVENTLOG_H -#define ANDROID_SF_EVENTLOG_H +#include +#include -// --------------------------------------------------------------------------- namespace android { -// --------------------------------------------------------------------------- - -class String8; class EventLog : public Singleton { public: - static void logFrameDurations(const String8& window, - const int32_t* durations, size_t numDurations); + static void logFrameDurations(const std::string_view& name, const int32_t* durations, + size_t numDurations); protected: EventLog(); @@ -54,18 +51,13 @@ private: public: explicit TagBuffer(int32_t tag); - // starts list of items void startList(int8_t count); - // terminates the list void endList(); - // write a 32-bit integer - void writeInt32(int32_t value); - // write a 64-bit integer - void writeInt64(int64_t value); - // write a C string - void writeString8(const String8& value); - // outputs the the buffer to the log + void writeInt32(int32_t); + void writeInt64(int64_t); + void writeString(const std::string_view&); + void log(); }; @@ -74,12 +66,8 @@ private: EventLog& operator =(const EventLog&); enum { LOGTAG_SF_FRAME_DUR = 60100 }; - void doLogFrameDurations(const String8& window, const int32_t* durations, - size_t numDurations); + void doLogFrameDurations(const std::string_view& name, const int32_t* durations, + size_t numDurations); }; -// --------------------------------------------------------------------------- -}// namespace android -// --------------------------------------------------------------------------- - -#endif /* ANDROID_SF_EVENTLOG_H */ +} // namespace android diff --git a/services/surfaceflinger/FrameTracker.cpp b/services/surfaceflinger/FrameTracker.cpp index f4cc49b851..a6e511e76e 100644 --- a/services/surfaceflinger/FrameTracker.cpp +++ b/services/surfaceflinger/FrameTracker.cpp @@ -21,7 +21,6 @@ #include #include -#include #include @@ -139,7 +138,7 @@ void FrameTracker::getStats(FrameStats* outStats) const { } } -void FrameTracker::logAndResetStats(const String8& name) { +void FrameTracker::logAndResetStats(const std::string_view& name) { Mutex::Autolock lock(mMutex); logStatsLocked(name); resetFrameCountersLocked(); @@ -217,7 +216,7 @@ void FrameTracker::resetFrameCountersLocked() { } } -void FrameTracker::logStatsLocked(const String8& name) const { +void FrameTracker::logStatsLocked(const std::string_view& name) const { for (int i = 0; i < NUM_FRAME_BUCKETS; i++) { if (mNumFrames[i] > 0) { EventLog::logFrameDurations(name, mNumFrames, NUM_FRAME_BUCKETS); diff --git a/services/surfaceflinger/FrameTracker.h b/services/surfaceflinger/FrameTracker.h index 555dcc1d1f..35382be1c0 100644 --- a/services/surfaceflinger/FrameTracker.h +++ b/services/surfaceflinger/FrameTracker.h @@ -14,20 +14,17 @@ * limitations under the License. */ -#ifndef ANDROID_FRAMETRACKER_H -#define ANDROID_FRAMETRACKER_H +#pragma once #include - -#include - #include -#include #include +#include -namespace android { +#include +#include -class String8; +namespace android { // FrameTracker tracks information about the most recently rendered frames. It // uses a circular buffer of frame records, and is *NOT* thread-safe - @@ -87,7 +84,7 @@ public: // logAndResetStats dumps the current statistics to the binary event log // and then resets the accumulated statistics to their initial values. - void logAndResetStats(const String8& name); + void logAndResetStats(const std::string_view& name); // dumpStats dump appends the current frame display time history to the result string. void dumpStats(std::string& result) const; @@ -123,7 +120,7 @@ private: void resetFrameCountersLocked(); // logStatsLocked dumps the current statistics to the binary event log. - void logStatsLocked(const String8& name) const; + void logStatsLocked(const std::string_view& name) const; // isFrameValidLocked returns true if the data for the given frame index is // valid and has all arrived (i.e. there are no oustanding fences). @@ -160,6 +157,4 @@ private: mutable Mutex mMutex; }; -} - -#endif // ANDROID_FRAMETRACKER_H +} // namespace android diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 6a45625c89..0c700a779f 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -83,8 +83,6 @@ Layer::Layer(const LayerCreationArgs& args) if (args.flags & ISurfaceComposerClient::eOpaque) layerFlags |= layer_state_t::eLayerOpaque; if (args.flags & ISurfaceComposerClient::eSecure) layerFlags |= layer_state_t::eLayerSecure; - mTransactionName = String8("TX - ") + mName; - mCurrentState.active_legacy.w = args.w; mCurrentState.active_legacy.h = args.h; mCurrentState.flags = layerFlags; @@ -137,11 +135,11 @@ Layer::~Layer() { } LayerCreationArgs::LayerCreationArgs(SurfaceFlinger* flinger, const sp& client, - const String8& name, uint32_t w, uint32_t h, uint32_t flags, + std::string name, uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata) : flinger(flinger), client(client), - name(name), + name(std::move(name)), w(w), h(h), flags(flags), @@ -235,10 +233,6 @@ void Layer::addToCurrentState() { // set-up // --------------------------------------------------------------------------- -const String8& Layer::getName() const { - return mName; -} - bool Layer::getPremultipledAlpha() const { return mPremultipliedAlpha; } @@ -523,7 +517,7 @@ void Layer::latchCompositionState(compositionengine::LayerFECompositionState& co } const char* Layer::getDebugName() const { - return mName.string(); + return mName.c_str(); } // --------------------------------------------------------------------------- @@ -614,7 +608,7 @@ void Layer::pushPendingState() { if (mCurrentState.barrierLayer_legacy != nullptr && !isRemovedFromCurrentState()) { sp barrierLayer = mCurrentState.barrierLayer_legacy.promote(); if (barrierLayer == nullptr) { - ALOGE("[%s] Unable to promote barrier Layer.", mName.string()); + ALOGE("[%s] Unable to promote barrier Layer.", getDebugName()); // If we can't promote the layer we are intended to wait on, // then it is expired or otherwise invalid. Allow this transaction // to be applied as per normal (no synchronization). @@ -638,7 +632,7 @@ void Layer::pushPendingState() { mFlinger->setTransactionFlags(eTraversalNeeded); } mPendingStates.push_back(mCurrentState); - ATRACE_INT(mTransactionName.string(), mPendingStates.size()); + ATRACE_INT(mTransactionName.c_str(), mPendingStates.size()); } void Layer::popPendingState(State* stateToCommit) { @@ -646,7 +640,7 @@ void Layer::popPendingState(State* stateToCommit) { *stateToCommit = mPendingStates[0]; mPendingStates.removeAt(0); - ATRACE_INT(mTransactionName.string(), mPendingStates.size()); + ATRACE_INT(mTransactionName.c_str(), mPendingStates.size()); } bool Layer::applyPendingStates(State* stateToCommit) { @@ -657,7 +651,7 @@ bool Layer::applyPendingStates(State* stateToCommit) { // If we don't have a sync point for this, apply it anyway. It // will be visually wrong, but it should keep us from getting // into too much trouble. - ALOGE("[%s] No local sync point found", mName.string()); + ALOGE("[%s] No local sync point found", getDebugName()); popPendingState(stateToCommit); stateUpdateAvailable = true; continue; @@ -665,7 +659,7 @@ bool Layer::applyPendingStates(State* stateToCommit) { if (mRemoteSyncPoints.front()->getFrameNumber() != mPendingStates[0].frameNumber_legacy) { - ALOGE("[%s] Unexpected sync point frame number found", mName.string()); + ALOGE("[%s] Unexpected sync point frame number found", getDebugName()); // Signal our end of the sync point and then dispose of it mRemoteSyncPoints.front()->setTransactionApplied(); @@ -717,7 +711,7 @@ uint32_t Layer::doTransactionResize(uint32_t flags, State* stateToCommit) { " requested={ wh={%4u,%4u} }}\n" " drawing={ active ={ wh={%4u,%4u} crop={%4d,%4d,%4d,%4d} (%4d,%4d) }\n" " requested={ wh={%4u,%4u} }}\n", - this, getName().string(), getBufferTransform(), getEffectiveScalingMode(), + this, getName().c_str(), getBufferTransform(), getEffectiveScalingMode(), stateToCommit->active_legacy.w, stateToCommit->active_legacy.h, stateToCommit->crop_legacy.left, stateToCommit->crop_legacy.top, stateToCommit->crop_legacy.right, stateToCommit->crop_legacy.bottom, @@ -999,9 +993,10 @@ bool Layer::setBackgroundColor(const half3& color, float alpha, ui::Dataspace da if (!mCurrentState.bgColorLayer && alpha != 0) { // create background color layer if one does not yet exist uint32_t flags = ISurfaceComposerClient::eFXSurfaceColor; - const String8& name = mName + "BackgroundColorLayer"; + std::string name = mName + "BackgroundColorLayer"; mCurrentState.bgColorLayer = mFlinger->getFactory().createColorLayer( - LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, flags, LayerMetadata())); + LayerCreationArgs(mFlinger.get(), nullptr, std::move(name), 0, 0, flags, + LayerMetadata())); // add to child list addChild(mCurrentState.bgColorLayer); @@ -1196,11 +1191,13 @@ void Layer::updateTransformHint(const sp& display) const { // TODO(marissaw): add new layer state info to layer debugging LayerDebugInfo Layer::getLayerDebugInfo() const { + using namespace std::string_literals; + LayerDebugInfo info; const State& ds = getDrawingState(); info.mName = getName(); sp parent = getParent(); - info.mParentName = (parent == nullptr ? std::string("none") : parent->getName().string()); + info.mParentName = parent ? parent->getName() : "none"s; info.mType = getType(); info.mTransparentRegion = ds.activeTransparentRegion_legacy; @@ -1267,12 +1264,12 @@ void Layer::miniDump(std::string& result, const sp& displayDevice std::string name; if (mName.length() > 77) { std::string shortened; - shortened.append(mName.string(), 36); + shortened.append(mName, 0, 36); shortened.append("[...]"); - shortened.append(mName.string() + (mName.length() - 36), 36); - name = shortened; + shortened.append(mName, mName.length() - 36); + name = std::move(shortened); } else { - name = std::string(mName.string(), mName.size()); + name = mName; } StringAppendF(&result, " %s\n", name.c_str()); @@ -1319,14 +1316,14 @@ void Layer::getFrameStats(FrameStats* outStats) const { } void Layer::dumpFrameEvents(std::string& result) { - StringAppendF(&result, "- Layer %s (%s, %p)\n", getName().string(), getType(), this); + StringAppendF(&result, "- Layer %s (%s, %p)\n", getName().c_str(), getType(), this); Mutex::Autolock lock(mFrameEventHistoryMutex); mFrameEventHistory.checkFencesForCompletion(); mFrameEventHistory.dump(result); } void Layer::dumpCallingUidPid(std::string& result) const { - StringAppendF(&result, "Layer %s (%s) pid:%d uid:%d\n", getName().string(), getType(), + StringAppendF(&result, "Layer %s (%s) pid:%d uid:%d\n", getName().c_str(), getType(), mCallingPid, mCallingUid); } diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 3023cf5df3..ad81920dc9 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -79,12 +78,12 @@ class SurfaceInterceptor; // --------------------------------------------------------------------------- struct LayerCreationArgs { - LayerCreationArgs(SurfaceFlinger* flinger, const sp& client, const String8& name, + LayerCreationArgs(SurfaceFlinger* flinger, const sp& client, std::string name, uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata); SurfaceFlinger* flinger; const sp& client; - const String8& name; + std::string name; uint32_t w; uint32_t h; uint32_t flags; @@ -804,7 +803,7 @@ public: // Creates a new handle each time, so we only expect // this to be called once. sp getHandle(); - const String8& getName() const; + const std::string& getName() const { return mName; } virtual void notifyAvailableFrames(nsecs_t /*expectedPresentTime*/) {} virtual PixelFormat getPixelFormat() const { return PIXEL_FORMAT_NONE; } bool getPremultipledAlpha() const; @@ -820,8 +819,8 @@ protected: bool usingRelativeZ(LayerVector::StateSet stateSet) const; bool mPremultipliedAlpha{true}; - String8 mName; - String8 mTransactionName; // A cached version of "TX - " + mName for systraces + const std::string mName; + const std::string mTransactionName{"TX - " + mName}; bool mPrimaryDisplayOnly = false; diff --git a/services/surfaceflinger/LayerRejecter.cpp b/services/surfaceflinger/LayerRejecter.cpp index 8a221837ac..1a60f1ed08 100644 --- a/services/surfaceflinger/LayerRejecter.cpp +++ b/services/surfaceflinger/LayerRejecter.cpp @@ -24,7 +24,7 @@ namespace android { LayerRejecter::LayerRejecter(Layer::State& front, Layer::State& current, - bool& recomputeVisibleRegions, bool stickySet, const char* name, + bool& recomputeVisibleRegions, bool stickySet, const std::string& name, int32_t overrideScalingMode, bool transformToDisplayInverse) : mFront(front), mCurrent(current), @@ -90,7 +90,7 @@ bool LayerRejecter::reject(const sp& buf, const BufferItem& item) "(%4d,%4d) " "}\n" " requested_legacy={ wh={%4u,%4u} }}\n", - mName, bufWidth, bufHeight, item.mTransform, item.mScalingMode, + mName.c_str(), bufWidth, bufHeight, item.mTransform, item.mScalingMode, mFront.active_legacy.w, mFront.active_legacy.h, mFront.crop_legacy.left, mFront.crop_legacy.top, mFront.crop_legacy.right, mFront.crop_legacy.bottom, mFront.crop_legacy.getWidth(), mFront.crop_legacy.getHeight(), @@ -102,7 +102,8 @@ bool LayerRejecter::reject(const sp& buf, const BufferItem& item) // reject this buffer ALOGE("[%s] rejecting buffer: " "bufWidth=%d, bufHeight=%d, front.active_legacy.{w=%d, h=%d}", - mName, bufWidth, bufHeight, mFront.active_legacy.w, mFront.active_legacy.h); + mName.c_str(), bufWidth, bufHeight, mFront.active_legacy.w, + mFront.active_legacy.h); return true; } } diff --git a/services/surfaceflinger/LayerRejecter.h b/services/surfaceflinger/LayerRejecter.h index 1bd0c26dc6..fb5c750571 100644 --- a/services/surfaceflinger/LayerRejecter.h +++ b/services/surfaceflinger/LayerRejecter.h @@ -14,30 +14,29 @@ * limitations under the License. */ -#ifndef ANDROID_LAYER_REJECTER_H -#define ANDROID_LAYER_REJECTER_H +#pragma once #include "Layer.h" #include "BufferLayerConsumer.h" namespace android { - class LayerRejecter : public BufferLayerConsumer::BufferRejecter { - public: - LayerRejecter(Layer::State &front, Layer::State ¤t, bool &recomputeVisibleRegions, - bool stickySet, const char *name, int32_t overrideScalingMode, - bool transformToDisplayInverse); - virtual bool reject(const sp &buf, const BufferItem &item); +class LayerRejecter : public BufferLayerConsumer::BufferRejecter { +public: + LayerRejecter(Layer::State& front, Layer::State& current, bool& recomputeVisibleRegions, + bool stickySet, const std::string& name, int32_t overrideScalingMode, + bool transformToDisplayInverse); - private: - Layer::State &mFront; - Layer::State &mCurrent; - bool &mRecomputeVisibleRegions; - bool mStickyTransformSet; - const char *mName; - int32_t mOverrideScalingMode; - bool mTransformToDisplayInverse; - }; -} // namespace android + virtual bool reject(const sp&, const BufferItem&); -#endif // ANDROID_LAYER_REJECTER_H +private: + Layer::State& mFront; + Layer::State& mCurrent; + bool& mRecomputeVisibleRegions; + const bool mStickyTransformSet; + const std::string& mName; + const int32_t mOverrideScalingMode; + const bool mTransformToDisplayInverse; +}; + +} // namespace android diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp index 1c1367c916..30027decfb 100644 --- a/services/surfaceflinger/RegionSamplingThread.cpp +++ b/services/surfaceflinger/RegionSamplingThread.cpp @@ -436,7 +436,7 @@ void RegionSamplingThread::captureSample() { } if (!intersectsAnyArea) return; - ALOGV("Traversing [%s] [%d, %d, %d, %d]", layer->getName().string(), bounds.left, + ALOGV("Traversing [%s] [%d, %d, %d, %d]", layer->getDebugName(), bounds.left, bounds.top, bounds.right, bounds.bottom); visitor(layer); }; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 54e20659a7..0e33f10ab6 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -122,6 +122,8 @@ namespace android { +using namespace std::string_literals; + using namespace android::hardware::configstore; using namespace android::hardware::configstore::V1_0; using namespace android::sysprop; @@ -1911,8 +1913,7 @@ void SurfaceFlinger::postComposition() layer->onPostComposition(displayDevice->getId(), glCompositionDoneFenceTime, presentFenceTime, compositorTiming); if (frameLatched) { - recordBufferingStats(layer->getName().string(), - layer->getOccupancyHistory(false)); + recordBufferingStats(layer->getName(), layer->getOccupancyHistory(false)); } }); @@ -2574,7 +2575,7 @@ void SurfaceFlinger::commitTransactionLocked() { if (!mLayersPendingRemoval.isEmpty()) { // Notify removed layers now that they can't be drawn from for (const auto& l : mLayersPendingRemoval) { - recordBufferingStats(l->getName().string(), l->getOccupancyHistory(true)); + recordBufferingStats(l->getName(), l->getOccupancyHistory(true)); // Ensure any buffers set to display on any children are released. if (l->isRemovedFromCurrentState()) { @@ -3244,11 +3245,12 @@ uint32_t SurfaceFlinger::setClientStateLocked( // everything else inherits layer stack from its parent. if (layer->hasParent()) { ALOGE("Attempt to set layer stack on layer with parent (%s) is invalid", - layer->getName().string()); + layer->getDebugName()); } else if (idx < 0) { ALOGE("Attempt to set layer stack on layer without parent (%s) that " - "that also does not appear in the top level layer list. Something" - " has gone wrong.", layer->getName().string()); + "that also does not appear in the top level layer list. Something" + " has gone wrong.", + layer->getDebugName()); } else if (layer->setLayerStack(s.layerStack)) { mCurrentState.layersSortedByZ.removeAt(idx); mCurrentState.layersSortedByZ.add(layer); @@ -3406,7 +3408,7 @@ status_t SurfaceFlinger::mirrorLayer(const sp& client, const sp sp mirrorLayer; sp mirrorFrom; - String8 uniqueName = getUniqueLayerName(String8("MirrorRoot")); + std::string uniqueName = getUniqueLayerName("MirrorRoot"); { Mutex::Autolock _l(mStateLock); @@ -3415,8 +3417,8 @@ status_t SurfaceFlinger::mirrorLayer(const sp& client, const sp return NAME_NOT_FOUND; } - status_t result = createContainerLayer(client, uniqueName, -1, -1, 0, LayerMetadata(), - outHandle, &mirrorLayer); + status_t result = createContainerLayer(client, std::move(uniqueName), -1, -1, 0, + LayerMetadata(), outHandle, &mirrorLayer); if (result != NO_ERROR) { return result; } @@ -3447,7 +3449,7 @@ status_t SurfaceFlinger::createLayer(const String8& name, const sp& clie sp layer; - String8 uniqueName = getUniqueLayerName(name); + std::string uniqueName = getUniqueLayerName(name.string()); bool primaryDisplayOnly = false; @@ -3463,13 +3465,13 @@ status_t SurfaceFlinger::createLayer(const String8& name, const sp& clie switch (flags & ISurfaceComposerClient::eFXSurfaceMask) { case ISurfaceComposerClient::eFXSurfaceBufferQueue: - result = createBufferQueueLayer(client, uniqueName, w, h, flags, std::move(metadata), - format, handle, gbp, &layer); + result = createBufferQueueLayer(client, std::move(uniqueName), w, h, flags, + std::move(metadata), format, handle, gbp, &layer); break; case ISurfaceComposerClient::eFXSurfaceBufferState: - result = createBufferStateLayer(client, uniqueName, w, h, flags, std::move(metadata), - handle, &layer); + result = createBufferStateLayer(client, std::move(uniqueName), w, h, flags, + std::move(metadata), handle, &layer); break; case ISurfaceComposerClient::eFXSurfaceColor: // check if buffer size is set for color layer. @@ -3479,8 +3481,8 @@ status_t SurfaceFlinger::createLayer(const String8& name, const sp& clie return BAD_VALUE; } - result = createColorLayer(client, uniqueName, w, h, flags, std::move(metadata), handle, - &layer); + result = createColorLayer(client, std::move(uniqueName), w, h, flags, + std::move(metadata), handle, &layer); break; case ISurfaceComposerClient::eFXSurfaceContainer: // check if buffer size is set for container layer. @@ -3489,8 +3491,8 @@ status_t SurfaceFlinger::createLayer(const String8& name, const sp& clie int(w), int(h)); return BAD_VALUE; } - result = createContainerLayer(client, uniqueName, w, h, flags, std::move(metadata), - handle, &layer); + result = createContainerLayer(client, std::move(uniqueName), w, h, flags, + std::move(metadata), handle, &layer); break; default: result = BAD_VALUE; @@ -3517,35 +3519,32 @@ status_t SurfaceFlinger::createLayer(const String8& name, const sp& clie return result; } -String8 SurfaceFlinger::getUniqueLayerName(const String8& name) -{ - bool matchFound = true; - uint32_t dupeCounter = 0; +std::string SurfaceFlinger::getUniqueLayerName(const char* name) { + unsigned dupeCounter = 0; // Tack on our counter whether there is a hit or not, so everyone gets a tag - String8 uniqueName = name + "#" + String8(std::to_string(dupeCounter).c_str()); + std::string uniqueName = base::StringPrintf("%s#%u", name, dupeCounter); // Grab the state lock since we're accessing mCurrentState Mutex::Autolock lock(mStateLock); // Loop over layers until we're sure there is no matching name + bool matchFound = true; while (matchFound) { matchFound = false; mCurrentState.traverseInZOrder([&](Layer* layer) { if (layer->getName() == uniqueName) { matchFound = true; - uniqueName = name + "#" + String8(std::to_string(++dupeCounter).c_str()); + uniqueName = base::StringPrintf("%s#%u", name, ++dupeCounter); } }); } - ALOGV_IF(dupeCounter > 0, "duplicate layer name: changing %s to %s", name.c_str(), - uniqueName.c_str()); - + ALOGV_IF(dupeCounter > 0, "duplicate layer name: changing %s to %s", name, uniqueName.c_str()); return uniqueName; } -status_t SurfaceFlinger::createBufferQueueLayer(const sp& client, const String8& name, +status_t SurfaceFlinger::createBufferQueueLayer(const sp& client, std::string name, uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata, PixelFormat& format, sp* handle, @@ -3563,8 +3562,7 @@ status_t SurfaceFlinger::createBufferQueueLayer(const sp& client, const } sp layer; - LayerCreationArgs args = - LayerCreationArgs(this, client, name, w, h, flags, std::move(metadata)); + LayerCreationArgs args(this, client, std::move(name), w, h, flags, std::move(metadata)); args.textureName = getNewTexture(); { // Grab the SF state lock during this since it's the only safe way to access @@ -3585,12 +3583,11 @@ status_t SurfaceFlinger::createBufferQueueLayer(const sp& client, const return err; } -status_t SurfaceFlinger::createBufferStateLayer(const sp& client, const String8& name, +status_t SurfaceFlinger::createBufferStateLayer(const sp& client, std::string name, uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata, sp* handle, sp* outLayer) { - LayerCreationArgs args = - LayerCreationArgs(this, client, name, w, h, flags, std::move(metadata)); + LayerCreationArgs args(this, client, std::move(name), w, h, flags, std::move(metadata)); args.displayDevice = getDefaultDisplayDevice(); args.textureName = getNewTexture(); sp layer = getFactory().createBufferStateLayer(args); @@ -3600,26 +3597,25 @@ status_t SurfaceFlinger::createBufferStateLayer(const sp& client, const return NO_ERROR; } -status_t SurfaceFlinger::createColorLayer(const sp& client, const String8& name, uint32_t w, +status_t SurfaceFlinger::createColorLayer(const sp& client, std::string name, uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata, sp* handle, sp* outLayer) { *outLayer = getFactory().createColorLayer( - LayerCreationArgs(this, client, name, w, h, flags, std::move(metadata))); + {this, client, std::move(name), w, h, flags, std::move(metadata)}); *handle = (*outLayer)->getHandle(); return NO_ERROR; } -status_t SurfaceFlinger::createContainerLayer(const sp& client, const String8& name, +status_t SurfaceFlinger::createContainerLayer(const sp& client, std::string name, uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata, sp* handle, sp* outLayer) { *outLayer = getFactory().createContainerLayer( - LayerCreationArgs(this, client, name, w, h, flags, std::move(metadata))); + {this, client, std::move(name), w, h, flags, std::move(metadata)}); *handle = (*outLayer)->getHandle(); return NO_ERROR; } - void SurfaceFlinger::markLayerPendingRemovalLocked(const sp& layer) { mLayersPendingRemoval.add(layer); mLayersRemoved = true; @@ -3828,8 +3824,6 @@ status_t SurfaceFlinger::doDump(int fd, const DumpArgs& args, strerror(-err), err); } - using namespace std::string_literals; - static const std::unordered_map dumpers = { {"--display-id"s, dumper(&SurfaceFlinger::dumpDisplayIdentificationData)}, {"--dispsync"s, @@ -3885,7 +3879,7 @@ status_t SurfaceFlinger::dumpCritical(int fd, const DumpArgs&, bool asProto) { void SurfaceFlinger::listLayersLocked(std::string& result) const { mCurrentState.traverseInZOrder( - [&](Layer* layer) { StringAppendF(&result, "%s\n", layer->getName().string()); }); + [&](Layer* layer) { StringAppendF(&result, "%s\n", layer->getDebugName()); }); } void SurfaceFlinger::dumpStatsLocked(const DumpArgs& args, std::string& result) const { @@ -3894,7 +3888,7 @@ void SurfaceFlinger::dumpStatsLocked(const DumpArgs& args, std::string& result) if (args.size() > 1) { const auto name = String8(args[1]); mCurrentState.traverseInZOrder([&](Layer* layer) { - if (name == layer->getName()) { + if (layer->getName() == name.string()) { layer->dumpFrameStats(result); } }); @@ -3904,8 +3898,11 @@ void SurfaceFlinger::dumpStatsLocked(const DumpArgs& args, std::string& result) } void SurfaceFlinger::clearStatsLocked(const DumpArgs& args, std::string&) { + const bool clearAll = args.size() < 2; + const auto name = clearAll ? String8() : String8(args[1]); + mCurrentState.traverseInZOrder([&](Layer* layer) { - if (args.size() < 2 || String8(args[1]) == layer->getName()) { + if (clearAll || layer->getName() == name.string()) { layer->clearFrameStats(); } }); @@ -3924,7 +3921,7 @@ void SurfaceFlinger::logFrameStats() { layer->logFrameStats(); }); - mAnimFrameTracker.logAndResetStats(String8("")); + mAnimFrameTracker.logAndResetStats(""); } void SurfaceFlinger::appendSfConfigString(std::string& result) const { @@ -3982,8 +3979,8 @@ void SurfaceFlinger::dumpStaticScreenStats(std::string& result) const { bucketTimeSec, percent); } -void SurfaceFlinger::recordBufferingStats(const char* layerName, - std::vector&& history) { +void SurfaceFlinger::recordBufferingStats(const std::string& layerName, + std::vector&& history) { Mutex::Autolock lock(getBE().mBufferingStatsMutex); auto& stats = getBE().mBufferingStats[layerName]; for (const auto& segment : history) { @@ -5031,13 +5028,14 @@ status_t SurfaceFlinger::captureLayers( drawLayers(); } else { Rect bounds = getBounds(); + uint32_t w = static_cast(bounds.getWidth()); + uint32_t h = static_cast(bounds.getHeight()); // In the "childrenOnly" case we reparent the children to a screenshot // layer which has no properties set and which does not draw. sp screenshotParentLayer = - mFlinger->getFactory().createContainerLayer( - LayerCreationArgs(mFlinger, nullptr, String8("Screenshot Parent"), - bounds.getWidth(), bounds.getHeight(), 0, - LayerMetadata())); + mFlinger->getFactory().createContainerLayer({mFlinger, nullptr, + "Screenshot Parent"s, w, h, 0, + LayerMetadata()}); ReparentForDrawing reparent(mLayer, screenshotParentLayer, sourceCrop); drawLayers(); diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 9f3a914366..b719245caa 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -607,27 +607,27 @@ private: sp* handle, sp* gbp, const sp& parentHandle, const sp& parentLayer = nullptr); - status_t createBufferQueueLayer(const sp& client, const String8& name, uint32_t w, + status_t createBufferQueueLayer(const sp& client, std::string name, uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata, PixelFormat& format, sp* outHandle, sp* outGbp, sp* outLayer); - status_t createBufferStateLayer(const sp& client, const String8& name, uint32_t w, + status_t createBufferStateLayer(const sp& client, std::string name, uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata, sp* outHandle, sp* outLayer); - status_t createColorLayer(const sp& client, const String8& name, uint32_t w, uint32_t h, + status_t createColorLayer(const sp& client, std::string name, uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata, sp* outHandle, sp* outLayer); - status_t createContainerLayer(const sp& client, const String8& name, uint32_t w, + status_t createContainerLayer(const sp& client, std::string name, uint32_t w, uint32_t h, uint32_t flags, LayerMetadata metadata, sp* outHandle, sp* outLayer); status_t mirrorLayer(const sp& client, const sp& mirrorFromHandle, sp* outHandle); - String8 getUniqueLayerName(const String8& name); + std::string getUniqueLayerName(const char* name); // called when all clients have released all their references to // this layer meaning it is entirely safe to destroy all @@ -866,8 +866,8 @@ private: // Not const because each Layer needs to query Fences and cache timestamps. void dumpFrameEventsLocked(std::string& result); - void recordBufferingStats(const char* layerName, - std::vector&& history); + void recordBufferingStats(const std::string& layerName, + std::vector&& history); void dumpBufferingStats(std::string& result) const; void dumpDisplayIdentificationData(std::string& result) const; void dumpRawDisplayIdentificationData(const DumpArgs&, std::string& result) const; diff --git a/services/surfaceflinger/SurfaceInterceptor.cpp b/services/surfaceflinger/SurfaceInterceptor.cpp index a02d14cc4d..7e6c472d7f 100644 --- a/services/surfaceflinger/SurfaceInterceptor.cpp +++ b/services/surfaceflinger/SurfaceInterceptor.cpp @@ -165,10 +165,6 @@ const sp SurfaceInterceptor::getLayer(const wp& weak return layer; } -const std::string SurfaceInterceptor::getLayerName(const sp& layer) const { - return layer->getName().string(); -} - int32_t SurfaceInterceptor::getLayerId(const sp& layer) const { return layer->sequence; } @@ -490,7 +486,7 @@ void SurfaceInterceptor::addSurfaceCreationLocked(Increment* increment, { SurfaceCreation* creation(increment->mutable_surface_creation()); creation->set_id(getLayerId(layer)); - creation->set_name(getLayerName(layer)); + creation->set_name(layer->getName()); creation->set_w(layer->mCurrentState.active_legacy.w); creation->set_h(layer->mCurrentState.active_legacy.h); } diff --git a/services/surfaceflinger/SurfaceInterceptor.h b/services/surfaceflinger/SurfaceInterceptor.h index 6858c4d5a6..72b734b8fd 100644 --- a/services/surfaceflinger/SurfaceInterceptor.h +++ b/services/surfaceflinger/SurfaceInterceptor.h @@ -123,7 +123,6 @@ private: status_t writeProtoFileLocked(); const sp getLayer(const wp& weakHandle) const; - const std::string getLayerName(const sp& layer) const; int32_t getLayerId(const sp& layer) const; int32_t getLayerIdFromWeakRef(const wp& layer) const; int32_t getLayerIdFromHandle(const sp& weakHandle) const; diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp index 8aff096d5e..60da70fd25 100644 --- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp +++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp @@ -839,7 +839,7 @@ struct ColorLayerVariant : public BaseLayerVariant { static FlingerLayerType createLayer(CompositionTest* test) { FlingerLayerType layer = Base::template createLayerWithFactory(test, [test]() { return new ColorLayer(LayerCreationArgs(test->mFlinger.mFlinger.get(), sp(), - String8("test-layer"), LayerProperties::WIDTH, + "test-layer", LayerProperties::WIDTH, LayerProperties::HEIGHT, LayerProperties::LAYER_FLAGS, LayerMetadata())); }); @@ -879,11 +879,9 @@ struct BufferLayerVariant : public BaseLayerVariant { FlingerLayerType layer = Base::template createLayerWithFactory(test, [test]() { sp client; - String8 name("test-layer"); - LayerCreationArgs args = - LayerCreationArgs(test->mFlinger.mFlinger.get(), client, name, - LayerProperties::WIDTH, LayerProperties::HEIGHT, - LayerProperties::LAYER_FLAGS, LayerMetadata()); + LayerCreationArgs args(test->mFlinger.mFlinger.get(), client, "test-layer", + LayerProperties::WIDTH, LayerProperties::HEIGHT, + LayerProperties::LAYER_FLAGS, LayerMetadata()); args.textureName = test->mFlinger.mutableTexturePool().back(); return new BufferQueueLayer(args); }); -- cgit v1.2.3-59-g8ed1b From b0dbdaaf3b1a42ab072af9d111d56900b1197af4 Mon Sep 17 00:00:00 2001 From: Ady Abraham Date: Mon, 6 Jan 2020 16:19:42 -0800 Subject: SurfaceFlinger: Enable -WConversion in Android.bp Enable global -WConversion in Android.bp and turn it off in individual files. This is the first step to enable -WConversion in SurfaceFlinger. Test: boot Bug: 129481165 Change-Id: Ia752df39ef380bde71705a32582d618242c466f7 --- libs/renderengine/tests/RenderEngineTest.cpp | 7 +++++++ services/surfaceflinger/Android.bp | 1 + services/surfaceflinger/BufferLayer.cpp | 7 +++++++ services/surfaceflinger/BufferLayerConsumer.cpp | 7 +++++++ services/surfaceflinger/BufferQueueLayer.cpp | 7 +++++++ services/surfaceflinger/BufferStateLayer.cpp | 7 +++++++ services/surfaceflinger/Client.cpp | 7 +++++++ services/surfaceflinger/ColorLayer.cpp | 7 +++++++ .../CompositionEngine/mock/Display.cpp | 7 +++++++ .../CompositionEngine/mock/Layer.cpp | 7 +++++++ .../CompositionEngine/mock/LayerFE.cpp | 7 +++++++ .../CompositionEngine/mock/Output.cpp | 7 +++++++ .../CompositionEngine/mock/OutputLayer.cpp | 7 +++++++ .../CompositionEngine/src/CompositionEngine.cpp | 7 +++++++ .../CompositionEngine/src/Display.cpp | 7 +++++++ .../CompositionEngine/src/HwcBufferCache.cpp | 7 +++++++ .../surfaceflinger/CompositionEngine/src/Layer.cpp | 7 +++++++ .../src/LayerFECompositionState.cpp | 7 +++++++ .../CompositionEngine/src/Output.cpp | 7 +++++++ .../CompositionEngine/src/OutputLayer.cpp | 7 +++++++ .../src/OutputLayerCompositionState.cpp | 7 +++++++ .../CompositionEngine/src/RenderSurface.cpp | 7 +++++++ .../tests/CompositionEngineTest.cpp | 7 +++++++ .../CompositionEngine/tests/DisplayTest.cpp | 7 +++++++ .../CompositionEngine/tests/LayerTest.cpp | 7 +++++++ .../CompositionEngine/tests/OutputLayerTest.cpp | 7 +++++++ .../CompositionEngine/tests/OutputTest.cpp | 7 +++++++ .../CompositionEngine/tests/RenderSurfaceTest.cpp | 7 +++++++ services/surfaceflinger/ContainerLayer.cpp | 7 +++++++ services/surfaceflinger/DisplayDevice.cpp | 7 +++++++ .../surfaceflinger/DisplayHardware/ComposerHal.cpp | 7 +++++++ .../DisplayHardware/DisplayIdentification.cpp | 7 +++++++ .../DisplayHardware/FramebufferSurface.cpp | 7 +++++++ services/surfaceflinger/DisplayHardware/HWC2.cpp | 7 +++++++ .../surfaceflinger/DisplayHardware/HWComposer.cpp | 7 +++++++ .../DisplayHardware/VirtualDisplaySurface.cpp | 7 +++++++ services/surfaceflinger/Effects/Daltonizer.cpp | 7 +++++++ services/surfaceflinger/EventLog/EventLog.cpp | 7 +++++++ .../surfaceflinger/FrameTracer/FrameTracer.cpp | 7 +++++++ services/surfaceflinger/FrameTracker.cpp | 7 +++++++ services/surfaceflinger/Layer.cpp | 7 +++++++ services/surfaceflinger/LayerProtoHelper.cpp | 7 +++++++ services/surfaceflinger/LayerRejecter.cpp | 7 +++++++ services/surfaceflinger/LayerVector.cpp | 7 +++++++ services/surfaceflinger/MonitoredProducer.cpp | 7 +++++++ services/surfaceflinger/RefreshRateOverlay.cpp | 7 +++++++ services/surfaceflinger/RegionSamplingThread.cpp | 7 +++++++ services/surfaceflinger/RenderArea.cpp | 23 ++++++++++++++++++++++ services/surfaceflinger/Scheduler/DispSync.cpp | 7 +++++++ .../surfaceflinger/Scheduler/DispSyncSource.cpp | 7 +++++++ .../Scheduler/EventControlThread.cpp | 7 +++++++ services/surfaceflinger/Scheduler/EventThread.cpp | 7 +++++++ services/surfaceflinger/Scheduler/LayerHistory.cpp | 7 +++++++ services/surfaceflinger/Scheduler/MessageQueue.cpp | 7 +++++++ services/surfaceflinger/Scheduler/PhaseOffsets.cpp | 7 +++++++ .../Scheduler/RefreshRateConfigs.cpp | 6 ++++++ services/surfaceflinger/Scheduler/Scheduler.cpp | 7 +++++++ .../surfaceflinger/Scheduler/SchedulerUtils.cpp | 7 +++++++ .../surfaceflinger/Scheduler/VSyncModulator.cpp | 7 +++++++ .../surfaceflinger/Scheduler/VSyncPredictor.cpp | 7 +++++++ services/surfaceflinger/SurfaceFlinger.cpp | 7 +++++++ .../SurfaceFlingerDefaultFactory.cpp | 7 +++++++ services/surfaceflinger/SurfaceFlingerFactory.cpp | 7 +++++++ services/surfaceflinger/SurfaceInterceptor.cpp | 7 +++++++ services/surfaceflinger/SurfaceTracing.cpp | 7 +++++++ services/surfaceflinger/TimeStats/TimeStats.cpp | 7 +++++++ .../surfaceflinger/TransactionCompletedThread.cpp | 7 +++++++ services/surfaceflinger/main_surfaceflinger.cpp | 7 +++++++ services/surfaceflinger/tests/BufferGenerator.cpp | 7 +++++++ services/surfaceflinger/tests/Credentials_test.cpp | 7 +++++++ .../tests/DereferenceSurfaceControl_test.cpp | 7 +++++++ .../surfaceflinger/tests/DisplayConfigs_test.cpp | 7 +++++++ .../surfaceflinger/tests/LayerCallback_test.cpp | 7 +++++++ .../tests/LayerRenderTypeTransaction_test.cpp | 7 +++++++ .../surfaceflinger/tests/LayerTransaction_test.cpp | 7 +++++++ .../LayerTypeAndRenderTypeTransaction_test.cpp | 7 +++++++ .../tests/LayerTypeTransaction_test.cpp | 7 +++++++ services/surfaceflinger/tests/LayerUpdate_test.cpp | 7 +++++++ services/surfaceflinger/tests/MirrorLayer_test.cpp | 7 +++++++ .../tests/MultiDisplayLayerBounds_test.cpp | 7 +++++++ services/surfaceflinger/tests/RelativeZ_test.cpp | 7 +++++++ services/surfaceflinger/tests/SetGeometry_test.cpp | 7 +++++++ services/surfaceflinger/tests/Stress_test.cpp | 7 +++++++ .../tests/SurfaceInterceptor_test.cpp | 7 +++++++ .../tests/fakehwc/FakeComposerClient.cpp | 7 +++++++ .../tests/fakehwc/FakeComposerService.cpp | 7 +++++++ .../tests/fakehwc/FakeComposerUtils.cpp | 7 +++++++ .../tests/fakehwc/SFFakeHwc_test.cpp | 7 +++++++ services/surfaceflinger/tests/hwc2/Hwc2Test.cpp | 7 +++++++ .../surfaceflinger/tests/hwc2/Hwc2TestBuffer.cpp | 7 +++++++ .../surfaceflinger/tests/hwc2/Hwc2TestLayers.cpp | 7 +++++++ .../tests/hwc2/Hwc2TestPixelComparator.cpp | 7 +++++++ .../tests/hwc2/Hwc2TestProperties.cpp | 7 +++++++ .../surfaceflinger/tests/unittests/CachingTest.cpp | 7 +++++++ .../tests/unittests/CompositionTest.cpp | 7 +++++++ .../tests/unittests/DisplayTransactionTest.cpp | 7 +++++++ .../tests/unittests/FrameTracerTest.cpp | 7 +++++++ .../tests/unittests/LayerHistoryTest.cpp | 23 ++++++++++++++++++++++ .../tests/unittests/PhaseOffsetsTest.cpp | 7 +++++++ .../tests/unittests/RefreshRateConfigsTest.cpp | 8 ++++---- .../tests/unittests/RefreshRateStatsTest.cpp | 7 +++++++ .../tests/unittests/RegionSamplingTest.cpp | 7 +++++++ .../tests/unittests/SchedulerTest.cpp | 23 ++++++++++++++++++++++ .../tests/unittests/SchedulerUtilsTest.cpp | 8 +++++++- .../tests/unittests/TimeStatsTest.cpp | 7 +++++++ .../tests/unittests/TransactionApplicationTest.cpp | 7 +++++++ .../unittests/VSyncDispatchTimerQueueTest.cpp | 7 +++++++ .../tests/unittests/VSyncPredictorTest.cpp | 7 +++++++ .../mock/DisplayHardware/MockComposer.cpp | 7 +++++++ .../unittests/mock/MockSurfaceInterceptor.cpp | 7 +++++++ services/surfaceflinger/tests/vsync/vsync.cpp | 7 +++++++ 111 files changed, 815 insertions(+), 5 deletions(-) (limited to 'services/surfaceflinger/ContainerLayer.cpp') diff --git a/libs/renderengine/tests/RenderEngineTest.cpp b/libs/renderengine/tests/RenderEngineTest.cpp index ba5a3f5550..7700b2e01f 100644 --- a/libs/renderengine/tests/RenderEngineTest.cpp +++ b/libs/renderengine/tests/RenderEngineTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -1339,3 +1343,6 @@ TEST_F(RenderEngineTest, drawLayers_fillShadow_translucentCasterWithAlpha) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Android.bp b/services/surfaceflinger/Android.bp index 4c5e5da36a..8fa35d83e7 100644 --- a/services/surfaceflinger/Android.bp +++ b/services/surfaceflinger/Android.bp @@ -7,6 +7,7 @@ cc_defaults { "-Wthread-safety", "-Wunused", "-Wunreachable-code", + "-Wconversion", ], } diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index 3b1b796076..7845cab397 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + //#define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "BufferLayer" @@ -795,3 +799,6 @@ void BufferLayer::updateCloneBufferInfo() { #if defined(__gl2_h_) #error "don't include gl2/gl2.h in this file" #endif + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/BufferLayerConsumer.cpp b/services/surfaceflinger/BufferLayerConsumer.cpp index ea55795119..5e04d9597a 100644 --- a/services/surfaceflinger/BufferLayerConsumer.cpp +++ b/services/surfaceflinger/BufferLayerConsumer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "BufferLayerConsumer" #define ATRACE_TAG ATRACE_TAG_GRAPHICS @@ -519,3 +523,6 @@ BufferLayerConsumer::Image::~Image() { } } }; // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp index e4e4bc7db6..c1b87751a4 100644 --- a/services/surfaceflinger/BufferQueueLayer.cpp +++ b/services/surfaceflinger/BufferQueueLayer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "BufferQueueLayer" #define ATRACE_TAG ATRACE_TAG_GRAPHICS @@ -612,3 +616,6 @@ void BufferQueueLayer::ContentsChangedListener::abandon() { // ----------------------------------------------------------------------- } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp index 067aa46b71..c173c66b4e 100644 --- a/services/surfaceflinger/BufferStateLayer.cpp +++ b/services/surfaceflinger/BufferStateLayer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + //#define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "BufferStateLayer" @@ -681,3 +685,6 @@ sp BufferStateLayer::createClone() { return layer; } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp index f3313645fa..fb72ab8065 100644 --- a/services/surfaceflinger/Client.cpp +++ b/services/surfaceflinger/Client.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -131,3 +135,6 @@ status_t Client::getLayerFrameStats(const sp& handle, FrameStats* outSt // --------------------------------------------------------------------------- }; // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp index 8bfa569eeb..6aea88abd6 100644 --- a/services/surfaceflinger/ColorLayer.cpp +++ b/services/surfaceflinger/ColorLayer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + // #define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "ColorLayer" @@ -116,3 +120,6 @@ sp ColorLayer::createClone() { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/mock/Display.cpp b/services/surfaceflinger/CompositionEngine/mock/Display.cpp index 01cf11278b..dc303d736f 100644 --- a/services/surfaceflinger/CompositionEngine/mock/Display.cpp +++ b/services/surfaceflinger/CompositionEngine/mock/Display.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include namespace android::compositionengine::mock { @@ -24,3 +28,6 @@ Display::Display() = default; Display::~Display() = default; } // namespace android::compositionengine::mock + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/mock/Layer.cpp b/services/surfaceflinger/CompositionEngine/mock/Layer.cpp index 08483cb301..a733bacee9 100644 --- a/services/surfaceflinger/CompositionEngine/mock/Layer.cpp +++ b/services/surfaceflinger/CompositionEngine/mock/Layer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include namespace android::compositionengine::mock { @@ -24,3 +28,6 @@ Layer::Layer() = default; Layer::~Layer() = default; } // namespace android::compositionengine::mock + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/mock/LayerFE.cpp b/services/surfaceflinger/CompositionEngine/mock/LayerFE.cpp index 607eaad826..232756f247 100644 --- a/services/surfaceflinger/CompositionEngine/mock/LayerFE.cpp +++ b/services/surfaceflinger/CompositionEngine/mock/LayerFE.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include namespace android::compositionengine::mock { @@ -24,3 +28,6 @@ LayerFE::LayerFE() = default; LayerFE::~LayerFE() = default; } // namespace android::compositionengine::mock + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/mock/Output.cpp b/services/surfaceflinger/CompositionEngine/mock/Output.cpp index 44df4c3da3..2608ef0cc0 100644 --- a/services/surfaceflinger/CompositionEngine/mock/Output.cpp +++ b/services/surfaceflinger/CompositionEngine/mock/Output.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include namespace android::compositionengine::mock { @@ -24,3 +28,6 @@ Output::Output() = default; Output::~Output() = default; } // namespace android::compositionengine::mock + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/mock/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/mock/OutputLayer.cpp index 4da9377123..c1153e3596 100644 --- a/services/surfaceflinger/CompositionEngine/mock/OutputLayer.cpp +++ b/services/surfaceflinger/CompositionEngine/mock/OutputLayer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include namespace android::compositionengine::mock { @@ -24,3 +28,6 @@ OutputLayer::OutputLayer() = default; OutputLayer::~OutputLayer() = default; } // namespace android::compositionengine::mock + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp b/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp index 5eabecd3ca..030c7039f7 100644 --- a/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp +++ b/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -155,3 +159,6 @@ void CompositionEngine::updateLayerStateFromFE(CompositionRefreshArgs& args) { } // namespace impl } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/src/Display.cpp b/services/surfaceflinger/CompositionEngine/src/Display.cpp index e885629c4b..20f765c4a8 100644 --- a/services/surfaceflinger/CompositionEngine/src/Display.cpp +++ b/services/surfaceflinger/CompositionEngine/src/Display.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -337,3 +341,6 @@ void Display::finishFrame(const compositionengine::CompositionRefreshArgs& refre } } // namespace android::compositionengine::impl + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp b/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp index f72862be07..995a0ca71f 100644 --- a/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp +++ b/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -48,3 +52,6 @@ void HwcBufferCache::getHwcBuffer(int slot, const sp& buffer, uin } } // namespace android::compositionengine::impl + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/src/Layer.cpp b/services/surfaceflinger/CompositionEngine/src/Layer.cpp index ecacaeee9c..22ecd33a2a 100644 --- a/services/surfaceflinger/CompositionEngine/src/Layer.cpp +++ b/services/surfaceflinger/CompositionEngine/src/Layer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -41,3 +45,6 @@ void Layer::dump(std::string& out) const { } // namespace impl } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp b/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp index e74052994a..085e83838e 100644 --- a/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp +++ b/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -86,3 +90,6 @@ void LayerFECompositionState::dump(std::string& out) const { } } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp index 6e2816715f..01413b9478 100644 --- a/services/surfaceflinger/CompositionEngine/src/Output.cpp +++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -1058,3 +1062,6 @@ compositionengine::Output::FrameFences Output::presentAndGetFrameFences() { } // namespace impl } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp index 82d24222f1..ac66d8cbe3 100644 --- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -645,3 +649,6 @@ void OutputLayer::dump(std::string& out) const { } // namespace impl } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayerCompositionState.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayerCompositionState.cpp index cc3c54c8b1..20c8f9a112 100644 --- a/services/surfaceflinger/CompositionEngine/src/OutputLayerCompositionState.cpp +++ b/services/surfaceflinger/CompositionEngine/src/OutputLayerCompositionState.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -70,3 +74,6 @@ void OutputLayerCompositionState::dump(std::string& out) const { } } // namespace android::compositionengine::impl + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/src/RenderSurface.cpp b/services/surfaceflinger/CompositionEngine/src/RenderSurface.cpp index 949feb4041..10512eb9e9 100644 --- a/services/surfaceflinger/CompositionEngine/src/RenderSurface.cpp +++ b/services/surfaceflinger/CompositionEngine/src/RenderSurface.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include @@ -249,3 +253,6 @@ sp& RenderSurface::mutableGraphicBufferForTest() { } // namespace impl } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp b/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp index 989494d13f..ebcd0a0594 100644 --- a/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -298,3 +302,6 @@ TEST_F(CompositionTestPreComposition, } // namespace } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp b/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp index ae939693fa..0fe5843331 100644 --- a/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -833,3 +837,6 @@ TEST_F(DisplayFunctionalTest, postFramebufferCriticalCallsAreOrdered) { } // namespace } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/tests/LayerTest.cpp b/services/surfaceflinger/CompositionEngine/tests/LayerTest.cpp index 787f973215..44df2893d7 100644 --- a/services/surfaceflinger/CompositionEngine/tests/LayerTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/LayerTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -59,3 +63,6 @@ TEST_F(LayerTest, canInstantiateLayer) {} } // namespace } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp index 0e579fa7e1..bd830be68c 100644 --- a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -1054,3 +1058,6 @@ TEST_F(OutputLayerTest, needsFilteringReturnsTrueIfDisplaySizeDifferentFromSourc } // namespace } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp index 80528e3cb9..24311c7e5b 100644 --- a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -3781,3 +3785,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers, } // namespace } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/CompositionEngine/tests/RenderSurfaceTest.cpp b/services/surfaceflinger/CompositionEngine/tests/RenderSurfaceTest.cpp index fd47e453c8..4fba10bf66 100644 --- a/services/surfaceflinger/CompositionEngine/tests/RenderSurfaceTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/RenderSurfaceTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -350,3 +354,6 @@ TEST_F(RenderSurfaceTest, flipForwardsSignal) { } // namespace } // namespace android::compositionengine + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/ContainerLayer.cpp b/services/surfaceflinger/ContainerLayer.cpp index ab664be5e2..841e79f8af 100644 --- a/services/surfaceflinger/ContainerLayer.cpp +++ b/services/surfaceflinger/ContainerLayer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + // #define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "ContainerLayer" @@ -39,3 +43,6 @@ sp ContainerLayer::createClone() { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index e0dc3e7751..e2122d1d30 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + // #define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "DisplayDevice" @@ -327,3 +331,6 @@ const HdrCapabilities& DisplayDevice::getHdrCapabilities() const { std::atomic DisplayDeviceState::sNextSequenceId(1); } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp index eb032f3fe8..6892dd8ed0 100644 --- a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp +++ b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "HwcComposer" @@ -1622,3 +1626,6 @@ void CommandReader::takePresentOrValidateStage(Display display, uint32_t* state) } // namespace Hwc2 } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/DisplayHardware/DisplayIdentification.cpp b/services/surfaceflinger/DisplayHardware/DisplayIdentification.cpp index ba7818dd02..277081f230 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayIdentification.cpp +++ b/services/surfaceflinger/DisplayHardware/DisplayIdentification.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "DisplayIdentification" @@ -204,3 +208,6 @@ DisplayId getVirtualDisplayId(uint32_t id) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp index 7370b0ccb2..36544b6653 100644 --- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp +++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp @@ -15,6 +15,10 @@ ** limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + // #define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "FramebufferSurface" @@ -193,3 +197,6 @@ const sp& FramebufferSurface::getClientTargetAcquireFence() const { // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp index 12b0ddd26d..41e787980a 100644 --- a/services/surfaceflinger/DisplayHardware/HWC2.cpp +++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + // #define LOG_NDEBUG 0 #undef LOG_TAG @@ -977,3 +981,6 @@ Error Layer::setColorTransform(const android::mat4& matrix) { } // namespace impl } // namespace HWC2 + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 1960f431a8..153cfe7f9d 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + // #define LOG_NDEBUG 0 #undef LOG_TAG @@ -948,3 +952,6 @@ uint32_t HWComposer::getMaxVirtualDisplayCount() const { } // namespace impl } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp index 56b0ea61e3..fba3261388 100644 --- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp +++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + // #define LOG_NDEBUG 0 #include "VirtualDisplaySurface.h" @@ -694,3 +698,6 @@ const char* VirtualDisplaySurface::dbgSourceStr(Source s) { // --------------------------------------------------------------------------- } // namespace android // --------------------------------------------------------------------------- + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Effects/Daltonizer.cpp b/services/surfaceflinger/Effects/Daltonizer.cpp index 01c9c0fc68..a7090c51f2 100644 --- a/services/surfaceflinger/Effects/Daltonizer.cpp +++ b/services/surfaceflinger/Effects/Daltonizer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "Daltonizer.h" #include @@ -171,3 +175,6 @@ void Daltonizer::update() { } } /* namespace android */ + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/EventLog/EventLog.cpp b/services/surfaceflinger/EventLog/EventLog.cpp index a532fc130f..3b609524e8 100644 --- a/services/surfaceflinger/EventLog/EventLog.cpp +++ b/services/surfaceflinger/EventLog/EventLog.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -124,3 +128,6 @@ void EventLog::TagBuffer::writeString(const std::string_view& value) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/FrameTracer/FrameTracer.cpp b/services/surfaceflinger/FrameTracer/FrameTracer.cpp index 441811646b..b986f3844a 100644 --- a/services/surfaceflinger/FrameTracer/FrameTracer.cpp +++ b/services/surfaceflinger/FrameTracer/FrameTracer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "FrameTracer" #define ATRACE_TAG ATRACE_TAG_GRAPHICS @@ -179,3 +183,6 @@ std::string FrameTracer::miniDump() { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/FrameTracker.cpp b/services/surfaceflinger/FrameTracker.cpp index a6e511e76e..8ad805b1d8 100644 --- a/services/surfaceflinger/FrameTracker.cpp +++ b/services/surfaceflinger/FrameTracker.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + // This is needed for stdint.h to define INT64_MAX in C++ #define __STDC_LIMIT_MACROS @@ -246,3 +250,6 @@ void FrameTracker::dumpStats(std::string& result) const { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 2593681b6b..b0c94a279e 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + //#define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "Layer" @@ -2304,3 +2308,6 @@ void Layer::addChildToDrawing(const sp& layer) { #if defined(__gl2_h_) #error "don't include gl2/gl2.h in this file" #endif + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/LayerProtoHelper.cpp b/services/surfaceflinger/LayerProtoHelper.cpp index b4022704d5..0fe1421926 100644 --- a/services/surfaceflinger/LayerProtoHelper.cpp +++ b/services/surfaceflinger/LayerProtoHelper.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "LayerProtoHelper.h" namespace android { @@ -165,3 +169,6 @@ void LayerProtoHelper::writeToProto(const mat4 matrix, ColorTransformProto* colo } // namespace surfaceflinger } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/LayerRejecter.cpp b/services/surfaceflinger/LayerRejecter.cpp index 412f9779c8..d3364a0929 100644 --- a/services/surfaceflinger/LayerRejecter.cpp +++ b/services/surfaceflinger/LayerRejecter.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "LayerRejecter.h" #include @@ -136,3 +140,6 @@ bool LayerRejecter::reject(const sp& buf, const BufferItem& item) } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/LayerVector.cpp b/services/surfaceflinger/LayerVector.cpp index 8271fd97ea..7c959b9e56 100644 --- a/services/surfaceflinger/LayerVector.cpp +++ b/services/surfaceflinger/LayerVector.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "LayerVector.h" #include "Layer.h" @@ -83,3 +87,6 @@ void LayerVector::traverseInReverseZOrder(StateSet stateSet, const Visitor& visi } } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/MonitoredProducer.cpp b/services/surfaceflinger/MonitoredProducer.cpp index 7a959f7b19..5009e10532 100644 --- a/services/surfaceflinger/MonitoredProducer.cpp +++ b/services/surfaceflinger/MonitoredProducer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "MonitoredProducer.h" #include "Layer.h" #include "SurfaceFlinger.h" @@ -168,3 +172,6 @@ sp MonitoredProducer::getLayer() const { // --------------------------------------------------------------------------- }; // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/RefreshRateOverlay.cpp b/services/surfaceflinger/RefreshRateOverlay.cpp index c69859e32a..33e5796e6f 100644 --- a/services/surfaceflinger/RefreshRateOverlay.cpp +++ b/services/surfaceflinger/RefreshRateOverlay.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "RefreshRateOverlay.h" #include "Client.h" #include "Layer.h" @@ -211,3 +215,6 @@ void RefreshRateOverlay::changeRefreshRate(const RefreshRate& refreshRate) { } }; // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp index 73de4f8b78..0031d70160 100644 --- a/services/surfaceflinger/RegionSamplingThread.cpp +++ b/services/surfaceflinger/RegionSamplingThread.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + //#define LOG_NDEBUG 0 #define ATRACE_TAG ATRACE_TAG_GRAPHICS #undef LOG_TAG @@ -472,3 +476,6 @@ void RegionSamplingThread::threadMain() NO_THREAD_SAFETY_ANALYSIS { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/RenderArea.cpp b/services/surfaceflinger/RenderArea.cpp index 93759e8ad7..9a6c8533ea 100644 --- a/services/surfaceflinger/RenderArea.cpp +++ b/services/surfaceflinger/RenderArea.cpp @@ -1,3 +1,23 @@ +/* + * 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. + */ + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "RenderArea.h" namespace android { @@ -13,3 +33,6 @@ float RenderArea::getCaptureFillValue(CaptureFill captureFill) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/DispSync.cpp b/services/surfaceflinger/Scheduler/DispSync.cpp index 4bdfad94eb..ca41608c1c 100644 --- a/services/surfaceflinger/Scheduler/DispSync.cpp +++ b/services/surfaceflinger/Scheduler/DispSync.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 @@ -847,3 +851,6 @@ nsecs_t DispSync::expectedPresentTime() { } // namespace impl } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/DispSyncSource.cpp b/services/surfaceflinger/Scheduler/DispSyncSource.cpp index bd4b0ec0d1..776e98463f 100644 --- a/services/surfaceflinger/Scheduler/DispSyncSource.cpp +++ b/services/surfaceflinger/Scheduler/DispSyncSource.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include "DispSyncSource.h" @@ -104,3 +108,6 @@ void DispSyncSource::onDispSyncEvent(nsecs_t when) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/EventControlThread.cpp b/services/surfaceflinger/Scheduler/EventControlThread.cpp index 85a7f82a3c..7f9db9ca2d 100644 --- a/services/surfaceflinger/Scheduler/EventControlThread.cpp +++ b/services/surfaceflinger/Scheduler/EventControlThread.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -73,3 +77,6 @@ void EventControlThread::threadMain() NO_THREAD_SAFETY_ANALYSIS { } // namespace impl } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp index 5bdef5807f..14e3ec6ead 100644 --- a/services/surfaceflinger/Scheduler/EventThread.cpp +++ b/services/surfaceflinger/Scheduler/EventThread.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include @@ -517,3 +521,6 @@ const char* EventThread::toCString(State state) { } // namespace impl } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/LayerHistory.cpp b/services/surfaceflinger/Scheduler/LayerHistory.cpp index cf79d9fcf7..db16f8df1f 100644 --- a/services/surfaceflinger/Scheduler/LayerHistory.cpp +++ b/services/surfaceflinger/Scheduler/LayerHistory.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "LayerHistory" #define ATRACE_TAG ATRACE_TAG_GRAPHICS @@ -158,3 +162,6 @@ void LayerHistory::clear() { } } // namespace android::scheduler::impl + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/MessageQueue.cpp b/services/surfaceflinger/Scheduler/MessageQueue.cpp index 5318b00983..005d157fd5 100644 --- a/services/surfaceflinger/Scheduler/MessageQueue.cpp +++ b/services/surfaceflinger/Scheduler/MessageQueue.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -159,3 +163,6 @@ int MessageQueue::eventReceiver(int /*fd*/, int /*events*/) { } // namespace impl } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/PhaseOffsets.cpp b/services/surfaceflinger/Scheduler/PhaseOffsets.cpp index 13014c789b..106aa9bccb 100644 --- a/services/surfaceflinger/Scheduler/PhaseOffsets.cpp +++ b/services/surfaceflinger/Scheduler/PhaseOffsets.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "PhaseOffsets.h" #include @@ -330,3 +334,6 @@ void PhaseDurations::dump(std::string& result) const { } // namespace impl } // namespace android::scheduler + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp index 692ded928d..45d1f23029 100644 --- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp +++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + // #define LOG_NDEBUG 0 #include "RefreshRateConfigs.h" @@ -217,3 +221,5 @@ void RefreshRateConfigs::init(const std::vector& configs, } } // namespace android::scheduler +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp index 73dc753c7e..c96eba40fd 100644 --- a/services/surfaceflinger/Scheduler/Scheduler.cpp +++ b/services/surfaceflinger/Scheduler/Scheduler.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "Scheduler" #define ATRACE_TAG ATRACE_TAG_GRAPHICS @@ -595,3 +599,6 @@ void Scheduler::onDisplayRefreshed(nsecs_t timestamp) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/SchedulerUtils.cpp b/services/surfaceflinger/Scheduler/SchedulerUtils.cpp index fb5414fd4b..27120be272 100644 --- a/services/surfaceflinger/Scheduler/SchedulerUtils.cpp +++ b/services/surfaceflinger/Scheduler/SchedulerUtils.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "SchedulerUtils.h" #include @@ -36,3 +40,6 @@ int64_t calculate_median(std::vector* v) { } // namespace scheduler } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/VSyncModulator.cpp b/services/surfaceflinger/Scheduler/VSyncModulator.cpp index 8de35b1c2f..40a992cf01 100644 --- a/services/surfaceflinger/Scheduler/VSyncModulator.cpp +++ b/services/surfaceflinger/Scheduler/VSyncModulator.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include "VSyncModulator.h" @@ -144,3 +148,6 @@ void VSyncModulator::updateOffsetsLocked() { } } // namespace android::scheduler + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/Scheduler/VSyncPredictor.cpp b/services/surfaceflinger/Scheduler/VSyncPredictor.cpp index 3b99a58838..915419154f 100644 --- a/services/surfaceflinger/Scheduler/VSyncPredictor.cpp +++ b/services/surfaceflinger/Scheduler/VSyncPredictor.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 #include "VSyncPredictor.h" @@ -224,3 +228,6 @@ bool VSyncPredictor::needsMoreSamples(nsecs_t now) const { } } // namespace android::scheduler + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index b7a2c760e6..3dcf7d1665 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + //#define LOG_NDEBUG 0 #define ATRACE_TAG ATRACE_TAG_GRAPHICS @@ -5772,3 +5776,6 @@ status_t SurfaceFlinger::setGlobalShadowSettings(const half4& ambientColor, cons #if defined(__gl2_h_) #error "don't include gl2/gl2.h in this file" #endif + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/SurfaceFlingerDefaultFactory.cpp b/services/surfaceflinger/SurfaceFlingerDefaultFactory.cpp index d5c2306e1f..e12d31a99a 100644 --- a/services/surfaceflinger/SurfaceFlingerDefaultFactory.cpp +++ b/services/surfaceflinger/SurfaceFlingerDefaultFactory.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -138,3 +142,6 @@ sp DefaultFactory::createColorLayer(const LayerCreationArgs& args) { } } // namespace android::surfaceflinger + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/SurfaceFlingerFactory.cpp b/services/surfaceflinger/SurfaceFlingerFactory.cpp index 9b1f658661..3997b04f5f 100644 --- a/services/surfaceflinger/SurfaceFlingerFactory.cpp +++ b/services/surfaceflinger/SurfaceFlingerFactory.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "SurfaceFlinger.h" #include "SurfaceFlingerDefaultFactory.h" @@ -26,3 +30,6 @@ sp createSurfaceFlinger() { } } // namespace android::surfaceflinger + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/SurfaceInterceptor.cpp b/services/surfaceflinger/SurfaceInterceptor.cpp index 8e0462ab52..79123f979b 100644 --- a/services/surfaceflinger/SurfaceInterceptor.cpp +++ b/services/surfaceflinger/SurfaceInterceptor.cpp @@ -13,6 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" #undef LOG_TAG #define LOG_TAG "SurfaceInterceptor" #define ATRACE_TAG ATRACE_TAG_GRAPHICS @@ -677,3 +681,6 @@ void SurfaceInterceptor::savePowerModeUpdate(int32_t sequenceId, int32_t mode) { } // namespace impl } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/SurfaceTracing.cpp b/services/surfaceflinger/SurfaceTracing.cpp index eb26cd0379..6fd4e46c73 100644 --- a/services/surfaceflinger/SurfaceTracing.cpp +++ b/services/surfaceflinger/SurfaceTracing.cpp @@ -13,6 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" #undef LOG_TAG #define LOG_TAG "SurfaceTracing" #define ATRACE_TAG ATRACE_TAG_GRAPHICS @@ -202,3 +206,6 @@ void SurfaceTracing::dump(std::string& result) const { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/TimeStats/TimeStats.cpp b/services/surfaceflinger/TimeStats/TimeStats.cpp index a5fabf2c16..0939fa4f9b 100644 --- a/services/surfaceflinger/TimeStats/TimeStats.cpp +++ b/services/surfaceflinger/TimeStats/TimeStats.cpp @@ -13,6 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" #undef LOG_TAG #define LOG_TAG "TimeStats" #define ATRACE_TAG ATRACE_TAG_GRAPHICS @@ -657,3 +661,6 @@ void TimeStats::dump(bool asProto, std::optional maxLayers, std::strin } // namespace impl } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/TransactionCompletedThread.cpp b/services/surfaceflinger/TransactionCompletedThread.cpp index 1475889cd9..daa67ae043 100644 --- a/services/surfaceflinger/TransactionCompletedThread.cpp +++ b/services/surfaceflinger/TransactionCompletedThread.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + //#define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "TransactionCompletedThread" @@ -355,3 +359,6 @@ CallbackHandle::CallbackHandle(const sp& transactionListener, : listener(transactionListener), callbackIds(ids), surfaceControl(sc) {} } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/main_surfaceflinger.cpp b/services/surfaceflinger/main_surfaceflinger.cpp index e7986d3344..d7ad9deb03 100644 --- a/services/surfaceflinger/main_surfaceflinger.cpp +++ b/services/surfaceflinger/main_surfaceflinger.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -121,3 +125,6 @@ int main(int, char**) { return 0; } + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/BufferGenerator.cpp b/services/surfaceflinger/tests/BufferGenerator.cpp index 8ddda60cd2..293738cfcb 100644 --- a/services/surfaceflinger/tests/BufferGenerator.cpp +++ b/services/surfaceflinger/tests/BufferGenerator.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -379,3 +383,6 @@ void BufferGenerator::setBuffer(const sp& buffer, int32_t fence, } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/Credentials_test.cpp b/services/surfaceflinger/tests/Credentials_test.cpp index f6188738b2..a7c095d327 100644 --- a/services/surfaceflinger/tests/Credentials_test.cpp +++ b/services/surfaceflinger/tests/Credentials_test.cpp @@ -31,6 +31,10 @@ const float FRAME_SCALE = 1.0f; * Methods like EnableVsyncInjections and InjectVsync are not tested since they do not * return anything meaningful. */ + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" class CredentialsTest : public ::testing::Test { protected: void SetUp() override { @@ -362,3 +366,6 @@ TEST_F(CredentialsTest, GetActiveColorModeBasicCorrectness) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/DereferenceSurfaceControl_test.cpp b/services/surfaceflinger/tests/DereferenceSurfaceControl_test.cpp index 0cef0d1c87..46b98f9193 100644 --- a/services/surfaceflinger/tests/DereferenceSurfaceControl_test.cpp +++ b/services/surfaceflinger/tests/DereferenceSurfaceControl_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "LayerTransactionTest.h" namespace android { @@ -67,3 +71,6 @@ TEST_F(DereferenceSurfaceControlTest, LayerInTransaction) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/DisplayConfigs_test.cpp b/services/surfaceflinger/tests/DisplayConfigs_test.cpp index d51b9a146f..3aa4474b6b 100644 --- a/services/surfaceflinger/tests/DisplayConfigs_test.cpp +++ b/services/surfaceflinger/tests/DisplayConfigs_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include "LayerTransactionTest.h" namespace android { @@ -68,3 +72,6 @@ TEST_F(RefreshRateRangeTest, setAllConfigs) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" \ No newline at end of file diff --git a/services/surfaceflinger/tests/LayerCallback_test.cpp b/services/surfaceflinger/tests/LayerCallback_test.cpp index 7a5ed484d1..6d28e621ac 100644 --- a/services/surfaceflinger/tests/LayerCallback_test.cpp +++ b/services/surfaceflinger/tests/LayerCallback_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "LayerTransactionTest.h" #include "utils/CallbackUtils.h" @@ -870,3 +874,6 @@ TEST_F(LayerCallbackTest, DesiredPresentTime_Past) { EXPECT_NO_FATAL_FAILURE(waitForCallback(callback, expected, true)); } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/LayerRenderTypeTransaction_test.cpp b/services/surfaceflinger/tests/LayerRenderTypeTransaction_test.cpp index 92698f0142..24874b010b 100644 --- a/services/surfaceflinger/tests/LayerRenderTypeTransaction_test.cpp +++ b/services/surfaceflinger/tests/LayerRenderTypeTransaction_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -1841,3 +1845,6 @@ TEST_P(LayerRenderTypeTransactionTest, SetColorTransformOnChildAndParent) { } } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/LayerTransaction_test.cpp b/services/surfaceflinger/tests/LayerTransaction_test.cpp index 7816c667bb..97cba63192 100644 --- a/services/surfaceflinger/tests/LayerTransaction_test.cpp +++ b/services/surfaceflinger/tests/LayerTransaction_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include "LayerTransactionTest.h" @@ -190,3 +194,6 @@ TEST_F(LayerTransactionTest, DISABLED_BufferQueueLayerMergeDamageRegionWhenDropp ASSERT_EQ(OK, producer->disconnect(NATIVE_WINDOW_API_CPU)); } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/LayerTypeAndRenderTypeTransaction_test.cpp b/services/surfaceflinger/tests/LayerTypeAndRenderTypeTransaction_test.cpp index daeff17ea3..71f01b0c1d 100644 --- a/services/surfaceflinger/tests/LayerTypeAndRenderTypeTransaction_test.cpp +++ b/services/surfaceflinger/tests/LayerTypeAndRenderTypeTransaction_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include "TransactionTestHarnesses.h" @@ -267,3 +271,6 @@ TEST_P(LayerTypeAndRenderTypeTransactionTest, SetLayerStackBasic) { } } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/LayerTypeTransaction_test.cpp b/services/surfaceflinger/tests/LayerTypeTransaction_test.cpp index 42ec34a129..7e9202bb82 100644 --- a/services/surfaceflinger/tests/LayerTypeTransaction_test.cpp +++ b/services/surfaceflinger/tests/LayerTypeTransaction_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include "TransactionTestHarnesses.h" @@ -186,3 +190,6 @@ TEST_P(LayerTypeTransactionTest, RefreshRateIsInitialized) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/LayerUpdate_test.cpp b/services/surfaceflinger/tests/LayerUpdate_test.cpp index 0ad122b5ed..0459386936 100644 --- a/services/surfaceflinger/tests/LayerUpdate_test.cpp +++ b/services/surfaceflinger/tests/LayerUpdate_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "LayerTransactionTest.h" namespace android { @@ -1708,3 +1712,6 @@ TEST_F(ScreenCaptureTest, CaptureInvalidLayer) { ASSERT_EQ(NAME_NOT_FOUND, sf->captureLayers(redLayerHandle, &outBuffer, Rect::EMPTY_RECT, 1.0)); } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/MirrorLayer_test.cpp b/services/surfaceflinger/tests/MirrorLayer_test.cpp index 0bcac1a880..b49bd54599 100644 --- a/services/surfaceflinger/tests/MirrorLayer_test.cpp +++ b/services/surfaceflinger/tests/MirrorLayer_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "LayerTransactionTest.h" namespace android { @@ -224,3 +228,6 @@ TEST_F(MirrorLayerTest, MirrorBufferLayer) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/MultiDisplayLayerBounds_test.cpp b/services/surfaceflinger/tests/MultiDisplayLayerBounds_test.cpp index 066c9aa3ce..e525e2af9b 100644 --- a/services/surfaceflinger/tests/MultiDisplayLayerBounds_test.cpp +++ b/services/surfaceflinger/tests/MultiDisplayLayerBounds_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "LayerTransactionTest.h" namespace android { @@ -122,3 +126,6 @@ TEST_F(MultiDisplayLayerBoundsTest, RenderLayerInMirroredVirtualDisplay) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/RelativeZ_test.cpp b/services/surfaceflinger/tests/RelativeZ_test.cpp index 8c56d27e8a..1180cacf7f 100644 --- a/services/surfaceflinger/tests/RelativeZ_test.cpp +++ b/services/surfaceflinger/tests/RelativeZ_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "LayerTransactionTest.h" namespace android { @@ -204,3 +208,6 @@ TEST_F(RelativeZTest, LayerAndRelativeRemoved) { } } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/SetGeometry_test.cpp b/services/surfaceflinger/tests/SetGeometry_test.cpp index dca06ec8d4..5fe2513bb3 100644 --- a/services/surfaceflinger/tests/SetGeometry_test.cpp +++ b/services/surfaceflinger/tests/SetGeometry_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "LayerTransactionTest.h" namespace android { @@ -97,3 +101,6 @@ TEST_F(SetGeometryTest, Scale) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/Stress_test.cpp b/services/surfaceflinger/tests/Stress_test.cpp index ee857b01f2..e9b6ba0f64 100644 --- a/services/surfaceflinger/tests/Stress_test.cpp +++ b/services/surfaceflinger/tests/Stress_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -107,3 +111,6 @@ TEST(LayerProtoStress, mem_info) { } } + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp b/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp index 1fa426d14e..75d0761907 100644 --- a/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp +++ b/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -1011,3 +1015,6 @@ TEST_F(SurfaceInterceptorTest, InterceptSimultaneousUpdatesWorks) { ASSERT_TRUE(singleIncrementFound(capturedTrace, Increment::IncrementCase::kSurfaceCreation)); } } + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/fakehwc/FakeComposerClient.cpp b/services/surfaceflinger/tests/fakehwc/FakeComposerClient.cpp index 0c370a6fdb..5824e589d1 100644 --- a/services/surfaceflinger/tests/fakehwc/FakeComposerClient.cpp +++ b/services/surfaceflinger/tests/fakehwc/FakeComposerClient.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + //#define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "FakeComposer" @@ -896,3 +900,6 @@ Layer FakeComposerClient::getLayer(size_t index) const { // this might get more involving. return static_cast(index); } + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/fakehwc/FakeComposerService.cpp b/services/surfaceflinger/tests/fakehwc/FakeComposerService.cpp index f727bc4079..c656eed0fb 100644 --- a/services/surfaceflinger/tests/fakehwc/FakeComposerService.cpp +++ b/services/surfaceflinger/tests/fakehwc/FakeComposerService.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "FakeHwcService" @@ -170,3 +174,6 @@ Return FakeComposerService_2_4::createClient_2_4(createClient_2_4_cb hidl_ } } // namespace sftest + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/fakehwc/FakeComposerUtils.cpp b/services/surfaceflinger/tests/fakehwc/FakeComposerUtils.cpp index 4d2146810b..2f89696e8e 100644 --- a/services/surfaceflinger/tests/fakehwc/FakeComposerUtils.cpp +++ b/services/surfaceflinger/tests/fakehwc/FakeComposerUtils.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "FakeHwcUtil" @@ -183,3 +187,6 @@ void FakeHwcEnvironment::TearDown() { } } // namespace sftest + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/fakehwc/SFFakeHwc_test.cpp b/services/surfaceflinger/tests/fakehwc/SFFakeHwc_test.cpp index 09fdbdf114..18572064b6 100644 --- a/services/surfaceflinger/tests/fakehwc/SFFakeHwc_test.cpp +++ b/services/surfaceflinger/tests/fakehwc/SFFakeHwc_test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + // #define LOG_NDEBUG 0 #undef LOG_TAG #define LOG_TAG "FakeHwcTest" @@ -1970,3 +1974,6 @@ int main(int argc, char** argv) { ::testing::InitGoogleMock(&argc, argv); return RUN_ALL_TESTS(); } + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp b/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp index 13774b4ed3..f9a1fe9a73 100644 --- a/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp +++ b/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -4770,3 +4774,6 @@ TEST_F(Hwc2Test, PRESENT_VIRTUAL_DISPLAY_default_5) ASSERT_NO_FATAL_FAILURE(createAndPresentVirtualDisplay(layerCnt, coverage, virtualDisplayExceptions)); } + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/hwc2/Hwc2TestBuffer.cpp b/services/surfaceflinger/tests/hwc2/Hwc2TestBuffer.cpp index 648456295d..fcd0d31078 100644 --- a/services/surfaceflinger/tests/hwc2/Hwc2TestBuffer.cpp +++ b/services/surfaceflinger/tests/hwc2/Hwc2TestBuffer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -789,3 +793,6 @@ int Hwc2TestOutputBuffer::getOutputBuffer(buffer_handle_t* outHandle, return 0; } + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/hwc2/Hwc2TestLayers.cpp b/services/surfaceflinger/tests/hwc2/Hwc2TestLayers.cpp index 90127a1302..b76ace8752 100644 --- a/services/surfaceflinger/tests/hwc2/Hwc2TestLayers.cpp +++ b/services/surfaceflinger/tests/hwc2/Hwc2TestLayers.cpp @@ -13,6 +13,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -279,3 +283,6 @@ bool Hwc2TestLayers::setVisibleRegions() return optimized; } + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/hwc2/Hwc2TestPixelComparator.cpp b/services/surfaceflinger/tests/hwc2/Hwc2TestPixelComparator.cpp index 904b927abf..8ca88150e9 100644 --- a/services/surfaceflinger/tests/hwc2/Hwc2TestPixelComparator.cpp +++ b/services/surfaceflinger/tests/hwc2/Hwc2TestPixelComparator.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include @@ -111,3 +115,6 @@ std::string ComparatorResult::dumpComparison() const } return stream.str(); } + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/hwc2/Hwc2TestProperties.cpp b/services/surfaceflinger/tests/hwc2/Hwc2TestProperties.cpp index c5b92d0664..1efb21e639 100644 --- a/services/surfaceflinger/tests/hwc2/Hwc2TestProperties.cpp +++ b/services/surfaceflinger/tests/hwc2/Hwc2TestProperties.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -780,3 +784,6 @@ const std::array Hwc2TestSurfaceDamage::mCompositionSupport = {{ const std::array Hwc2TestTransform::mCompositionSupport = {{ false, true, true, false, true, true, }}; + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/CachingTest.cpp b/services/surfaceflinger/tests/unittests/CachingTest.cpp index 74ce540626..1b8c76d1b9 100644 --- a/services/surfaceflinger/tests/unittests/CachingTest.cpp +++ b/services/surfaceflinger/tests/unittests/CachingTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "CachingTest" @@ -91,3 +95,6 @@ TEST_F(SlotGenerationTest, getHwcCacheSlot_Reuse) { } } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp index cce21ceddb..8a762d4030 100644 --- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp +++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "CompositionTest" @@ -1423,3 +1427,6 @@ TEST_F(CompositionTest, DebugOptionForcingClientCompositionOfBufferLayerWithDirt } // namespace } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp index 55c3ab8b22..33563eaed6 100644 --- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp +++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "LibSurfaceFlingerUnittests" @@ -3239,3 +3243,6 @@ TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToUnknownExternalDispla } // namespace } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/FrameTracerTest.cpp b/services/surfaceflinger/tests/unittests/FrameTracerTest.cpp index c334bcf85d..68cb52fe87 100644 --- a/services/surfaceflinger/tests/unittests/FrameTracerTest.cpp +++ b/services/surfaceflinger/tests/unittests/FrameTracerTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "LibSurfaceFlingerUnittests" @@ -394,3 +398,6 @@ TEST_F(FrameTracerTest, traceFenceWithValidStartTime_ShouldHaveCorrectDuration) } // namespace } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp b/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp index f055fe72ac..c9af057ae5 100644 --- a/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp +++ b/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp @@ -1,3 +1,23 @@ +/* + * Copyright 2019 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. + */ + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "LayerHistoryTest" @@ -241,3 +261,6 @@ TEST_F(LayerHistoryTest, multipleLayers) { } // namespace } // namespace android::scheduler + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/PhaseOffsetsTest.cpp b/services/surfaceflinger/tests/unittests/PhaseOffsetsTest.cpp index 6360ec14cd..910e73baf2 100644 --- a/services/surfaceflinger/tests/unittests/PhaseOffsetsTest.cpp +++ b/services/surfaceflinger/tests/unittests/PhaseOffsetsTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "SchedulerUnittests" @@ -124,3 +128,6 @@ TEST_F(PhaseOffsetsTest, getOffsetsForRefreshRate_DefaultOffsets) { } // namespace } // namespace scheduler } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" \ No newline at end of file diff --git a/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp b/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp index cc3c985aa1..86aa8fb22b 100644 --- a/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp +++ b/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp @@ -242,11 +242,11 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContent) { TEST_F(RefreshRateConfigsTest, testInPolicy) { RefreshRate expectedDefaultConfig = {HWC_CONFIG_ID_60, VSYNC_60_POINT_4, HWC_GROUP_ID_0, "60fps", 60}; - ASSERT_TRUE(expectedDefaultConfig.inPolicy(60.000004, 60.000004)); + ASSERT_TRUE(expectedDefaultConfig.inPolicy(60.000004f, 60.000004f)); ASSERT_TRUE(expectedDefaultConfig.inPolicy(59.0f, 60.1f)); - ASSERT_FALSE(expectedDefaultConfig.inPolicy(75.0, 90.0)); - ASSERT_FALSE(expectedDefaultConfig.inPolicy(60.0011, 90.0)); - ASSERT_FALSE(expectedDefaultConfig.inPolicy(50.0, 59.998)); + ASSERT_FALSE(expectedDefaultConfig.inPolicy(75.0f, 90.0f)); + ASSERT_FALSE(expectedDefaultConfig.inPolicy(60.0011f, 90.0f)); + ASSERT_FALSE(expectedDefaultConfig.inPolicy(50.0f, 59.998f)); } } // namespace diff --git a/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp b/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp index ef4699f628..8e07c79656 100644 --- a/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp +++ b/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "SchedulerUnittests" @@ -195,3 +199,6 @@ TEST_F(RefreshRateStatsTest, twoConfigsTest) { } // namespace } // namespace scheduler } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/RegionSamplingTest.cpp b/services/surfaceflinger/tests/unittests/RegionSamplingTest.cpp index d8de804ad8..f19e55409c 100644 --- a/services/surfaceflinger/tests/unittests/RegionSamplingTest.cpp +++ b/services/surfaceflinger/tests/unittests/RegionSamplingTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "RegionSamplingTest" @@ -137,3 +141,6 @@ TEST_F(RegionSamplingTest, orientation_90) { } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp index 40536abc5d..b1ecf4da6e 100644 --- a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp +++ b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp @@ -1,3 +1,23 @@ +/* + * Copyright 2019 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. + */ + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "SchedulerUnittests" @@ -144,3 +164,6 @@ TEST_F(SchedulerTest, validConnectionHandle) { } // namespace } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/SchedulerUtilsTest.cpp b/services/surfaceflinger/tests/unittests/SchedulerUtilsTest.cpp index 5865579641..5f6a7150d6 100644 --- a/services/surfaceflinger/tests/unittests/SchedulerUtilsTest.cpp +++ b/services/surfaceflinger/tests/unittests/SchedulerUtilsTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "SchedulerUnittests" @@ -128,4 +132,6 @@ TEST_F(SchedulerUtilsTest, calculate_mode) { } // namespace } // namespace scheduler -} // namespace android \ No newline at end of file +} // namespace android +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp b/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp index 3e808c0abb..bcf3ba8856 100644 --- a/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp +++ b/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "LibSurfaceFlingerUnittests" @@ -656,3 +660,6 @@ TEST_F(TimeStatsTest, canSurviveMonkey) { } // namespace } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp b/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp index 994a509e4f..f1739e5e8a 100644 --- a/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp +++ b/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "CompositionTest" @@ -321,3 +325,6 @@ TEST_F(TransactionApplicationTest, FromHandle) { EXPECT_EQ(nullptr, ret.get()); } } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/VSyncDispatchTimerQueueTest.cpp b/services/surfaceflinger/tests/unittests/VSyncDispatchTimerQueueTest.cpp index 5aff4296f9..82919abe03 100644 --- a/services/surfaceflinger/tests/unittests/VSyncDispatchTimerQueueTest.cpp +++ b/services/surfaceflinger/tests/unittests/VSyncDispatchTimerQueueTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "LibSurfaceFlingerUnittests" #define LOG_NDEBUG 0 @@ -803,3 +807,6 @@ TEST_F(VSyncDispatchTimerQueueEntryTest, reportsScheduledIfStillTime) { } } // namespace android::scheduler + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/VSyncPredictorTest.cpp b/services/surfaceflinger/tests/unittests/VSyncPredictorTest.cpp index 4cb6a38217..00d3cc6e0b 100644 --- a/services/surfaceflinger/tests/unittests/VSyncPredictorTest.cpp +++ b/services/surfaceflinger/tests/unittests/VSyncPredictorTest.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #undef LOG_TAG #define LOG_TAG "LibSurfaceFlingerUnittests" #define LOG_NDEBUG 0 @@ -352,3 +356,6 @@ TEST_F(VSyncPredictorTest, doesNotPredictBeforeTimePointWithHigherIntercept) { } } // namespace android::scheduler + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.cpp b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.cpp index 7ed57b9d96..0780af1f26 100644 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.cpp +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "mock/DisplayHardware/MockComposer.h" namespace android { @@ -27,3 +31,6 @@ Composer::~Composer() = default; } // namespace mock } // namespace Hwc2 } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.cpp b/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.cpp index 4129328ba9..7e925b94ee 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.cpp +++ b/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include "mock/MockSurfaceInterceptor.h" namespace android { @@ -25,3 +29,6 @@ SurfaceInterceptor::~SurfaceInterceptor() = default; } // namespace mock } // namespace android + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/vsync/vsync.cpp b/services/surfaceflinger/tests/vsync/vsync.cpp index a1b45e6adb..667dfb92d5 100644 --- a/services/surfaceflinger/tests/vsync/vsync.cpp +++ b/services/surfaceflinger/tests/vsync/vsync.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" + #include #include #include @@ -82,3 +86,6 @@ int main(int /*argc*/, char** /*argv*/) return 0; } + +// TODO(b/129481165): remove the #pragma below and fix conversion issues +#pragma clang diagnostic pop // ignored "-Wconversion" -- cgit v1.2.3-59-g8ed1b