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 | |
Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 17 | #ifndef ANDROID_SF_LAYER_STATE_H |
| 18 | #define ANDROID_SF_LAYER_STATE_H |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include <utils/Errors.h> |
| 24 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | #include <ui/Region.h> |
Jamie Gennis | f15a83f | 2012-05-10 20:43:55 -0700 | [diff] [blame] | 26 | #include <ui/Rect.h> |
Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 27 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | namespace android { |
| 29 | |
| 30 | class Parcel; |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 31 | class ISurfaceComposerClient; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | |
Andy McFadden | 4125a4f | 2014-01-29 17:17:11 -0800 | [diff] [blame] | 33 | /* |
| 34 | * Used to communicate layer information between SurfaceFlinger and its clients. |
| 35 | */ |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 | struct layer_state_t { |
| 37 | |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 38 | |
| 39 | enum { |
Andy McFadden | 4125a4f | 2014-01-29 17:17:11 -0800 | [diff] [blame] | 40 | eLayerHidden = 0x01, // SURFACE_HIDDEN in SurfaceControl.java |
| 41 | eLayerOpaque = 0x02, // SURFACE_OPAQUE |
Dan Stoza | 2311608 | 2015-06-18 14:58:39 -0700 | [diff] [blame] | 42 | eLayerSecure = 0x80, // SECURE |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | enum { |
| 46 | ePositionChanged = 0x00000001, |
| 47 | eLayerChanged = 0x00000002, |
| 48 | eSizeChanged = 0x00000004, |
| 49 | eAlphaChanged = 0x00000008, |
| 50 | eMatrixChanged = 0x00000010, |
| 51 | eTransparentRegionChanged = 0x00000020, |
Dan Stoza | 2311608 | 2015-06-18 14:58:39 -0700 | [diff] [blame] | 52 | eFlagsChanged = 0x00000040, |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 53 | eLayerStackChanged = 0x00000080, |
| 54 | eCropChanged = 0x00000100, |
Pablo Ceballos | acbe678 | 2016-03-04 17:54:21 +0000 | [diff] [blame] | 55 | eDeferTransaction = 0x00000200, |
Robert Carr | c3574f7 | 2016-03-24 12:19:32 -0700 | [diff] [blame] | 56 | eFinalCropChanged = 0x00000400, |
Robert Carr | 82364e3 | 2016-05-15 11:27:47 -0700 | [diff] [blame] | 57 | eOverrideScalingModeChanged = 0x00000800, |
Robert Carr | 99e27f0 | 2016-06-16 15:18:02 -0700 | [diff] [blame] | 58 | eGeometryAppliesWithResize = 0x00001000, |
Albert Chaulk | 6cf6af0 | 2016-11-22 13:52:43 -0500 | [diff] [blame] | 59 | eLayerInfoChanged = 0x00002000, |
Robert Carr | 1db73f6 | 2016-12-21 12:58:51 -0800 | [diff] [blame^] | 60 | eReparentChildren = 0x00004000, |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 61 | }; |
| 62 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | layer_state_t() |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 64 | : what(0), |
Mathias Agopian | 8785578 | 2012-07-24 21:41:09 -0700 | [diff] [blame] | 65 | x(0), y(0), z(0), w(0), h(0), layerStack(0), |
Jeff Brown | 6501e99 | 2012-07-16 15:38:18 -0700 | [diff] [blame] | 66 | alpha(0), flags(0), mask(0), |
Pablo Ceballos | acbe678 | 2016-03-04 17:54:21 +0000 | [diff] [blame] | 67 | reserved(0), crop(Rect::INVALID_RECT), |
Robert Carr | c3574f7 | 2016-03-24 12:19:32 -0700 | [diff] [blame] | 68 | finalCrop(Rect::INVALID_RECT), frameNumber(0), |
Albert Chaulk | 6cf6af0 | 2016-11-22 13:52:43 -0500 | [diff] [blame] | 69 | overrideScalingMode(-1), type(0), appid(0) |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 70 | { |
| 71 | matrix.dsdx = matrix.dtdy = 1.0f; |
| 72 | matrix.dsdy = matrix.dtdx = 0.0f; |
| 73 | } |
| 74 | |
| 75 | status_t write(Parcel& output) const; |
| 76 | status_t read(const Parcel& input); |
| 77 | |
| 78 | struct matrix22_t { |
Pablo Ceballos | bd3577e | 2016-06-20 17:40:34 -0700 | [diff] [blame] | 79 | float dsdx{0}; |
| 80 | float dtdx{0}; |
| 81 | float dsdy{0}; |
| 82 | float dtdy{0}; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 83 | }; |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 84 | sp<IBinder> surface; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | uint32_t what; |
Mathias Agopian | 41b6aab | 2011-08-30 18:51:54 -0700 | [diff] [blame] | 86 | float x; |
| 87 | float y; |
Robert Carr | ae06083 | 2016-11-28 10:51:00 -0800 | [diff] [blame] | 88 | int32_t z; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 89 | uint32_t w; |
| 90 | uint32_t h; |
Mathias Agopian | 8785578 | 2012-07-24 21:41:09 -0700 | [diff] [blame] | 91 | uint32_t layerStack; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 92 | float alpha; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 93 | uint8_t flags; |
| 94 | uint8_t mask; |
| 95 | uint8_t reserved; |
| 96 | matrix22_t matrix; |
Jamie Gennis | f15a83f | 2012-05-10 20:43:55 -0700 | [diff] [blame] | 97 | Rect crop; |
Pablo Ceballos | acbe678 | 2016-03-04 17:54:21 +0000 | [diff] [blame] | 98 | Rect finalCrop; |
Dan Stoza | 7dde599 | 2015-05-22 09:51:44 -0700 | [diff] [blame] | 99 | sp<IBinder> handle; |
Robert Carr | 1db73f6 | 2016-12-21 12:58:51 -0800 | [diff] [blame^] | 100 | sp<IBinder> reparentHandle; |
Dan Stoza | 7dde599 | 2015-05-22 09:51:44 -0700 | [diff] [blame] | 101 | uint64_t frameNumber; |
Robert Carr | c3574f7 | 2016-03-24 12:19:32 -0700 | [diff] [blame] | 102 | int32_t overrideScalingMode; |
Albert Chaulk | 6cf6af0 | 2016-11-22 13:52:43 -0500 | [diff] [blame] | 103 | uint32_t type; |
| 104 | uint32_t appid; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 105 | // non POD must be last. see write/read |
| 106 | Region transparentRegion; |
| 107 | }; |
| 108 | |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 109 | struct ComposerState { |
| 110 | sp<ISurfaceComposerClient> client; |
| 111 | layer_state_t state; |
| 112 | status_t write(Parcel& output) const; |
| 113 | status_t read(const Parcel& input); |
| 114 | }; |
| 115 | |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 116 | struct DisplayState { |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 117 | |
| 118 | enum { |
| 119 | eOrientationDefault = 0, |
| 120 | eOrientation90 = 1, |
| 121 | eOrientation180 = 2, |
| 122 | eOrientation270 = 3, |
| 123 | eOrientationUnchanged = 4, |
| 124 | eOrientationSwapMask = 0x01 |
| 125 | }; |
| 126 | |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 127 | enum { |
Mathias Agopian | 00e8c7a | 2012-09-04 19:30:46 -0700 | [diff] [blame] | 128 | eSurfaceChanged = 0x01, |
| 129 | eLayerStackChanged = 0x02, |
Michael Wright | 1f6078a | 2014-06-26 16:01:02 -0700 | [diff] [blame] | 130 | eDisplayProjectionChanged = 0x04, |
| 131 | eDisplaySizeChanged = 0x08 |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 132 | }; |
| 133 | |
Pablo Ceballos | 60d6922 | 2015-08-07 14:47:20 -0700 | [diff] [blame] | 134 | DisplayState(); |
| 135 | |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 136 | uint32_t what; |
| 137 | sp<IBinder> token; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 138 | sp<IGraphicBufferProducer> surface; |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 139 | uint32_t layerStack; |
| 140 | uint32_t orientation; |
| 141 | Rect viewport; |
| 142 | Rect frame; |
Michael Wright | 1f6078a | 2014-06-26 16:01:02 -0700 | [diff] [blame] | 143 | uint32_t width, height; |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 144 | status_t write(Parcel& output) const; |
| 145 | status_t read(const Parcel& input); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 146 | }; |
| 147 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 148 | }; // namespace android |
| 149 | |
Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 150 | #endif // ANDROID_SF_LAYER_STATE_H |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 151 | |