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 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | #include <stdlib.h> |
| 18 | #include <stdint.h> |
| 19 | #include <sys/types.h> |
| 20 | |
| 21 | #include <utils/Errors.h> |
| 22 | #include <utils/Log.h> |
Mathias Agopian | 310f8da | 2009-05-22 01:27:01 -0700 | [diff] [blame] | 23 | #include <binder/IPCThreadState.h> |
| 24 | #include <binder/IServiceManager.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | |
| 26 | #include <GLES/gl.h> |
| 27 | #include <GLES/glext.h> |
| 28 | |
| 29 | #include <hardware/hardware.h> |
| 30 | |
| 31 | #include "clz.h" |
| 32 | #include "LayerBase.h" |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 33 | #include "SurfaceFlinger.h" |
| 34 | #include "DisplayHardware/DisplayHardware.h" |
| 35 | |
| 36 | |
| 37 | // We don't honor the premultiplied alpha flags, which means that |
| 38 | // premultiplied surface may be composed using a non-premultiplied |
| 39 | // equation. We do this because it may be a lot faster on some hardware |
| 40 | // The correct value is HONOR_PREMULTIPLIED_ALPHA = 1 |
| 41 | #define HONOR_PREMULTIPLIED_ALPHA 0 |
| 42 | |
| 43 | namespace android { |
| 44 | |
| 45 | // --------------------------------------------------------------------------- |
| 46 | |
| 47 | const uint32_t LayerBase::typeInfo = 1; |
| 48 | const char* const LayerBase::typeID = "LayerBase"; |
| 49 | |
| 50 | const uint32_t LayerBaseClient::typeInfo = LayerBase::typeInfo | 2; |
| 51 | const char* const LayerBaseClient::typeID = "LayerBaseClient"; |
| 52 | |
| 53 | // --------------------------------------------------------------------------- |
| 54 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 55 | LayerBase::LayerBase(SurfaceFlinger* flinger, DisplayID display) |
| 56 | : dpy(display), contentDirty(false), |
| 57 | mFlinger(flinger), |
| 58 | mTransformed(false), |
Mathias Agopian | a2fe0a2 | 2009-09-23 18:34:53 -0700 | [diff] [blame] | 59 | mUseLinearFiltering(false), |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | mOrientation(0), |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 61 | mTransactionFlags(0), |
| 62 | mPremultipliedAlpha(true), |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | mInvalidate(0) |
| 64 | { |
| 65 | const DisplayHardware& hw(flinger->graphicPlane(0).displayHardware()); |
| 66 | mFlags = hw.getFlags(); |
| 67 | } |
| 68 | |
| 69 | LayerBase::~LayerBase() |
| 70 | { |
| 71 | } |
| 72 | |
| 73 | const GraphicPlane& LayerBase::graphicPlane(int dpy) const |
| 74 | { |
| 75 | return mFlinger->graphicPlane(dpy); |
| 76 | } |
| 77 | |
| 78 | GraphicPlane& LayerBase::graphicPlane(int dpy) |
| 79 | { |
| 80 | return mFlinger->graphicPlane(dpy); |
| 81 | } |
| 82 | |
| 83 | void LayerBase::initStates(uint32_t w, uint32_t h, uint32_t flags) |
| 84 | { |
| 85 | uint32_t layerFlags = 0; |
| 86 | if (flags & ISurfaceComposer::eHidden) |
| 87 | layerFlags = ISurfaceComposer::eLayerHidden; |
| 88 | |
| 89 | if (flags & ISurfaceComposer::eNonPremultiplied) |
| 90 | mPremultipliedAlpha = false; |
| 91 | |
| 92 | mCurrentState.z = 0; |
| 93 | mCurrentState.w = w; |
| 94 | mCurrentState.h = h; |
| 95 | mCurrentState.alpha = 0xFF; |
| 96 | mCurrentState.flags = layerFlags; |
| 97 | mCurrentState.sequence = 0; |
| 98 | mCurrentState.transform.set(0, 0); |
| 99 | |
| 100 | // drawing state & current state are identical |
| 101 | mDrawingState = mCurrentState; |
| 102 | } |
| 103 | |
| 104 | void LayerBase::commitTransaction(bool skipSize) { |
| 105 | const uint32_t w = mDrawingState.w; |
| 106 | const uint32_t h = mDrawingState.h; |
| 107 | mDrawingState = mCurrentState; |
| 108 | if (skipSize) { |
| 109 | mDrawingState.w = w; |
| 110 | mDrawingState.h = h; |
| 111 | } |
| 112 | } |
| 113 | void LayerBase::forceVisibilityTransaction() { |
| 114 | // this can be called without SurfaceFlinger.mStateLock, but if we |
| 115 | // can atomically increment the sequence number, it doesn't matter. |
| 116 | android_atomic_inc(&mCurrentState.sequence); |
| 117 | requestTransaction(); |
| 118 | } |
| 119 | bool LayerBase::requestTransaction() { |
| 120 | int32_t old = setTransactionFlags(eTransactionNeeded); |
| 121 | return ((old & eTransactionNeeded) == 0); |
| 122 | } |
| 123 | uint32_t LayerBase::getTransactionFlags(uint32_t flags) { |
| 124 | return android_atomic_and(~flags, &mTransactionFlags) & flags; |
| 125 | } |
| 126 | uint32_t LayerBase::setTransactionFlags(uint32_t flags) { |
| 127 | return android_atomic_or(flags, &mTransactionFlags); |
| 128 | } |
| 129 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 130 | bool LayerBase::setPosition(int32_t x, int32_t y) { |
| 131 | if (mCurrentState.transform.tx() == x && mCurrentState.transform.ty() == y) |
| 132 | return false; |
| 133 | mCurrentState.sequence++; |
| 134 | mCurrentState.transform.set(x, y); |
| 135 | requestTransaction(); |
| 136 | return true; |
| 137 | } |
| 138 | bool LayerBase::setLayer(uint32_t z) { |
| 139 | if (mCurrentState.z == z) |
| 140 | return false; |
| 141 | mCurrentState.sequence++; |
| 142 | mCurrentState.z = z; |
| 143 | requestTransaction(); |
| 144 | return true; |
| 145 | } |
| 146 | bool LayerBase::setSize(uint32_t w, uint32_t h) { |
| 147 | if (mCurrentState.w == w && mCurrentState.h == h) |
| 148 | return false; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 149 | mCurrentState.w = w; |
| 150 | mCurrentState.h = h; |
| 151 | requestTransaction(); |
| 152 | return true; |
| 153 | } |
| 154 | bool LayerBase::setAlpha(uint8_t alpha) { |
| 155 | if (mCurrentState.alpha == alpha) |
| 156 | return false; |
| 157 | mCurrentState.sequence++; |
| 158 | mCurrentState.alpha = alpha; |
| 159 | requestTransaction(); |
| 160 | return true; |
| 161 | } |
| 162 | bool LayerBase::setMatrix(const layer_state_t::matrix22_t& matrix) { |
| 163 | // TODO: check the matrix has changed |
| 164 | mCurrentState.sequence++; |
| 165 | mCurrentState.transform.set( |
| 166 | matrix.dsdx, matrix.dsdy, matrix.dtdx, matrix.dtdy); |
| 167 | requestTransaction(); |
| 168 | return true; |
| 169 | } |
| 170 | bool LayerBase::setTransparentRegionHint(const Region& transparent) { |
| 171 | // TODO: check the region has changed |
| 172 | mCurrentState.sequence++; |
| 173 | mCurrentState.transparentRegion = transparent; |
| 174 | requestTransaction(); |
| 175 | return true; |
| 176 | } |
| 177 | bool LayerBase::setFlags(uint8_t flags, uint8_t mask) { |
| 178 | const uint32_t newFlags = (mCurrentState.flags & ~mask) | (flags & mask); |
| 179 | if (mCurrentState.flags == newFlags) |
| 180 | return false; |
| 181 | mCurrentState.sequence++; |
| 182 | mCurrentState.flags = newFlags; |
| 183 | requestTransaction(); |
| 184 | return true; |
| 185 | } |
| 186 | |
| 187 | Rect LayerBase::visibleBounds() const |
| 188 | { |
| 189 | return mTransformedBounds; |
| 190 | } |
| 191 | |
| 192 | void LayerBase::setVisibleRegion(const Region& visibleRegion) { |
| 193 | // always called from main thread |
| 194 | visibleRegionScreen = visibleRegion; |
| 195 | } |
| 196 | |
| 197 | void LayerBase::setCoveredRegion(const Region& coveredRegion) { |
| 198 | // always called from main thread |
| 199 | coveredRegionScreen = coveredRegion; |
| 200 | } |
| 201 | |
| 202 | uint32_t LayerBase::doTransaction(uint32_t flags) |
| 203 | { |
| 204 | const Layer::State& front(drawingState()); |
| 205 | const Layer::State& temp(currentState()); |
| 206 | |
| 207 | if (temp.sequence != front.sequence) { |
| 208 | // invalidate and recompute the visible regions if needed |
| 209 | flags |= eVisibleRegion; |
| 210 | this->contentDirty = true; |
| 211 | } |
Mathias Agopian | a2fe0a2 | 2009-09-23 18:34:53 -0700 | [diff] [blame] | 212 | |
| 213 | if (temp.sequence != front.sequence) { |
| 214 | const bool linearFiltering = mUseLinearFiltering; |
| 215 | mUseLinearFiltering = false; |
| 216 | if (!(mFlags & DisplayHardware::SLOW_CONFIG)) { |
| 217 | // we may use linear filtering, if the matrix scales us |
| 218 | const uint8_t type = temp.transform.getType(); |
| 219 | if (!temp.transform.preserveRects() || (type >= Transform::SCALE)) { |
| 220 | mUseLinearFiltering = true; |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 225 | // Commit the transaction |
| 226 | commitTransaction(flags & eRestartTransaction); |
| 227 | return flags; |
| 228 | } |
| 229 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 230 | void LayerBase::validateVisibility(const Transform& planeTransform) |
| 231 | { |
| 232 | const Layer::State& s(drawingState()); |
| 233 | const Transform tr(planeTransform * s.transform); |
| 234 | const bool transformed = tr.transformed(); |
| 235 | |
Mathias Agopian | cbb288b | 2009-09-07 16:32:45 -0700 | [diff] [blame] | 236 | uint32_t w = s.w; |
| 237 | uint32_t h = s.h; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 238 | tr.transform(mVertices[0], 0, 0); |
| 239 | tr.transform(mVertices[1], 0, h); |
| 240 | tr.transform(mVertices[2], w, h); |
| 241 | tr.transform(mVertices[3], w, 0); |
| 242 | if (UNLIKELY(transformed)) { |
| 243 | // NOTE: here we could also punt if we have too many rectangles |
| 244 | // in the transparent region |
| 245 | if (tr.preserveRects()) { |
| 246 | // transform the transparent region |
| 247 | transparentRegionScreen = tr.transform(s.transparentRegion); |
| 248 | } else { |
| 249 | // transformation too complex, can't do the transparent region |
| 250 | // optimization. |
| 251 | transparentRegionScreen.clear(); |
| 252 | } |
| 253 | } else { |
| 254 | transparentRegionScreen = s.transparentRegion; |
| 255 | } |
| 256 | |
| 257 | // cache a few things... |
| 258 | mOrientation = tr.getOrientation(); |
| 259 | mTransformedBounds = tr.makeBounds(w, h); |
| 260 | mTransformed = transformed; |
| 261 | mLeft = tr.tx(); |
| 262 | mTop = tr.ty(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | void LayerBase::lockPageFlip(bool& recomputeVisibleRegions) |
| 266 | { |
| 267 | } |
| 268 | |
| 269 | void LayerBase::unlockPageFlip( |
| 270 | const Transform& planeTransform, Region& outDirtyRegion) |
| 271 | { |
| 272 | if ((android_atomic_and(~1, &mInvalidate)&1) == 1) { |
| 273 | outDirtyRegion.orSelf(visibleRegionScreen); |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | void LayerBase::finishPageFlip() |
| 278 | { |
| 279 | } |
| 280 | |
| 281 | void LayerBase::invalidate() |
| 282 | { |
| 283 | if ((android_atomic_or(1, &mInvalidate)&1) == 0) { |
| 284 | mFlinger->signalEvent(); |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | void LayerBase::drawRegion(const Region& reg) const |
| 289 | { |
Mathias Agopian | 20f6878 | 2009-05-11 00:03:41 -0700 | [diff] [blame] | 290 | Region::const_iterator it = reg.begin(); |
| 291 | Region::const_iterator const end = reg.end(); |
| 292 | if (it != end) { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 293 | Rect r; |
| 294 | const DisplayHardware& hw(graphicPlane(0).displayHardware()); |
| 295 | const int32_t fbWidth = hw.getWidth(); |
| 296 | const int32_t fbHeight = hw.getHeight(); |
| 297 | const GLshort vertices[][2] = { { 0, 0 }, { fbWidth, 0 }, |
| 298 | { fbWidth, fbHeight }, { 0, fbHeight } }; |
| 299 | glVertexPointer(2, GL_SHORT, 0, vertices); |
Mathias Agopian | 20f6878 | 2009-05-11 00:03:41 -0700 | [diff] [blame] | 300 | while (it != end) { |
| 301 | const Rect& r = *it++; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 302 | const GLint sy = fbHeight - (r.top + r.height()); |
| 303 | glScissor(r.left, sy, r.width(), r.height()); |
| 304 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | void LayerBase::draw(const Region& inClip) const |
| 310 | { |
| 311 | // invalidate the region we'll update |
| 312 | Region clip(inClip); // copy-on-write, so no-op most of the time |
| 313 | |
| 314 | // Remove the transparent area from the clipping region |
| 315 | const State& s = drawingState(); |
| 316 | if (LIKELY(!s.transparentRegion.isEmpty())) { |
| 317 | clip.subtract(transparentRegionScreen); |
| 318 | if (clip.isEmpty()) { |
| 319 | // usually this won't happen because this should be taken care of |
| 320 | // by SurfaceFlinger::computeVisibleRegions() |
| 321 | return; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | // reset GL state |
| 326 | glEnable(GL_SCISSOR_TEST); |
| 327 | |
| 328 | onDraw(clip); |
| 329 | |
| 330 | /* |
| 331 | glDisable(GL_TEXTURE_2D); |
| 332 | glDisable(GL_DITHER); |
| 333 | glEnable(GL_BLEND); |
| 334 | glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
| 335 | glColor4x(0, 0x8000, 0, 0x10000); |
| 336 | drawRegion(transparentRegionScreen); |
| 337 | glDisable(GL_BLEND); |
| 338 | */ |
| 339 | } |
| 340 | |
| 341 | GLuint LayerBase::createTexture() const |
| 342 | { |
| 343 | GLuint textureName = -1; |
| 344 | glGenTextures(1, &textureName); |
| 345 | glBindTexture(GL_TEXTURE_2D, textureName); |
| 346 | glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 347 | glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
Mathias Agopian | a2fe0a2 | 2009-09-23 18:34:53 -0700 | [diff] [blame] | 348 | glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 349 | glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 350 | return textureName; |
| 351 | } |
| 352 | |
Rebecca Schultz Zavin | 29aa74c | 2009-09-01 23:06:45 -0700 | [diff] [blame] | 353 | void LayerBase::clearWithOpenGL(const Region& clip, GLclampx red, |
| 354 | GLclampx green, GLclampx blue, |
| 355 | GLclampx alpha) const |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 356 | { |
| 357 | const DisplayHardware& hw(graphicPlane(0).displayHardware()); |
| 358 | const uint32_t fbHeight = hw.getHeight(); |
Rebecca Schultz Zavin | 29aa74c | 2009-09-01 23:06:45 -0700 | [diff] [blame] | 359 | glColor4x(red,green,blue,alpha); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 360 | glDisable(GL_TEXTURE_2D); |
| 361 | glDisable(GL_BLEND); |
| 362 | glDisable(GL_DITHER); |
Mathias Agopian | 20f6878 | 2009-05-11 00:03:41 -0700 | [diff] [blame] | 363 | |
| 364 | Region::const_iterator it = clip.begin(); |
| 365 | Region::const_iterator const end = clip.end(); |
Mathias Agopian | 95a666b | 2009-09-24 14:57:26 -0700 | [diff] [blame^] | 366 | glEnable(GL_SCISSOR_TEST); |
| 367 | glVertexPointer(2, GL_FIXED, 0, mVertices); |
| 368 | while (it != end) { |
| 369 | const Rect& r = *it++; |
| 370 | const GLint sy = fbHeight - (r.top + r.height()); |
| 371 | glScissor(r.left, sy, r.width(), r.height()); |
| 372 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 373 | } |
| 374 | } |
| 375 | |
Rebecca Schultz Zavin | 29aa74c | 2009-09-01 23:06:45 -0700 | [diff] [blame] | 376 | void LayerBase::clearWithOpenGL(const Region& clip) const |
| 377 | { |
| 378 | clearWithOpenGL(clip,0,0,0,0); |
| 379 | } |
| 380 | |
Mathias Agopian | 1fed11c | 2009-06-23 18:08:22 -0700 | [diff] [blame] | 381 | void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 382 | { |
| 383 | const DisplayHardware& hw(graphicPlane(0).displayHardware()); |
| 384 | const uint32_t fbHeight = hw.getHeight(); |
| 385 | const State& s(drawingState()); |
Mathias Agopian | 0926f50 | 2009-05-04 14:17:04 -0700 | [diff] [blame] | 386 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 387 | // bind our texture |
Mathias Agopian | 1fed11c | 2009-06-23 18:08:22 -0700 | [diff] [blame] | 388 | validateTexture(texture.name); |
| 389 | uint32_t width = texture.width; |
| 390 | uint32_t height = texture.height; |
| 391 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 392 | glEnable(GL_TEXTURE_2D); |
| 393 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 394 | if (UNLIKELY(s.alpha < 0xFF)) { |
| 395 | // We have an alpha-modulation. We need to modulate all |
| 396 | // texture components by alpha because we're always using |
| 397 | // premultiplied alpha. |
| 398 | |
| 399 | // If the texture doesn't have an alpha channel we can |
| 400 | // use REPLACE and switch to non premultiplied alpha |
| 401 | // blending (SRCA/ONE_MINUS_SRCA). |
| 402 | |
| 403 | GLenum env, src; |
| 404 | if (needsBlending()) { |
| 405 | env = GL_MODULATE; |
| 406 | src = mPremultipliedAlpha ? GL_ONE : GL_SRC_ALPHA; |
| 407 | } else { |
| 408 | env = GL_REPLACE; |
| 409 | src = GL_SRC_ALPHA; |
| 410 | } |
| 411 | const GGLfixed alpha = (s.alpha << 16)/255; |
| 412 | glColor4x(alpha, alpha, alpha, alpha); |
| 413 | glEnable(GL_BLEND); |
| 414 | glBlendFunc(src, GL_ONE_MINUS_SRC_ALPHA); |
| 415 | glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, env); |
| 416 | } else { |
| 417 | glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
| 418 | glColor4x(0x10000, 0x10000, 0x10000, 0x10000); |
| 419 | if (needsBlending()) { |
| 420 | GLenum src = mPremultipliedAlpha ? GL_ONE : GL_SRC_ALPHA; |
| 421 | glEnable(GL_BLEND); |
| 422 | glBlendFunc(src, GL_ONE_MINUS_SRC_ALPHA); |
| 423 | } else { |
| 424 | glDisable(GL_BLEND); |
| 425 | } |
| 426 | } |
| 427 | |
Mathias Agopian | 95a666b | 2009-09-24 14:57:26 -0700 | [diff] [blame^] | 428 | Region::const_iterator it = clip.begin(); |
| 429 | Region::const_iterator const end = clip.end(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 430 | if (UNLIKELY(transformed() |
| 431 | || !(mFlags & DisplayHardware::DRAW_TEXTURE_EXTENSION) )) |
| 432 | { |
| 433 | //StopWatch watch("GL transformed"); |
Mathias Agopian | 95a666b | 2009-09-24 14:57:26 -0700 | [diff] [blame^] | 434 | const GLfixed texCoords[4][2] = { |
| 435 | { 0, 0 }, |
| 436 | { 0, 0x10000 }, |
| 437 | { 0x10000, 0x10000 }, |
| 438 | { 0x10000, 0 } |
| 439 | }; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 440 | |
Mathias Agopian | 95a666b | 2009-09-24 14:57:26 -0700 | [diff] [blame^] | 441 | glMatrixMode(GL_TEXTURE); |
| 442 | glLoadIdentity(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 443 | |
Mathias Agopian | 95a666b | 2009-09-24 14:57:26 -0700 | [diff] [blame^] | 444 | // the texture's source is rotated |
| 445 | if (texture.transform == HAL_TRANSFORM_ROT_90) { |
| 446 | // TODO: handle the other orientations |
| 447 | glTranslatef(0, 1, 0); |
| 448 | glRotatef(-90, 0, 0, 1); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 449 | } |
Mathias Agopian | 95a666b | 2009-09-24 14:57:26 -0700 | [diff] [blame^] | 450 | |
| 451 | if (!(mFlags & (DisplayHardware::NPOT_EXTENSION | |
| 452 | DisplayHardware::DIRECT_TEXTURE))) { |
| 453 | // find the smallest power-of-two that will accommodate our surface |
| 454 | GLuint tw = 1 << (31 - clz(width)); |
| 455 | GLuint th = 1 << (31 - clz(height)); |
| 456 | if (tw < width) tw <<= 1; |
| 457 | if (th < height) th <<= 1; |
| 458 | GLfloat ws = GLfloat(width) /tw; |
| 459 | GLfloat hs = GLfloat(height)/th; |
| 460 | glScalef(ws, hs, 1.0f); |
| 461 | } |
| 462 | |
| 463 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
| 464 | glVertexPointer(2, GL_FIXED, 0, mVertices); |
| 465 | glTexCoordPointer(2, GL_FIXED, 0, texCoords); |
| 466 | |
| 467 | while (it != end) { |
| 468 | const Rect& r = *it++; |
| 469 | const GLint sy = fbHeight - (r.top + r.height()); |
| 470 | glScissor(r.left, sy, r.width(), r.height()); |
| 471 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
| 472 | } |
| 473 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 474 | } else { |
Mathias Agopian | 95a666b | 2009-09-24 14:57:26 -0700 | [diff] [blame^] | 475 | GLint crop[4] = { 0, height, width, -height }; |
| 476 | glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop); |
| 477 | int x = tx(); |
| 478 | int y = ty(); |
| 479 | y = fbHeight - (y + height); |
| 480 | while (it != end) { |
| 481 | const Rect& r = *it++; |
| 482 | const GLint sy = fbHeight - (r.top + r.height()); |
| 483 | glScissor(r.left, sy, r.width(), r.height()); |
| 484 | glDrawTexiOES(x, y, 0, width, height); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 485 | } |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | void LayerBase::validateTexture(GLint textureName) const |
| 490 | { |
| 491 | glBindTexture(GL_TEXTURE_2D, textureName); |
| 492 | // TODO: reload the texture if needed |
| 493 | // this is currently done in loadTexture() below |
Mathias Agopian | a2fe0a2 | 2009-09-23 18:34:53 -0700 | [diff] [blame] | 494 | if (mUseLinearFiltering) { |
| 495 | glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 496 | glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 497 | } else { |
| 498 | glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 499 | glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 500 | } |
Mathias Agopian | 401c257 | 2009-09-23 19:16:27 -0700 | [diff] [blame] | 501 | |
| 502 | if (needsDithering()) { |
| 503 | glEnable(GL_DITHER); |
| 504 | } else { |
| 505 | glDisable(GL_DITHER); |
| 506 | } |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 507 | } |
| 508 | |
Mathias Agopian | 1fed11c | 2009-06-23 18:08:22 -0700 | [diff] [blame] | 509 | void LayerBase::loadTexture(Texture* texture, GLint textureName, |
| 510 | const Region& dirty, const GGLSurface& t) const |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 511 | { |
| 512 | // TODO: defer the actual texture reload until LayerBase::validateTexture |
| 513 | // is called. |
| 514 | |
Mathias Agopian | 1fed11c | 2009-06-23 18:08:22 -0700 | [diff] [blame] | 515 | texture->name = textureName; |
| 516 | GLuint& textureWidth(texture->width); |
| 517 | GLuint& textureHeight(texture->height); |
| 518 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 519 | uint32_t flags = mFlags; |
| 520 | glBindTexture(GL_TEXTURE_2D, textureName); |
| 521 | |
| 522 | GLuint tw = t.width; |
| 523 | GLuint th = t.height; |
| 524 | |
| 525 | /* |
| 526 | * In OpenGL ES we can't specify a stride with glTexImage2D (however, |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 527 | * GL_UNPACK_ALIGNMENT is a limited form of stride). |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 528 | * So if the stride here isn't representable with GL_UNPACK_ALIGNMENT, we |
| 529 | * need to do something reasonable (here creating a bigger texture). |
| 530 | * |
| 531 | * extra pixels = (((stride - width) * pixelsize) / GL_UNPACK_ALIGNMENT); |
| 532 | * |
| 533 | * This situation doesn't happen often, but some h/w have a limitation |
| 534 | * for their framebuffer (eg: must be multiple of 8 pixels), and |
| 535 | * we need to take that into account when using these buffers as |
| 536 | * textures. |
| 537 | * |
| 538 | * This should never be a problem with POT textures |
| 539 | */ |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 540 | |
| 541 | int unpack = __builtin_ctz(t.stride * bytesPerPixel(t.format)); |
| 542 | unpack = 1 << ((unpack > 3) ? 3 : unpack); |
| 543 | glPixelStorei(GL_UNPACK_ALIGNMENT, unpack); |
| 544 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 545 | /* |
| 546 | * round to POT if needed |
| 547 | */ |
| 548 | |
| 549 | GLuint texture_w = tw; |
| 550 | GLuint texture_h = th; |
| 551 | if (!(flags & DisplayHardware::NPOT_EXTENSION)) { |
| 552 | // find the smallest power-of-two that will accommodate our surface |
| 553 | texture_w = 1 << (31 - clz(t.width)); |
| 554 | texture_h = 1 << (31 - clz(t.height)); |
| 555 | if (texture_w < t.width) texture_w <<= 1; |
| 556 | if (texture_h < t.height) texture_h <<= 1; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 557 | } |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 558 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 559 | regular: |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 560 | Rect bounds(dirty.bounds()); |
| 561 | GLvoid* data = 0; |
| 562 | if (texture_w!=textureWidth || texture_h!=textureHeight) { |
| 563 | // texture size changed, we need to create a new one |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 564 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 565 | if (!textureWidth || !textureHeight) { |
| 566 | // this is the first time, load the whole texture |
| 567 | if (texture_w==tw && texture_h==th) { |
| 568 | // we can do it one pass |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 569 | data = t.data; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 570 | } else { |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 571 | // we have to create the texture first because it |
| 572 | // doesn't match the size of the buffer |
| 573 | bounds.set(Rect(tw, th)); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 574 | } |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 575 | } |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 576 | |
| 577 | if (t.format == GGL_PIXEL_FORMAT_RGB_565) { |
| 578 | glTexImage2D(GL_TEXTURE_2D, 0, |
| 579 | GL_RGB, texture_w, texture_h, 0, |
| 580 | GL_RGB, GL_UNSIGNED_SHORT_5_6_5, data); |
| 581 | } else if (t.format == GGL_PIXEL_FORMAT_RGBA_4444) { |
| 582 | glTexImage2D(GL_TEXTURE_2D, 0, |
| 583 | GL_RGBA, texture_w, texture_h, 0, |
| 584 | GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, data); |
Mathias Agopian | 816d7d0 | 2009-09-14 18:10:30 -0700 | [diff] [blame] | 585 | } else if (t.format == GGL_PIXEL_FORMAT_RGBA_8888 || |
| 586 | t.format == GGL_PIXEL_FORMAT_RGBX_8888) { |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 587 | glTexImage2D(GL_TEXTURE_2D, 0, |
| 588 | GL_RGBA, texture_w, texture_h, 0, |
| 589 | GL_RGBA, GL_UNSIGNED_BYTE, data); |
| 590 | } else if ( t.format == GGL_PIXEL_FORMAT_YCbCr_422_SP || |
| 591 | t.format == GGL_PIXEL_FORMAT_YCbCr_420_SP) { |
| 592 | // just show the Y plane of YUV buffers |
| 593 | glTexImage2D(GL_TEXTURE_2D, 0, |
| 594 | GL_LUMINANCE, texture_w, texture_h, 0, |
| 595 | GL_LUMINANCE, GL_UNSIGNED_BYTE, data); |
| 596 | } else { |
| 597 | // oops, we don't handle this format! |
| 598 | LOGE("layer %p, texture=%d, using format %d, which is not " |
| 599 | "supported by the GL", this, textureName, t.format); |
| 600 | textureName = -1; |
| 601 | } |
| 602 | textureWidth = texture_w; |
| 603 | textureHeight = texture_h; |
| 604 | } |
| 605 | if (!data && textureName>=0) { |
| 606 | if (t.format == GGL_PIXEL_FORMAT_RGB_565) { |
| 607 | glTexSubImage2D(GL_TEXTURE_2D, 0, |
| 608 | 0, bounds.top, t.width, bounds.height(), |
| 609 | GL_RGB, GL_UNSIGNED_SHORT_5_6_5, |
| 610 | t.data + bounds.top*t.stride*2); |
| 611 | } else if (t.format == GGL_PIXEL_FORMAT_RGBA_4444) { |
| 612 | glTexSubImage2D(GL_TEXTURE_2D, 0, |
| 613 | 0, bounds.top, t.width, bounds.height(), |
| 614 | GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, |
| 615 | t.data + bounds.top*t.stride*2); |
Mathias Agopian | 816d7d0 | 2009-09-14 18:10:30 -0700 | [diff] [blame] | 616 | } else if (t.format == GGL_PIXEL_FORMAT_RGBA_8888 || |
| 617 | t.format == GGL_PIXEL_FORMAT_RGBX_8888) { |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 618 | glTexSubImage2D(GL_TEXTURE_2D, 0, |
| 619 | 0, bounds.top, t.width, bounds.height(), |
| 620 | GL_RGBA, GL_UNSIGNED_BYTE, |
| 621 | t.data + bounds.top*t.stride*4); |
| 622 | } else if ( t.format == GGL_PIXEL_FORMAT_YCbCr_422_SP || |
| 623 | t.format == GGL_PIXEL_FORMAT_YCbCr_420_SP) { |
| 624 | // just show the Y plane of YUV buffers |
| 625 | glTexSubImage2D(GL_TEXTURE_2D, 0, |
| 626 | 0, bounds.top, t.width, bounds.height(), |
| 627 | GL_LUMINANCE, GL_UNSIGNED_BYTE, |
| 628 | t.data + bounds.top*t.stride); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 629 | } |
| 630 | } |
| 631 | } |
| 632 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 633 | // --------------------------------------------------------------------------- |
| 634 | |
Mathias Agopian | 2e12324 | 2009-06-23 20:06:46 -0700 | [diff] [blame] | 635 | int32_t LayerBaseClient::sIdentity = 0; |
| 636 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 637 | LayerBaseClient::LayerBaseClient(SurfaceFlinger* flinger, DisplayID display, |
Mathias Agopian | f9d9327 | 2009-06-19 17:00:27 -0700 | [diff] [blame] | 638 | const sp<Client>& client, int32_t i) |
Mathias Agopian | 48d819a | 2009-09-10 19:41:18 -0700 | [diff] [blame] | 639 | : LayerBase(flinger, display), lcblk(NULL), client(client), |
Mathias Agopian | cbb288b | 2009-09-07 16:32:45 -0700 | [diff] [blame] | 640 | mIndex(i), mIdentity(uint32_t(android_atomic_inc(&sIdentity))) |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 641 | { |
Mathias Agopian | 48d819a | 2009-09-10 19:41:18 -0700 | [diff] [blame] | 642 | lcblk = new SharedBufferServer( |
| 643 | client->ctrlblk, i, NUM_BUFFERS, |
| 644 | mIdentity); |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 645 | } |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 646 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 647 | void LayerBaseClient::onFirstRef() |
| 648 | { |
Mathias Agopian | f9d9327 | 2009-06-19 17:00:27 -0700 | [diff] [blame] | 649 | sp<Client> client(this->client.promote()); |
| 650 | if (client != 0) { |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 651 | client->bindLayer(this, mIndex); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 652 | } |
| 653 | } |
| 654 | |
| 655 | LayerBaseClient::~LayerBaseClient() |
| 656 | { |
Mathias Agopian | f9d9327 | 2009-06-19 17:00:27 -0700 | [diff] [blame] | 657 | sp<Client> client(this->client.promote()); |
| 658 | if (client != 0) { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 659 | client->free(mIndex); |
| 660 | } |
Mathias Agopian | 48d819a | 2009-09-10 19:41:18 -0700 | [diff] [blame] | 661 | delete lcblk; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 662 | } |
| 663 | |
Mathias Agopian | f9d9327 | 2009-06-19 17:00:27 -0700 | [diff] [blame] | 664 | int32_t LayerBaseClient::serverIndex() const |
| 665 | { |
| 666 | sp<Client> client(this->client.promote()); |
| 667 | if (client != 0) { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 668 | return (client->cid<<16)|mIndex; |
| 669 | } |
| 670 | return 0xFFFF0000 | mIndex; |
| 671 | } |
| 672 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 673 | sp<LayerBaseClient::Surface> LayerBaseClient::getSurface() |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 674 | { |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 675 | sp<Surface> s; |
| 676 | Mutex::Autolock _l(mLock); |
| 677 | s = mClientSurface.promote(); |
| 678 | if (s == 0) { |
| 679 | s = createSurface(); |
| 680 | mClientSurface = s; |
| 681 | } |
| 682 | return s; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 683 | } |
| 684 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 685 | sp<LayerBaseClient::Surface> LayerBaseClient::createSurface() const |
| 686 | { |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 687 | return new Surface(mFlinger, clientIndex(), mIdentity, |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 688 | const_cast<LayerBaseClient *>(this)); |
| 689 | } |
| 690 | |
| 691 | // --------------------------------------------------------------------------- |
| 692 | |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 693 | LayerBaseClient::Surface::Surface( |
| 694 | const sp<SurfaceFlinger>& flinger, |
| 695 | SurfaceID id, int identity, |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 696 | const sp<LayerBaseClient>& owner) |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 697 | : mFlinger(flinger), mToken(id), mIdentity(identity), mOwner(owner) |
| 698 | { |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 699 | } |
| 700 | |
| 701 | |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 702 | LayerBaseClient::Surface::~Surface() |
| 703 | { |
| 704 | /* |
| 705 | * This is a good place to clean-up all client resources |
| 706 | */ |
| 707 | |
| 708 | // destroy client resources |
| 709 | sp<LayerBaseClient> layer = getOwner(); |
| 710 | if (layer != 0) { |
| 711 | mFlinger->destroySurface(layer); |
| 712 | } |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 713 | } |
| 714 | |
| 715 | sp<LayerBaseClient> LayerBaseClient::Surface::getOwner() const { |
| 716 | sp<LayerBaseClient> owner(mOwner.promote()); |
| 717 | return owner; |
| 718 | } |
| 719 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 720 | status_t LayerBaseClient::Surface::onTransact( |
Mathias Agopian | 375f563 | 2009-06-15 18:24:59 -0700 | [diff] [blame] | 721 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 722 | { |
| 723 | switch (code) { |
| 724 | case REGISTER_BUFFERS: |
| 725 | case UNREGISTER_BUFFERS: |
| 726 | case CREATE_OVERLAY: |
| 727 | { |
Mathias Agopian | 375f563 | 2009-06-15 18:24:59 -0700 | [diff] [blame] | 728 | if (!mFlinger->mAccessSurfaceFlinger.checkCalling()) { |
| 729 | IPCThreadState* ipc = IPCThreadState::self(); |
| 730 | const int pid = ipc->getCallingPid(); |
| 731 | const int uid = ipc->getCallingUid(); |
| 732 | LOGE("Permission Denial: " |
| 733 | "can't access SurfaceFlinger pid=%d, uid=%d", pid, uid); |
| 734 | return PERMISSION_DENIED; |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 735 | } |
| 736 | } |
| 737 | } |
| 738 | return BnSurface::onTransact(code, data, reply, flags); |
| 739 | } |
| 740 | |
Mathias Agopian | cbb288b | 2009-09-07 16:32:45 -0700 | [diff] [blame] | 741 | sp<SurfaceBuffer> LayerBaseClient::Surface::requestBuffer(int index, int usage) |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 742 | { |
| 743 | return NULL; |
| 744 | } |
| 745 | |
| 746 | status_t LayerBaseClient::Surface::registerBuffers( |
| 747 | const ISurface::BufferHeap& buffers) |
| 748 | { |
| 749 | return INVALID_OPERATION; |
| 750 | } |
| 751 | |
| 752 | void LayerBaseClient::Surface::postBuffer(ssize_t offset) |
| 753 | { |
| 754 | } |
| 755 | |
| 756 | void LayerBaseClient::Surface::unregisterBuffers() |
| 757 | { |
| 758 | } |
| 759 | |
| 760 | sp<OverlayRef> LayerBaseClient::Surface::createOverlay( |
| 761 | uint32_t w, uint32_t h, int32_t format) |
| 762 | { |
| 763 | return NULL; |
| 764 | }; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 765 | |
| 766 | // --------------------------------------------------------------------------- |
| 767 | |
| 768 | }; // namespace android |