Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 19 | #include <sys/types.h> |
| 20 | #include <cstdint> |
| 21 | #include <list> |
Marissa Wall | 947d34e | 2019-03-29 14:03:53 -0700 | [diff] [blame] | 22 | #include <stack> |
| 23 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 24 | #include <android/gui/ISurfaceComposerClient.h> |
| 25 | #include <gui/LayerState.h> |
| 26 | #include <renderengine/Image.h> |
| 27 | #include <renderengine/Mesh.h> |
| 28 | #include <renderengine/RenderEngine.h> |
| 29 | #include <renderengine/Texture.h> |
| 30 | #include <system/window.h> // For NATIVE_WINDOW_SCALING_MODE_FREEZE |
| 31 | #include <ui/FrameStats.h> |
| 32 | #include <ui/GraphicBuffer.h> |
| 33 | #include <ui/PixelFormat.h> |
| 34 | #include <ui/Region.h> |
| 35 | #include <utils/RefBase.h> |
| 36 | #include <utils/String8.h> |
| 37 | #include <utils/Timers.h> |
| 38 | |
| 39 | #include "Client.h" |
| 40 | #include "DisplayHardware/HWComposer.h" |
| 41 | #include "FrameTimeline.h" |
| 42 | #include "FrameTracker.h" |
Vishnu Nair | 397a0e3 | 2022-07-26 00:01:48 +0000 | [diff] [blame] | 43 | #include "HwcSlotGenerator.h" |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 44 | #include "Layer.h" |
| 45 | #include "LayerVector.h" |
| 46 | #include "SurfaceFlinger.h" |
| 47 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 48 | namespace android { |
| 49 | |
Valerie Hau | 6449968 | 2019-04-10 11:04:29 -0700 | [diff] [blame] | 50 | class SlotGenerationTest; |
| 51 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 52 | class BufferStateLayer : public Layer { |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 53 | public: |
Lloyd Pique | 42ab75e | 2018-09-12 20:46:03 -0700 | [diff] [blame] | 54 | explicit BufferStateLayer(const LayerCreationArgs&); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 55 | |
Alec Mouri | 4545a8a | 2019-08-08 20:05:32 -0700 | [diff] [blame] | 56 | ~BufferStateLayer() override; |
| 57 | |
Peiyong Lin | f243e5e | 2020-08-22 17:40:59 -0700 | [diff] [blame] | 58 | // Implements Layer. |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 59 | sp<compositionengine::LayerFE> getCompositionEngineLayerFE() const override; |
| 60 | compositionengine::LayerFECompositionState* editCompositionState() override; |
| 61 | |
| 62 | // If we have received a new buffer this frame, we will pass its surface |
| 63 | // damage down to hardware composer. Otherwise, we must send a region with |
| 64 | // one empty rect. |
| 65 | void useSurfaceDamage() override; |
| 66 | void useEmptyDamage() override; |
| 67 | |
| 68 | bool isOpaque(const Layer::State& s) const override; |
| 69 | bool canReceiveInput() const override; |
| 70 | |
| 71 | // isVisible - true if this layer is visible, false otherwise |
| 72 | bool isVisible() const override; |
| 73 | |
| 74 | // isProtected - true if the layer may contain protected content in the |
| 75 | // GRALLOC_USAGE_PROTECTED sense. |
| 76 | bool isProtected() const override; |
| 77 | |
Vishnu Nair | 397a0e3 | 2022-07-26 00:01:48 +0000 | [diff] [blame] | 78 | bool usesSourceCrop() const override { return true; } |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 79 | |
| 80 | bool isHdrY410() const override; |
| 81 | |
| 82 | void onPostComposition(const DisplayDevice*, const std::shared_ptr<FenceTime>& glDoneFence, |
| 83 | const std::shared_ptr<FenceTime>& presentFence, |
| 84 | const CompositorTiming&) override; |
| 85 | |
| 86 | // latchBuffer - called each time the screen is redrawn and returns whether |
| 87 | // the visible regions need to be recomputed (this is a fairly heavy |
| 88 | // operation, so this should be set only if needed). Typically this is used |
| 89 | // to figure out if the content or size of a surface has changed. |
Vishnu Nair | 397a0e3 | 2022-07-26 00:01:48 +0000 | [diff] [blame] | 90 | bool latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime) override; |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 91 | bool hasReadyFrame() const override; |
| 92 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 93 | // Calls latchBuffer if the buffer has a frame queued and then releases the buffer. |
| 94 | // This is used if the buffer is just latched and releases to free up the buffer |
| 95 | // and will not be shown on screen. |
| 96 | // Should only be called on the main thread. |
| 97 | void latchAndReleaseBuffer() override; |
| 98 | |
| 99 | bool getTransformToDisplayInverse() const override; |
| 100 | |
| 101 | Rect getBufferCrop() const override; |
| 102 | |
| 103 | uint32_t getBufferTransform() const override; |
| 104 | |
| 105 | ui::Dataspace getDataSpace() const override; |
| 106 | |
| 107 | sp<GraphicBuffer> getBuffer() const override; |
| 108 | const std::shared_ptr<renderengine::ExternalTexture>& getExternalTexture() const override; |
| 109 | |
| 110 | ui::Transform::RotationFlags getTransformHint() const override { return mTransformHint; } |
| 111 | |
| 112 | // Implements Layer. |
chaviw | 8a01fa4 | 2019-08-19 12:39:31 -0700 | [diff] [blame] | 113 | const char* getType() const override { return "BufferStateLayer"; } |
| 114 | |
Dominik Laskowski | b17c621 | 2022-05-09 09:36:19 -0700 | [diff] [blame] | 115 | void onLayerDisplayed(ftl::SharedFuture<FenceResult>) override; |
Sally Qi | 59a9f50 | 2021-10-12 18:53:23 +0000 | [diff] [blame] | 116 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 117 | void releasePendingBuffer(nsecs_t dequeueReadyTime) override; |
| 118 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 119 | Region getActiveTransparentRegion(const Layer::State& s) const override { |
| 120 | return s.transparentRegionHint; |
| 121 | } |
| 122 | Rect getCrop(const Layer::State& s) const; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 123 | |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 124 | bool setTransform(uint32_t transform) override; |
| 125 | bool setTransformToDisplayInverse(bool transformToDisplayInverse) override; |
| 126 | bool setCrop(const Rect& crop) override; |
Vishnu Nair | dbbe385 | 2022-01-12 20:22:11 -0800 | [diff] [blame] | 127 | bool setBuffer(std::shared_ptr<renderengine::ExternalTexture>& /* buffer */, |
| 128 | const BufferData& bufferData, nsecs_t postTime, nsecs_t desiredPresentTime, |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 129 | bool isAutoTimestamp, std::optional<nsecs_t> dequeueTime, |
| 130 | const FrameTimelineInfo& info) override; |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 131 | bool setDataspace(ui::Dataspace dataspace) override; |
| 132 | bool setHdrMetadata(const HdrMetadata& hdrMetadata) override; |
| 133 | bool setSurfaceDamageRegion(const Region& surfaceDamage) override; |
| 134 | bool setApi(int32_t api) override; |
| 135 | bool setSidebandStream(const sp<NativeHandle>& sidebandStream) override; |
Jiakai Zhang | a5505cb | 2021-11-09 11:46:30 +0000 | [diff] [blame] | 136 | bool setTransactionCompletedListeners(const std::vector<sp<CallbackHandle>>& handles) override; |
Chavi Weingarten | a5aedbd | 2021-04-09 13:37:33 +0000 | [diff] [blame] | 137 | bool setPosition(float /*x*/, float /*y*/) override; |
Robert Carr | de6d7b4 | 2022-01-07 18:23:06 -0800 | [diff] [blame] | 138 | bool setMatrix(const layer_state_t::matrix22_t& /*matrix*/); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 139 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 140 | // Override to ignore legacy layer state properties that are not used by BufferStateLayer |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 141 | bool setSize(uint32_t /*w*/, uint32_t /*h*/) override { return false; } |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 142 | bool setTransparentRegionHint(const Region& transparent) override; |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 143 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 144 | // BufferStateLayers can return Rect::INVALID_RECT if the layer does not have a display frame |
| 145 | // and its parent layer is not bounded |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 146 | Rect getBufferSize(const State& s) const override; |
Vishnu Nair | 4351ad5 | 2019-02-11 14:13:02 -0800 | [diff] [blame] | 147 | FloatRect computeSourceBounds(const FloatRect& parentBounds) const override; |
Vishnu Nair | cf26a0a | 2020-11-13 12:56:20 -0800 | [diff] [blame] | 148 | void setAutoRefresh(bool autoRefresh) override; |
Valerie Hau | bc6ddb1 | 2019-03-08 11:10:15 -0800 | [diff] [blame] | 149 | |
chaviw | f3f40fe | 2021-04-27 15:54:02 -0500 | [diff] [blame] | 150 | bool setBufferCrop(const Rect& bufferCrop) override; |
Vishnu Nair | 6bdec7d | 2021-05-10 15:01:13 -0700 | [diff] [blame] | 151 | bool setDestinationFrame(const Rect& destinationFrame) override; |
Robert Carr | 6a16031 | 2021-05-17 12:08:20 -0700 | [diff] [blame] | 152 | bool updateGeometry() override; |
chaviw | f3f40fe | 2021-04-27 15:54:02 -0500 | [diff] [blame] | 153 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 154 | bool fenceHasSignaled() const; |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 155 | bool onPreComposition(nsecs_t) override; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 156 | |
Robert Carr | 7121caf | 2020-12-15 13:07:32 -0800 | [diff] [blame] | 157 | // See mPendingBufferTransactions |
Robert Carr | 7121caf | 2020-12-15 13:07:32 -0800 | [diff] [blame] | 158 | void decrementPendingBufferCount(); |
Vishnu Nair | 8eda69e | 2021-02-26 10:42:10 -0800 | [diff] [blame] | 159 | std::atomic<int32_t>* getPendingBufferCounter() override { return &mPendingBufferTransactions; } |
| 160 | std::string getPendingBufferCounterName() override { return mBlastTransactionName; } |
Robert Carr | 7121caf | 2020-12-15 13:07:32 -0800 | [diff] [blame] | 161 | |
chaviw | 4244e03 | 2019-09-04 11:27:49 -0700 | [diff] [blame] | 162 | protected: |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 163 | void gatherBufferInfo(); |
Jorim Jaggi | 9c03b50 | 2020-11-24 23:51:31 +0100 | [diff] [blame] | 164 | void onSurfaceFrameCreated(const std::shared_ptr<frametimeline::SurfaceFrame>& surfaceFrame); |
chaviw | 39d0147 | 2021-04-08 14:26:24 -0500 | [diff] [blame] | 165 | ui::Transform getInputTransform() const override; |
| 166 | Rect getInputBounds() const override; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 167 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 168 | struct BufferInfo { |
| 169 | nsecs_t mDesiredPresentTime; |
| 170 | std::shared_ptr<FenceTime> mFenceTime; |
| 171 | sp<Fence> mFence; |
| 172 | uint32_t mTransform{0}; |
| 173 | ui::Dataspace mDataspace{ui::Dataspace::UNKNOWN}; |
| 174 | Rect mCrop; |
| 175 | uint32_t mScaleMode{NATIVE_WINDOW_SCALING_MODE_FREEZE}; |
| 176 | Region mSurfaceDamage; |
| 177 | HdrMetadata mHdrMetadata; |
| 178 | int mApi; |
| 179 | PixelFormat mPixelFormat{PIXEL_FORMAT_NONE}; |
| 180 | bool mTransformToDisplayInverse{false}; |
| 181 | |
| 182 | std::shared_ptr<renderengine::ExternalTexture> mBuffer; |
| 183 | uint64_t mFrameNumber; |
| 184 | int mBufferSlot{BufferQueue::INVALID_BUFFER_SLOT}; |
| 185 | |
| 186 | bool mFrameLatencyNeeded{false}; |
| 187 | }; |
| 188 | |
| 189 | BufferInfo mBufferInfo; |
| 190 | |
| 191 | std::optional<compositionengine::LayerFE::LayerSettings> prepareClientComposition( |
| 192 | compositionengine::LayerFE::ClientCompositionTargetSettings&) override; |
| 193 | |
| 194 | /* |
| 195 | * compositionengine::LayerFE overrides |
| 196 | */ |
| 197 | const compositionengine::LayerFECompositionState* getCompositionState() const override; |
| 198 | void preparePerFrameCompositionState() override; |
| 199 | |
| 200 | static bool getOpacityForFormat(PixelFormat format); |
| 201 | |
| 202 | // from graphics API |
| 203 | const uint32_t mTextureName; |
| 204 | ui::Dataspace translateDataspace(ui::Dataspace dataspace); |
| 205 | void setInitialValuesForClone(const sp<Layer>& clonedFrom); |
| 206 | void updateCloneBufferInfo() override; |
| 207 | uint64_t mPreviousFrameNumber = 0; |
| 208 | |
| 209 | void setTransformHint(ui::Transform::RotationFlags displayTransformHint) override; |
| 210 | |
| 211 | // Transform hint provided to the producer. This must be accessed holding |
| 212 | // the mStateLock. |
| 213 | ui::Transform::RotationFlags mTransformHint = ui::Transform::ROT_0; |
| 214 | |
| 215 | bool getAutoRefresh() const { return mDrawingState.autoRefresh; } |
| 216 | bool getSidebandStreamChanged() const { return mSidebandStreamChanged; } |
| 217 | |
| 218 | std::atomic<bool> mSidebandStreamChanged{false}; |
| 219 | |
chaviw | 4244e03 | 2019-09-04 11:27:49 -0700 | [diff] [blame] | 220 | private: |
Peiyong Lin | f243e5e | 2020-08-22 17:40:59 -0700 | [diff] [blame] | 221 | friend class SlotGenerationTest; |
Adithya Srinivasan | b238cd5 | 2021-02-04 17:54:05 +0000 | [diff] [blame] | 222 | friend class TransactionFrameTracerTest; |
Adithya Srinivasan | b9a7dab | 2021-01-14 23:49:46 +0000 | [diff] [blame] | 223 | friend class TransactionSurfaceFrameTest; |
| 224 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 225 | // We generate InputWindowHandles for all non-cursor buffered layers regardless of whether they |
| 226 | // have an InputChannel. This is to enable the InputDispatcher to do PID based occlusion |
| 227 | // detection. |
| 228 | bool needsInputInfo() const override { return !mPotentialCursor; } |
| 229 | |
| 230 | // Returns true if this layer requires filtering |
| 231 | bool needsFiltering(const DisplayDevice*) const override; |
| 232 | bool needsFilteringForScreenshots(const DisplayDevice*, |
| 233 | const ui::Transform& inverseParentTransform) const override; |
| 234 | |
| 235 | PixelFormat getPixelFormat() const; |
| 236 | |
| 237 | // Computes the transform matrix using the setFilteringEnabled to determine whether the |
| 238 | // transform matrix should be computed for use with bilinear filtering. |
| 239 | void getDrawingTransformMatrix(bool filteringEnabled, float outMatrix[16]); |
| 240 | |
| 241 | std::unique_ptr<compositionengine::LayerFECompositionState> mCompositionState; |
| 242 | |
Vishnu Nair | 8eda69e | 2021-02-26 10:42:10 -0800 | [diff] [blame] | 243 | inline void tracePendingBufferCount(int32_t pendingBuffers); |
Peiyong Lin | f243e5e | 2020-08-22 17:40:59 -0700 | [diff] [blame] | 244 | |
Valerie Hau | bf78464 | 2020-01-29 07:25:23 -0800 | [diff] [blame] | 245 | bool updateFrameEventHistory(const sp<Fence>& acquireFence, nsecs_t postedTime, |
| 246 | nsecs_t requestedPresentTime); |
| 247 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 248 | // Latch sideband stream and returns true if the dirty region should be updated. |
| 249 | bool latchSidebandStream(bool& recomputeVisibleRegions); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 250 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 251 | bool hasFrameUpdate() const; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 252 | |
Vishnu Nair | 397a0e3 | 2022-07-26 00:01:48 +0000 | [diff] [blame] | 253 | void updateTexImage(nsecs_t latchTime); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 254 | |
chaviw | b4c6e58 | 2019-08-16 14:35:07 -0700 | [diff] [blame] | 255 | sp<Layer> createClone() override; |
Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 256 | |
chaviw | 4244e03 | 2019-09-04 11:27:49 -0700 | [diff] [blame] | 257 | // Crop that applies to the buffer |
Vishnu Nair | 5cc9ac0 | 2021-04-19 13:23:38 -0700 | [diff] [blame] | 258 | Rect computeBufferCrop(const State& s); |
chaviw | 4244e03 | 2019-09-04 11:27:49 -0700 | [diff] [blame] | 259 | |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 260 | bool willPresentCurrentTransaction() const; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 261 | |
Vishnu Nair | a72f6c0 | 2022-07-01 05:33:08 +0000 | [diff] [blame] | 262 | // Returns true if the transformed buffer size does not match the layer size and we need |
| 263 | // to apply filtering. |
| 264 | bool bufferNeedsFiltering() const; |
Vishnu Nair | e7f79c5 | 2020-10-29 14:45:03 -0700 | [diff] [blame] | 265 | |
Ady Abraham | 9dada82 | 2022-02-03 10:26:59 -0800 | [diff] [blame] | 266 | bool simpleBufferUpdate(const layer_state_t& s) const override; |
| 267 | |
Chavi Weingarten | d00e0f7 | 2022-07-14 15:59:20 +0000 | [diff] [blame] | 268 | void callReleaseBufferCallback(const sp<ITransactionCompletedListener>& listener, |
| 269 | const sp<GraphicBuffer>& buffer, uint64_t framenumber, |
| 270 | const sp<Fence>& releaseFence, |
| 271 | uint32_t currentMaxAcquiredBufferCount); |
| 272 | |
Vishnu Nair | 4ba0c2e | 2021-06-24 11:27:17 -0700 | [diff] [blame] | 273 | ReleaseCallbackId mPreviousReleaseCallbackId = ReleaseCallbackId::INVALID_ID; |
Mikael Pessa | 2e1608f | 2019-07-19 11:25:35 -0700 | [diff] [blame] | 274 | uint64_t mPreviousReleasedFrameNumber = 0; |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 275 | |
Robert Carr | 79dc06a | 2022-02-22 15:28:59 -0800 | [diff] [blame] | 276 | uint64_t mPreviousBarrierFrameNumber = 0; |
| 277 | |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 278 | bool mReleasePreviousBuffer = false; |
Vishnu Nair | 1506b18 | 2021-02-22 14:35:15 -0800 | [diff] [blame] | 279 | |
| 280 | // Stores the last set acquire fence signal time used to populate the callback handle's acquire |
| 281 | // time. |
Ady Abraham | 461296a | 2022-01-21 11:11:31 -0800 | [diff] [blame] | 282 | std::variant<nsecs_t, sp<Fence>> mCallbackHandleAcquireTimeOrFence = -1; |
Marissa Wall | 024a191 | 2018-08-13 13:55:35 -0700 | [diff] [blame] | 283 | |
Jorim Jaggi | 9c03b50 | 2020-11-24 23:51:31 +0100 | [diff] [blame] | 284 | std::deque<std::shared_ptr<android::frametimeline::SurfaceFrame>> mPendingJankClassifications; |
Adithya Srinivasan | d17c7da | 2021-03-05 20:43:32 +0000 | [diff] [blame] | 285 | // An upper bound on the number of SurfaceFrames in the pending classifications deque. |
| 286 | static constexpr int kPendingClassificationMaxSurfaceFrames = 25; |
Jorim Jaggi | 9c03b50 | 2020-11-24 23:51:31 +0100 | [diff] [blame] | 287 | |
Robert Carr | 7121caf | 2020-12-15 13:07:32 -0800 | [diff] [blame] | 288 | const std::string mBlastTransactionName{"BufferTX - " + mName}; |
| 289 | // This integer is incremented everytime a buffer arrives at the server for this layer, |
| 290 | // and decremented when a buffer is dropped or latched. When changed the integer is exported |
| 291 | // to systrace with ATRACE_INT and mBlastTransactionName. This way when debugging perf it is |
| 292 | // possible to see when a buffer arrived at the server, and in which frame it latched. |
| 293 | // |
| 294 | // You can understand the trace this way: |
| 295 | // - If the integer increases, a buffer arrived at the server. |
| 296 | // - If the integer decreases in latchBuffer, that buffer was latched |
| 297 | // - If the integer decreases in setBuffer or doTransaction, a buffer was dropped |
Vishnu Nair | 8eda69e | 2021-02-26 10:42:10 -0800 | [diff] [blame] | 298 | std::atomic<int32_t> mPendingBufferTransactions{0}; |
Robert Carr | 7121caf | 2020-12-15 13:07:32 -0800 | [diff] [blame] | 299 | |
Vishnu Nair | 6bdec7d | 2021-05-10 15:01:13 -0700 | [diff] [blame] | 300 | // Contains requested position and matrix updates. This will be applied if the client does |
| 301 | // not specify a destination frame. |
| 302 | ui::Transform mRequestedTransform; |
| 303 | |
Marissa Wall | 947d34e | 2019-03-29 14:03:53 -0700 | [diff] [blame] | 304 | sp<HwcSlotGenerator> mHwcSlotGenerator; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 305 | }; |
| 306 | |
| 307 | } // namespace android |