| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright (C) 2008 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 |  | 
| Vishnu Nair | 217d8e6 | 2018-09-12 16:34:49 -0700 | [diff] [blame] | 17 | #define LOG_TAG "LayerState" | 
 | 18 |  | 
| Garfield Tan | 8a3083e | 2018-12-03 13:21:07 -0800 | [diff] [blame] | 19 | #include <inttypes.h> | 
 | 20 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | #include <utils/Errors.h> | 
| Mathias Agopian | c5b2c0b | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 22 | #include <binder/Parcel.h> | 
| Mathias Agopian | 90ac799 | 2012-02-25 18:48:35 -0800 | [diff] [blame] | 23 | #include <gui/ISurfaceComposerClient.h> | 
| Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 24 | #include <gui/IGraphicBufferProducer.h> | 
| Robert Carr | 4cdc58f | 2017-08-23 14:22:20 -0700 | [diff] [blame] | 25 | #include <gui/LayerState.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 |  | 
 | 27 | namespace android { | 
 | 28 |  | 
 | 29 | status_t layer_state_t::write(Parcel& output) const | 
 | 30 | { | 
| Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 31 |     output.writeStrongBinder(surface); | 
| Garfield Tan | 8a3083e | 2018-12-03 13:21:07 -0800 | [diff] [blame] | 32 |     output.writeUint64(what); | 
| Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 33 |     output.writeFloat(x); | 
 | 34 |     output.writeFloat(y); | 
| Robert Carr | ae06083 | 2016-11-28 10:51:00 -0800 | [diff] [blame] | 35 |     output.writeInt32(z); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 36 |     output.writeUint32(w); | 
 | 37 |     output.writeUint32(h); | 
 | 38 |     output.writeUint32(layerStack); | 
| Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 39 |     output.writeFloat(alpha); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 40 |     output.writeUint32(flags); | 
 | 41 |     output.writeUint32(mask); | 
| Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 42 |     *reinterpret_cast<layer_state_t::matrix22_t *>( | 
 | 43 |             output.writeInplace(sizeof(layer_state_t::matrix22_t))) = matrix; | 
| Marissa Wall | f58c14b | 2018-07-24 10:50:43 -0700 | [diff] [blame] | 44 |     output.write(crop_legacy); | 
| Marissa Wall | f58c14b | 2018-07-24 10:50:43 -0700 | [diff] [blame] | 45 |     output.writeStrongBinder(barrierHandle_legacy); | 
| Robert Carr | 1db73f6 | 2016-12-21 12:58:51 -0800 | [diff] [blame] | 46 |     output.writeStrongBinder(reparentHandle); | 
| Marissa Wall | f58c14b | 2018-07-24 10:50:43 -0700 | [diff] [blame] | 47 |     output.writeUint64(frameNumber_legacy); | 
| Robert Carr | c3574f7 | 2016-03-24 12:19:32 -0700 | [diff] [blame] | 48 |     output.writeInt32(overrideScalingMode); | 
| Marissa Wall | f58c14b | 2018-07-24 10:50:43 -0700 | [diff] [blame] | 49 |     output.writeStrongBinder(IInterface::asBinder(barrierGbp_legacy)); | 
| Robert Carr | db66e62 | 2017-04-10 16:55:57 -0700 | [diff] [blame] | 50 |     output.writeStrongBinder(relativeLayerHandle); | 
| chaviw | 0617894 | 2017-07-27 10:25:59 -0700 | [diff] [blame] | 51 |     output.writeStrongBinder(parentHandleForChild); | 
| chaviw | 13fdc49 | 2017-06-27 12:40:18 -0700 | [diff] [blame] | 52 |     output.writeFloat(color.r); | 
 | 53 |     output.writeFloat(color.g); | 
 | 54 |     output.writeFloat(color.b); | 
| Robert Carr | 2c358bf | 2018-08-08 15:58:15 -0700 | [diff] [blame] | 55 | #ifndef NO_INPUT | 
 | 56 |     inputInfo.write(output); | 
 | 57 | #endif | 
| Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 58 |     output.write(transparentRegion); | 
| Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 59 |     output.writeUint32(transform); | 
 | 60 |     output.writeBool(transformToDisplayInverse); | 
 | 61 |     output.write(crop); | 
| Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 62 |     output.write(frame); | 
| Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 63 |     if (buffer) { | 
 | 64 |         output.writeBool(true); | 
 | 65 |         output.write(*buffer); | 
 | 66 |     } else { | 
 | 67 |         output.writeBool(false); | 
 | 68 |     } | 
 | 69 |     if (acquireFence) { | 
 | 70 |         output.writeBool(true); | 
 | 71 |         output.write(*acquireFence); | 
 | 72 |     } else { | 
 | 73 |         output.writeBool(false); | 
 | 74 |     } | 
 | 75 |     output.writeUint32(static_cast<uint32_t>(dataspace)); | 
 | 76 |     output.write(hdrMetadata); | 
 | 77 |     output.write(surfaceDamageRegion); | 
 | 78 |     output.writeInt32(api); | 
 | 79 |     if (sidebandStream) { | 
 | 80 |         output.writeBool(true); | 
 | 81 |         output.writeNativeHandle(sidebandStream->handle()); | 
 | 82 |     } else { | 
 | 83 |         output.writeBool(false); | 
 | 84 |     } | 
 | 85 |  | 
| Peiyong Lin | d378863 | 2018-09-18 16:01:31 -0700 | [diff] [blame] | 86 |     memcpy(output.writeInplace(16 * sizeof(float)), | 
 | 87 |            colorTransform.asArray(), 16 * sizeof(float)); | 
| Lucas Dupin | 1b6531c | 2018-07-05 17:18:21 -0700 | [diff] [blame] | 88 |     output.writeFloat(cornerRadius); | 
| Marissa Wall | 3dad52d | 2019-03-22 14:03:19 -0700 | [diff] [blame] | 89 |     output.writeBool(hasListenerCallbacks); | 
| Steven Moreland | 9d4ce9b | 2019-07-17 15:23:38 -0700 | [diff] [blame] | 90 |     output.writeStrongBinder(cachedBuffer.token.promote()); | 
| Marissa Wall | 947d34e | 2019-03-29 14:03:53 -0700 | [diff] [blame] | 91 |     output.writeUint64(cachedBuffer.id); | 
| Evan Rosky | 1f6d6d5 | 2018-12-06 10:47:26 -0800 | [diff] [blame] | 92 |     output.writeParcelable(metadata); | 
| Marissa Wall | ebc2c05 | 2019-01-16 19:16:55 -0800 | [diff] [blame] | 93 |  | 
| Valerie Hau | dd0b757 | 2019-01-29 14:59:27 -0800 | [diff] [blame] | 94 |     output.writeFloat(bgColorAlpha); | 
 | 95 |     output.writeUint32(static_cast<uint32_t>(bgColorDataspace)); | 
| Peiyong Lin | c502cb7 | 2019-03-01 15:00:23 -0800 | [diff] [blame] | 96 |     output.writeBool(colorSpaceAgnostic); | 
| Valerie Hau | ed54efa | 2019-01-11 20:03:14 -0800 | [diff] [blame] | 97 |  | 
| Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 98 |     return NO_ERROR; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 99 | } | 
 | 100 |  | 
 | 101 | status_t layer_state_t::read(const Parcel& input) | 
 | 102 | { | 
| Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 103 |     surface = input.readStrongBinder(); | 
| Garfield Tan | 8a3083e | 2018-12-03 13:21:07 -0800 | [diff] [blame] | 104 |     what = input.readUint64(); | 
| Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 105 |     x = input.readFloat(); | 
 | 106 |     y = input.readFloat(); | 
| Robert Carr | ae06083 | 2016-11-28 10:51:00 -0800 | [diff] [blame] | 107 |     z = input.readInt32(); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 108 |     w = input.readUint32(); | 
 | 109 |     h = input.readUint32(); | 
 | 110 |     layerStack = input.readUint32(); | 
| Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 111 |     alpha = input.readFloat(); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 112 |     flags = static_cast<uint8_t>(input.readUint32()); | 
 | 113 |     mask = static_cast<uint8_t>(input.readUint32()); | 
| Michael Lentine | 8afa1c4 | 2014-10-31 11:10:13 -0700 | [diff] [blame] | 114 |     const void* matrix_data = input.readInplace(sizeof(layer_state_t::matrix22_t)); | 
 | 115 |     if (matrix_data) { | 
 | 116 |         matrix = *reinterpret_cast<layer_state_t::matrix22_t const *>(matrix_data); | 
 | 117 |     } else { | 
 | 118 |         return BAD_VALUE; | 
 | 119 |     } | 
| Marissa Wall | f58c14b | 2018-07-24 10:50:43 -0700 | [diff] [blame] | 120 |     input.read(crop_legacy); | 
| Marissa Wall | f58c14b | 2018-07-24 10:50:43 -0700 | [diff] [blame] | 121 |     barrierHandle_legacy = input.readStrongBinder(); | 
| Robert Carr | 1db73f6 | 2016-12-21 12:58:51 -0800 | [diff] [blame] | 122 |     reparentHandle = input.readStrongBinder(); | 
| Marissa Wall | f58c14b | 2018-07-24 10:50:43 -0700 | [diff] [blame] | 123 |     frameNumber_legacy = input.readUint64(); | 
| Robert Carr | c3574f7 | 2016-03-24 12:19:32 -0700 | [diff] [blame] | 124 |     overrideScalingMode = input.readInt32(); | 
| Marissa Wall | f58c14b | 2018-07-24 10:50:43 -0700 | [diff] [blame] | 125 |     barrierGbp_legacy = interface_cast<IGraphicBufferProducer>(input.readStrongBinder()); | 
| Robert Carr | db66e62 | 2017-04-10 16:55:57 -0700 | [diff] [blame] | 126 |     relativeLayerHandle = input.readStrongBinder(); | 
| chaviw | 0617894 | 2017-07-27 10:25:59 -0700 | [diff] [blame] | 127 |     parentHandleForChild = input.readStrongBinder(); | 
| chaviw | 13fdc49 | 2017-06-27 12:40:18 -0700 | [diff] [blame] | 128 |     color.r = input.readFloat(); | 
 | 129 |     color.g = input.readFloat(); | 
 | 130 |     color.b = input.readFloat(); | 
| Robert Carr | 2c358bf | 2018-08-08 15:58:15 -0700 | [diff] [blame] | 131 |  | 
 | 132 | #ifndef NO_INPUT | 
 | 133 |     inputInfo = InputWindowInfo::read(input); | 
 | 134 | #endif | 
 | 135 |  | 
| Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 136 |     input.read(transparentRegion); | 
| Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 137 |     transform = input.readUint32(); | 
 | 138 |     transformToDisplayInverse = input.readBool(); | 
 | 139 |     input.read(crop); | 
| Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 140 |     input.read(frame); | 
| Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 141 |     buffer = new GraphicBuffer(); | 
 | 142 |     if (input.readBool()) { | 
 | 143 |         input.read(*buffer); | 
 | 144 |     } | 
 | 145 |     acquireFence = new Fence(); | 
 | 146 |     if (input.readBool()) { | 
 | 147 |         input.read(*acquireFence); | 
 | 148 |     } | 
 | 149 |     dataspace = static_cast<ui::Dataspace>(input.readUint32()); | 
 | 150 |     input.read(hdrMetadata); | 
 | 151 |     input.read(surfaceDamageRegion); | 
 | 152 |     api = input.readInt32(); | 
 | 153 |     if (input.readBool()) { | 
 | 154 |         sidebandStream = NativeHandle::create(input.readNativeHandle(), true); | 
 | 155 |     } | 
 | 156 |  | 
| Peiyong Lin | d378863 | 2018-09-18 16:01:31 -0700 | [diff] [blame] | 157 |     colorTransform = mat4(static_cast<const float*>(input.readInplace(16 * sizeof(float)))); | 
| Lucas Dupin | 1b6531c | 2018-07-05 17:18:21 -0700 | [diff] [blame] | 158 |     cornerRadius = input.readFloat(); | 
| Marissa Wall | 3dad52d | 2019-03-22 14:03:19 -0700 | [diff] [blame] | 159 |     hasListenerCallbacks = input.readBool(); | 
| Steven Moreland | 9d4ce9b | 2019-07-17 15:23:38 -0700 | [diff] [blame] | 160 |     cachedBuffer.token = input.readStrongBinder(); | 
| Marissa Wall | 947d34e | 2019-03-29 14:03:53 -0700 | [diff] [blame] | 161 |     cachedBuffer.id = input.readUint64(); | 
| Evan Rosky | 1f6d6d5 | 2018-12-06 10:47:26 -0800 | [diff] [blame] | 162 |     input.readParcelable(&metadata); | 
| Marissa Wall | ebc2c05 | 2019-01-16 19:16:55 -0800 | [diff] [blame] | 163 |  | 
| Valerie Hau | dd0b757 | 2019-01-29 14:59:27 -0800 | [diff] [blame] | 164 |     bgColorAlpha = input.readFloat(); | 
 | 165 |     bgColorDataspace = static_cast<ui::Dataspace>(input.readUint32()); | 
| Peiyong Lin | c502cb7 | 2019-03-01 15:00:23 -0800 | [diff] [blame] | 166 |     colorSpaceAgnostic = input.readBool(); | 
| Valerie Hau | ed54efa | 2019-01-11 20:03:14 -0800 | [diff] [blame] | 167 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 168 |     return NO_ERROR; | 
 | 169 | } | 
 | 170 |  | 
| Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 171 | status_t ComposerState::write(Parcel& output) const { | 
| Marco Nelissen | 2ea926b | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 172 |     output.writeStrongBinder(IInterface::asBinder(client)); | 
| Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 173 |     return state.write(output); | 
 | 174 | } | 
 | 175 |  | 
 | 176 | status_t ComposerState::read(const Parcel& input) { | 
 | 177 |     client = interface_cast<ISurfaceComposerClient>(input.readStrongBinder()); | 
 | 178 |     return state.read(input); | 
 | 179 | } | 
 | 180 |  | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 181 |  | 
| Pablo Ceballos | 60d6922 | 2015-08-07 14:47:20 -0700 | [diff] [blame] | 182 | DisplayState::DisplayState() : | 
 | 183 |     what(0), | 
 | 184 |     layerStack(0), | 
 | 185 |     orientation(eOrientationDefault), | 
 | 186 |     viewport(Rect::EMPTY_RECT), | 
 | 187 |     frame(Rect::EMPTY_RECT), | 
 | 188 |     width(0), | 
 | 189 |     height(0) { | 
 | 190 | } | 
 | 191 |  | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 192 | status_t DisplayState::write(Parcel& output) const { | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 193 |     output.writeStrongBinder(token); | 
| Marco Nelissen | 2ea926b | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 194 |     output.writeStrongBinder(IInterface::asBinder(surface)); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 195 |     output.writeUint32(what); | 
 | 196 |     output.writeUint32(layerStack); | 
 | 197 |     output.writeUint32(orientation); | 
| Mathias Agopian | 8683fca | 2012-08-12 19:37:16 -0700 | [diff] [blame] | 198 |     output.write(viewport); | 
 | 199 |     output.write(frame); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 200 |     output.writeUint32(width); | 
 | 201 |     output.writeUint32(height); | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 202 |     return NO_ERROR; | 
 | 203 | } | 
 | 204 |  | 
 | 205 | status_t DisplayState::read(const Parcel& input) { | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 206 |     token = input.readStrongBinder(); | 
| Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 207 |     surface = interface_cast<IGraphicBufferProducer>(input.readStrongBinder()); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 208 |     what = input.readUint32(); | 
 | 209 |     layerStack = input.readUint32(); | 
 | 210 |     orientation = input.readUint32(); | 
| Mathias Agopian | 8683fca | 2012-08-12 19:37:16 -0700 | [diff] [blame] | 211 |     input.read(viewport); | 
 | 212 |     input.read(frame); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 213 |     width = input.readUint32(); | 
 | 214 |     height = input.readUint32(); | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 215 |     return NO_ERROR; | 
 | 216 | } | 
 | 217 |  | 
| Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 218 | void DisplayState::merge(const DisplayState& other) { | 
 | 219 |     if (other.what & eSurfaceChanged) { | 
 | 220 |         what |= eSurfaceChanged; | 
 | 221 |         surface = other.surface; | 
 | 222 |     } | 
 | 223 |     if (other.what & eLayerStackChanged) { | 
 | 224 |         what |= eLayerStackChanged; | 
 | 225 |         layerStack = other.layerStack; | 
 | 226 |     } | 
 | 227 |     if (other.what & eDisplayProjectionChanged) { | 
 | 228 |         what |= eDisplayProjectionChanged; | 
 | 229 |         orientation = other.orientation; | 
 | 230 |         viewport = other.viewport; | 
 | 231 |         frame = other.frame; | 
 | 232 |     } | 
 | 233 |     if (other.what & eDisplaySizeChanged) { | 
 | 234 |         what |= eDisplaySizeChanged; | 
 | 235 |         width = other.width; | 
 | 236 |         height = other.height; | 
 | 237 |     } | 
 | 238 | } | 
 | 239 |  | 
 | 240 | void layer_state_t::merge(const layer_state_t& other) { | 
 | 241 |     if (other.what & ePositionChanged) { | 
 | 242 |         what |= ePositionChanged; | 
 | 243 |         x = other.x; | 
 | 244 |         y = other.y; | 
 | 245 |     } | 
 | 246 |     if (other.what & eLayerChanged) { | 
 | 247 |         what |= eLayerChanged; | 
| chaviw | 3237758 | 2019-05-13 11:15:19 -0700 | [diff] [blame] | 248 |         what &= ~eRelativeLayerChanged; | 
| Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 249 |         z = other.z; | 
 | 250 |     } | 
 | 251 |     if (other.what & eSizeChanged) { | 
 | 252 |         what |= eSizeChanged; | 
 | 253 |         w = other.w; | 
 | 254 |         h = other.h; | 
 | 255 |     } | 
 | 256 |     if (other.what & eAlphaChanged) { | 
 | 257 |         what |= eAlphaChanged; | 
 | 258 |         alpha = other.alpha; | 
 | 259 |     } | 
 | 260 |     if (other.what & eMatrixChanged) { | 
 | 261 |         what |= eMatrixChanged; | 
 | 262 |         matrix = other.matrix; | 
 | 263 |     } | 
 | 264 |     if (other.what & eTransparentRegionChanged) { | 
 | 265 |         what |= eTransparentRegionChanged; | 
 | 266 |         transparentRegion = other.transparentRegion; | 
 | 267 |     } | 
 | 268 |     if (other.what & eFlagsChanged) { | 
 | 269 |         what |= eFlagsChanged; | 
 | 270 |         flags = other.flags; | 
 | 271 |         mask = other.mask; | 
 | 272 |     } | 
 | 273 |     if (other.what & eLayerStackChanged) { | 
 | 274 |         what |= eLayerStackChanged; | 
 | 275 |         layerStack = other.layerStack; | 
 | 276 |     } | 
| Marissa Wall | f58c14b | 2018-07-24 10:50:43 -0700 | [diff] [blame] | 277 |     if (other.what & eCropChanged_legacy) { | 
 | 278 |         what |= eCropChanged_legacy; | 
 | 279 |         crop_legacy = other.crop_legacy; | 
| Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 280 |     } | 
| Lucas Dupin | 1b6531c | 2018-07-05 17:18:21 -0700 | [diff] [blame] | 281 |     if (other.what & eCornerRadiusChanged) { | 
 | 282 |         what |= eCornerRadiusChanged; | 
 | 283 |         cornerRadius = other.cornerRadius; | 
 | 284 |     } | 
| Marissa Wall | f58c14b | 2018-07-24 10:50:43 -0700 | [diff] [blame] | 285 |     if (other.what & eDeferTransaction_legacy) { | 
 | 286 |         what |= eDeferTransaction_legacy; | 
 | 287 |         barrierHandle_legacy = other.barrierHandle_legacy; | 
 | 288 |         barrierGbp_legacy = other.barrierGbp_legacy; | 
 | 289 |         frameNumber_legacy = other.frameNumber_legacy; | 
| Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 290 |     } | 
| Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 291 |     if (other.what & eOverrideScalingModeChanged) { | 
 | 292 |         what |= eOverrideScalingModeChanged; | 
 | 293 |         overrideScalingMode = other.overrideScalingMode; | 
 | 294 |     } | 
 | 295 |     if (other.what & eGeometryAppliesWithResize) { | 
 | 296 |         what |= eGeometryAppliesWithResize; | 
 | 297 |     } | 
 | 298 |     if (other.what & eReparentChildren) { | 
 | 299 |         what |= eReparentChildren; | 
 | 300 |         reparentHandle = other.reparentHandle; | 
 | 301 |     } | 
 | 302 |     if (other.what & eDetachChildren) { | 
 | 303 |         what |= eDetachChildren; | 
 | 304 |     } | 
 | 305 |     if (other.what & eRelativeLayerChanged) { | 
 | 306 |         what |= eRelativeLayerChanged; | 
| chaviw | 3237758 | 2019-05-13 11:15:19 -0700 | [diff] [blame] | 307 |         what &= ~eLayerChanged; | 
| Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 308 |         z = other.z; | 
 | 309 |         relativeLayerHandle = other.relativeLayerHandle; | 
 | 310 |     } | 
 | 311 |     if (other.what & eReparent) { | 
 | 312 |         what |= eReparent; | 
 | 313 |         parentHandleForChild = other.parentHandleForChild; | 
 | 314 |     } | 
| chaviw | ca27f25 | 2018-02-06 16:46:39 -0800 | [diff] [blame] | 315 |     if (other.what & eDestroySurface) { | 
 | 316 |         what |= eDestroySurface; | 
 | 317 |     } | 
| Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 318 |     if (other.what & eTransformChanged) { | 
 | 319 |         what |= eTransformChanged; | 
 | 320 |         transform = other.transform; | 
 | 321 |     } | 
 | 322 |     if (other.what & eTransformToDisplayInverseChanged) { | 
 | 323 |         what |= eTransformToDisplayInverseChanged; | 
 | 324 |         transformToDisplayInverse = other.transformToDisplayInverse; | 
 | 325 |     } | 
 | 326 |     if (other.what & eCropChanged) { | 
 | 327 |         what |= eCropChanged; | 
 | 328 |         crop = other.crop; | 
 | 329 |     } | 
| Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 330 |     if (other.what & eFrameChanged) { | 
 | 331 |         what |= eFrameChanged; | 
 | 332 |         frame = other.frame; | 
 | 333 |     } | 
| Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 334 |     if (other.what & eBufferChanged) { | 
 | 335 |         what |= eBufferChanged; | 
 | 336 |         buffer = other.buffer; | 
 | 337 |     } | 
 | 338 |     if (other.what & eAcquireFenceChanged) { | 
 | 339 |         what |= eAcquireFenceChanged; | 
 | 340 |         acquireFence = other.acquireFence; | 
 | 341 |     } | 
 | 342 |     if (other.what & eDataspaceChanged) { | 
 | 343 |         what |= eDataspaceChanged; | 
 | 344 |         dataspace = other.dataspace; | 
 | 345 |     } | 
 | 346 |     if (other.what & eHdrMetadataChanged) { | 
 | 347 |         what |= eHdrMetadataChanged; | 
 | 348 |         hdrMetadata = other.hdrMetadata; | 
 | 349 |     } | 
 | 350 |     if (other.what & eSurfaceDamageRegionChanged) { | 
 | 351 |         what |= eSurfaceDamageRegionChanged; | 
 | 352 |         surfaceDamageRegion = other.surfaceDamageRegion; | 
 | 353 |     } | 
 | 354 |     if (other.what & eApiChanged) { | 
 | 355 |         what |= eApiChanged; | 
 | 356 |         api = other.api; | 
 | 357 |     } | 
 | 358 |     if (other.what & eSidebandStreamChanged) { | 
 | 359 |         what |= eSidebandStreamChanged; | 
 | 360 |         sidebandStream = other.sidebandStream; | 
 | 361 |     } | 
| Peiyong Lin | d378863 | 2018-09-18 16:01:31 -0700 | [diff] [blame] | 362 |     if (other.what & eColorTransformChanged) { | 
 | 363 |         what |= eColorTransformChanged; | 
 | 364 |         colorTransform = other.colorTransform; | 
 | 365 |     } | 
| Marissa Wall | 3dad52d | 2019-03-22 14:03:19 -0700 | [diff] [blame] | 366 |     if (other.what & eHasListenerCallbacksChanged) { | 
 | 367 |         what |= eHasListenerCallbacksChanged; | 
 | 368 |         hasListenerCallbacks = other.hasListenerCallbacks; | 
| Marissa Wall | c837b5e | 2018-10-12 10:04:44 -0700 | [diff] [blame] | 369 |     } | 
| Robert Carr | d314f16 | 2018-08-15 13:12:42 -0700 | [diff] [blame] | 370 |  | 
| Robert Carr | 2c358bf | 2018-08-08 15:58:15 -0700 | [diff] [blame] | 371 | #ifndef NO_INPUT | 
 | 372 |     if (other.what & eInputInfoChanged) { | 
 | 373 |         what |= eInputInfoChanged; | 
 | 374 |         inputInfo = other.inputInfo; | 
 | 375 |     } | 
 | 376 | #endif | 
 | 377 |  | 
| Marissa Wall | ebc2c05 | 2019-01-16 19:16:55 -0800 | [diff] [blame] | 378 |     if (other.what & eCachedBufferChanged) { | 
 | 379 |         what |= eCachedBufferChanged; | 
 | 380 |         cachedBuffer = other.cachedBuffer; | 
 | 381 |     } | 
| Valerie Hau | dd0b757 | 2019-01-29 14:59:27 -0800 | [diff] [blame] | 382 |     if (other.what & eBackgroundColorChanged) { | 
 | 383 |         what |= eBackgroundColorChanged; | 
 | 384 |         color = other.color; | 
 | 385 |         bgColorAlpha = other.bgColorAlpha; | 
 | 386 |         bgColorDataspace = other.bgColorDataspace; | 
| Valerie Hau | ed54efa | 2019-01-11 20:03:14 -0800 | [diff] [blame] | 387 |     } | 
| Evan Rosky | 1f6d6d5 | 2018-12-06 10:47:26 -0800 | [diff] [blame] | 388 |     if (other.what & eMetadataChanged) { | 
 | 389 |         what |= eMetadataChanged; | 
 | 390 |         metadata.merge(other.metadata); | 
 | 391 |     } | 
| Vishnu Nair | 217d8e6 | 2018-09-12 16:34:49 -0700 | [diff] [blame] | 392 |     if ((other.what & what) != other.what) { | 
 | 393 |         ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? " | 
| Garfield Tan | 8a3083e | 2018-12-03 13:21:07 -0800 | [diff] [blame] | 394 |               "other.what=0x%" PRIu64 " what=0x%" PRIu64, | 
| Vishnu Nair | 217d8e6 | 2018-09-12 16:34:49 -0700 | [diff] [blame] | 395 |               other.what, what); | 
| Robert Carr | d314f16 | 2018-08-15 13:12:42 -0700 | [diff] [blame] | 396 |     } | 
| Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 397 | } | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 398 |  | 
| chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 399 | // ------------------------------- InputWindowCommands ---------------------------------------- | 
 | 400 |  | 
 | 401 | void InputWindowCommands::merge(const InputWindowCommands& other) { | 
 | 402 |     transferTouchFocusCommands | 
 | 403 |             .insert(transferTouchFocusCommands.end(), | 
 | 404 |                     std::make_move_iterator(other.transferTouchFocusCommands.begin()), | 
 | 405 |                     std::make_move_iterator(other.transferTouchFocusCommands.end())); | 
| chaviw | a911b10 | 2019-02-14 10:18:33 -0800 | [diff] [blame] | 406 |  | 
 | 407 |     syncInputWindows |= other.syncInputWindows; | 
| chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 408 | } | 
 | 409 |  | 
 | 410 | void InputWindowCommands::clear() { | 
 | 411 |     transferTouchFocusCommands.clear(); | 
| chaviw | a911b10 | 2019-02-14 10:18:33 -0800 | [diff] [blame] | 412 |     syncInputWindows = false; | 
| chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 413 | } | 
 | 414 |  | 
 | 415 | void InputWindowCommands::write(Parcel& output) const { | 
 | 416 |     output.writeUint32(static_cast<uint32_t>(transferTouchFocusCommands.size())); | 
 | 417 |     for (const auto& transferTouchFocusCommand : transferTouchFocusCommands) { | 
 | 418 |         output.writeStrongBinder(transferTouchFocusCommand.fromToken); | 
 | 419 |         output.writeStrongBinder(transferTouchFocusCommand.toToken); | 
 | 420 |     } | 
| chaviw | a911b10 | 2019-02-14 10:18:33 -0800 | [diff] [blame] | 421 |  | 
 | 422 |     output.writeBool(syncInputWindows); | 
| chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 423 | } | 
 | 424 |  | 
 | 425 | void InputWindowCommands::read(const Parcel& input) { | 
 | 426 |     size_t count = input.readUint32(); | 
 | 427 |     transferTouchFocusCommands.clear(); | 
 | 428 |     for (size_t i = 0; i < count; i++) { | 
 | 429 |         TransferTouchFocusCommand transferTouchFocusCommand; | 
 | 430 |         transferTouchFocusCommand.fromToken = input.readStrongBinder(); | 
 | 431 |         transferTouchFocusCommand.toToken = input.readStrongBinder(); | 
 | 432 |         transferTouchFocusCommands.emplace_back(transferTouchFocusCommand); | 
 | 433 |     } | 
| chaviw | a911b10 | 2019-02-14 10:18:33 -0800 | [diff] [blame] | 434 |  | 
 | 435 |     syncInputWindows = input.readBool(); | 
| chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 436 | } | 
 | 437 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 438 | }; // namespace android |