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, |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 61 | layer_state_t() |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 62 | : what(0), |
Mathias Agopian | 8785578 | 2012-07-24 21:41:09 -0700 | [diff] [blame] | 63 | x(0), y(0), z(0), w(0), h(0), layerStack(0), |
Jeff Brown | 6501e99 | 2012-07-16 15:38:18 -0700 | [diff] [blame] | 64 | alpha(0), flags(0), mask(0), |
Pablo Ceballos | acbe678 | 2016-03-04 17:54:21 +0000 | [diff] [blame] | 65 | reserved(0), crop(Rect::INVALID_RECT), |
Robert Carr | c3574f7 | 2016-03-24 12:19:32 -0700 | [diff] [blame] | 66 | finalCrop(Rect::INVALID_RECT), frameNumber(0), |
| 67 | overrideScalingMode(-1) |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 68 | { |
| 69 | matrix.dsdx = matrix.dtdy = 1.0f; |
| 70 | matrix.dsdy = matrix.dtdx = 0.0f; |
| 71 | } |
| 72 | |
| 73 | status_t write(Parcel& output) const; |
| 74 | status_t read(const Parcel& input); |
| 75 | |
| 76 | struct matrix22_t { |
| 77 | float dsdx; |
| 78 | float dtdx; |
| 79 | float dsdy; |
| 80 | float dtdy; |
| 81 | }; |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 82 | sp<IBinder> surface; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 83 | uint32_t what; |
Mathias Agopian | 41b6aab | 2011-08-30 18:51:54 -0700 | [diff] [blame] | 84 | float x; |
| 85 | float y; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 86 | uint32_t z; |
| 87 | uint32_t w; |
| 88 | uint32_t h; |
Mathias Agopian | 8785578 | 2012-07-24 21:41:09 -0700 | [diff] [blame] | 89 | uint32_t layerStack; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 90 | float alpha; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 91 | uint8_t flags; |
| 92 | uint8_t mask; |
| 93 | uint8_t reserved; |
| 94 | matrix22_t matrix; |
Jamie Gennis | f15a83f | 2012-05-10 20:43:55 -0700 | [diff] [blame] | 95 | Rect crop; |
Pablo Ceballos | acbe678 | 2016-03-04 17:54:21 +0000 | [diff] [blame] | 96 | Rect finalCrop; |
Dan Stoza | 7dde599 | 2015-05-22 09:51:44 -0700 | [diff] [blame] | 97 | sp<IBinder> handle; |
| 98 | uint64_t frameNumber; |
Robert Carr | c3574f7 | 2016-03-24 12:19:32 -0700 | [diff] [blame] | 99 | int32_t overrideScalingMode; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 100 | // non POD must be last. see write/read |
| 101 | Region transparentRegion; |
| 102 | }; |
| 103 | |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 104 | struct ComposerState { |
| 105 | sp<ISurfaceComposerClient> client; |
| 106 | layer_state_t state; |
| 107 | status_t write(Parcel& output) const; |
| 108 | status_t read(const Parcel& input); |
| 109 | }; |
| 110 | |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 111 | struct DisplayState { |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 112 | |
| 113 | enum { |
| 114 | eOrientationDefault = 0, |
| 115 | eOrientation90 = 1, |
| 116 | eOrientation180 = 2, |
| 117 | eOrientation270 = 3, |
| 118 | eOrientationUnchanged = 4, |
| 119 | eOrientationSwapMask = 0x01 |
| 120 | }; |
| 121 | |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 122 | enum { |
Mathias Agopian | 00e8c7a | 2012-09-04 19:30:46 -0700 | [diff] [blame] | 123 | eSurfaceChanged = 0x01, |
| 124 | eLayerStackChanged = 0x02, |
Michael Wright | 1f6078a | 2014-06-26 16:01:02 -0700 | [diff] [blame] | 125 | eDisplayProjectionChanged = 0x04, |
| 126 | eDisplaySizeChanged = 0x08 |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 127 | }; |
| 128 | |
Pablo Ceballos | 60d6922 | 2015-08-07 14:47:20 -0700 | [diff] [blame] | 129 | DisplayState(); |
| 130 | |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 131 | uint32_t what; |
| 132 | sp<IBinder> token; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 133 | sp<IGraphicBufferProducer> surface; |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 134 | uint32_t layerStack; |
| 135 | uint32_t orientation; |
| 136 | Rect viewport; |
| 137 | Rect frame; |
Michael Wright | 1f6078a | 2014-06-26 16:01:02 -0700 | [diff] [blame] | 138 | uint32_t width, height; |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 139 | status_t write(Parcel& output) const; |
| 140 | status_t read(const Parcel& input); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 141 | }; |
| 142 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 143 | }; // namespace android |
| 144 | |
Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 145 | #endif // ANDROID_SF_LAYER_STATE_H |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 146 | |