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