blob: 35d0215fa1636d1d6d5f38efe63af3d793941252 [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>
29#include <compositionengine/Layer.h>
30#include <compositionengine/LayerCreationArgs.h>
Lloyd Piquef5275482019-01-29 18:42:42 -080031#include <compositionengine/LayerFECompositionState.h>
Lloyd Pique37c2c9b2018-12-04 17:25:10 -080032#include <compositionengine/OutputLayer.h>
33#include <compositionengine/impl/OutputLayerCompositionState.h>
Lloyd Piquefeb73d72018-12-04 17:23:44 -080034#include <cutils/compiler.h>
35#include <cutils/native_handle.h>
36#include <cutils/properties.h>
37#include <gui/BufferItem.h>
38#include <gui/BufferQueue.h>
chaviwf83ce182019-09-12 14:43:08 -070039#include <gui/GLConsumer.h>
Lloyd Piquefeb73d72018-12-04 17:23:44 -080040#include <gui/LayerDebugInfo.h>
41#include <gui/Surface.h>
42#include <renderengine/RenderEngine.h>
43#include <ui/DebugUtils.h>
44#include <utils/Errors.h>
45#include <utils/Log.h>
46#include <utils/NativeHandle.h>
47#include <utils/StopWatch.h>
48#include <utils/Trace.h>
49
Alec Mourie60041e2019-06-14 18:59:51 -070050#include <cmath>
51#include <cstdlib>
52#include <mutex>
53#include <sstream>
54
David Sodman0c69cad2017-08-21 12:12:51 -070055#include "Colorizer.h"
56#include "DisplayDevice.h"
Mikael Pessa90092f42019-08-26 17:22:04 -070057#include "FrameTracer/FrameTracer.h"
David Sodman0c69cad2017-08-21 12:12:51 -070058#include "LayerRejecter.h"
Yiwei Zhang7e666a52018-11-15 13:33:42 -080059#include "TimeStats/TimeStats.h"
60
David Sodman0c69cad2017-08-21 12:12:51 -070061namespace android {
62
Peiyong Lin1a70eca2019-11-15 09:33:33 -080063static constexpr float defaultMaxMasteringLuminance = 1000.0;
64static constexpr float defaultMaxContentLuminance = 1000.0;
65
Lloyd Pique42ab75e2018-09-12 20:46:03 -070066BufferLayer::BufferLayer(const LayerCreationArgs& args)
Lloyd Piquefeb73d72018-12-04 17:23:44 -080067 : Layer(args),
chaviwb4c6e582019-08-16 14:35:07 -070068 mTextureName(args.textureName),
Lloyd Piquefeb73d72018-12-04 17:23:44 -080069 mCompositionLayer{mFlinger->getCompositionEngine().createLayer(
70 compositionengine::LayerCreationArgs{this})} {
Dominik Laskowski87a07e42019-10-10 20:38:02 -070071 ALOGV("Creating Layer %s", getDebugName());
David Sodman0c69cad2017-08-21 12:12:51 -070072
Lloyd Pique42ab75e2018-09-12 20:46:03 -070073 mPremultipliedAlpha = !(args.flags & ISurfaceComposerClient::eNonPremultiplied);
David Sodman0c69cad2017-08-21 12:12:51 -070074
Lloyd Pique42ab75e2018-09-12 20:46:03 -070075 mPotentialCursor = args.flags & ISurfaceComposerClient::eCursorWindow;
76 mProtectedByApp = args.flags & ISurfaceComposerClient::eProtectedByApp;
David Sodman0c69cad2017-08-21 12:12:51 -070077}
78
79BufferLayer::~BufferLayer() {
chaviwb4c6e582019-08-16 14:35:07 -070080 if (!isClone()) {
81 // The original layer and the clone layer share the same texture. Therefore, only one of
82 // the layers, in this case the original layer, needs to handle the deletion. The original
83 // layer and the clone should be removed at the same time so there shouldn't be any issue
84 // with the clone layer trying to use the deleted texture.
85 mFlinger->deleteTextureAsync(mTextureName);
86 }
Yiwei Zhang1a88c402019-11-18 10:43:58 -080087 const int32_t layerId = getSequence();
88 mFlinger->mTimeStats->onDestroy(layerId);
89 mFlinger->mFrameTracer->onDestroy(layerId);
David Sodman0c69cad2017-08-21 12:12:51 -070090}
91
David Sodmaneb085e02017-10-05 18:49:04 -070092void BufferLayer::useSurfaceDamage() {
93 if (mFlinger->mForceFullDamage) {
94 surfaceDamageRegion = Region::INVALID_REGION;
95 } else {
chaviw4244e032019-09-04 11:27:49 -070096 surfaceDamageRegion = mBufferInfo.mSurfaceDamage;
David Sodmaneb085e02017-10-05 18:49:04 -070097 }
98}
99
100void BufferLayer::useEmptyDamage() {
101 surfaceDamageRegion.clear();
102}
103
Marissa Wallfd668622018-05-10 10:21:13 -0700104bool BufferLayer::isOpaque(const Layer::State& s) const {
105 // if we don't have a buffer or sidebandStream yet, we're translucent regardless of the
106 // layer's opaque flag.
chaviwd62d3062019-09-04 14:48:02 -0700107 if ((mSidebandStream == nullptr) && (mBufferInfo.mBuffer == nullptr)) {
Marissa Wallfd668622018-05-10 10:21:13 -0700108 return false;
109 }
110
111 // if the layer has the opaque flag, then we're always opaque,
112 // otherwise we use the current buffer's format.
113 return ((s.flags & layer_state_t::eLayerOpaque) != 0) || getOpacityForFormat(getPixelFormat());
David Sodman0c69cad2017-08-21 12:12:51 -0700114}
115
116bool BufferLayer::isVisible() const {
Dominik Laskowskif7a09ed2019-10-07 13:54:18 -0700117 return !isHiddenByPolicy() && getAlpha() > 0.0f &&
chaviwd62d3062019-09-04 14:48:02 -0700118 (mBufferInfo.mBuffer != nullptr || mSidebandStream != nullptr);
David Sodman0c69cad2017-08-21 12:12:51 -0700119}
120
121bool BufferLayer::isFixedSize() const {
122 return getEffectiveScalingMode() != NATIVE_WINDOW_SCALING_MODE_FREEZE;
123}
124
Lloyd Piquea83776c2019-01-29 18:42:32 -0800125bool BufferLayer::usesSourceCrop() const {
126 return true;
127}
128
David Sodman0c69cad2017-08-21 12:12:51 -0700129static constexpr mat4 inverseOrientation(uint32_t transform) {
David Sodman41fdfc92017-11-06 16:09:56 -0800130 const mat4 flipH(-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1);
131 const mat4 flipV(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1);
132 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 -0700133 mat4 tr;
134
135 if (transform & NATIVE_WINDOW_TRANSFORM_ROT_90) {
136 tr = tr * rot90;
137 }
138 if (transform & NATIVE_WINDOW_TRANSFORM_FLIP_H) {
139 tr = tr * flipH;
140 }
141 if (transform & NATIVE_WINDOW_TRANSFORM_FLIP_V) {
142 tr = tr * flipV;
143 }
144 return inverse(tr);
145}
146
Vishnu Nair9b079a22020-01-21 14:36:08 -0800147std::optional<compositionengine::LayerFE::LayerSettings> BufferLayer::prepareClientComposition(
Lloyd Piquef16688f2019-02-19 17:47:57 -0800148 compositionengine::LayerFE::ClientCompositionTargetSettings& targetSettings) {
David Sodman0c69cad2017-08-21 12:12:51 -0700149 ATRACE_CALL();
Lloyd Piquef16688f2019-02-19 17:47:57 -0800150
Vishnu Nair9b079a22020-01-21 14:36:08 -0800151 std::optional<compositionengine::LayerFE::LayerSettings> result =
152 Layer::prepareClientComposition(targetSettings);
Lloyd Piquef16688f2019-02-19 17:47:57 -0800153 if (!result) {
154 return result;
155 }
156
chaviwd62d3062019-09-04 14:48:02 -0700157 if (CC_UNLIKELY(mBufferInfo.mBuffer == 0)) {
David Sodman0c69cad2017-08-21 12:12:51 -0700158 // the texture has not been created yet, this Layer has
159 // in fact never been drawn into. This happens frequently with
160 // SurfaceView because the WindowManager can't know when the client
161 // has drawn the first time.
162
163 // If there is nothing under us, we paint the screen in black, otherwise
164 // we just skip this update.
165
166 // figure out if there is something below us
167 Region under;
168 bool finished = false;
169 mFlinger->mDrawingState.traverseInZOrder([&](Layer* layer) {
170 if (finished || layer == static_cast<BufferLayer const*>(this)) {
171 finished = true;
172 return;
173 }
Lloyd Piquea2468662019-03-07 21:31:06 -0800174
175 under.orSelf(layer->getScreenBounds());
David Sodman0c69cad2017-08-21 12:12:51 -0700176 });
177 // if not everything below us is covered, we plug the holes!
Lloyd Piquef16688f2019-02-19 17:47:57 -0800178 Region holes(targetSettings.clip.subtract(under));
David Sodman0c69cad2017-08-21 12:12:51 -0700179 if (!holes.isEmpty()) {
Lloyd Piquef16688f2019-02-19 17:47:57 -0800180 targetSettings.clearRegion.orSelf(holes);
David Sodman0c69cad2017-08-21 12:12:51 -0700181 }
Lloyd Piquef16688f2019-02-19 17:47:57 -0800182 return std::nullopt;
David Sodman0c69cad2017-08-21 12:12:51 -0700183 }
Lloyd Pique688abd42019-02-15 15:42:24 -0800184 bool blackOutLayer = (isProtected() && !targetSettings.supportsProtectedContent) ||
Lloyd Piquef16688f2019-02-19 17:47:57 -0800185 (isSecure() && !targetSettings.isSecure);
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000186 const State& s(getDrawingState());
Vishnu Nair9b079a22020-01-21 14:36:08 -0800187 LayerFE::LayerSettings& layer = *result;
David Sodman0c69cad2017-08-21 12:12:51 -0700188 if (!blackOutLayer) {
chaviwd62d3062019-09-04 14:48:02 -0700189 layer.source.buffer.buffer = mBufferInfo.mBuffer;
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000190 layer.source.buffer.isOpaque = isOpaque(s);
chaviwd62d3062019-09-04 14:48:02 -0700191 layer.source.buffer.fence = mBufferInfo.mFence;
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000192 layer.source.buffer.textureName = mTextureName;
193 layer.source.buffer.usePremultipliedAlpha = getPremultipledAlpha();
194 layer.source.buffer.isY410BT2020 = isHdrY410();
Peiyong Lin1a70eca2019-11-15 09:33:33 -0800195 bool hasSmpte2086 = mBufferInfo.mHdrMetadata.validTypes & HdrMetadata::SMPTE2086;
196 bool hasCta861_3 = mBufferInfo.mHdrMetadata.validTypes & HdrMetadata::CTA861_3;
197 layer.source.buffer.maxMasteringLuminance = hasSmpte2086
198 ? mBufferInfo.mHdrMetadata.smpte2086.maxLuminance
199 : defaultMaxMasteringLuminance;
200 layer.source.buffer.maxContentLuminance = hasCta861_3
201 ? mBufferInfo.mHdrMetadata.cta8613.maxContentLightLevel
202 : defaultMaxContentLuminance;
Vishnu Nair9b079a22020-01-21 14:36:08 -0800203 layer.frameNumber = mCurrentFrameNumber;
204 layer.bufferId = mBufferInfo.mBuffer ? mBufferInfo.mBuffer->getId() : 0;
205
David Sodman0c69cad2017-08-21 12:12:51 -0700206 // TODO: we could be more subtle with isFixedSize()
Lloyd Piquef16688f2019-02-19 17:47:57 -0800207 const bool useFiltering = targetSettings.needsFiltering || mNeedsFiltering || isFixedSize();
David Sodman0c69cad2017-08-21 12:12:51 -0700208
209 // Query the texture matrix given our current filtering mode.
210 float textureMatrix[16];
chaviwf83ce182019-09-12 14:43:08 -0700211 getDrawingTransformMatrix(useFiltering, textureMatrix);
David Sodman0c69cad2017-08-21 12:12:51 -0700212
213 if (getTransformToDisplayInverse()) {
214 /*
215 * the code below applies the primary display's inverse transform to
216 * the texture transform
217 */
Dominik Laskowski718f9602019-11-09 20:01:35 -0800218 uint32_t transform = DisplayDevice::getPrimaryDisplayRotationFlags();
David Sodman0c69cad2017-08-21 12:12:51 -0700219 mat4 tr = inverseOrientation(transform);
220
221 /**
222 * TODO(b/36727915): This is basically a hack.
223 *
224 * Ensure that regardless of the parent transformation,
225 * this buffer is always transformed from native display
226 * orientation to display orientation. For example, in the case
227 * of a camera where the buffer remains in native orientation,
228 * we want the pixels to always be upright.
229 */
230 sp<Layer> p = mDrawingParent.promote();
231 if (p != nullptr) {
232 const auto parentTransform = p->getTransform();
233 tr = tr * inverseOrientation(parentTransform.getOrientation());
234 }
235
236 // and finally apply it to the original texture matrix
237 const mat4 texTransform(mat4(static_cast<const float*>(textureMatrix)) * tr);
238 memcpy(textureMatrix, texTransform.asArray(), sizeof(textureMatrix));
239 }
240
Vishnu Nair4351ad52019-02-11 14:13:02 -0800241 const Rect win{getBounds()};
Marissa Wall290ad082019-03-06 13:23:47 -0800242 float bufferWidth = getBufferSize(s).getWidth();
243 float bufferHeight = getBufferSize(s).getHeight();
244
245 // BufferStateLayers can have a "buffer size" of [0, 0, -1, -1] when no display frame has
246 // been set and there is no parent layer bounds. In that case, the scale is meaningless so
247 // ignore them.
248 if (!getBufferSize(s).isValid()) {
249 bufferWidth = float(win.right) - float(win.left);
250 bufferHeight = float(win.bottom) - float(win.top);
251 }
David Sodman0c69cad2017-08-21 12:12:51 -0700252
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000253 const float scaleHeight = (float(win.bottom) - float(win.top)) / bufferHeight;
254 const float scaleWidth = (float(win.right) - float(win.left)) / bufferWidth;
255 const float translateY = float(win.top) / bufferHeight;
256 const float translateX = float(win.left) / bufferWidth;
257
258 // Flip y-coordinates because GLConsumer expects OpenGL convention.
259 mat4 tr = mat4::translate(vec4(.5, .5, 0, 1)) * mat4::scale(vec4(1, -1, 1, 1)) *
260 mat4::translate(vec4(-.5, -.5, 0, 1)) *
261 mat4::translate(vec4(translateX, translateY, 0, 1)) *
262 mat4::scale(vec4(scaleWidth, scaleHeight, 1.0, 1.0));
263
264 layer.source.buffer.useTextureFiltering = useFiltering;
265 layer.source.buffer.textureTransform = mat4(static_cast<const float*>(textureMatrix)) * tr;
David Sodman0c69cad2017-08-21 12:12:51 -0700266 } else {
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000267 // If layer is blacked out, force alpha to 1 so that we draw a black color
268 // layer.
269 layer.source.buffer.buffer = nullptr;
270 layer.alpha = 1.0;
Vishnu Nair9b079a22020-01-21 14:36:08 -0800271 layer.frameNumber = 0;
272 layer.bufferId = 0;
David Sodman0c69cad2017-08-21 12:12:51 -0700273 }
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000274
Vishnu Nair9b079a22020-01-21 14:36:08 -0800275 return layer;
David Sodman0c69cad2017-08-21 12:12:51 -0700276}
277
Marissa Wallfd668622018-05-10 10:21:13 -0700278bool BufferLayer::isHdrY410() const {
279 // pixel format is HDR Y410 masquerading as RGBA_1010102
chaviw4244e032019-09-04 11:27:49 -0700280 return (mBufferInfo.mDataspace == ui::Dataspace::BT2020_ITU_PQ &&
281 mBufferInfo.mApi == NATIVE_WINDOW_API_MEDIA &&
chaviwd62d3062019-09-04 14:48:02 -0700282 mBufferInfo.mBuffer->getPixelFormat() == HAL_PIXEL_FORMAT_RGBA_1010102);
David Sodmaneb085e02017-10-05 18:49:04 -0700283}
284
Lloyd Piquef5275482019-01-29 18:42:42 -0800285void BufferLayer::latchPerFrameState(
286 compositionengine::LayerFECompositionState& compositionState) const {
287 Layer::latchPerFrameState(compositionState);
David Sodman0c69cad2017-08-21 12:12:51 -0700288
289 // Sideband layers
Lloyd Piquef5275482019-01-29 18:42:42 -0800290 if (compositionState.sidebandStream.get()) {
291 compositionState.compositionType = Hwc2::IComposerClient::Composition::SIDEBAND;
David Sodman15094112018-10-11 09:39:37 -0700292 } else {
Lloyd Piquef5275482019-01-29 18:42:42 -0800293 // Normal buffer layers
chaviw4244e032019-09-04 11:27:49 -0700294 compositionState.hdrMetadata = mBufferInfo.mHdrMetadata;
Lloyd Piquef5275482019-01-29 18:42:42 -0800295 compositionState.compositionType = mPotentialCursor
296 ? Hwc2::IComposerClient::Composition::CURSOR
297 : Hwc2::IComposerClient::Composition::DEVICE;
David Sodman0c69cad2017-08-21 12:12:51 -0700298 }
David Sodman0c69cad2017-08-21 12:12:51 -0700299}
300
Marissa Wallfd668622018-05-10 10:21:13 -0700301bool BufferLayer::onPreComposition(nsecs_t refreshStartTime) {
chaviwd62d3062019-09-04 14:48:02 -0700302 if (mBufferInfo.mBuffer != nullptr) {
Marissa Wallfd668622018-05-10 10:21:13 -0700303 Mutex::Autolock lock(mFrameEventHistoryMutex);
304 mFrameEventHistory.addPreComposition(mCurrentFrameNumber, refreshStartTime);
David Sodman0c69cad2017-08-21 12:12:51 -0700305 }
Marissa Wallfd668622018-05-10 10:21:13 -0700306 mRefreshPending = false;
307 return hasReadyFrame();
David Sodman0c69cad2017-08-21 12:12:51 -0700308}
309
Adithya Srinivasanb69e0762019-11-11 18:39:53 -0800310bool BufferLayer::onPostComposition(sp<const DisplayDevice> displayDevice,
Dominik Laskowski075d3172018-05-24 15:50:06 -0700311 const std::shared_ptr<FenceTime>& glDoneFence,
Marissa Wallfd668622018-05-10 10:21:13 -0700312 const std::shared_ptr<FenceTime>& presentFence,
313 const CompositorTiming& compositorTiming) {
314 // mFrameLatencyNeeded is true when a new frame was latched for the
315 // composition.
chaviw74b03172019-08-19 11:09:03 -0700316 if (!mBufferInfo.mFrameLatencyNeeded) return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700317
318 // Update mFrameEventHistory.
Dan Stoza436ccf32018-06-21 12:10:12 -0700319 {
Marissa Wallfd668622018-05-10 10:21:13 -0700320 Mutex::Autolock lock(mFrameEventHistoryMutex);
321 mFrameEventHistory.addPostComposition(mCurrentFrameNumber, glDoneFence, presentFence,
322 compositorTiming);
David Sodman0c69cad2017-08-21 12:12:51 -0700323 }
324
Marissa Wallfd668622018-05-10 10:21:13 -0700325 // Update mFrameTracker.
chaviw4244e032019-09-04 11:27:49 -0700326 nsecs_t desiredPresentTime = mBufferInfo.mDesiredPresentTime;
Marissa Wallfd668622018-05-10 10:21:13 -0700327 mFrameTracker.setDesiredPresentTime(desiredPresentTime);
328
Yiwei Zhang1a88c402019-11-18 10:43:58 -0800329 const int32_t layerId = getSequence();
330 mFlinger->mTimeStats->setDesiredTime(layerId, mCurrentFrameNumber, desiredPresentTime);
Marissa Wallfd668622018-05-10 10:21:13 -0700331
Adithya Srinivasanb69e0762019-11-11 18:39:53 -0800332 const auto outputLayer = findOutputLayerForDisplay(displayDevice);
333 if (outputLayer && outputLayer->requiresClientComposition()) {
334 nsecs_t clientCompositionTimestamp = outputLayer->getState().clientCompositionTimestamp;
335 mFlinger->mFrameTracer->traceTimestamp(layerId, getCurrentBufferId(), mCurrentFrameNumber,
336 clientCompositionTimestamp,
337 FrameTracer::FrameEvent::FALLBACK_COMPOSITION);
338 }
339
chaviw4244e032019-09-04 11:27:49 -0700340 std::shared_ptr<FenceTime> frameReadyFence = mBufferInfo.mFenceTime;
Marissa Wallfd668622018-05-10 10:21:13 -0700341 if (frameReadyFence->isValid()) {
342 mFrameTracker.setFrameReadyFence(std::move(frameReadyFence));
343 } else {
344 // There was no fence for this frame, so assume that it was ready
345 // to be presented at the desired present time.
346 mFrameTracker.setFrameReadyTime(desiredPresentTime);
Dominik Laskowski45de9bd2018-06-11 17:44:10 -0700347 }
Marissa Wallfd668622018-05-10 10:21:13 -0700348
Adithya Srinivasanb69e0762019-11-11 18:39:53 -0800349 const auto displayId = displayDevice->getId();
Marissa Wallfd668622018-05-10 10:21:13 -0700350 if (presentFence->isValid()) {
Yiwei Zhang1a88c402019-11-18 10:43:58 -0800351 mFlinger->mTimeStats->setPresentFence(layerId, mCurrentFrameNumber, presentFence);
352 mFlinger->mFrameTracer->traceFence(layerId, getCurrentBufferId(), mCurrentFrameNumber,
Mikael Pessa90092f42019-08-26 17:22:04 -0700353 presentFence, FrameTracer::FrameEvent::PRESENT_FENCE);
Marissa Wallfd668622018-05-10 10:21:13 -0700354 mFrameTracker.setActualPresentFence(std::shared_ptr<FenceTime>(presentFence));
Dominik Laskowski075d3172018-05-24 15:50:06 -0700355 } else if (displayId && mFlinger->getHwComposer().isConnected(*displayId)) {
Marissa Wallfd668622018-05-10 10:21:13 -0700356 // The HWC doesn't support present fences, so use the refresh
357 // timestamp instead.
Dominik Laskowski075d3172018-05-24 15:50:06 -0700358 const nsecs_t actualPresentTime = mFlinger->getHwComposer().getRefreshTimestamp(*displayId);
Yiwei Zhang1a88c402019-11-18 10:43:58 -0800359 mFlinger->mTimeStats->setPresentTime(layerId, mCurrentFrameNumber, actualPresentTime);
360 mFlinger->mFrameTracer->traceTimestamp(layerId, getCurrentBufferId(), mCurrentFrameNumber,
Mikael Pessa90092f42019-08-26 17:22:04 -0700361 actualPresentTime,
362 FrameTracer::FrameEvent::PRESENT_FENCE);
Marissa Wallfd668622018-05-10 10:21:13 -0700363 mFrameTracker.setActualPresentTime(actualPresentTime);
364 }
365
366 mFrameTracker.advanceFrame();
chaviw74b03172019-08-19 11:09:03 -0700367 mBufferInfo.mFrameLatencyNeeded = false;
Marissa Wallfd668622018-05-10 10:21:13 -0700368 return true;
David Sodman0c69cad2017-08-21 12:12:51 -0700369}
370
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700371bool BufferLayer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime,
372 nsecs_t expectedPresentTime) {
Marissa Wallfd668622018-05-10 10:21:13 -0700373 ATRACE_CALL();
David Sodman0c69cad2017-08-21 12:12:51 -0700374
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800375 bool refreshRequired = latchSidebandStream(recomputeVisibleRegions);
David Sodman0c69cad2017-08-21 12:12:51 -0700376
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800377 if (refreshRequired) {
378 return refreshRequired;
David Sodman0c69cad2017-08-21 12:12:51 -0700379 }
380
Marissa Wallfd668622018-05-10 10:21:13 -0700381 if (!hasReadyFrame()) {
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800382 return false;
David Sodman0c69cad2017-08-21 12:12:51 -0700383 }
David Sodman0c69cad2017-08-21 12:12:51 -0700384
Marissa Wallfd668622018-05-10 10:21:13 -0700385 // if we've already called updateTexImage() without going through
386 // a composition step, we have to skip this layer at this point
387 // because we cannot call updateTeximage() without a corresponding
388 // compositionComplete() call.
389 // we'll trigger an update in onPreComposition().
390 if (mRefreshPending) {
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800391 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700392 }
393
394 // If the head buffer's acquire fence hasn't signaled yet, return and
395 // try again later
396 if (!fenceHasSignaled()) {
Ady Abraham09bd3922019-04-08 10:44:56 -0700397 ATRACE_NAME("!fenceHasSignaled()");
David Sodman0c69cad2017-08-21 12:12:51 -0700398 mFlinger->signalLayerUpdate();
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800399 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700400 }
401
402 // Capture the old state of the layer for comparisons later
403 const State& s(getDrawingState());
404 const bool oldOpacity = isOpaque(s);
chaviwd62d3062019-09-04 14:48:02 -0700405
406 BufferInfo oldBufferInfo = mBufferInfo;
Marissa Wallfd668622018-05-10 10:21:13 -0700407
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700408 if (!allTransactionsSignaled(expectedPresentTime)) {
Marissa Wallebb486e2019-05-15 14:08:08 -0700409 mFlinger->setTransactionFlags(eTraversalNeeded);
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800410 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700411 }
412
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700413 status_t err = updateTexImage(recomputeVisibleRegions, latchTime, expectedPresentTime);
Marissa Wallfd668622018-05-10 10:21:13 -0700414 if (err != NO_ERROR) {
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800415 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700416 }
417
418 err = updateActiveBuffer();
419 if (err != NO_ERROR) {
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800420 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700421 }
422
Marissa Wallfd668622018-05-10 10:21:13 -0700423 err = updateFrameNumber(latchTime);
424 if (err != NO_ERROR) {
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800425 return false;
Marissa Wallfd668622018-05-10 10:21:13 -0700426 }
427
chaviw4244e032019-09-04 11:27:49 -0700428 gatherBufferInfo();
429
Marissa Wallfd668622018-05-10 10:21:13 -0700430 mRefreshPending = true;
chaviw74b03172019-08-19 11:09:03 -0700431 mBufferInfo.mFrameLatencyNeeded = true;
chaviwd62d3062019-09-04 14:48:02 -0700432 if (oldBufferInfo.mBuffer == nullptr) {
Marissa Wallfd668622018-05-10 10:21:13 -0700433 // the first time we receive a buffer, we need to trigger a
434 // geometry invalidation.
435 recomputeVisibleRegions = true;
436 }
437
chaviw4244e032019-09-04 11:27:49 -0700438 if ((mBufferInfo.mCrop != oldBufferInfo.mCrop) ||
439 (mBufferInfo.mTransform != oldBufferInfo.mTransform) ||
440 (mBufferInfo.mScaleMode != oldBufferInfo.mScaleMode) ||
441 (mBufferInfo.mTransformToDisplayInverse != oldBufferInfo.mTransformToDisplayInverse)) {
Marissa Wallfd668622018-05-10 10:21:13 -0700442 recomputeVisibleRegions = true;
443 }
444
chaviwd62d3062019-09-04 14:48:02 -0700445 if (oldBufferInfo.mBuffer != nullptr) {
446 uint32_t bufWidth = mBufferInfo.mBuffer->getWidth();
447 uint32_t bufHeight = mBufferInfo.mBuffer->getHeight();
448 if (bufWidth != uint32_t(oldBufferInfo.mBuffer->width) ||
449 bufHeight != uint32_t(oldBufferInfo.mBuffer->height)) {
Marissa Wallfd668622018-05-10 10:21:13 -0700450 recomputeVisibleRegions = true;
451 }
452 }
453
454 if (oldOpacity != isOpaque(s)) {
455 recomputeVisibleRegions = true;
456 }
457
458 // Remove any sync points corresponding to the buffer which was just
459 // latched
460 {
461 Mutex::Autolock lock(mLocalSyncPointMutex);
462 auto point = mLocalSyncPoints.begin();
463 while (point != mLocalSyncPoints.end()) {
464 if (!(*point)->frameIsAvailable() || !(*point)->transactionIsApplied()) {
465 // This sync point must have been added since we started
466 // latching. Don't drop it yet.
467 ++point;
468 continue;
469 }
470
471 if ((*point)->getFrameNumber() <= mCurrentFrameNumber) {
Alec Mourie60041e2019-06-14 18:59:51 -0700472 std::stringstream ss;
473 ss << "Dropping sync point " << (*point)->getFrameNumber();
474 ATRACE_NAME(ss.str().c_str());
Marissa Wallfd668622018-05-10 10:21:13 -0700475 point = mLocalSyncPoints.erase(point);
476 } else {
477 ++point;
478 }
479 }
480 }
481
Vishnu Nair6194e2e2019-02-06 12:58:39 -0800482 return true;
Marissa Wallfd668622018-05-10 10:21:13 -0700483}
484
485// transaction
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700486void BufferLayer::notifyAvailableFrames(nsecs_t expectedPresentTime) {
487 const auto headFrameNumber = getHeadFrameNumber(expectedPresentTime);
Ady Abrahamcd1580c2019-04-29 15:40:03 -0700488 const bool headFenceSignaled = fenceHasSignaled();
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700489 const bool presentTimeIsCurrent = framePresentTimeIsCurrent(expectedPresentTime);
Marissa Wallfd668622018-05-10 10:21:13 -0700490 Mutex::Autolock lock(mLocalSyncPointMutex);
491 for (auto& point : mLocalSyncPoints) {
Ady Abrahamcd1580c2019-04-29 15:40:03 -0700492 if (headFrameNumber >= point->getFrameNumber() && headFenceSignaled &&
493 presentTimeIsCurrent) {
Marissa Wallfd668622018-05-10 10:21:13 -0700494 point->setFrameAvailable();
chaviw43cb3cb2019-05-31 15:23:41 -0700495 sp<Layer> requestedSyncLayer = point->getRequestedSyncLayer();
496 if (requestedSyncLayer) {
497 // Need to update the transaction flag to ensure the layer's pending transaction
498 // gets applied.
499 requestedSyncLayer->setTransactionFlags(eTransactionNeeded);
500 }
Marissa Wallfd668622018-05-10 10:21:13 -0700501 }
David Sodman0c69cad2017-08-21 12:12:51 -0700502 }
503}
504
Marissa Wallfd668622018-05-10 10:21:13 -0700505bool BufferLayer::hasReadyFrame() const {
Marissa Wall024a1912018-08-13 13:55:35 -0700506 return hasFrameUpdate() || getSidebandStreamChanged() || getAutoRefresh();
Marissa Wallfd668622018-05-10 10:21:13 -0700507}
508
509uint32_t BufferLayer::getEffectiveScalingMode() const {
510 if (mOverrideScalingMode >= 0) {
511 return mOverrideScalingMode;
512 }
513
chaviw4244e032019-09-04 11:27:49 -0700514 return mBufferInfo.mScaleMode;
Marissa Wallfd668622018-05-10 10:21:13 -0700515}
516
517bool BufferLayer::isProtected() const {
chaviwd62d3062019-09-04 14:48:02 -0700518 const sp<GraphicBuffer>& buffer(mBufferInfo.mBuffer);
Marissa Wallfd668622018-05-10 10:21:13 -0700519 return (buffer != 0) && (buffer->getUsage() & GRALLOC_USAGE_PROTECTED);
520}
521
522bool BufferLayer::latchUnsignaledBuffers() {
523 static bool propertyLoaded = false;
524 static bool latch = false;
525 static std::mutex mutex;
526 std::lock_guard<std::mutex> lock(mutex);
527 if (!propertyLoaded) {
528 char value[PROPERTY_VALUE_MAX] = {};
529 property_get("debug.sf.latch_unsignaled", value, "0");
530 latch = atoi(value);
531 propertyLoaded = true;
532 }
533 return latch;
534}
535
536// h/w composer set-up
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700537bool BufferLayer::allTransactionsSignaled(nsecs_t expectedPresentTime) {
538 const auto headFrameNumber = getHeadFrameNumber(expectedPresentTime);
Marissa Wallfd668622018-05-10 10:21:13 -0700539 bool matchingFramesFound = false;
540 bool allTransactionsApplied = true;
541 Mutex::Autolock lock(mLocalSyncPointMutex);
542
543 for (auto& point : mLocalSyncPoints) {
544 if (point->getFrameNumber() > headFrameNumber) {
545 break;
546 }
547 matchingFramesFound = true;
548
549 if (!point->frameIsAvailable()) {
550 // We haven't notified the remote layer that the frame for
551 // this point is available yet. Notify it now, and then
552 // abort this attempt to latch.
553 point->setFrameAvailable();
554 allTransactionsApplied = false;
555 break;
556 }
557
558 allTransactionsApplied = allTransactionsApplied && point->transactionIsApplied();
559 }
560 return !matchingFramesFound || allTransactionsApplied;
David Sodman0c69cad2017-08-21 12:12:51 -0700561}
562
563// As documented in libhardware header, formats in the range
564// 0x100 - 0x1FF are specific to the HAL implementation, and
565// are known to have no alpha channel
566// TODO: move definition for device-specific range into
567// hardware.h, instead of using hard-coded values here.
568#define HARDWARE_IS_DEVICE_FORMAT(f) ((f) >= 0x100 && (f) <= 0x1FF)
569
570bool BufferLayer::getOpacityForFormat(uint32_t format) {
571 if (HARDWARE_IS_DEVICE_FORMAT(format)) {
572 return true;
573 }
574 switch (format) {
575 case HAL_PIXEL_FORMAT_RGBA_8888:
576 case HAL_PIXEL_FORMAT_BGRA_8888:
577 case HAL_PIXEL_FORMAT_RGBA_FP16:
578 case HAL_PIXEL_FORMAT_RGBA_1010102:
579 return false;
580 }
581 // in all other case, we have no blending (also for unknown formats)
582 return true;
583}
584
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800585bool BufferLayer::needsFiltering(const sp<const DisplayDevice>& displayDevice) const {
Lloyd Piquef16688f2019-02-19 17:47:57 -0800586 // If we are not capturing based on the state of a known display device,
587 // just return false.
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800588 if (displayDevice == nullptr) {
Lloyd Piquef16688f2019-02-19 17:47:57 -0800589 return false;
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800590 }
591
592 const auto outputLayer = findOutputLayerForDisplay(displayDevice);
593 if (outputLayer == nullptr) {
Lloyd Piquef16688f2019-02-19 17:47:57 -0800594 return false;
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800595 }
596
Lloyd Piquef16688f2019-02-19 17:47:57 -0800597 // We need filtering if the sourceCrop rectangle size does not match the
598 // displayframe rectangle size (not a 1:1 render)
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800599 const auto& compositionState = outputLayer->getState();
600 const auto displayFrame = compositionState.displayFrame;
601 const auto sourceCrop = compositionState.sourceCrop;
Lloyd Piquef16688f2019-02-19 17:47:57 -0800602 return sourceCrop.getHeight() != displayFrame.getHeight() ||
Peiyong Linc2020ca2019-01-10 11:36:12 -0800603 sourceCrop.getWidth() != displayFrame.getWidth();
Chia-I Wu692e0832018-06-05 15:46:58 -0700604}
605
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700606uint64_t BufferLayer::getHeadFrameNumber(nsecs_t expectedPresentTime) const {
Lloyd Pique0449b0f2018-12-20 16:23:45 -0800607 if (hasFrameUpdate()) {
Dominik Laskowskia8955dd2019-07-10 10:19:09 -0700608 return getFrameNumber(expectedPresentTime);
David Sodman0c69cad2017-08-21 12:12:51 -0700609 } else {
610 return mCurrentFrameNumber;
611 }
612}
613
Vishnu Nair60356342018-11-13 13:00:45 -0800614Rect BufferLayer::getBufferSize(const State& s) const {
615 // If we have a sideband stream, or we are scaling the buffer then return the layer size since
616 // we cannot determine the buffer size.
617 if ((s.sidebandStream != nullptr) ||
618 (getEffectiveScalingMode() != NATIVE_WINDOW_SCALING_MODE_FREEZE)) {
619 return Rect(getActiveWidth(s), getActiveHeight(s));
620 }
621
chaviwd62d3062019-09-04 14:48:02 -0700622 if (mBufferInfo.mBuffer == nullptr) {
Vishnu Nair60356342018-11-13 13:00:45 -0800623 return Rect::INVALID_RECT;
624 }
625
chaviwd62d3062019-09-04 14:48:02 -0700626 uint32_t bufWidth = mBufferInfo.mBuffer->getWidth();
627 uint32_t bufHeight = mBufferInfo.mBuffer->getHeight();
Vishnu Nair60356342018-11-13 13:00:45 -0800628
629 // Undo any transformations on the buffer and return the result.
chaviw4244e032019-09-04 11:27:49 -0700630 if (mBufferInfo.mTransform & ui::Transform::ROT_90) {
Vishnu Nair60356342018-11-13 13:00:45 -0800631 std::swap(bufWidth, bufHeight);
632 }
633
Lloyd Pique0449b0f2018-12-20 16:23:45 -0800634 if (getTransformToDisplayInverse()) {
Dominik Laskowski718f9602019-11-09 20:01:35 -0800635 uint32_t invTransform = DisplayDevice::getPrimaryDisplayRotationFlags();
Vishnu Nair60356342018-11-13 13:00:45 -0800636 if (invTransform & ui::Transform::ROT_90) {
637 std::swap(bufWidth, bufHeight);
638 }
639 }
640
641 return Rect(bufWidth, bufHeight);
642}
643
Lloyd Piquefeb73d72018-12-04 17:23:44 -0800644std::shared_ptr<compositionengine::Layer> BufferLayer::getCompositionLayer() const {
645 return mCompositionLayer;
646}
647
Vishnu Nair4351ad52019-02-11 14:13:02 -0800648FloatRect BufferLayer::computeSourceBounds(const FloatRect& parentBounds) const {
649 const State& s(getDrawingState());
650
651 // If we have a sideband stream, or we are scaling the buffer then return the layer size since
652 // we cannot determine the buffer size.
653 if ((s.sidebandStream != nullptr) ||
654 (getEffectiveScalingMode() != NATIVE_WINDOW_SCALING_MODE_FREEZE)) {
655 return FloatRect(0, 0, getActiveWidth(s), getActiveHeight(s));
656 }
657
chaviwd62d3062019-09-04 14:48:02 -0700658 if (mBufferInfo.mBuffer == nullptr) {
Vishnu Nair4351ad52019-02-11 14:13:02 -0800659 return parentBounds;
660 }
661
chaviwd62d3062019-09-04 14:48:02 -0700662 uint32_t bufWidth = mBufferInfo.mBuffer->getWidth();
663 uint32_t bufHeight = mBufferInfo.mBuffer->getHeight();
Vishnu Nair4351ad52019-02-11 14:13:02 -0800664
665 // Undo any transformations on the buffer and return the result.
chaviw4244e032019-09-04 11:27:49 -0700666 if (mBufferInfo.mTransform & ui::Transform::ROT_90) {
Vishnu Nair4351ad52019-02-11 14:13:02 -0800667 std::swap(bufWidth, bufHeight);
668 }
669
670 if (getTransformToDisplayInverse()) {
Dominik Laskowski718f9602019-11-09 20:01:35 -0800671 uint32_t invTransform = DisplayDevice::getPrimaryDisplayRotationFlags();
Vishnu Nair4351ad52019-02-11 14:13:02 -0800672 if (invTransform & ui::Transform::ROT_90) {
673 std::swap(bufWidth, bufHeight);
674 }
675 }
676
677 return FloatRect(0, 0, bufWidth, bufHeight);
678}
679
chaviw49a108c2019-08-12 11:23:06 -0700680void BufferLayer::latchAndReleaseBuffer() {
681 mRefreshPending = false;
682 if (hasReadyFrame()) {
683 bool ignored = false;
684 latchBuffer(ignored, systemTime(), 0 /* expectedPresentTime */);
685 }
686 releasePendingBuffer(systemTime());
687}
688
chaviw4244e032019-09-04 11:27:49 -0700689PixelFormat BufferLayer::getPixelFormat() const {
690 return mBufferInfo.mPixelFormat;
691}
692
693bool BufferLayer::getTransformToDisplayInverse() const {
694 return mBufferInfo.mTransformToDisplayInverse;
695}
696
697Rect BufferLayer::getBufferCrop() const {
698 // this is the crop rectangle that applies to the buffer
699 // itself (as opposed to the window)
700 if (!mBufferInfo.mCrop.isEmpty()) {
701 // if the buffer crop is defined, we use that
702 return mBufferInfo.mCrop;
chaviwd62d3062019-09-04 14:48:02 -0700703 } else if (mBufferInfo.mBuffer != nullptr) {
chaviw4244e032019-09-04 11:27:49 -0700704 // otherwise we use the whole buffer
chaviwd62d3062019-09-04 14:48:02 -0700705 return mBufferInfo.mBuffer->getBounds();
chaviw4244e032019-09-04 11:27:49 -0700706 } else {
707 // if we don't have a buffer yet, we use an empty/invalid crop
708 return Rect();
709 }
710}
711
712uint32_t BufferLayer::getBufferTransform() const {
713 return mBufferInfo.mTransform;
714}
715
716ui::Dataspace BufferLayer::getDataSpace() const {
717 return mBufferInfo.mDataspace;
718}
719
720ui::Dataspace BufferLayer::translateDataspace(ui::Dataspace dataspace) {
721 ui::Dataspace updatedDataspace = dataspace;
722 // translate legacy dataspaces to modern dataspaces
723 switch (dataspace) {
724 case ui::Dataspace::SRGB:
725 updatedDataspace = ui::Dataspace::V0_SRGB;
726 break;
727 case ui::Dataspace::SRGB_LINEAR:
728 updatedDataspace = ui::Dataspace::V0_SRGB_LINEAR;
729 break;
730 case ui::Dataspace::JFIF:
731 updatedDataspace = ui::Dataspace::V0_JFIF;
732 break;
733 case ui::Dataspace::BT601_625:
734 updatedDataspace = ui::Dataspace::V0_BT601_625;
735 break;
736 case ui::Dataspace::BT601_525:
737 updatedDataspace = ui::Dataspace::V0_BT601_525;
738 break;
739 case ui::Dataspace::BT709:
740 updatedDataspace = ui::Dataspace::V0_BT709;
741 break;
742 default:
743 break;
744 }
745
746 return updatedDataspace;
747}
748
chaviwd62d3062019-09-04 14:48:02 -0700749sp<GraphicBuffer> BufferLayer::getBuffer() const {
750 return mBufferInfo.mBuffer;
751}
752
chaviwf83ce182019-09-12 14:43:08 -0700753void BufferLayer::getDrawingTransformMatrix(bool filteringEnabled, float outMatrix[16]) {
754 GLConsumer::computeTransformMatrix(outMatrix, mBufferInfo.mBuffer, mBufferInfo.mCrop,
755 mBufferInfo.mTransform, filteringEnabled);
756}
757
chaviwb4c6e582019-08-16 14:35:07 -0700758void BufferLayer::setInitialValuesForClone(const sp<Layer>& clonedFrom) {
759 Layer::setInitialValuesForClone(clonedFrom);
760
761 sp<BufferLayer> bufferClonedFrom = static_cast<BufferLayer*>(clonedFrom.get());
762 mPremultipliedAlpha = bufferClonedFrom->mPremultipliedAlpha;
763 mPotentialCursor = bufferClonedFrom->mPotentialCursor;
764 mProtectedByApp = bufferClonedFrom->mProtectedByApp;
chaviw74b03172019-08-19 11:09:03 -0700765
766 updateCloneBufferInfo();
767}
768
769void BufferLayer::updateCloneBufferInfo() {
770 if (!isClone() || !isClonedFromAlive()) {
771 return;
772 }
773
774 sp<BufferLayer> clonedFrom = static_cast<BufferLayer*>(getClonedFrom().get());
775 mBufferInfo = clonedFrom->mBufferInfo;
776 mSidebandStream = clonedFrom->mSidebandStream;
777 surfaceDamageRegion = clonedFrom->surfaceDamageRegion;
778 mCurrentFrameNumber = clonedFrom->mCurrentFrameNumber.load();
779 mPreviousFrameNumber = clonedFrom->mPreviousFrameNumber;
780
781 // After buffer info is updated, the drawingState from the real layer needs to be copied into
782 // the cloned. This is because some properties of drawingState can change when latchBuffer is
chaviwaf87b3e2019-10-01 16:59:28 -0700783 // called. However, copying the drawingState would also overwrite the cloned layer's relatives
784 // and touchableRegionCrop. Therefore, temporarily store the relatives so they can be set in
785 // the cloned drawingState again.
chaviw74b03172019-08-19 11:09:03 -0700786 wp<Layer> tmpZOrderRelativeOf = mDrawingState.zOrderRelativeOf;
787 SortedVector<wp<Layer>> tmpZOrderRelatives = mDrawingState.zOrderRelatives;
chaviwaf87b3e2019-10-01 16:59:28 -0700788 wp<Layer> tmpTouchableRegionCrop = mDrawingState.touchableRegionCrop;
789 InputWindowInfo tmpInputInfo = mDrawingState.inputInfo;
790
chaviw74b03172019-08-19 11:09:03 -0700791 mDrawingState = clonedFrom->mDrawingState;
chaviwaf87b3e2019-10-01 16:59:28 -0700792
793 mDrawingState.touchableRegionCrop = tmpTouchableRegionCrop;
chaviw74b03172019-08-19 11:09:03 -0700794 mDrawingState.zOrderRelativeOf = tmpZOrderRelativeOf;
795 mDrawingState.zOrderRelatives = tmpZOrderRelatives;
chaviwaf87b3e2019-10-01 16:59:28 -0700796 mDrawingState.inputInfo = tmpInputInfo;
chaviwb4c6e582019-08-16 14:35:07 -0700797}
798
David Sodman0c69cad2017-08-21 12:12:51 -0700799} // namespace android
800
801#if defined(__gl_h_)
802#error "don't include gl/gl.h in this file"
803#endif
804
805#if defined(__gl2_h_)
806#error "don't include gl2/gl2.h in this file"
807#endif
Ady Abrahamb0dbdaa2020-01-06 16:19:42 -0800808
809// TODO(b/129481165): remove the #pragma below and fix conversion issues
810#pragma clang diagnostic pop // ignored "-Wconversion"