| The Android Open Source Project | edbf3b6 | 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 |  | 
|  | 17 | #define LOG_TAG "SurfaceComposerClient" | 
|  | 18 |  | 
|  | 19 | #include <stdint.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 20 | #include <sys/types.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 22 | #include <utils/Errors.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | #include <utils/Log.h> | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 24 | #include <utils/Singleton.h> | 
| Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 25 | #include <utils/SortedVector.h> | 
|  | 26 | #include <utils/String8.h> | 
|  | 27 | #include <utils/threads.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 |  | 
| Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 29 | #include <binder/IMemory.h> | 
| Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 30 | #include <binder/IServiceManager.h> | 
| Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 31 |  | 
| Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 32 | #include <ui/DisplayInfo.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 33 |  | 
| Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 34 | #include <surfaceflinger/ISurface.h> | 
| Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 35 | #include <surfaceflinger/ISurfaceComposer.h> | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 36 | #include <surfaceflinger/ISurfaceComposerClient.h> | 
| Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 37 | #include <surfaceflinger/SurfaceComposerClient.h> | 
|  | 38 |  | 
|  | 39 | #include <private/surfaceflinger/LayerState.h> | 
|  | 40 | #include <private/surfaceflinger/SharedBufferStack.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 42 |  | 
|  | 43 | namespace android { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | // --------------------------------------------------------------------------- | 
|  | 45 |  | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 46 | ANDROID_SINGLETON_STATIC_INSTANCE(ComposerService); | 
|  | 47 |  | 
| Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 48 | ComposerService::ComposerService() | 
|  | 49 | : Singleton<ComposerService>() { | 
|  | 50 | const String16 name("SurfaceFlinger"); | 
|  | 51 | while (getService(name, &mComposerService) != NO_ERROR) { | 
|  | 52 | usleep(250000); | 
|  | 53 | } | 
|  | 54 | mServerCblkMemory = mComposerService->getCblk(); | 
|  | 55 | mServerCblk = static_cast<surface_flinger_cblk_t volatile *>( | 
|  | 56 | mServerCblkMemory->getBase()); | 
|  | 57 | } | 
|  | 58 |  | 
|  | 59 | sp<ISurfaceComposer> ComposerService::getComposerService() { | 
|  | 60 | return ComposerService::getInstance().mComposerService; | 
|  | 61 | } | 
|  | 62 |  | 
|  | 63 | surface_flinger_cblk_t const volatile * ComposerService::getControlBlock() { | 
|  | 64 | return ComposerService::getInstance().mServerCblk; | 
|  | 65 | } | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 66 |  | 
|  | 67 | static inline sp<ISurfaceComposer> getComposerService() { | 
|  | 68 | return ComposerService::getComposerService(); | 
|  | 69 | } | 
|  | 70 |  | 
|  | 71 | static inline surface_flinger_cblk_t const volatile * get_cblk() { | 
|  | 72 | return ComposerService::getControlBlock(); | 
|  | 73 | } | 
|  | 74 |  | 
|  | 75 | // --------------------------------------------------------------------------- | 
|  | 76 |  | 
|  | 77 | class Composer : public Singleton<Composer> | 
|  | 78 | { | 
|  | 79 | Mutex mLock; | 
|  | 80 | SortedVector< wp<SurfaceComposerClient> > mActiveConnections; | 
|  | 81 | SortedVector<sp<SurfaceComposerClient> > mOpenTransactions; | 
|  | 82 |  | 
|  | 83 | Composer() : Singleton<Composer>() { | 
|  | 84 | } | 
|  | 85 |  | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 86 | void addClientImpl(const sp<SurfaceComposerClient>& client) { | 
|  | 87 | Mutex::Autolock _l(mLock); | 
|  | 88 | mActiveConnections.add(client); | 
|  | 89 | } | 
|  | 90 |  | 
|  | 91 | void removeClientImpl(const sp<SurfaceComposerClient>& client) { | 
|  | 92 | Mutex::Autolock _l(mLock); | 
|  | 93 | mActiveConnections.remove(client); | 
|  | 94 | } | 
|  | 95 |  | 
|  | 96 | void openGlobalTransactionImpl() | 
|  | 97 | { | 
|  | 98 | Mutex::Autolock _l(mLock); | 
|  | 99 | if (mOpenTransactions.size()) { | 
|  | 100 | LOGE("openGlobalTransaction() called more than once. skipping."); | 
|  | 101 | return; | 
|  | 102 | } | 
|  | 103 | const size_t N = mActiveConnections.size(); | 
|  | 104 | for (size_t i=0; i<N; i++) { | 
|  | 105 | sp<SurfaceComposerClient> client(mActiveConnections[i].promote()); | 
|  | 106 | if (client != 0 && mOpenTransactions.indexOf(client) < 0) { | 
|  | 107 | if (client->openTransaction() == NO_ERROR) { | 
|  | 108 | mOpenTransactions.add(client); | 
|  | 109 | } else { | 
|  | 110 | LOGE("openTransaction on client %p failed", client.get()); | 
|  | 111 | // let it go, it'll fail later when the user | 
|  | 112 | // tries to do something with the transaction | 
|  | 113 | } | 
| Mathias Agopian | dd3423c | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 114 | } | 
| Mathias Agopian | dd3423c | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 115 | } | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 116 | } | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 117 |  | 
|  | 118 | void closeGlobalTransactionImpl() | 
|  | 119 | { | 
|  | 120 | mLock.lock(); | 
|  | 121 | SortedVector< sp<SurfaceComposerClient> > clients(mOpenTransactions); | 
|  | 122 | mOpenTransactions.clear(); | 
|  | 123 | mLock.unlock(); | 
|  | 124 |  | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 125 | sp<ISurfaceComposer> sm(getComposerService()); | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 126 | sm->openGlobalTransaction(); | 
|  | 127 | const size_t N = clients.size(); | 
|  | 128 | for (size_t i=0; i<N; i++) { | 
|  | 129 | clients[i]->closeTransaction(); | 
|  | 130 | } | 
|  | 131 | sm->closeGlobalTransaction(); | 
|  | 132 | } | 
|  | 133 |  | 
|  | 134 | friend class Singleton<Composer>; | 
|  | 135 |  | 
|  | 136 | public: | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 137 | static void addClient(const sp<SurfaceComposerClient>& client) { | 
|  | 138 | Composer::getInstance().addClientImpl(client); | 
|  | 139 | } | 
|  | 140 | static void removeClient(const sp<SurfaceComposerClient>& client) { | 
|  | 141 | Composer::getInstance().removeClientImpl(client); | 
|  | 142 | } | 
|  | 143 | static void openGlobalTransaction() { | 
|  | 144 | Composer::getInstance().openGlobalTransactionImpl(); | 
|  | 145 | } | 
|  | 146 | static void closeGlobalTransaction() { | 
|  | 147 | Composer::getInstance().closeGlobalTransactionImpl(); | 
|  | 148 | } | 
|  | 149 | }; | 
|  | 150 |  | 
|  | 151 | ANDROID_SINGLETON_STATIC_INSTANCE(Composer); | 
|  | 152 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 153 | // --------------------------------------------------------------------------- | 
|  | 154 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 155 | static inline int compare_type( const layer_state_t& lhs, | 
|  | 156 | const layer_state_t& rhs) { | 
|  | 157 | if (lhs.surface < rhs.surface)  return -1; | 
|  | 158 | if (lhs.surface > rhs.surface)  return 1; | 
|  | 159 | return 0; | 
|  | 160 | } | 
|  | 161 |  | 
|  | 162 | SurfaceComposerClient::SurfaceComposerClient() | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 163 | : mTransactionOpen(0), mPrebuiltLayerState(0), mStatus(NO_INIT) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 164 | { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 165 | } | 
|  | 166 |  | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 167 | void SurfaceComposerClient::onFirstRef() | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 168 | { | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 169 | sp<ISurfaceComposer> sm(getComposerService()); | 
|  | 170 | if (sm != 0) { | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 171 | sp<ISurfaceComposerClient> conn = sm->createConnection(); | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 172 | if (conn != 0) { | 
|  | 173 | mClient = conn; | 
|  | 174 | Composer::addClient(this); | 
|  | 175 | mPrebuiltLayerState = new layer_state_t; | 
|  | 176 | mStatus = NO_ERROR; | 
|  | 177 | } | 
|  | 178 | } | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 179 | } | 
|  | 180 |  | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 181 | SurfaceComposerClient::~SurfaceComposerClient() | 
|  | 182 | { | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 183 | delete mPrebuiltLayerState; | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 184 | dispose(); | 
|  | 185 | } | 
| Mathias Agopian | dd3423c | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 186 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 187 | status_t SurfaceComposerClient::initCheck() const | 
|  | 188 | { | 
|  | 189 | return mStatus; | 
|  | 190 | } | 
|  | 191 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 192 | sp<IBinder> SurfaceComposerClient::connection() const | 
|  | 193 | { | 
|  | 194 | return (mClient != 0) ? mClient->asBinder() : 0; | 
|  | 195 | } | 
|  | 196 |  | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 197 | status_t SurfaceComposerClient::linkToComposerDeath( | 
|  | 198 | const sp<IBinder::DeathRecipient>& recipient, | 
|  | 199 | void* cookie, uint32_t flags) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 200 | { | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 201 | sp<ISurfaceComposer> sm(getComposerService()); | 
|  | 202 | return sm->asBinder()->linkToDeath(recipient, cookie, flags); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 203 | } | 
|  | 204 |  | 
|  | 205 | void SurfaceComposerClient::dispose() | 
|  | 206 | { | 
|  | 207 | // this can be called more than once. | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 208 | sp<ISurfaceComposerClient> client; | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 209 | Mutex::Autolock _lm(mLock); | 
|  | 210 | if (mClient != 0) { | 
|  | 211 | Composer::removeClient(this); | 
|  | 212 | client = mClient; // hold ref while lock is held | 
|  | 213 | mClient.clear(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 214 | } | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 215 | mStatus = NO_INIT; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 216 | } | 
|  | 217 |  | 
|  | 218 | status_t SurfaceComposerClient::getDisplayInfo( | 
|  | 219 | DisplayID dpy, DisplayInfo* info) | 
|  | 220 | { | 
| Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 221 | if (uint32_t(dpy)>=NUM_DISPLAY_MAX) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 222 | return BAD_VALUE; | 
|  | 223 |  | 
|  | 224 | volatile surface_flinger_cblk_t const * cblk = get_cblk(); | 
|  | 225 | volatile display_cblk_t const * dcblk = cblk->displays + dpy; | 
|  | 226 |  | 
|  | 227 | info->w              = dcblk->w; | 
|  | 228 | info->h              = dcblk->h; | 
|  | 229 | info->orientation    = dcblk->orientation; | 
|  | 230 | info->xdpi           = dcblk->xdpi; | 
|  | 231 | info->ydpi           = dcblk->ydpi; | 
|  | 232 | info->fps            = dcblk->fps; | 
|  | 233 | info->density        = dcblk->density; | 
|  | 234 | return getPixelFormatInfo(dcblk->format, &(info->pixelFormatInfo)); | 
|  | 235 | } | 
|  | 236 |  | 
|  | 237 | ssize_t SurfaceComposerClient::getDisplayWidth(DisplayID dpy) | 
|  | 238 | { | 
| Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 239 | if (uint32_t(dpy)>=NUM_DISPLAY_MAX) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 240 | return BAD_VALUE; | 
|  | 241 | volatile surface_flinger_cblk_t const * cblk = get_cblk(); | 
|  | 242 | volatile display_cblk_t const * dcblk = cblk->displays + dpy; | 
|  | 243 | return dcblk->w; | 
|  | 244 | } | 
|  | 245 |  | 
|  | 246 | ssize_t SurfaceComposerClient::getDisplayHeight(DisplayID dpy) | 
|  | 247 | { | 
| Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 248 | if (uint32_t(dpy)>=NUM_DISPLAY_MAX) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 249 | return BAD_VALUE; | 
|  | 250 | volatile surface_flinger_cblk_t const * cblk = get_cblk(); | 
|  | 251 | volatile display_cblk_t const * dcblk = cblk->displays + dpy; | 
|  | 252 | return dcblk->h; | 
|  | 253 | } | 
|  | 254 |  | 
|  | 255 | ssize_t SurfaceComposerClient::getDisplayOrientation(DisplayID dpy) | 
|  | 256 | { | 
| Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 257 | if (uint32_t(dpy)>=NUM_DISPLAY_MAX) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 258 | return BAD_VALUE; | 
|  | 259 | volatile surface_flinger_cblk_t const * cblk = get_cblk(); | 
|  | 260 | volatile display_cblk_t const * dcblk = cblk->displays + dpy; | 
|  | 261 | return dcblk->orientation; | 
|  | 262 | } | 
|  | 263 |  | 
|  | 264 | ssize_t SurfaceComposerClient::getNumberOfDisplays() | 
|  | 265 | { | 
|  | 266 | volatile surface_flinger_cblk_t const * cblk = get_cblk(); | 
|  | 267 | uint32_t connected = cblk->connected; | 
|  | 268 | int n = 0; | 
|  | 269 | while (connected) { | 
|  | 270 | if (connected&1) n++; | 
|  | 271 | connected >>= 1; | 
|  | 272 | } | 
|  | 273 | return n; | 
|  | 274 | } | 
|  | 275 |  | 
| Mathias Agopian | 01b7668 | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 276 | sp<SurfaceControl> SurfaceComposerClient::createSurface( | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 277 | DisplayID display, | 
|  | 278 | uint32_t w, | 
|  | 279 | uint32_t h, | 
|  | 280 | PixelFormat format, | 
|  | 281 | uint32_t flags) | 
|  | 282 | { | 
| Mathias Agopian | 285dbde | 2010-03-01 16:09:43 -0800 | [diff] [blame] | 283 | String8 name; | 
|  | 284 | const size_t SIZE = 128; | 
|  | 285 | char buffer[SIZE]; | 
|  | 286 | snprintf(buffer, SIZE, "<pid_%d>", getpid()); | 
|  | 287 | name.append(buffer); | 
|  | 288 |  | 
| Mathias Agopian | 0ef4e15 | 2011-04-20 14:19:32 -0700 | [diff] [blame] | 289 | return SurfaceComposerClient::createSurface(name, display, | 
| Mathias Agopian | 285dbde | 2010-03-01 16:09:43 -0800 | [diff] [blame] | 290 | w, h, format, flags); | 
| Mathias Agopian | 285dbde | 2010-03-01 16:09:43 -0800 | [diff] [blame] | 291 | } | 
|  | 292 |  | 
|  | 293 | sp<SurfaceControl> SurfaceComposerClient::createSurface( | 
| Mathias Agopian | 285dbde | 2010-03-01 16:09:43 -0800 | [diff] [blame] | 294 | const String8& name, | 
|  | 295 | DisplayID display, | 
|  | 296 | uint32_t w, | 
|  | 297 | uint32_t h, | 
|  | 298 | PixelFormat format, | 
|  | 299 | uint32_t flags) | 
|  | 300 | { | 
| Mathias Agopian | 01b7668 | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 301 | sp<SurfaceControl> result; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 302 | if (mStatus == NO_ERROR) { | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 303 | ISurfaceComposerClient::surface_data_t data; | 
| Mathias Agopian | 0ef4e15 | 2011-04-20 14:19:32 -0700 | [diff] [blame] | 304 | sp<ISurface> surface = mClient->createSurface(&data, name, | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 305 | display, w, h, format, flags); | 
|  | 306 | if (surface != 0) { | 
| Mathias Agopian | 53503a9 | 2010-06-08 15:40:56 -0700 | [diff] [blame] | 307 | result = new SurfaceControl(this, surface, data, w, h, format, flags); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 308 | } | 
|  | 309 | } | 
|  | 310 | return result; | 
|  | 311 | } | 
|  | 312 |  | 
|  | 313 | status_t SurfaceComposerClient::destroySurface(SurfaceID sid) | 
|  | 314 | { | 
|  | 315 | if (mStatus != NO_ERROR) | 
|  | 316 | return mStatus; | 
|  | 317 |  | 
|  | 318 | // it's okay to destroy a surface while a transaction is open, | 
|  | 319 | // (transactions really are a client-side concept) | 
|  | 320 | // however, this indicates probably a misuse of the API or a bug | 
|  | 321 | // in the client code. | 
|  | 322 | LOGW_IF(mTransactionOpen, | 
|  | 323 | "Destroying surface while a transaction is open. " | 
|  | 324 | "Client %p: destroying surface %d, mTransactionOpen=%d", | 
|  | 325 | this, sid, mTransactionOpen); | 
|  | 326 |  | 
|  | 327 | status_t err = mClient->destroySurface(sid); | 
|  | 328 | return err; | 
|  | 329 | } | 
|  | 330 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 331 | void SurfaceComposerClient::openGlobalTransaction() | 
|  | 332 | { | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 333 | Composer::openGlobalTransaction(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 334 | } | 
|  | 335 |  | 
|  | 336 | void SurfaceComposerClient::closeGlobalTransaction() | 
|  | 337 | { | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 338 | Composer::closeGlobalTransaction(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 339 | } | 
|  | 340 |  | 
|  | 341 | status_t SurfaceComposerClient::freezeDisplay(DisplayID dpy, uint32_t flags) | 
|  | 342 | { | 
| Mathias Agopian | dd3423c | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 343 | sp<ISurfaceComposer> sm(getComposerService()); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 344 | return sm->freezeDisplay(dpy, flags); | 
|  | 345 | } | 
|  | 346 |  | 
|  | 347 | status_t SurfaceComposerClient::unfreezeDisplay(DisplayID dpy, uint32_t flags) | 
|  | 348 | { | 
| Mathias Agopian | dd3423c | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 349 | sp<ISurfaceComposer> sm(getComposerService()); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 350 | return sm->unfreezeDisplay(dpy, flags); | 
|  | 351 | } | 
|  | 352 |  | 
| Mathias Agopian | c08731e | 2009-03-27 18:11:38 -0700 | [diff] [blame] | 353 | int SurfaceComposerClient::setOrientation(DisplayID dpy, | 
|  | 354 | int orientation, uint32_t flags) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 355 | { | 
| Mathias Agopian | dd3423c | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 356 | sp<ISurfaceComposer> sm(getComposerService()); | 
| Mathias Agopian | c08731e | 2009-03-27 18:11:38 -0700 | [diff] [blame] | 357 | return sm->setOrientation(dpy, orientation, flags); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 358 | } | 
|  | 359 |  | 
|  | 360 | status_t SurfaceComposerClient::openTransaction() | 
|  | 361 | { | 
|  | 362 | if (mStatus != NO_ERROR) | 
|  | 363 | return mStatus; | 
|  | 364 | Mutex::Autolock _l(mLock); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 365 | mTransactionOpen++; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 366 | return NO_ERROR; | 
|  | 367 | } | 
|  | 368 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 369 | status_t SurfaceComposerClient::closeTransaction() | 
|  | 370 | { | 
|  | 371 | if (mStatus != NO_ERROR) | 
|  | 372 | return mStatus; | 
|  | 373 |  | 
|  | 374 | Mutex::Autolock _l(mLock); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 375 | if (mTransactionOpen <= 0) { | 
|  | 376 | LOGE(   "closeTransaction (client %p, mTransactionOpen=%d) " | 
|  | 377 | "called more times than openTransaction()", | 
|  | 378 | this, mTransactionOpen); | 
|  | 379 | return INVALID_OPERATION; | 
|  | 380 | } | 
|  | 381 |  | 
|  | 382 | if (mTransactionOpen >= 2) { | 
|  | 383 | mTransactionOpen--; | 
|  | 384 | return NO_ERROR; | 
|  | 385 | } | 
|  | 386 |  | 
|  | 387 | mTransactionOpen = 0; | 
|  | 388 | const ssize_t count = mStates.size(); | 
|  | 389 | if (count) { | 
|  | 390 | mClient->setState(count, mStates.array()); | 
|  | 391 | mStates.clear(); | 
|  | 392 | } | 
|  | 393 | return NO_ERROR; | 
|  | 394 | } | 
|  | 395 |  | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 396 | layer_state_t* SurfaceComposerClient::get_state_l(SurfaceID index) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 397 | { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 398 | // API usage error, do nothing. | 
|  | 399 | if (mTransactionOpen<=0) { | 
|  | 400 | LOGE("Not in transaction (client=%p, SurfaceID=%d, mTransactionOpen=%d", | 
|  | 401 | this, int(index), mTransactionOpen); | 
|  | 402 | return 0; | 
|  | 403 | } | 
|  | 404 |  | 
|  | 405 | // use mPrebuiltLayerState just to find out if we already have it | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 406 | layer_state_t& dummy(*mPrebuiltLayerState); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 407 | dummy.surface = index; | 
|  | 408 | ssize_t i = mStates.indexOf(dummy); | 
|  | 409 | if (i < 0) { | 
|  | 410 | // we don't have it, add an initialized layer_state to our list | 
|  | 411 | i = mStates.add(dummy); | 
|  | 412 | } | 
|  | 413 | return mStates.editArray() + i; | 
|  | 414 | } | 
|  | 415 |  | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 416 | layer_state_t* SurfaceComposerClient::lockLayerState(SurfaceID id) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 417 | { | 
|  | 418 | layer_state_t* s; | 
|  | 419 | mLock.lock(); | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 420 | s = get_state_l(id); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 421 | if (!s) mLock.unlock(); | 
|  | 422 | return s; | 
|  | 423 | } | 
|  | 424 |  | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 425 | void SurfaceComposerClient::unlockLayerState() | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 426 | { | 
|  | 427 | mLock.unlock(); | 
|  | 428 | } | 
|  | 429 |  | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 430 | status_t SurfaceComposerClient::setPosition(SurfaceID id, int32_t x, int32_t y) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 431 | { | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 432 | layer_state_t* s = lockLayerState(id); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 433 | if (!s) return BAD_INDEX; | 
|  | 434 | s->what |= ISurfaceComposer::ePositionChanged; | 
|  | 435 | s->x = x; | 
|  | 436 | s->y = y; | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 437 | unlockLayerState(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 438 | return NO_ERROR; | 
|  | 439 | } | 
|  | 440 |  | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 441 | status_t SurfaceComposerClient::setSize(SurfaceID id, uint32_t w, uint32_t h) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 442 | { | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 443 | layer_state_t* s = lockLayerState(id); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 444 | if (!s) return BAD_INDEX; | 
|  | 445 | s->what |= ISurfaceComposer::eSizeChanged; | 
|  | 446 | s->w = w; | 
|  | 447 | s->h = h; | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 448 | unlockLayerState(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 449 | return NO_ERROR; | 
|  | 450 | } | 
|  | 451 |  | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 452 | status_t SurfaceComposerClient::setLayer(SurfaceID id, int32_t z) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 453 | { | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 454 | layer_state_t* s = lockLayerState(id); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 455 | if (!s) return BAD_INDEX; | 
|  | 456 | s->what |= ISurfaceComposer::eLayerChanged; | 
|  | 457 | s->z = z; | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 458 | unlockLayerState(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 459 | return NO_ERROR; | 
|  | 460 | } | 
|  | 461 |  | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 462 | status_t SurfaceComposerClient::hide(SurfaceID id) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 463 | { | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 464 | return setFlags(id, ISurfaceComposer::eLayerHidden, | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 465 | ISurfaceComposer::eLayerHidden); | 
|  | 466 | } | 
|  | 467 |  | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 468 | status_t SurfaceComposerClient::show(SurfaceID id, int32_t) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 469 | { | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 470 | return setFlags(id, 0, ISurfaceComposer::eLayerHidden); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 471 | } | 
|  | 472 |  | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 473 | status_t SurfaceComposerClient::freeze(SurfaceID id) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 474 | { | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 475 | return setFlags(id, ISurfaceComposer::eLayerFrozen, | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 476 | ISurfaceComposer::eLayerFrozen); | 
|  | 477 | } | 
|  | 478 |  | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 479 | status_t SurfaceComposerClient::unfreeze(SurfaceID id) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 480 | { | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 481 | return setFlags(id, 0, ISurfaceComposer::eLayerFrozen); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 482 | } | 
|  | 483 |  | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 484 | status_t SurfaceComposerClient::setFlags(SurfaceID id, | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 485 | uint32_t flags, uint32_t mask) | 
|  | 486 | { | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 487 | layer_state_t* s = lockLayerState(id); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 488 | if (!s) return BAD_INDEX; | 
|  | 489 | s->what |= ISurfaceComposer::eVisibilityChanged; | 
|  | 490 | s->flags &= ~mask; | 
|  | 491 | s->flags |= (flags & mask); | 
|  | 492 | s->mask |= mask; | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 493 | unlockLayerState(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 494 | return NO_ERROR; | 
|  | 495 | } | 
|  | 496 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 497 | status_t SurfaceComposerClient::setTransparentRegionHint( | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 498 | SurfaceID id, const Region& transparentRegion) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 499 | { | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 500 | layer_state_t* s = lockLayerState(id); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 501 | if (!s) return BAD_INDEX; | 
|  | 502 | s->what |= ISurfaceComposer::eTransparentRegionChanged; | 
|  | 503 | s->transparentRegion = transparentRegion; | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 504 | unlockLayerState(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 505 | return NO_ERROR; | 
|  | 506 | } | 
|  | 507 |  | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 508 | status_t SurfaceComposerClient::setAlpha(SurfaceID id, float alpha) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 509 | { | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 510 | layer_state_t* s = lockLayerState(id); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 511 | if (!s) return BAD_INDEX; | 
|  | 512 | s->what |= ISurfaceComposer::eAlphaChanged; | 
|  | 513 | s->alpha = alpha; | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 514 | unlockLayerState(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 515 | return NO_ERROR; | 
|  | 516 | } | 
|  | 517 |  | 
|  | 518 | status_t SurfaceComposerClient::setMatrix( | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 519 | SurfaceID id, | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 520 | float dsdx, float dtdx, | 
|  | 521 | float dsdy, float dtdy ) | 
|  | 522 | { | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 523 | layer_state_t* s = lockLayerState(id); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 524 | if (!s) return BAD_INDEX; | 
|  | 525 | s->what |= ISurfaceComposer::eMatrixChanged; | 
|  | 526 | layer_state_t::matrix22_t matrix; | 
|  | 527 | matrix.dsdx = dsdx; | 
|  | 528 | matrix.dtdx = dtdx; | 
|  | 529 | matrix.dsdy = dsdy; | 
|  | 530 | matrix.dtdy = dtdy; | 
|  | 531 | s->matrix = matrix; | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 532 | unlockLayerState(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 533 | return NO_ERROR; | 
|  | 534 | } | 
|  | 535 |  | 
| Mathias Agopian | 62185b7 | 2009-04-16 16:19:50 -0700 | [diff] [blame] | 536 | status_t SurfaceComposerClient::setFreezeTint(SurfaceID id, uint32_t tint) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 537 | { | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 538 | layer_state_t* s = lockLayerState(id); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 539 | if (!s) return BAD_INDEX; | 
|  | 540 | s->what |= ISurfaceComposer::eFreezeTintChanged; | 
|  | 541 | s->tint = tint; | 
| Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 542 | unlockLayerState(); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 543 | return NO_ERROR; | 
|  | 544 | } | 
|  | 545 |  | 
| Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 546 | // ---------------------------------------------------------------------------- | 
| Mathias Agopian | 74c40c0 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 547 |  | 
|  | 548 | ScreenshotClient::ScreenshotClient() | 
|  | 549 | : mWidth(0), mHeight(0), mFormat(PIXEL_FORMAT_NONE) { | 
|  | 550 | } | 
|  | 551 |  | 
|  | 552 | status_t ScreenshotClient::update() { | 
|  | 553 | sp<ISurfaceComposer> s(ComposerService::getComposerService()); | 
|  | 554 | if (s == NULL) return NO_INIT; | 
|  | 555 | mHeap = 0; | 
|  | 556 | return s->captureScreen(0, &mHeap, | 
| Mathias Agopian | bf2c6a6 | 2010-12-10 16:22:31 -0800 | [diff] [blame] | 557 | &mWidth, &mHeight, &mFormat, 0, 0, | 
|  | 558 | 0, -1UL); | 
| Mathias Agopian | 74c40c0 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 559 | } | 
|  | 560 |  | 
|  | 561 | status_t ScreenshotClient::update(uint32_t reqWidth, uint32_t reqHeight) { | 
|  | 562 | sp<ISurfaceComposer> s(ComposerService::getComposerService()); | 
|  | 563 | if (s == NULL) return NO_INIT; | 
|  | 564 | mHeap = 0; | 
|  | 565 | return s->captureScreen(0, &mHeap, | 
| Mathias Agopian | bf2c6a6 | 2010-12-10 16:22:31 -0800 | [diff] [blame] | 566 | &mWidth, &mHeight, &mFormat, reqWidth, reqHeight, | 
|  | 567 | 0, -1UL); | 
|  | 568 | } | 
|  | 569 |  | 
|  | 570 | status_t ScreenshotClient::update(uint32_t reqWidth, uint32_t reqHeight, | 
|  | 571 | uint32_t minLayerZ, uint32_t maxLayerZ) { | 
|  | 572 | sp<ISurfaceComposer> s(ComposerService::getComposerService()); | 
|  | 573 | if (s == NULL) return NO_INIT; | 
|  | 574 | mHeap = 0; | 
|  | 575 | return s->captureScreen(0, &mHeap, | 
|  | 576 | &mWidth, &mHeight, &mFormat, reqWidth, reqHeight, | 
|  | 577 | minLayerZ, maxLayerZ); | 
| Mathias Agopian | 74c40c0 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 578 | } | 
|  | 579 |  | 
|  | 580 | void ScreenshotClient::release() { | 
|  | 581 | mHeap = 0; | 
|  | 582 | } | 
|  | 583 |  | 
|  | 584 | void const* ScreenshotClient::getPixels() const { | 
|  | 585 | return mHeap->getBase(); | 
|  | 586 | } | 
|  | 587 |  | 
|  | 588 | uint32_t ScreenshotClient::getWidth() const { | 
|  | 589 | return mWidth; | 
|  | 590 | } | 
|  | 591 |  | 
|  | 592 | uint32_t ScreenshotClient::getHeight() const { | 
|  | 593 | return mHeight; | 
|  | 594 | } | 
|  | 595 |  | 
|  | 596 | PixelFormat ScreenshotClient::getFormat() const { | 
|  | 597 | return mFormat; | 
|  | 598 | } | 
|  | 599 |  | 
|  | 600 | uint32_t ScreenshotClient::getStride() const { | 
|  | 601 | return mWidth; | 
|  | 602 | } | 
|  | 603 |  | 
|  | 604 | size_t ScreenshotClient::getSize() const { | 
|  | 605 | return mHeap->getSize(); | 
|  | 606 | } | 
|  | 607 |  | 
|  | 608 | // ---------------------------------------------------------------------------- | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 609 | }; // namespace android | 
|  | 610 |  |