blob: 078720a87ed2ca72d9c85b825feb2b634fc9d517 [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
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 Agopian9cce3252010-02-09 17:46:37 -080017#ifndef ANDROID_SF_LAYER_STATE_H
18#define ANDROID_SF_LAYER_STATE_H
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080019
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <utils/Errors.h>
24
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080025#include <ui/Region.h>
Jamie Gennisf15a83f2012-05-10 20:43:55 -070026#include <ui/Rect.h>
Mathias Agopian9cce3252010-02-09 17:46:37 -080027
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080028namespace android {
29
30class Parcel;
Mathias Agopian698c0872011-06-28 19:09:31 -070031class ISurfaceComposerClient;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080032
Andy McFadden4125a4f2014-01-29 17:17:11 -080033/*
34 * Used to communicate layer information between SurfaceFlinger and its clients.
35 */
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080036struct layer_state_t {
37
Mathias Agopian3165cc22012-08-08 19:42:09 -070038
39 enum {
Andy McFadden4125a4f2014-01-29 17:17:11 -080040 eLayerHidden = 0x01, // SURFACE_HIDDEN in SurfaceControl.java
41 eLayerOpaque = 0x02, // SURFACE_OPAQUE
Dan Stoza23116082015-06-18 14:58:39 -070042 eLayerSecure = 0x80, // SECURE
Mathias Agopian3165cc22012-08-08 19:42:09 -070043 };
44
45 enum {
46 ePositionChanged = 0x00000001,
47 eLayerChanged = 0x00000002,
48 eSizeChanged = 0x00000004,
49 eAlphaChanged = 0x00000008,
50 eMatrixChanged = 0x00000010,
51 eTransparentRegionChanged = 0x00000020,
Dan Stoza23116082015-06-18 14:58:39 -070052 eFlagsChanged = 0x00000040,
Mathias Agopian3165cc22012-08-08 19:42:09 -070053 eLayerStackChanged = 0x00000080,
54 eCropChanged = 0x00000100,
Pablo Ceballosacbe6782016-03-04 17:54:21 +000055 eDeferTransaction = 0x00000200,
56 eFinalCropChanged = 0x00000400
Mathias Agopian3165cc22012-08-08 19:42:09 -070057 };
58
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080059 layer_state_t()
Mathias Agopianac9fa422013-02-11 16:40:36 -080060 : what(0),
Mathias Agopian87855782012-07-24 21:41:09 -070061 x(0), y(0), z(0), w(0), h(0), layerStack(0),
Jeff Brown6501e992012-07-16 15:38:18 -070062 alpha(0), flags(0), mask(0),
Pablo Ceballosacbe6782016-03-04 17:54:21 +000063 reserved(0), crop(Rect::INVALID_RECT),
64 finalCrop(Rect::INVALID_RECT), frameNumber(0)
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080065 {
66 matrix.dsdx = matrix.dtdy = 1.0f;
67 matrix.dsdy = matrix.dtdx = 0.0f;
68 }
69
70 status_t write(Parcel& output) const;
71 status_t read(const Parcel& input);
72
73 struct matrix22_t {
74 float dsdx;
75 float dtdx;
76 float dsdy;
77 float dtdy;
78 };
Mathias Agopianac9fa422013-02-11 16:40:36 -080079 sp<IBinder> surface;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080080 uint32_t what;
Mathias Agopian41b6aab2011-08-30 18:51:54 -070081 float x;
82 float y;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080083 uint32_t z;
84 uint32_t w;
85 uint32_t h;
Mathias Agopian87855782012-07-24 21:41:09 -070086 uint32_t layerStack;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080087 float alpha;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080088 uint8_t flags;
89 uint8_t mask;
90 uint8_t reserved;
91 matrix22_t matrix;
Jamie Gennisf15a83f2012-05-10 20:43:55 -070092 Rect crop;
Pablo Ceballosacbe6782016-03-04 17:54:21 +000093 Rect finalCrop;
Dan Stoza7dde5992015-05-22 09:51:44 -070094 sp<IBinder> handle;
95 uint64_t frameNumber;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080096 // non POD must be last. see write/read
97 Region transparentRegion;
98};
99
Mathias Agopian698c0872011-06-28 19:09:31 -0700100struct ComposerState {
101 sp<ISurfaceComposerClient> client;
102 layer_state_t state;
103 status_t write(Parcel& output) const;
104 status_t read(const Parcel& input);
105};
106
Mathias Agopian8b33f032012-07-24 20:43:54 -0700107struct DisplayState {
Mathias Agopian3165cc22012-08-08 19:42:09 -0700108
109 enum {
110 eOrientationDefault = 0,
111 eOrientation90 = 1,
112 eOrientation180 = 2,
113 eOrientation270 = 3,
114 eOrientationUnchanged = 4,
115 eOrientationSwapMask = 0x01
116 };
117
Mathias Agopiane57f2922012-08-09 16:29:12 -0700118 enum {
Mathias Agopian00e8c7a2012-09-04 19:30:46 -0700119 eSurfaceChanged = 0x01,
120 eLayerStackChanged = 0x02,
Michael Wright1f6078a2014-06-26 16:01:02 -0700121 eDisplayProjectionChanged = 0x04,
122 eDisplaySizeChanged = 0x08
Mathias Agopiane57f2922012-08-09 16:29:12 -0700123 };
124
Pablo Ceballos60d69222015-08-07 14:47:20 -0700125 DisplayState();
126
Mathias Agopiane57f2922012-08-09 16:29:12 -0700127 uint32_t what;
128 sp<IBinder> token;
Andy McFadden2adaf042012-12-18 09:49:45 -0800129 sp<IGraphicBufferProducer> surface;
Mathias Agopiane57f2922012-08-09 16:29:12 -0700130 uint32_t layerStack;
131 uint32_t orientation;
132 Rect viewport;
133 Rect frame;
Michael Wright1f6078a2014-06-26 16:01:02 -0700134 uint32_t width, height;
Mathias Agopiane57f2922012-08-09 16:29:12 -0700135 status_t write(Parcel& output) const;
136 status_t read(const Parcel& input);
Mathias Agopian8b33f032012-07-24 20:43:54 -0700137};
138
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800139}; // namespace android
140
Mathias Agopian9cce3252010-02-09 17:46:37 -0800141#endif // ANDROID_SF_LAYER_STATE_H
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800142