blob: f4f45be49f3d0a7c76ecb9ad80f7b22a4d61c7bb [file] [log] [blame]
David Sodman0c69cad2017-08-21 12:12:51 -07001/*
2 * Copyright (C) 2017 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
Ady Abrahamb0dbdaa2020-01-06 16:19:42 -080017// TODO(b/129481165): remove the #pragma below and fix conversion issues
18#pragma clang diagnostic push
19#pragma clang diagnostic ignored "-Wconversion"
20
David Sodman0c69cad2017-08-21 12:12:51 -070021//#define LOG_NDEBUG 0
22#undef LOG_TAG
23#define LOG_TAG "BufferLayer"
24#define ATRACE_TAG ATRACE_TAG_GRAPHICS
25
Alec Mourie60041e2019-06-14 18:59:51 -070026#include "BufferLayer.h"
Lloyd Piquefeb73d72018-12-04 17:23:44 -080027
28#include <compositionengine/CompositionEngine.h>
Lloyd Piquef5275482019-01-29 18:42:42 -080029#include <compositionengine/LayerFECompositionState.h>
Lloyd Pique37c2c9b2018-12-04 17:25:10 -080030#include <compositionengine/OutputLayer.h>
31#include <compositionengine/impl/OutputLayerCompositionState.h>
Lloyd Piquefeb73d72018-12-04 17:23:44 -080032#include <cutils/compiler.h>
33#include <cutils/native_handle.h>
34#include <cutils/properties.h>
35#include <gui/BufferItem.h>
36#include <gui/BufferQueue.h>
chaviwf83ce182019-09-12 14:43:08 -070037#include <gui/GLConsumer.h>
Lloyd Piquefeb73d72018-12-04 17:23:44 -080038#include <gui/LayerDebugInfo.h>
39#include <gui/Surface.h>
40#include <renderengine/RenderEngine.h>
41#include <ui/DebugUtils.h>
42#include <utils/Errors.h>
43#include <utils/Log.h>
44#include <utils/NativeHandle.h>
45#include <utils/StopWatch.h>
46#include <utils/Trace.h>
47
Alec Mourie60041e2019-06-14 18:59:51 -070048#include <cmath>
49#include <cstdlib>
50#include <mutex>
51#include <sstream>
52
David Sodman0c69cad2017-08-21 12:12:51 -070053#include "Colorizer.h"
54#include "DisplayDevice.h"
Mikael Pessa90092f42019-08-26 17:22:04 -070055#include "FrameTracer/FrameTracer.h"
David Sodman0c69cad2017-08-21 12:12:51 -070056#include "LayerRejecter.h"
Yiwei Zhang7e666a52018-11-15 13:33:42 -080057#include "TimeStats/TimeStats.h"
58
David Sodman0c69cad2017-08-21 12:12:51 -070059namespace android {
60
Peiyong Lin1a70eca2019-11-15 09:33:33 -080061static constexpr float defaultMaxMasteringLuminance = 1000.0;
62static constexpr float defaultMaxContentLuminance = 1000.0;
63
Lloyd Pique42ab75e2018-09-12 20:46:03 -070064BufferLayer::BufferLayer(const LayerCreationArgs& args)
Lloyd Piquefeb73d72018-12-04 17:23:44 -080065 : Layer(args),
chaviwb4c6e582019-08-16 14:35:07 -070066 mTextureName(args.textureName),
Lloyd Piquede196652020-01-22 17:29:58 -080067 mCompositionState{mFlinger->getCompositionEngine().createLayerFECompositionState()} {
Dominik Laskowski87a07e42019-10-10 20:38:02 -070068 ALOGV("Creating Layer %s", getDebugName());
David Sodman0c69cad2017-08-21 12:12:51 -070069
Lloyd Pique42ab75e2018-09-12 20:46:03 -070070 mPremultipliedAlpha = !(args.flags & ISurfaceComposerClient::eNonPremultiplied);
David Sodman0c69cad2017-08-21 12:12:51 -070071
Lloyd Pique42ab75e2018-09-12 20:46:03 -070072 mPotentialCursor = args.flags & ISurfaceComposerClient::eCursorWindow;
73 mProtectedByApp = args.flags & ISurfaceComposerClient::eProtectedByApp;
David Sodman0c69cad2017-08-21 12:12:51 -070074}
75
76BufferLayer::~BufferLayer() {
chaviwb4c6e582019-08-16 14:35:07 -070077 if (!isClone()) {
78 // The original layer and the clone layer share the same texture. Therefore, only one of
79 // the layers, in this case the original layer, needs to handle the deletion. The original
80 // layer and the clone should be removed at the same time so there shouldn't be any issue
81 // with the clone layer trying to use the deleted texture.
82 mFlinger->deleteTextureAsync(mTextureName);
83 }
Yiwei Zhang1a88c402019-11-18 10:43:58 -080084 const int32_t layerId = getSequence();
85 mFlinger->mTimeStats->onDestroy(layerId);
86 mFlinger->mFrameTracer->onDestroy(layerId);
David Sodman0c69cad2017-08-21 12:12:51 -070087}
88
David Sodmaneb085e02017-10-05 18:49:04 -070089void BufferLayer::useSurfaceDamage() {
90 if (mFlinger->mForceFullDamage) {
91 surfaceDamageRegion = Region::INVALID_REGION;
92 } else {
chaviw4244e032019-09-04 11:27:49 -070093 surfaceDamageRegion = mBufferInfo.mSurfaceDamage;
David Sodmaneb085e02017-10-05 18:49:04 -070094 }
95}
96
97void BufferLayer::useEmptyDamage() {
98 surfaceDamageRegion.clear();
99}
100
Marissa Wallfd668622018-05-10 10:21:13 -0700101bool BufferLayer::isOpaque(const Layer::State& s) const {
102 // if we don't have a buffer or sidebandStream yet, we're translucent regardless of the
103 // layer's opaque flag.
chaviwd62d3062019-09-04 14:48:02 -0700104 if ((mSidebandStream == nullptr) && (mBufferInfo.mBuffer == nullptr)) {
Marissa Wallfd668622018-05-10 10:21:13 -0700105 return false;
106 }
107
108 // if the layer has the opaque flag, then we're always opaque,
109 // otherwise we use the current buffer's format.
110 return ((s.flags & layer_state_t::eLayerOpaque) != 0) || getOpacityForFormat(getPixelFormat());
David Sodman0c69cad2017-08-21 12:12:51 -0700111}
112
113bool BufferLayer::isVisible() const {
Dominik Laskowskif7a09ed2019-10-07 13:54:18 -0700114 return !isHiddenByPolicy() && getAlpha() > 0.0f &&
chaviwd62d3062019-09-04 14:48:02 -0700115 (mBufferInfo.mBuffer != nullptr || mSidebandStream != nullptr);
David Sodman0c69cad2017-08-21 12:12:51 -0700116}
117
118bool BufferLayer::isFixedSize() const {
119 return getEffectiveScalingMode() != NATIVE_WINDOW_SCALING_MODE_FREEZE;
120}
121
Lloyd Piquea83776c2019-01-29 18:42:32 -0800122bool BufferLayer::usesSourceCrop() const {
123 return true;
124}
125
David Sodman0c69cad2017-08-21 12:12:51 -0700126static constexpr mat4 inverseOrientation(uint32_t transform) {
David Sodman41fdfc92017-11-06 16:09:56 -0800127 const mat4 flipH(-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1);
128 const mat4 flipV(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1);
129 const mat4 rot90(0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1);
David Sodman0c69cad2017-08-21 12:12:51 -0700130 mat4 tr;
131
132 if (transform & NATIVE_WINDOW_TRANSFORM_ROT_90) {
133 tr = tr * rot90;
134 }
135 if (transform & NATIVE_WINDOW_TRANSFORM_FLIP_H) {
136 tr = tr * flipH;
137 }
138 if (transform & NATIVE_WINDOW_TRANSFORM_FLIP_V) {
139 tr = tr * flipV;
140 }
141 return inverse(tr);
142}
143
Vishnu Nair9b079a22020-01-21 14:36:08 -0800144std::optional<compositionengine::LayerFE::LayerSettings> BufferLayer::prepareClientComposition(
Lloyd Piquef16688f2019-02-19 17:47:57 -0800145 compositionengine::LayerFE::ClientCompositionTargetSettings& targetSettings) {
David Sodman0c69cad2017-08-21 12:12:51 -0700146 ATRACE_CALL();
Lloyd Piquef16688f2019-02-19 17:47:57 -0800147
Vishnu Nair9b079a22020-01-21 14:36:08 -0800148 std::optional<compositionengine::LayerFE::LayerSettings> result =
149 Layer::prepareClientComposition(targetSettings);
Lloyd Piquef16688f2019-02-19 17:47:57 -0800150 if (!result) {
151 return result;
152 }
153
chaviwd62d3062019-09-04 14:48:02 -0700154 if (CC_UNLIKELY(mBufferInfo.mBuffer == 0)) {
David Sodman0c69cad2017-08-21 12:12:51 -0700155 // the texture has not been created yet, this Layer has
156 // in fact never been drawn into. This happens frequently with
157 // SurfaceView because the WindowManager can't know when the client
158 // has drawn the first time.
159
160 // If there is nothing under us, we paint the screen in black, otherwise
161 // we just skip this update.
162
163 // figure out if there is something below us
164 Region under;
165 bool finished = false;
166 mFlinger->mDrawingState.traverseInZOrder([&](Layer* layer) {
167 if (finished || layer == static_cast<BufferLayer const*>(this)) {
168 finished = true;
169 return;
170 }
Lloyd Piquea2468662019-03-07 21:31:06 -0800171
172 under.orSelf(layer->getScreenBounds());
David Sodman0c69cad2017-08-21 12:12:51 -0700173 });
174 // if not everything below us is covered, we plug the holes!
Lloyd Piquef16688f2019-02-19 17:47:57 -0800175 Region holes(targetSettings.clip.subtract(under));
David Sodman0c69cad2017-08-21 12:12:51 -0700176 if (!holes.isEmpty()) {
Lloyd Piquef16688f2019-02-19 17:47:57 -0800177 targetSettings.clearRegion.orSelf(holes);
David Sodman0c69cad2017-08-21 12:12:51 -0700178 }
Lloyd Piquef16688f2019-02-19 17:47:57 -0800179 return std::nullopt;
David Sodman0c69cad2017-08-21 12:12:51 -0700180 }
Lloyd Pique688abd42019-02-15 15:42:24 -0800181 bool blackOutLayer = (isProtected() && !targetSettings.supportsProtectedContent) ||
Lloyd Piquef16688f2019-02-19 17:47:57 -0800182 (isSecure() && !targetSettings.isSecure);
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000183 const State& s(getDrawingState());
Lloyd Piquede196652020-01-22 17:29:58 -0800184 compositionengine::LayerFE::LayerSettings& layer = *result;
David Sodman0c69cad2017-08-21 12:12:51 -0700185 if (!blackOutLayer) {
chaviwd62d3062019-09-04 14:48:02 -0700186 layer.source.buffer.buffer = mBufferInfo.mBuffer;
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000187 layer.source.buffer.isOpaque = isOpaque(s);
chaviwd62d3062019-09-04 14:48:02 -0700188 layer.source.buffer.fence = mBufferInfo.mFence;
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000189 layer.source.buffer.textureName = mTextureName;
190 layer.source.buffer.usePremultipliedAlpha = getPremultipledAlpha();
191 layer.source.buffer.isY410BT2020 = isHdrY410();
Peiyong Lin1a70eca2019-11-15 09:33:33 -0800192 bool hasSmpte2086 = mBufferInfo.mHdrMetadata.validTypes & HdrMetadata::SMPTE2086;
193 bool hasCta861_3 = mBufferInfo.mHdrMetadata.validTypes & HdrMetadata::CTA861_3;
194 layer.source.buffer.maxMasteringLuminance = hasSmpte2086
195 ? mBufferInfo.mHdrMetadata.smpte2086.maxLuminance
196 : defaultMaxMasteringLuminance;
197 layer.source.buffer.maxContentLuminance = hasCta861_3
198 ? mBufferInfo.mHdrMetadata.cta8613.maxContentLightLevel
199 : defaultMaxContentLuminance;
Vishnu Nair9b079a22020-01-21 14:36:08 -0800200 layer.frameNumber = mCurrentFrameNumber;
201 layer.bufferId = mBufferInfo.mBuffer ? mBufferInfo.mBuffer->getId() : 0;
202
David Sodman0c69cad2017-08-21 12:12:51 -0700203 // TODO: we could be more subtle with isFixedSize()
Lloyd Piquef16688f2019-02-19 17:47:57 -0800204 const bool useFiltering = targetSettings.needsFiltering || mNeedsFiltering || isFixedSize();
David Sodman0c69cad2017-08-21 12:12:51 -0700205
206 // Query the texture matrix given our current filtering mode.
207 float textureMatrix[16];
chaviwf83ce182019-09-12 14:43:08 -0700208 getDrawingTransformMatrix(useFiltering, textureMatrix);
David Sodman0c69cad2017-08-21 12:12:51 -0700209
210 if (getTransformToDisplayInverse()) {
211 /*
212 * the code below applies the primary display's inverse transform to
213 * the texture transform
214 */
Dominik Laskowski718f9602019-11-09 20:01:35 -0800215 uint32_t transform = DisplayDevice::getPrimaryDisplayRotationFlags();
David Sodman0c69cad2017-08-21 12:12:51 -0700216 mat4 tr = inverseOrientation(transform);
217
218 /**
219 * TODO(b/36727915): This is basically a hack.
220 *
221 * Ensure that regardless of the parent transformation,
222 * this buffer is always transformed from native display
223 * orientation to display orientation. For example, in the case
224 * of a camera where the buffer remains in native orientation,
225 * we want the pixels to always be upright.
226 */
227 sp<Layer> p = mDrawingParent.promote();
228 if (p != nullptr) {
229 const auto parentTransform = p->getTransform();
230 tr = tr * inverseOrientation(parentTransform.getOrientation());
231 }
232
233 // and finally apply it to the original texture matrix
234 const mat4 texTransform(mat4(static_cast<const float*>(textureMatrix)) * tr);
235 memcpy(textureMatrix, texTransform.asArray(), sizeof(textureMatrix));
236 }
237
Vishnu Nair4351ad52019-02-11 14:13:02 -0800238 const Rect win{getBounds()};
Marissa Wall290ad082019-03-06 13:23:47 -0800239 float bufferWidth = getBufferSize(s).getWidth();
240 float bufferHeight = getBufferSize(s).getHeight();
241
242 // BufferStateLayers can have a "buffer size" of [0, 0, -1, -1] when no display frame has
243 // been set and there is no parent layer bounds. In that case, the scale is meaningless so
244 // ignore them.
245 if (!getBufferSize(s).isValid()) {
246 bufferWidth = float(win.right) - float(win.left);
247 bufferHeight = float(win.bottom) - float(win.top);
248 }
David Sodman0c69cad2017-08-21 12:12:51 -0700249
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000250 const float scaleHeight = (float(win.bottom) - float(win.top)) / bufferHeight;
251 const float scaleWidth = (float(win.right) - float(win.left)) / bufferWidth;
252 const float translateY = float(win.top) / bufferHeight;
253 const float translateX = float(win.left) / bufferWidth;
254
255 // Flip y-coordinates because GLConsumer expects OpenGL convention.
256 mat4 tr = mat4::translate(vec4(.5, .5, 0, 1)) * mat4::scale(vec4(1, -1, 1, 1)) *
257 mat4::translate(vec4(-.5, -.5, 0, 1)) *
258 mat4::translate(vec4(translateX, translateY, 0, 1)) *
259 mat4::scale(vec4(scaleWidth, scaleHeight, 1.0, 1.0));
260
261 layer.source.buffer.useTextureFiltering = useFiltering;
262 layer.source.buffer.textureTransform = mat4(static_cast<const float*>(textureMatrix)) * tr;
David Sodman0c69cad2017-08-21 12:12:51 -0700263 } else {
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000264 // If layer is blacked out, force alpha to 1 so that we draw a black color
265 // layer.
266 layer.source.buffer.buffer = nullptr;
267 layer.alpha = 1.0;
Vishnu Nair9b079a22020-01-21 14:36:08 -0800268 layer.frameNumber = 0;
269 layer.bufferId = 0;
David Sodman0c69cad2017-08-21 12:12:51 -0700270 }
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000271
Vishnu Nair9b079a22020-01-21 14:36:08 -0800272 return layer;
David Sodman0c69cad2017-08-21 12:12:51 -0700273}
274
Marissa Wallfd668622018-05-10 10:21:13 -0700275bool BufferLayer::isHdrY410() const {
276 // pixel format is HDR Y410 masquerading as RGBA_1010102
chaviw4244e032019-09-04 11:27:49 -0700277 return (mBufferInfo.mDataspace == ui::Dataspace::BT2020_ITU_PQ &&
278 mBufferInfo.mApi == NATIVE_WINDOW_API_MEDIA &&
chaviwd62d3062019-09-04 14:48:02 -0700279 mBufferInfo.mBuffer->getPixelFormat() == HAL_PIXEL_FORMAT_RGBA_1010102);
David Sodmaneb085e02017-10-05 18:49:04 -0700280}
281
Lloyd Piquede196652020-01-22 17:29:58 -0800282sp<compositionengine::LayerFE> BufferLayer::getCompositionEngineLayerFE() const {
283 return asLayerFE();
284}
285
286compositionengine::LayerFECompositionState* BufferLayer::editCompositionState() {
287 return mCompositionState.get();
288}
289
290const compositionengine::LayerFECompositionState* BufferLayer::getCompositionState() const {
291 return mCompositionState.get();
292}
293
294void BufferLayer::preparePerFrameCompositionState() {
295 Layer::preparePerFrameCompositionState();
David Sodman0c69cad2017-08-21 12:12:51 -0700296
297 // Sideband layers
Lloyd Piquede196652020-01-22 17:29:58 -0800298 auto* compositionState = editCompositionState();
299 if (compositionState->sidebandStream.get()) {
300 compositionState->compositionType = Hwc2::IComposerClient::Composition::SIDEBAND;
David Sodman15094112018-10-11 09:39:37 -0700301 } else {
Lloyd Piquef5275482019-01-29 18:42:42 -0800302 // Normal buffer layers
Lloyd Piquede196652020-01-22 17:29:58 -0800303 compositionState->hdrMetadata = mBufferInfo.mHdrMetadata;
304 compositionState->compositionType = mPotentialCursor
Lloyd Piquef5275482019-01-29 18:42:42 -0800305 ? Hwc2::IComposerClient::Composition::CURSOR
306 : Hwc2::IComposerClient::Composition::DEVICE;
David Sodman0c69cad2017-08-21 12:12:51 -0700307 }
David Sodman0c69cad2017-08-21 12:12:51 -0700308}
309
Marissa Wallfd668622018-05-10 10:21:13 -0700310bool BufferLayer::onPreComposition(nsecs_t refreshStartTime) {
chaviwd62d3062019-09-04 14:48:02 -0700311 if (mBufferInfo.mBuffer != nullptr) {
Marissa Wallfd668622018-05-10 10:21:13 -0700312 Mutex::Autolock lock(mFrameEventHistoryMutex);
313 mFrameEventHistory.addPreComposition(mCurrentFrameNumber, refreshStartTime);
David Sodman0c69cad2017-08-21 12:12:51 -0700314 }
Marissa Wallfd668622018-05-10 10:21:13 -0700315 mRefreshPending = false;
316 return hasReadyFrame();
David Sodman0c69cad2017-08-21 12:12:51 -0700317}
318
Adithya Srinivasanb69e0762019-11-11 18:39:53 -0800319bool BufferLayer::onPostComposition(sp<const DisplayDevice> displayDevice,
Dominik Laskowski075d3172018-05-24 15:50:06 -0700320 const std::shared_ptr<FenceTime>& glDoneFence,
Marissa Wallfd668622018-05-10 10:21:13 -0700321 const std::shared_ptr<FenceTime>& presentFence,
322 const CompositorTiming& compositorTiming) {
323 // mFrameLatencyNeeded is true when a new frame was latched for the
324 // composition.
chaviw74b03172019-08-19 11:09:03 -0700325 if (!mBufferInfo.mFrameLatencyNeeded) return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700326
327 // Update mFrameEventHistory.
Dan Stoza436ccf32018-06-21 12:10:12 -0700328 {
Marissa Wallfd668622018-05-10 10:21:13 -0700329 Mutex::Autolock lock(mFrameEventHistoryMutex);
330 mFrameEventHistory.addPostComposition(mCurrentFrameNumber, glDoneFence, presentFence,
331 compositorTiming);
David Sodman0c69cad2017-08-21 12:12:51 -0700332 }
333
Marissa Wallfd668622018-05-10 10:21:13 -0700334 // Update mFrameTracker.
chaviw4244e032019-09-04 11:27:49 -0700335 nsecs_t desiredPresentTime = mBufferInfo.mDesiredPresentTime;
Marissa Wallfd668622018-05-10 10:21:13 -0700336 mFrameTracker.setDesiredPresentTime(desiredPresentTime);
337
Yiwei Zhang1a88c402019-11-18 10:43:58 -0800338 const int32_t layerId = getSequence();
339 mFlinger->mTimeStats->setDesiredTime(layerId, mCurrentFrameNumber, desiredPresentTime);
Marissa Wallfd668622018-05-10 10:21:13 -0700340
Adithya Srinivasanb69e0762019-11-11 18:39:53 -0800341 const auto outputLayer = findOutputLayerForDisplay(displayDevice);
342 if (outputLayer && outputLayer->requiresClientComposition()) {
343 nsecs_t clientCompositionTimestamp = outputLayer->getState().clientCompositionTimestamp;
344 mFlinger->mFrameTracer->traceTimestamp(layerId, getCurrentBufferId(), mCurrentFrameNumber,
345 clientCompositionTimestamp,
346 FrameTracer::FrameEvent::FALLBACK_COMPOSITION);
347 }
348
chaviw4244e032019-09-04 11:27:49 -0700349 std::shared_ptr<FenceTime> frameReadyFence = mBufferInfo.mFenceTime;
Marissa Wallfd668622018-05-10 10:21:13 -0700350 if (frameReadyFence->isValid()) {
351 mFrameTracker.setFrameReadyFence(std::move(frameReadyFence));
352 } else {
353 // There was no fence for this frame, so assume that it was ready
354 // to be presented at the desired present time.
355 mFrameTracker.setFrameReadyTime(desiredPresentTime);
Dominik Laskowski45de9bd2018-06-11 17:44:10 -0700356 }
Marissa Wallfd668622018-05-10 10:21:13 -0700357
Adithya Srinivasanb69e0762019-11-11 18:39:53 -0800358 const auto displayId = displayDevice->getId();
Marissa Wallfd668622018-05-10 10:21:13 -0700359 if (presentFence->isValid()) {
Yiwei Zhang1a88c402019-11-18 10:43:58 -0800360 mFlinger->mTimeStats->setPresentFence(layerId, mCurrentFrameNumber, presentFence);
361 mFlinger->mFrameTracer->traceFence(layerId, getCurrentBufferId(), mCurrentFrameNumber,
Mikael Pessa90092f42019-08-26 17:22:04 -0700362 presentFence, FrameTracer::FrameEvent::PRESENT_FENCE);
Marissa Wallfd668622018-05-10 10:21:13 -0700363 mFrameTracker.setActualPresentFence(std::shared_ptr<FenceTime>(presentFence));
Dominik Laskowski075d3172018-05-24 15:50:06 -0700364 } else if (displayId && mFlinger->getHwComposer().isConnected(*displayId)) {
Marissa Wallfd668622018-05-10 10:21:13 -0700365 // The HWC doesn't support present fences, so use the refresh
366 // timestamp instead.
Dominik Laskowski075d3172018-05-24 15:50:06 -0700367 const nsecs_t actualPresentTime = mFlinger->getHwComposer().getRefreshTimestamp(*displayId);
Yiwei Zhang1a88c402019-11-18 10:43:58 -0800368 mFlinger->mTimeStats->setPresentTime(layerId, mCurrentFrameNumber, actualPresentTime);
369 mFlinger->mFrameTracer->traceTimestamp(layerId, getCurrentBufferId(), mCurrentFrameNumber,
Mikael Pessa90092f42019-08-26 17:22:04 -0700370 actualPresentTime,
371 FrameTracer::FrameEvent::PRESENT_FENCE);
Marissa Wallfd668622018-05-10 10:21:13 -0700372 mFrameTracker.setActualPresentTime(actualPresentTime);
373 }
374
375 mFrameTracker.advanceFrame();
chaviw74b03172019-08-19 11:09:03 -0700376 mBufferInfo.mFrameLatencyNeeded = false;
Marissa Wallfd668622018-05-10 10:21:13 -0700377 return true;
David Sodman0c69cad2017-08-21 12:12:51 -0700378}
379
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700380bool BufferLayer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime,
381 nsecs_t expectedPresentTime) {
Marissa Wallfd668622018-05-10 10:21:13 -0700382 ATRACE_CALL();
David Sodman0c69cad2017-08-21 12:12:51 -0700383
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800384 bool refreshRequired = latchSidebandStream(recomputeVisibleRegions);
David Sodman0c69cad2017-08-21 12:12:51 -0700385
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800386 if (refreshRequired) {
387 return refreshRequired;
David Sodman0c69cad2017-08-21 12:12:51 -0700388 }
389
Marissa Wallfd668622018-05-10 10:21:13 -0700390 if (!hasReadyFrame()) {
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800391 return false;
David Sodman0c69cad2017-08-21 12:12:51 -0700392 }
David Sodman0c69cad2017-08-21 12:12:51 -0700393
Marissa Wallfd668622018-05-10 10:21:13 -0700394 // if we've already called updateTexImage() without going through
395 // a composition step, we have to skip this layer at this point
396 // because we cannot call updateTeximage() without a corresponding
397 // compositionComplete() call.
398 // we'll trigger an update in onPreComposition().
399 if (mRefreshPending) {
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800400 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700401 }
402
403 // If the head buffer's acquire fence hasn't signaled yet, return and
404 // try again later
405 if (!fenceHasSignaled()) {
Ady Abraham09bd3922019-04-08 10:44:56 -0700406 ATRACE_NAME("!fenceHasSignaled()");
David Sodman0c69cad2017-08-21 12:12:51 -0700407 mFlinger->signalLayerUpdate();
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800408 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700409 }
410
411 // Capture the old state of the layer for comparisons later
412 const State& s(getDrawingState());
413 const bool oldOpacity = isOpaque(s);
chaviwd62d3062019-09-04 14:48:02 -0700414
415 BufferInfo oldBufferInfo = mBufferInfo;
Marissa Wallfd668622018-05-10 10:21:13 -0700416
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700417 if (!allTransactionsSignaled(expectedPresentTime)) {
Marissa Wallebb486e2019-05-15 14:08:08 -0700418 mFlinger->setTransactionFlags(eTraversalNeeded);
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800419 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700420 }
421
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700422 status_t err = updateTexImage(recomputeVisibleRegions, latchTime, expectedPresentTime);
Marissa Wallfd668622018-05-10 10:21:13 -0700423 if (err != NO_ERROR) {
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800424 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700425 }
426
427 err = updateActiveBuffer();
428 if (err != NO_ERROR) {
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800429 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700430 }
431
Marissa Wallfd668622018-05-10 10:21:13 -0700432 err = updateFrameNumber(latchTime);
433 if (err != NO_ERROR) {
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800434 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700435 }
436
chaviw4244e032019-09-04 11:27:49 -0700437 gatherBufferInfo();
438
Marissa Wallfd668622018-05-10 10:21:13 -0700439 mRefreshPending = true;
chaviw74b03172019-08-19 11:09:03 -0700440 mBufferInfo.mFrameLatencyNeeded = true;
chaviwd62d3062019-09-04 14:48:02 -0700441 if (oldBufferInfo.mBuffer == nullptr) {
Marissa Wallfd668622018-05-10 10:21:13 -0700442 // the first time we receive a buffer, we need to trigger a
443 // geometry invalidation.
444 recomputeVisibleRegions = true;
445 }
446
chaviw4244e032019-09-04 11:27:49 -0700447 if ((mBufferInfo.mCrop != oldBufferInfo.mCrop) ||
448 (mBufferInfo.mTransform != oldBufferInfo.mTransform) ||
449 (mBufferInfo.mScaleMode != oldBufferInfo.mScaleMode) ||
450 (mBufferInfo.mTransformToDisplayInverse != oldBufferInfo.mTransformToDisplayInverse)) {
Marissa Wallfd668622018-05-10 10:21:13 -0700451 recomputeVisibleRegions = true;
452 }
453
chaviwd62d3062019-09-04 14:48:02 -0700454 if (oldBufferInfo.mBuffer != nullptr) {
455 uint32_t bufWidth = mBufferInfo.mBuffer->getWidth();
456 uint32_t bufHeight = mBufferInfo.mBuffer->getHeight();
457 if (bufWidth != uint32_t(oldBufferInfo.mBuffer->width) ||
458 bufHeight != uint32_t(oldBufferInfo.mBuffer->height)) {
Marissa Wallfd668622018-05-10 10:21:13 -0700459 recomputeVisibleRegions = true;
460 }
461 }
462
463 if (oldOpacity != isOpaque(s)) {
464 recomputeVisibleRegions = true;
465 }
466
467 // Remove any sync points corresponding to the buffer which was just
468 // latched
469 {
470 Mutex::Autolock lock(mLocalSyncPointMutex);
471 auto point = mLocalSyncPoints.begin();
472 while (point != mLocalSyncPoints.end()) {
473 if (!(*point)->frameIsAvailable() || !(*point)->transactionIsApplied()) {
474 // This sync point must have been added since we started
475 // latching. Don't drop it yet.
476 ++point;
477 continue;
478 }
479
480 if ((*point)->getFrameNumber() <= mCurrentFrameNumber) {
Alec Mourie60041e2019-06-14 18:59:51 -0700481 std::stringstream ss;
482 ss << "Dropping sync point " << (*point)->getFrameNumber();
483 ATRACE_NAME(ss.str().c_str());
Marissa Wallfd668622018-05-10 10:21:13 -0700484 point = mLocalSyncPoints.erase(point);
485 } else {
486 ++point;
487 }
488 }
489 }
490
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800491 return true;
Marissa Wallfd668622018-05-10 10:21:13 -0700492}
493
494// transaction
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700495void BufferLayer::notifyAvailableFrames(nsecs_t expectedPresentTime) {
496 const auto headFrameNumber = getHeadFrameNumber(expectedPresentTime);
Ady Abrahamcd1580c2019-04-29 15:40:03 -0700497 const bool headFenceSignaled = fenceHasSignaled();
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700498 const bool presentTimeIsCurrent = framePresentTimeIsCurrent(expectedPresentTime);
Marissa Wallfd668622018-05-10 10:21:13 -0700499 Mutex::Autolock lock(mLocalSyncPointMutex);
500 for (auto& point : mLocalSyncPoints) {
Ady Abrahamcd1580c2019-04-29 15:40:03 -0700501 if (headFrameNumber >= point->getFrameNumber() && headFenceSignaled &&
502 presentTimeIsCurrent) {
Marissa Wallfd668622018-05-10 10:21:13 -0700503 point->setFrameAvailable();
chaviw43cb3cb2019-05-31 15:23:41 -0700504 sp<Layer> requestedSyncLayer = point->getRequestedSyncLayer();
505 if (requestedSyncLayer) {
506 // Need to update the transaction flag to ensure the layer's pending transaction
507 // gets applied.
508 requestedSyncLayer->setTransactionFlags(eTransactionNeeded);
509 }
Marissa Wallfd668622018-05-10 10:21:13 -0700510 }
David Sodman0c69cad2017-08-21 12:12:51 -0700511 }
512}
513
Marissa Wallfd668622018-05-10 10:21:13 -0700514bool BufferLayer::hasReadyFrame() const {
Marissa Wall024a1912018-08-13 13:55:35 -0700515 return hasFrameUpdate() || getSidebandStreamChanged() || getAutoRefresh();
Marissa Wallfd668622018-05-10 10:21:13 -0700516}
517
518uint32_t BufferLayer::getEffectiveScalingMode() const {
519 if (mOverrideScalingMode >= 0) {
520 return mOverrideScalingMode;
521 }
522
chaviw4244e032019-09-04 11:27:49 -0700523 return mBufferInfo.mScaleMode;
Marissa Wallfd668622018-05-10 10:21:13 -0700524}
525
526bool BufferLayer::isProtected() const {
chaviwd62d3062019-09-04 14:48:02 -0700527 const sp<GraphicBuffer>& buffer(mBufferInfo.mBuffer);
Marissa Wallfd668622018-05-10 10:21:13 -0700528 return (buffer != 0) && (buffer->getUsage() & GRALLOC_USAGE_PROTECTED);
529}
530
531bool BufferLayer::latchUnsignaledBuffers() {
532 static bool propertyLoaded = false;
533 static bool latch = false;
534 static std::mutex mutex;
535 std::lock_guard<std::mutex> lock(mutex);
536 if (!propertyLoaded) {
537 char value[PROPERTY_VALUE_MAX] = {};
538 property_get("debug.sf.latch_unsignaled", value, "0");
539 latch = atoi(value);
540 propertyLoaded = true;
541 }
542 return latch;
543}
544
545// h/w composer set-up
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700546bool BufferLayer::allTransactionsSignaled(nsecs_t expectedPresentTime) {
547 const auto headFrameNumber = getHeadFrameNumber(expectedPresentTime);
Marissa Wallfd668622018-05-10 10:21:13 -0700548 bool matchingFramesFound = false;
549 bool allTransactionsApplied = true;
550 Mutex::Autolock lock(mLocalSyncPointMutex);
551
552 for (auto& point : mLocalSyncPoints) {
553 if (point->getFrameNumber() > headFrameNumber) {
554 break;
555 }
556 matchingFramesFound = true;
557
558 if (!point->frameIsAvailable()) {
559 // We haven't notified the remote layer that the frame for
560 // this point is available yet. Notify it now, and then
561 // abort this attempt to latch.
562 point->setFrameAvailable();
563 allTransactionsApplied = false;
564 break;
565 }
566
567 allTransactionsApplied = allTransactionsApplied && point->transactionIsApplied();
568 }
569 return !matchingFramesFound || allTransactionsApplied;
David Sodman0c69cad2017-08-21 12:12:51 -0700570}
571
572// As documented in libhardware header, formats in the range
573// 0x100 - 0x1FF are specific to the HAL implementation, and
574// are known to have no alpha channel
575// TODO: move definition for device-specific range into
576// hardware.h, instead of using hard-coded values here.
577#define HARDWARE_IS_DEVICE_FORMAT(f) ((f) >= 0x100 && (f) <= 0x1FF)
578
579bool BufferLayer::getOpacityForFormat(uint32_t format) {
580 if (HARDWARE_IS_DEVICE_FORMAT(format)) {
581 return true;
582 }
583 switch (format) {
584 case HAL_PIXEL_FORMAT_RGBA_8888:
585 case HAL_PIXEL_FORMAT_BGRA_8888:
586 case HAL_PIXEL_FORMAT_RGBA_FP16:
587 case HAL_PIXEL_FORMAT_RGBA_1010102:
588 return false;
589 }
590 // in all other case, we have no blending (also for unknown formats)
591 return true;
592}
593
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800594bool BufferLayer::needsFiltering(const sp<const DisplayDevice>& displayDevice) const {
Lloyd Piquef16688f2019-02-19 17:47:57 -0800595 // If we are not capturing based on the state of a known display device,
596 // just return false.
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800597 if (displayDevice == nullptr) {
Lloyd Piquef16688f2019-02-19 17:47:57 -0800598 return false;
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800599 }
600
601 const auto outputLayer = findOutputLayerForDisplay(displayDevice);
602 if (outputLayer == nullptr) {
Lloyd Piquef16688f2019-02-19 17:47:57 -0800603 return false;
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800604 }
605
Lloyd Piquef16688f2019-02-19 17:47:57 -0800606 // We need filtering if the sourceCrop rectangle size does not match the
607 // displayframe rectangle size (not a 1:1 render)
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800608 const auto& compositionState = outputLayer->getState();
609 const auto displayFrame = compositionState.displayFrame;
610 const auto sourceCrop = compositionState.sourceCrop;
Lloyd Piquef16688f2019-02-19 17:47:57 -0800611 return sourceCrop.getHeight() != displayFrame.getHeight() ||
Peiyong Linc2020ca2019-01-10 11:36:12 -0800612 sourceCrop.getWidth() != displayFrame.getWidth();
Chia-I Wu692e0832018-06-05 15:46:58 -0700613}
614
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700615uint64_t BufferLayer::getHeadFrameNumber(nsecs_t expectedPresentTime) const {
Lloyd Pique0449b0f2018-12-20 16:23:45 -0800616 if (hasFrameUpdate()) {
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700617 return getFrameNumber(expectedPresentTime);
David Sodman0c69cad2017-08-21 12:12:51 -0700618 } else {
619 return mCurrentFrameNumber;
620 }
621}
622
Vishnu Nair60356342018-11-13 13:00:45 -0800623Rect BufferLayer::getBufferSize(const State& s) const {
624 // If we have a sideband stream, or we are scaling the buffer then return the layer size since
625 // we cannot determine the buffer size.
626 if ((s.sidebandStream != nullptr) ||
627 (getEffectiveScalingMode() != NATIVE_WINDOW_SCALING_MODE_FREEZE)) {
628 return Rect(getActiveWidth(s), getActiveHeight(s));
629 }
630
chaviwd62d3062019-09-04 14:48:02 -0700631 if (mBufferInfo.mBuffer == nullptr) {
Vishnu Nair60356342018-11-13 13:00:45 -0800632 return Rect::INVALID_RECT;
633 }
634
chaviwd62d3062019-09-04 14:48:02 -0700635 uint32_t bufWidth = mBufferInfo.mBuffer->getWidth();
636 uint32_t bufHeight = mBufferInfo.mBuffer->getHeight();
Vishnu Nair60356342018-11-13 13:00:45 -0800637
638 // Undo any transformations on the buffer and return the result.
chaviw4244e032019-09-04 11:27:49 -0700639 if (mBufferInfo.mTransform & ui::Transform::ROT_90) {
Vishnu Nair60356342018-11-13 13:00:45 -0800640 std::swap(bufWidth, bufHeight);
641 }
642
Lloyd Pique0449b0f2018-12-20 16:23:45 -0800643 if (getTransformToDisplayInverse()) {
Dominik Laskowski718f9602019-11-09 20:01:35 -0800644 uint32_t invTransform = DisplayDevice::getPrimaryDisplayRotationFlags();
Vishnu Nair60356342018-11-13 13:00:45 -0800645 if (invTransform & ui::Transform::ROT_90) {
646 std::swap(bufWidth, bufHeight);
647 }
648 }
649
650 return Rect(bufWidth, bufHeight);
651}
652
Vishnu Nair4351ad52019-02-11 14:13:02 -0800653FloatRect BufferLayer::computeSourceBounds(const FloatRect& parentBounds) const {
654 const State& s(getDrawingState());
655
656 // If we have a sideband stream, or we are scaling the buffer then return the layer size since
657 // we cannot determine the buffer size.
658 if ((s.sidebandStream != nullptr) ||
659 (getEffectiveScalingMode() != NATIVE_WINDOW_SCALING_MODE_FREEZE)) {
660 return FloatRect(0, 0, getActiveWidth(s), getActiveHeight(s));
661 }
662
chaviwd62d3062019-09-04 14:48:02 -0700663 if (mBufferInfo.mBuffer == nullptr) {
Vishnu Nair4351ad52019-02-11 14:13:02 -0800664 return parentBounds;
665 }
666
chaviwd62d3062019-09-04 14:48:02 -0700667 uint32_t bufWidth = mBufferInfo.mBuffer->getWidth();
668 uint32_t bufHeight = mBufferInfo.mBuffer->getHeight();
Vishnu Nair4351ad52019-02-11 14:13:02 -0800669
670 // Undo any transformations on the buffer and return the result.
chaviw4244e032019-09-04 11:27:49 -0700671 if (mBufferInfo.mTransform & ui::Transform::ROT_90) {
Vishnu Nair4351ad52019-02-11 14:13:02 -0800672 std::swap(bufWidth, bufHeight);
673 }
674
675 if (getTransformToDisplayInverse()) {
Dominik Laskowski718f9602019-11-09 20:01:35 -0800676 uint32_t invTransform = DisplayDevice::getPrimaryDisplayRotationFlags();
Vishnu Nair4351ad52019-02-11 14:13:02 -0800677 if (invTransform & ui::Transform::ROT_90) {
678 std::swap(bufWidth, bufHeight);
679 }
680 }
681
682 return FloatRect(0, 0, bufWidth, bufHeight);
683}
684
chaviw49a108c2019-08-12 11:23:06 -0700685void BufferLayer::latchAndReleaseBuffer() {
686 mRefreshPending = false;
687 if (hasReadyFrame()) {
688 bool ignored = false;
689 latchBuffer(ignored, systemTime(), 0 /* expectedPresentTime */);
690 }
691 releasePendingBuffer(systemTime());
692}
693
chaviw4244e032019-09-04 11:27:49 -0700694PixelFormat BufferLayer::getPixelFormat() const {
695 return mBufferInfo.mPixelFormat;
696}
697
698bool BufferLayer::getTransformToDisplayInverse() const {
699 return mBufferInfo.mTransformToDisplayInverse;
700}
701
702Rect BufferLayer::getBufferCrop() const {
703 // this is the crop rectangle that applies to the buffer
704 // itself (as opposed to the window)
705 if (!mBufferInfo.mCrop.isEmpty()) {
706 // if the buffer crop is defined, we use that
707 return mBufferInfo.mCrop;
chaviwd62d3062019-09-04 14:48:02 -0700708 } else if (mBufferInfo.mBuffer != nullptr) {
chaviw4244e032019-09-04 11:27:49 -0700709 // otherwise we use the whole buffer
chaviwd62d3062019-09-04 14:48:02 -0700710 return mBufferInfo.mBuffer->getBounds();
chaviw4244e032019-09-04 11:27:49 -0700711 } else {
712 // if we don't have a buffer yet, we use an empty/invalid crop
713 return Rect();
714 }
715}
716
717uint32_t BufferLayer::getBufferTransform() const {
718 return mBufferInfo.mTransform;
719}
720
721ui::Dataspace BufferLayer::getDataSpace() const {
722 return mBufferInfo.mDataspace;
723}
724
725ui::Dataspace BufferLayer::translateDataspace(ui::Dataspace dataspace) {
726 ui::Dataspace updatedDataspace = dataspace;
727 // translate legacy dataspaces to modern dataspaces
728 switch (dataspace) {
729 case ui::Dataspace::SRGB:
730 updatedDataspace = ui::Dataspace::V0_SRGB;
731 break;
732 case ui::Dataspace::SRGB_LINEAR:
733 updatedDataspace = ui::Dataspace::V0_SRGB_LINEAR;
734 break;
735 case ui::Dataspace::JFIF:
736 updatedDataspace = ui::Dataspace::V0_JFIF;
737 break;
738 case ui::Dataspace::BT601_625:
739 updatedDataspace = ui::Dataspace::V0_BT601_625;
740 break;
741 case ui::Dataspace::BT601_525:
742 updatedDataspace = ui::Dataspace::V0_BT601_525;
743 break;
744 case ui::Dataspace::BT709:
745 updatedDataspace = ui::Dataspace::V0_BT709;
746 break;
747 default:
748 break;
749 }
750
751 return updatedDataspace;
752}
753
chaviwd62d3062019-09-04 14:48:02 -0700754sp<GraphicBuffer> BufferLayer::getBuffer() const {
755 return mBufferInfo.mBuffer;
756}
757
chaviwf83ce182019-09-12 14:43:08 -0700758void BufferLayer::getDrawingTransformMatrix(bool filteringEnabled, float outMatrix[16]) {
759 GLConsumer::computeTransformMatrix(outMatrix, mBufferInfo.mBuffer, mBufferInfo.mCrop,
760 mBufferInfo.mTransform, filteringEnabled);
761}
762
chaviwb4c6e582019-08-16 14:35:07 -0700763void BufferLayer::setInitialValuesForClone(const sp<Layer>& clonedFrom) {
764 Layer::setInitialValuesForClone(clonedFrom);
765
766 sp<BufferLayer> bufferClonedFrom = static_cast<BufferLayer*>(clonedFrom.get());
767 mPremultipliedAlpha = bufferClonedFrom->mPremultipliedAlpha;
768 mPotentialCursor = bufferClonedFrom->mPotentialCursor;
769 mProtectedByApp = bufferClonedFrom->mProtectedByApp;
chaviw74b03172019-08-19 11:09:03 -0700770
771 updateCloneBufferInfo();
772}
773
774void BufferLayer::updateCloneBufferInfo() {
775 if (!isClone() || !isClonedFromAlive()) {
776 return;
777 }
778
779 sp<BufferLayer> clonedFrom = static_cast<BufferLayer*>(getClonedFrom().get());
780 mBufferInfo = clonedFrom->mBufferInfo;
781 mSidebandStream = clonedFrom->mSidebandStream;
782 surfaceDamageRegion = clonedFrom->surfaceDamageRegion;
783 mCurrentFrameNumber = clonedFrom->mCurrentFrameNumber.load();
784 mPreviousFrameNumber = clonedFrom->mPreviousFrameNumber;
785
786 // After buffer info is updated, the drawingState from the real layer needs to be copied into
787 // the cloned. This is because some properties of drawingState can change when latchBuffer is
chaviwaf87b3e2019-10-01 16:59:28 -0700788 // called. However, copying the drawingState would also overwrite the cloned layer's relatives
789 // and touchableRegionCrop. Therefore, temporarily store the relatives so they can be set in
790 // the cloned drawingState again.
chaviw74b03172019-08-19 11:09:03 -0700791 wp<Layer> tmpZOrderRelativeOf = mDrawingState.zOrderRelativeOf;
792 SortedVector<wp<Layer>> tmpZOrderRelatives = mDrawingState.zOrderRelatives;
chaviwaf87b3e2019-10-01 16:59:28 -0700793 wp<Layer> tmpTouchableRegionCrop = mDrawingState.touchableRegionCrop;
794 InputWindowInfo tmpInputInfo = mDrawingState.inputInfo;
795
chaviw74b03172019-08-19 11:09:03 -0700796 mDrawingState = clonedFrom->mDrawingState;
chaviwaf87b3e2019-10-01 16:59:28 -0700797
798 mDrawingState.touchableRegionCrop = tmpTouchableRegionCrop;
chaviw74b03172019-08-19 11:09:03 -0700799 mDrawingState.zOrderRelativeOf = tmpZOrderRelativeOf;
800 mDrawingState.zOrderRelatives = tmpZOrderRelatives;
chaviwaf87b3e2019-10-01 16:59:28 -0700801 mDrawingState.inputInfo = tmpInputInfo;
chaviwb4c6e582019-08-16 14:35:07 -0700802}
803
David Sodman0c69cad2017-08-21 12:12:51 -0700804} // namespace android
805
806#if defined(__gl_h_)
807#error "don't include gl/gl.h in this file"
808#endif
809
810#if defined(__gl2_h_)
811#error "don't include gl2/gl2.h in this file"
812#endif
Ady Abrahamb0dbdaa2020-01-06 16:19:42 -0800813
814// TODO(b/129481165): remove the #pragma below and fix conversion issues
815#pragma clang diagnostic pop // ignored "-Wconversion"