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