The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 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 | 000479f | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 17 | #ifndef ANDROID_SF_SURFACE_H |
| 18 | #define ANDROID_SF_SURFACE_H |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include <utils/RefBase.h> |
| 24 | #include <utils/threads.h> |
| 25 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | #include <ui/PixelFormat.h> |
| 27 | #include <ui/Region.h> |
Mathias Agopian | ac2523b | 2009-05-05 18:11:11 -0700 | [diff] [blame] | 28 | #include <ui/egl/android_natives.h> |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 29 | |
Mathias Agopian | 000479f | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 30 | #include <surfaceflinger/ISurface.h> |
Mathias Agopian | 770492c | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 31 | #include <surfaceflinger/ISurfaceComposerClient.h> |
Mathias Agopian | 000479f | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 32 | |
Mathias Agopian | 8b13832 | 2010-04-12 16:22:15 -0700 | [diff] [blame] | 33 | #define ANDROID_VIEW_SURFACE_JNI_ID "mNativeSurface" |
| 34 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | namespace android { |
| 36 | |
| 37 | // --------------------------------------------------------------------------- |
| 38 | |
Mathias Agopian | 2be352a | 2010-05-21 17:24:35 -0700 | [diff] [blame] | 39 | class GraphicBuffer; |
Mathias Agopian | 6950e42 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 40 | class GraphicBufferMapper; |
Andreas Huber | ccf8b94 | 2009-08-07 12:01:29 -0700 | [diff] [blame] | 41 | class IOMX; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 42 | class Rect; |
Mathias Agopian | dff8e58 | 2009-05-04 14:17:04 -0700 | [diff] [blame] | 43 | class Surface; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | class SurfaceComposerClient; |
Mathias Agopian | 9779b22 | 2009-09-07 16:32:45 -0700 | [diff] [blame] | 45 | class SharedClient; |
| 46 | class SharedBufferClient; |
Mathias Agopian | c7b388c | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 47 | class SurfaceClient; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 49 | // --------------------------------------------------------------------------- |
| 50 | |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 51 | class SurfaceControl : public RefBase |
| 52 | { |
| 53 | public: |
| 54 | static bool isValid(const sp<SurfaceControl>& surface) { |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 55 | return (surface != 0) && surface->isValid(); |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 56 | } |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 57 | bool isValid() { |
| 58 | return mToken>=0 && mClient!=0; |
| 59 | } |
| 60 | static bool isSameSurface( |
| 61 | const sp<SurfaceControl>& lhs, const sp<SurfaceControl>& rhs); |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 62 | |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 63 | uint32_t getFlags() const { return mFlags; } |
| 64 | uint32_t getIdentity() const { return mIdentity; } |
| 65 | |
| 66 | // release surface data from java |
| 67 | void clear(); |
| 68 | |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 69 | status_t setLayer(int32_t layer); |
| 70 | status_t setPosition(int32_t x, int32_t y); |
| 71 | status_t setSize(uint32_t w, uint32_t h); |
| 72 | status_t hide(); |
| 73 | status_t show(int32_t layer = -1); |
| 74 | status_t freeze(); |
| 75 | status_t unfreeze(); |
| 76 | status_t setFlags(uint32_t flags, uint32_t mask); |
| 77 | status_t setTransparentRegionHint(const Region& transparent); |
| 78 | status_t setAlpha(float alpha=1.0f); |
| 79 | status_t setMatrix(float dsdx, float dtdx, float dsdy, float dtdy); |
| 80 | status_t setFreezeTint(uint32_t tint); |
| 81 | |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 82 | static status_t writeSurfaceToParcel( |
| 83 | const sp<SurfaceControl>& control, Parcel* parcel); |
| 84 | |
| 85 | sp<Surface> getSurface() const; |
| 86 | |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 87 | private: |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 88 | // can't be copied |
| 89 | SurfaceControl& operator = (SurfaceControl& rhs); |
| 90 | SurfaceControl(const SurfaceControl& rhs); |
| 91 | |
| 92 | |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 93 | friend class SurfaceComposerClient; |
| 94 | |
| 95 | // camera and camcorder need access to the ISurface binder interface for preview |
| 96 | friend class Camera; |
| 97 | friend class MediaRecorder; |
| 98 | // mediaplayer needs access to ISurface for display |
| 99 | friend class MediaPlayer; |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 100 | // for testing |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 101 | friend class Test; |
| 102 | const sp<ISurface>& getISurface() const { return mSurface; } |
| 103 | |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 104 | |
| 105 | friend class Surface; |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 106 | |
| 107 | SurfaceControl( |
| 108 | const sp<SurfaceComposerClient>& client, |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 109 | const sp<ISurface>& surface, |
Mathias Agopian | 770492c | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 110 | const ISurfaceComposerClient::surface_data_t& data, |
Mathias Agopian | 69d6209 | 2009-04-16 20:30:22 -0700 | [diff] [blame] | 111 | uint32_t w, uint32_t h, PixelFormat format, uint32_t flags); |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 112 | |
| 113 | ~SurfaceControl(); |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 114 | |
Mathias Agopian | 18e0260 | 2009-11-13 15:26:29 -0800 | [diff] [blame] | 115 | status_t validate() const; |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 116 | void destroy(); |
| 117 | |
| 118 | sp<SurfaceComposerClient> mClient; |
| 119 | sp<ISurface> mSurface; |
| 120 | SurfaceID mToken; |
| 121 | uint32_t mIdentity; |
Mathias Agopian | 5b5c914 | 2009-07-30 18:14:56 -0700 | [diff] [blame] | 122 | uint32_t mWidth; |
| 123 | uint32_t mHeight; |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 124 | PixelFormat mFormat; |
| 125 | uint32_t mFlags; |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 126 | mutable Mutex mLock; |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 127 | |
| 128 | mutable sp<Surface> mSurfaceData; |
Mathias Agopian | 6d2c0bc | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 129 | }; |
| 130 | |
| 131 | // --------------------------------------------------------------------------- |
| 132 | |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 133 | class Surface |
Dianne Hackborn | 8b49bd1 | 2010-06-30 13:56:17 -0700 | [diff] [blame^] | 134 | : public EGLNativeBase<ANativeWindow, Surface, RefBase> |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 135 | { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 136 | public: |
| 137 | struct SurfaceInfo { |
| 138 | uint32_t w; |
| 139 | uint32_t h; |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 140 | uint32_t s; |
| 141 | uint32_t usage; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 142 | PixelFormat format; |
| 143 | void* bits; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 144 | uint32_t reserved[2]; |
| 145 | }; |
| 146 | |
Mathias Agopian | 5e14010 | 2010-06-08 19:54:15 -0700 | [diff] [blame] | 147 | static status_t writeToParcel( |
| 148 | const sp<Surface>& control, Parcel* parcel); |
| 149 | |
Mathias Agopian | fae5cb2 | 2010-06-04 18:26:32 -0700 | [diff] [blame] | 150 | static sp<Surface> readFromParcel( |
| 151 | const Parcel& data, const sp<Surface>& other); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 152 | |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 153 | static bool isValid(const sp<Surface>& surface) { |
| 154 | return (surface != 0) && surface->isValid(); |
| 155 | } |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 156 | |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 157 | bool isValid(); |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 158 | uint32_t getFlags() const { return mFlags; } |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 159 | uint32_t getIdentity() const { return mIdentity; } |
| 160 | |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 161 | // the lock/unlock APIs must be used from the same thread |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 162 | status_t lock(SurfaceInfo* info, bool blocking = true); |
| 163 | status_t lock(SurfaceInfo* info, Region* dirty, bool blocking = true); |
| 164 | status_t unlockAndPost(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 165 | |
Mathias Agopian | dff8e58 | 2009-05-04 14:17:04 -0700 | [diff] [blame] | 166 | // setSwapRectangle() is intended to be used by GL ES clients |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 167 | void setSwapRectangle(const Rect& r); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 168 | |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 169 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 170 | private: |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 171 | /* |
| 172 | * Android frameworks friends |
| 173 | * (eventually this should go away and be replaced by proper APIs) |
| 174 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 175 | // camera and camcorder need access to the ISurface binder interface for preview |
| 176 | friend class Camera; |
| 177 | friend class MediaRecorder; |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 178 | // MediaPlayer needs access to ISurface for display |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 179 | friend class MediaPlayer; |
Andreas Huber | ccf8b94 | 2009-08-07 12:01:29 -0700 | [diff] [blame] | 180 | friend class IOMX; |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 181 | // this is just to be able to write some unit tests |
| 182 | friend class Test; |
| 183 | |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 184 | private: |
| 185 | friend class SurfaceComposerClient; |
| 186 | friend class SurfaceControl; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 187 | |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 188 | // can't be copied |
| 189 | Surface& operator = (Surface& rhs); |
| 190 | Surface(const Surface& rhs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 191 | |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 192 | Surface(const sp<SurfaceControl>& control); |
Mathias Agopian | fae5cb2 | 2010-06-04 18:26:32 -0700 | [diff] [blame] | 193 | Surface(const Parcel& data, const sp<IBinder>& ref); |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 194 | ~Surface(); |
| 195 | |
| 196 | |
| 197 | /* |
Dianne Hackborn | 8b49bd1 | 2010-06-30 13:56:17 -0700 | [diff] [blame^] | 198 | * ANativeWindow hooks |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 199 | */ |
Dianne Hackborn | 8b49bd1 | 2010-06-30 13:56:17 -0700 | [diff] [blame^] | 200 | static int setSwapInterval(ANativeWindow* window, int interval); |
| 201 | static int dequeueBuffer(ANativeWindow* window, android_native_buffer_t** buffer); |
| 202 | static int lockBuffer(ANativeWindow* window, android_native_buffer_t* buffer); |
| 203 | static int queueBuffer(ANativeWindow* window, android_native_buffer_t* buffer); |
| 204 | static int query(ANativeWindow* window, int what, int* value); |
| 205 | static int perform(ANativeWindow* window, int operation, ...); |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 206 | |
| 207 | int dequeueBuffer(android_native_buffer_t** buffer); |
| 208 | int lockBuffer(android_native_buffer_t* buffer); |
| 209 | int queueBuffer(android_native_buffer_t* buffer); |
Mathias Agopian | 5b5c914 | 2009-07-30 18:14:56 -0700 | [diff] [blame] | 210 | int query(int what, int* value); |
Mathias Agopian | 5cec474 | 2009-08-11 22:34:02 -0700 | [diff] [blame] | 211 | int perform(int operation, va_list args); |
Mathias Agopian | dff8e58 | 2009-05-04 14:17:04 -0700 | [diff] [blame] | 212 | |
Mathias Agopian | 2f7540e | 2010-03-11 15:06:54 -0800 | [diff] [blame] | 213 | void dispatch_setUsage(va_list args); |
| 214 | int dispatch_connect(va_list args); |
| 215 | int dispatch_disconnect(va_list args); |
Mathias Agopian | 16a86ee | 2010-04-15 18:48:26 -0700 | [diff] [blame] | 216 | int dispatch_crop(va_list args); |
Mathias Agopian | 25f0bda | 2010-05-21 14:19:50 -0700 | [diff] [blame] | 217 | int dispatch_set_buffer_count(va_list args); |
Mathias Agopian | 2be352a | 2010-05-21 17:24:35 -0700 | [diff] [blame] | 218 | int dispatch_set_buffers_geometry(va_list args); |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 219 | |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 220 | void setUsage(uint32_t reqUsage); |
Mathias Agopian | 2f7540e | 2010-03-11 15:06:54 -0800 | [diff] [blame] | 221 | int connect(int api); |
| 222 | int disconnect(int api); |
Mathias Agopian | 16a86ee | 2010-04-15 18:48:26 -0700 | [diff] [blame] | 223 | int crop(Rect const* rect); |
Mathias Agopian | 59751db | 2010-05-07 15:58:44 -0700 | [diff] [blame] | 224 | int setBufferCount(int bufferCount); |
Mathias Agopian | 2be352a | 2010-05-21 17:24:35 -0700 | [diff] [blame] | 225 | int setBuffersGeometry(int w, int h, int format); |
Mathias Agopian | 2f7540e | 2010-03-11 15:06:54 -0800 | [diff] [blame] | 226 | |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 227 | /* |
| 228 | * private stuff... |
| 229 | */ |
| 230 | void init(); |
| 231 | status_t validate() const; |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 232 | sp<ISurface> getISurface() const; |
| 233 | |
| 234 | inline const GraphicBufferMapper& getBufferMapper() const { return mBufferMapper; } |
| 235 | inline GraphicBufferMapper& getBufferMapper() { return mBufferMapper; } |
| 236 | |
Mathias Agopian | 2be352a | 2010-05-21 17:24:35 -0700 | [diff] [blame] | 237 | status_t getBufferLocked(int index, |
| 238 | uint32_t w, uint32_t h, uint32_t format, uint32_t usage); |
Mathias Agopian | f590f70 | 2010-04-27 16:41:19 -0700 | [diff] [blame] | 239 | int getBufferIndex(const sp<GraphicBuffer>& buffer) const; |
| 240 | |
Mathias Agopian | 2be352a | 2010-05-21 17:24:35 -0700 | [diff] [blame] | 241 | int getConnectedApi() const; |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 242 | |
Mathias Agopian | 2be352a | 2010-05-21 17:24:35 -0700 | [diff] [blame] | 243 | bool needNewBuffer(int bufIdx, |
| 244 | uint32_t *pWidth, uint32_t *pHeight, |
| 245 | uint32_t *pFormat, uint32_t *pUsage) const; |
| 246 | |
| 247 | class BufferInfo { |
| 248 | uint32_t mWidth; |
| 249 | uint32_t mHeight; |
| 250 | uint32_t mFormat; |
| 251 | uint32_t mUsage; |
| 252 | mutable uint32_t mDirty; |
| 253 | enum { |
| 254 | GEOMETRY = 0x01 |
| 255 | }; |
| 256 | public: |
| 257 | BufferInfo(); |
| 258 | void set(uint32_t w, uint32_t h, uint32_t format); |
| 259 | void set(uint32_t usage); |
| 260 | void get(uint32_t *pWidth, uint32_t *pHeight, |
| 261 | uint32_t *pFormat, uint32_t *pUsage) const; |
| 262 | bool validateBuffer(const sp<GraphicBuffer>& buffer) const; |
| 263 | }; |
| 264 | |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 265 | // constants |
Mathias Agopian | 7623da4 | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 266 | GraphicBufferMapper& mBufferMapper; |
| 267 | SurfaceClient& mClient; |
| 268 | SharedBufferClient* mSharedBufferClient; |
| 269 | status_t mInitCheck; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 270 | sp<ISurface> mSurface; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 271 | uint32_t mIdentity; |
| 272 | PixelFormat mFormat; |
| 273 | uint32_t mFlags; |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 274 | |
| 275 | // protected by mSurfaceLock |
| 276 | Rect mSwapRectangle; |
Mathias Agopian | 2f7540e | 2010-03-11 15:06:54 -0800 | [diff] [blame] | 277 | int mConnected; |
Mathias Agopian | 16a86ee | 2010-04-15 18:48:26 -0700 | [diff] [blame] | 278 | Rect mNextBufferCrop; |
Mathias Agopian | 2be352a | 2010-05-21 17:24:35 -0700 | [diff] [blame] | 279 | BufferInfo mBufferInfo; |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 280 | |
| 281 | // protected by mSurfaceLock. These are also used from lock/unlock |
| 282 | // but in that case, they must be called form the same thread. |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 283 | mutable Region mDirtyRegion; |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 284 | |
| 285 | // must be used from the lock/unlock thread |
Mathias Agopian | 6950e42 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 286 | sp<GraphicBuffer> mLockedBuffer; |
| 287 | sp<GraphicBuffer> mPostedBuffer; |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 288 | mutable Region mOldDirtyRegion; |
Mathias Agopian | a8a0aa8 | 2010-04-21 15:24:11 -0700 | [diff] [blame] | 289 | bool mReserved; |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 290 | |
Mathias Agopian | 2be352a | 2010-05-21 17:24:35 -0700 | [diff] [blame] | 291 | // only used from dequeueBuffer() |
| 292 | Vector< sp<GraphicBuffer> > mBuffers; |
| 293 | |
Mathias Agopian | 321abdb | 2009-08-14 18:52:17 -0700 | [diff] [blame] | 294 | // query() must be called from dequeueBuffer() thread |
| 295 | uint32_t mWidth; |
| 296 | uint32_t mHeight; |
| 297 | |
| 298 | // Inherently thread-safe |
| 299 | mutable Mutex mSurfaceLock; |
Mathias Agopian | 9779b22 | 2009-09-07 16:32:45 -0700 | [diff] [blame] | 300 | mutable Mutex mApiLock; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 301 | }; |
| 302 | |
| 303 | }; // namespace android |
| 304 | |
Mathias Agopian | 000479f | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 305 | #endif // ANDROID_SF_SURFACE_H |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 306 | |