Layer.cpp revision cbb1a95819ec302ae15e4a1162a8b1349ae5c33e
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 ATRACE_TAG ATRACE_TAG_GRAPHICS 18 19#include <stdlib.h> 20#include <stdint.h> 21#include <sys/types.h> 22#include <math.h> 23 24#include <cutils/compiler.h> 25#include <cutils/native_handle.h> 26#include <cutils/properties.h> 27 28#include <utils/Errors.h> 29#include <utils/Log.h> 30#include <utils/StopWatch.h> 31#include <utils/Trace.h> 32 33#include <ui/GraphicBuffer.h> 34#include <ui/PixelFormat.h> 35 36#include <gui/Surface.h> 37 38#include "clz.h" 39#include "DisplayHardware/DisplayHardware.h" 40#include "DisplayHardware/HWComposer.h" 41#include "GLExtensions.h" 42#include "Layer.h" 43#include "SurfaceFlinger.h" 44#include "SurfaceTextureLayer.h" 45 46#define DEBUG_RESIZE 0 47 48namespace android { 49 50// --------------------------------------------------------------------------- 51 52Layer::Layer(SurfaceFlinger* flinger, 53 DisplayID display, const sp<Client>& client) 54 : LayerBaseClient(flinger, display, client), 55 mTextureName(-1U), 56 mQueuedFrames(0), 57 mCurrentTransform(0), 58 mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), 59 mCurrentOpacity(true), 60 mRefreshPending(false), 61 mFrameLatencyNeeded(false), 62 mFrameLatencyOffset(0), 63 mFormat(PIXEL_FORMAT_NONE), 64 mGLExtensions(GLExtensions::getInstance()), 65 mOpaqueLayer(true), 66 mNeedsDithering(false), 67 mSecure(false), 68 mProtectedByApp(false) 69{ 70 mCurrentCrop.makeInvalid(); 71 glGenTextures(1, &mTextureName); 72} 73 74void Layer::onLayerDisplayed() { 75 if (mFrameLatencyNeeded) { 76 const DisplayHardware& hw(graphicPlane(0).displayHardware()); 77 mFrameStats[mFrameLatencyOffset].timestamp = mSurfaceTexture->getTimestamp(); 78 mFrameStats[mFrameLatencyOffset].set = systemTime(); 79 mFrameStats[mFrameLatencyOffset].vsync = hw.getRefreshTimestamp(); 80 mFrameLatencyOffset = (mFrameLatencyOffset + 1) % 128; 81 mFrameLatencyNeeded = false; 82 } 83} 84 85void Layer::onFirstRef() 86{ 87 LayerBaseClient::onFirstRef(); 88 89 struct FrameQueuedListener : public SurfaceTexture::FrameAvailableListener { 90 FrameQueuedListener(Layer* layer) : mLayer(layer) { } 91 private: 92 wp<Layer> mLayer; 93 virtual void onFrameAvailable() { 94 sp<Layer> that(mLayer.promote()); 95 if (that != 0) { 96 that->onFrameQueued(); 97 } 98 } 99 }; 100 101 // Creates a custom BufferQueue for SurfaceTexture to use 102 sp<BufferQueue> bq = new SurfaceTextureLayer(); 103 mSurfaceTexture = new SurfaceTexture(mTextureName, true, 104 GL_TEXTURE_EXTERNAL_OES, false, bq); 105 106 mSurfaceTexture->setConsumerUsageBits(getEffectiveUsage(0)); 107 mSurfaceTexture->setFrameAvailableListener(new FrameQueuedListener(this)); 108 mSurfaceTexture->setSynchronousMode(true); 109 110#ifdef TARGET_DISABLE_TRIPLE_BUFFERING 111#warning "disabling triple buffering" 112 mSurfaceTexture->setBufferCountServer(2); 113#else 114 mSurfaceTexture->setBufferCountServer(3); 115#endif 116} 117 118Layer::~Layer() 119{ 120 mFlinger->postMessageAsync( 121 new SurfaceFlinger::MessageDestroyGLTexture(mTextureName) ); 122} 123 124void Layer::onFrameQueued() { 125 android_atomic_inc(&mQueuedFrames); 126 mFlinger->signalLayerUpdate(); 127} 128 129// called with SurfaceFlinger::mStateLock as soon as the layer is entered 130// in the purgatory list 131void Layer::onRemoved() 132{ 133 mSurfaceTexture->abandon(); 134} 135 136void Layer::setName(const String8& name) { 137 LayerBase::setName(name); 138 mSurfaceTexture->setName(name); 139} 140 141void Layer::validateVisibility(const Transform& globalTransform) { 142 LayerBase::validateVisibility(globalTransform); 143 144 // This optimization allows the SurfaceTexture to bake in 145 // the rotation so hardware overlays can be used 146 mSurfaceTexture->setTransformHint(getTransformHint()); 147} 148 149sp<ISurface> Layer::createSurface() 150{ 151 class BSurface : public BnSurface, public LayerCleaner { 152 wp<const Layer> mOwner; 153 virtual sp<ISurfaceTexture> getSurfaceTexture() const { 154 sp<ISurfaceTexture> res; 155 sp<const Layer> that( mOwner.promote() ); 156 if (that != NULL) { 157 res = that->mSurfaceTexture->getBufferQueue(); 158 } 159 return res; 160 } 161 public: 162 BSurface(const sp<SurfaceFlinger>& flinger, 163 const sp<Layer>& layer) 164 : LayerCleaner(flinger, layer), mOwner(layer) { } 165 }; 166 sp<ISurface> sur(new BSurface(mFlinger, this)); 167 return sur; 168} 169 170wp<IBinder> Layer::getSurfaceTextureBinder() const 171{ 172 return mSurfaceTexture->getBufferQueue()->asBinder(); 173} 174 175status_t Layer::setBuffers( uint32_t w, uint32_t h, 176 PixelFormat format, uint32_t flags) 177{ 178 // this surfaces pixel format 179 PixelFormatInfo info; 180 status_t err = getPixelFormatInfo(format, &info); 181 if (err) { 182 ALOGE("unsupported pixelformat %d", format); 183 return err; 184 } 185 186 // the display's pixel format 187 const DisplayHardware& hw(graphicPlane(0).displayHardware()); 188 uint32_t const maxSurfaceDims = min( 189 hw.getMaxTextureSize(), hw.getMaxViewportDims()); 190 191 // never allow a surface larger than what our underlying GL implementation 192 // can handle. 193 if ((uint32_t(w)>maxSurfaceDims) || (uint32_t(h)>maxSurfaceDims)) { 194 ALOGE("dimensions too large %u x %u", uint32_t(w), uint32_t(h)); 195 return BAD_VALUE; 196 } 197 198 PixelFormatInfo displayInfo; 199 getPixelFormatInfo(hw.getFormat(), &displayInfo); 200 const uint32_t hwFlags = hw.getFlags(); 201 202 mFormat = format; 203 204 mSecure = (flags & ISurfaceComposer::eSecure) ? true : false; 205 mProtectedByApp = (flags & ISurfaceComposer::eProtectedByApp) ? true : false; 206 mOpaqueLayer = (flags & ISurfaceComposer::eOpaque); 207 mCurrentOpacity = getOpacityForFormat(format); 208 209 mSurfaceTexture->setDefaultBufferSize(w, h); 210 mSurfaceTexture->setDefaultBufferFormat(format); 211 mSurfaceTexture->setConsumerUsageBits(getEffectiveUsage(0)); 212 213 // we use the red index 214 int displayRedSize = displayInfo.getSize(PixelFormatInfo::INDEX_RED); 215 int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED); 216 mNeedsDithering = layerRedsize > displayRedSize; 217 218 return NO_ERROR; 219} 220 221void Layer::setGeometry(hwc_layer_t* hwcl) 222{ 223 LayerBaseClient::setGeometry(hwcl); 224 225 hwcl->flags &= ~HWC_SKIP_LAYER; 226 227 // we can't do alpha-fade with the hwc HAL 228 const State& s(drawingState()); 229 if (s.alpha < 0xFF) { 230 hwcl->flags = HWC_SKIP_LAYER; 231 } 232 233 /* 234 * Transformations are applied in this order: 235 * 1) buffer orientation/flip/mirror 236 * 2) state transformation (window manager) 237 * 3) layer orientation (screen orientation) 238 * mTransform is already the composition of (2) and (3) 239 * (NOTE: the matrices are multiplied in reverse order) 240 */ 241 242 const Transform bufferOrientation(mCurrentTransform); 243 const Transform tr(mTransform * bufferOrientation); 244 245 // this gives us only the "orientation" component of the transform 246 const uint32_t finalTransform = tr.getOrientation(); 247 248 // we can only handle simple transformation 249 if (finalTransform & Transform::ROT_INVALID) { 250 hwcl->flags = HWC_SKIP_LAYER; 251 } else { 252 hwcl->transform = finalTransform; 253 } 254 255 if (isCropped()) { 256 hwcl->sourceCrop.left = mCurrentCrop.left; 257 hwcl->sourceCrop.top = mCurrentCrop.top; 258 hwcl->sourceCrop.right = mCurrentCrop.right; 259 hwcl->sourceCrop.bottom = mCurrentCrop.bottom; 260 } else { 261 const sp<GraphicBuffer>& buffer(mActiveBuffer); 262 hwcl->sourceCrop.left = 0; 263 hwcl->sourceCrop.top = 0; 264 if (buffer != NULL) { 265 hwcl->sourceCrop.right = buffer->width; 266 hwcl->sourceCrop.bottom = buffer->height; 267 } else { 268 hwcl->sourceCrop.right = mTransformedBounds.width(); 269 hwcl->sourceCrop.bottom = mTransformedBounds.height(); 270 } 271 } 272} 273 274void Layer::setPerFrameData(hwc_layer_t* hwcl) { 275 const sp<GraphicBuffer>& buffer(mActiveBuffer); 276 if (buffer == NULL) { 277 // this can happen if the client never drew into this layer yet, 278 // or if we ran out of memory. In that case, don't let 279 // HWC handle it. 280 hwcl->flags |= HWC_SKIP_LAYER; 281 hwcl->handle = NULL; 282 } else { 283 hwcl->handle = buffer->handle; 284 } 285} 286 287void Layer::onDraw(const Region& clip) const 288{ 289 ATRACE_CALL(); 290 291 if (CC_UNLIKELY(mActiveBuffer == 0)) { 292 // the texture has not been created yet, this Layer has 293 // in fact never been drawn into. This happens frequently with 294 // SurfaceView because the WindowManager can't know when the client 295 // has drawn the first time. 296 297 // If there is nothing under us, we paint the screen in black, otherwise 298 // we just skip this update. 299 300 // figure out if there is something below us 301 Region under; 302 const SurfaceFlinger::LayerVector& drawingLayers( 303 mFlinger->mDrawingState.layersSortedByZ); 304 const size_t count = drawingLayers.size(); 305 for (size_t i=0 ; i<count ; ++i) { 306 const sp<LayerBase>& layer(drawingLayers[i]); 307 if (layer.get() == static_cast<LayerBase const*>(this)) 308 break; 309 under.orSelf(layer->visibleRegionScreen); 310 } 311 // if not everything below us is covered, we plug the holes! 312 Region holes(clip.subtract(under)); 313 if (!holes.isEmpty()) { 314 clearWithOpenGL(holes, 0, 0, 0, 1); 315 } 316 return; 317 } 318 319 if (!isProtected()) { 320 // TODO: we could be more subtle with isFixedSize() 321 const bool useFiltering = getFiltering() || needsFiltering() || isFixedSize(); 322 323 // Query the texture matrix given our current filtering mode. 324 float textureMatrix[16]; 325 mSurfaceTexture->setFilteringEnabled(useFiltering); 326 mSurfaceTexture->getTransformMatrix(textureMatrix); 327 328 // Set things up for texturing. 329 glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureName); 330 GLenum filter = GL_NEAREST; 331 if (useFiltering) { 332 filter = GL_LINEAR; 333 } 334 glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, filter); 335 glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, filter); 336 glMatrixMode(GL_TEXTURE); 337 glLoadMatrixf(textureMatrix); 338 glMatrixMode(GL_MODELVIEW); 339 glDisable(GL_TEXTURE_2D); 340 glEnable(GL_TEXTURE_EXTERNAL_OES); 341 } else { 342 glBindTexture(GL_TEXTURE_2D, mFlinger->getProtectedTexName()); 343 glMatrixMode(GL_TEXTURE); 344 glLoadIdentity(); 345 glMatrixMode(GL_MODELVIEW); 346 glDisable(GL_TEXTURE_EXTERNAL_OES); 347 glEnable(GL_TEXTURE_2D); 348 } 349 350 drawWithOpenGL(clip); 351 352 glDisable(GL_TEXTURE_EXTERNAL_OES); 353 glDisable(GL_TEXTURE_2D); 354} 355 356// As documented in libhardware header, formats in the range 357// 0x100 - 0x1FF are specific to the HAL implementation, and 358// are known to have no alpha channel 359// TODO: move definition for device-specific range into 360// hardware.h, instead of using hard-coded values here. 361#define HARDWARE_IS_DEVICE_FORMAT(f) ((f) >= 0x100 && (f) <= 0x1FF) 362 363bool Layer::getOpacityForFormat(uint32_t format) 364{ 365 if (HARDWARE_IS_DEVICE_FORMAT(format)) { 366 return true; 367 } 368 PixelFormatInfo info; 369 status_t err = getPixelFormatInfo(PixelFormat(format), &info); 370 // in case of error (unknown format), we assume no blending 371 return (err || info.h_alpha <= info.l_alpha); 372} 373 374 375bool Layer::isOpaque() const 376{ 377 // if we don't have a buffer yet, we're translucent regardless of the 378 // layer's opaque flag. 379 if (mActiveBuffer == 0) { 380 return false; 381 } 382 383 // if the layer has the opaque flag, then we're always opaque, 384 // otherwise we use the current buffer's format. 385 return mOpaqueLayer || mCurrentOpacity; 386} 387 388bool Layer::isProtected() const 389{ 390 const sp<GraphicBuffer>& activeBuffer(mActiveBuffer); 391 return (activeBuffer != 0) && 392 (activeBuffer->getUsage() & GRALLOC_USAGE_PROTECTED); 393} 394 395uint32_t Layer::doTransaction(uint32_t flags) 396{ 397 ATRACE_CALL(); 398 399 const Layer::State& front(drawingState()); 400 const Layer::State& temp(currentState()); 401 402 const bool sizeChanged = (front.requested_w != temp.requested_w) || 403 (front.requested_h != temp.requested_h); 404 405 if (sizeChanged) { 406 // the size changed, we need to ask our client to request a new buffer 407 ALOGD_IF(DEBUG_RESIZE, 408 "doTransaction: " 409 "resize (layer=%p), requested (%dx%d), drawing (%d,%d), " 410 "scalingMode=%d", 411 this, 412 int(temp.requested_w), int(temp.requested_h), 413 int(front.requested_w), int(front.requested_h), 414 mCurrentScalingMode); 415 416 if (!isFixedSize()) { 417 // this will make sure LayerBase::doTransaction doesn't update 418 // the drawing state's size 419 Layer::State& editDraw(mDrawingState); 420 editDraw.requested_w = temp.requested_w; 421 editDraw.requested_h = temp.requested_h; 422 } 423 424 // record the new size, form this point on, when the client request 425 // a buffer, it'll get the new size. 426 mSurfaceTexture->setDefaultBufferSize(temp.requested_w, 427 temp.requested_h); 428 } 429 430 return LayerBase::doTransaction(flags); 431} 432 433bool Layer::isFixedSize() const { 434 return mCurrentScalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE; 435} 436 437bool Layer::isCropped() const { 438 return !mCurrentCrop.isEmpty(); 439} 440 441// ---------------------------------------------------------------------------- 442// pageflip handling... 443// ---------------------------------------------------------------------------- 444 445bool Layer::onPreComposition() { 446 mRefreshPending = false; 447 return mQueuedFrames > 0; 448} 449 450void Layer::lockPageFlip(bool& recomputeVisibleRegions) 451{ 452 ATRACE_CALL(); 453 454 if (mQueuedFrames > 0) { 455 456 // if we've already called updateTexImage() without going through 457 // a composition step, we have to skip this layer at this point 458 // because we cannot call updateTeximage() without a corresponding 459 // compositionComplete() call. 460 // we'll trigger an update in onPreComposition(). 461 if (mRefreshPending) { 462 mPostedDirtyRegion.clear(); 463 return; 464 } 465 mRefreshPending = true; 466 467 // Capture the old state of the layer for comparisons later 468 const bool oldOpacity = isOpaque(); 469 sp<GraphicBuffer> oldActiveBuffer = mActiveBuffer; 470 471 // signal another event if we have more frames pending 472 if (android_atomic_dec(&mQueuedFrames) > 1) { 473 mFlinger->signalLayerUpdate(); 474 } 475 476 if (mSurfaceTexture->updateTexImage() < NO_ERROR) { 477 // something happened! 478 recomputeVisibleRegions = true; 479 return; 480 } 481 482 // update the active buffer 483 mActiveBuffer = mSurfaceTexture->getCurrentBuffer(); 484 mFrameLatencyNeeded = true; 485 486 if (oldActiveBuffer == NULL && mActiveBuffer != NULL) { 487 // the first time we receive a buffer, we need to trigger a 488 // geometry invalidation. 489 mFlinger->invalidateHwcGeometry(); 490 } 491 492 const Rect crop(mSurfaceTexture->getCurrentCrop()); 493 const uint32_t transform(mSurfaceTexture->getCurrentTransform()); 494 const uint32_t scalingMode(mSurfaceTexture->getCurrentScalingMode()); 495 if ((crop != mCurrentCrop) || 496 (transform != mCurrentTransform) || 497 (scalingMode != mCurrentScalingMode)) 498 { 499 mCurrentCrop = crop; 500 mCurrentTransform = transform; 501 mCurrentScalingMode = scalingMode; 502 mFlinger->invalidateHwcGeometry(); 503 } 504 505 uint32_t bufWidth = mActiveBuffer->getWidth(); 506 uint32_t bufHeight = mActiveBuffer->getHeight(); 507 if (oldActiveBuffer != NULL) { 508 if (bufWidth != uint32_t(oldActiveBuffer->width) || 509 bufHeight != uint32_t(oldActiveBuffer->height)) { 510 mFlinger->invalidateHwcGeometry(); 511 } 512 } 513 514 mCurrentOpacity = getOpacityForFormat(mActiveBuffer->format); 515 if (oldOpacity != isOpaque()) { 516 recomputeVisibleRegions = true; 517 } 518 519 glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 520 glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 521 522 // update the layer size if needed 523 const Layer::State& front(drawingState()); 524 525 // FIXME: mPostedDirtyRegion = dirty & bounds 526 mPostedDirtyRegion.set(front.w, front.h); 527 528 if ((front.w != front.requested_w) || 529 (front.h != front.requested_h)) 530 { 531 // check that we received a buffer of the right size 532 // (Take the buffer's orientation into account) 533 if (mCurrentTransform & Transform::ROT_90) { 534 swap(bufWidth, bufHeight); 535 } 536 537 if (isFixedSize() || 538 (bufWidth == front.requested_w && 539 bufHeight == front.requested_h)) 540 { 541 // Here we pretend the transaction happened by updating the 542 // current and drawing states. Drawing state is only accessed 543 // in this thread, no need to have it locked 544 Layer::State& editDraw(mDrawingState); 545 editDraw.w = editDraw.requested_w; 546 editDraw.h = editDraw.requested_h; 547 548 // We also need to update the current state so that we don't 549 // end-up doing too much work during the next transaction. 550 // NOTE: We actually don't need hold the transaction lock here 551 // because State::w and State::h are only accessed from 552 // this thread 553 Layer::State& editTemp(currentState()); 554 editTemp.w = editDraw.w; 555 editTemp.h = editDraw.h; 556 557 // recompute visible region 558 recomputeVisibleRegions = true; 559 } 560 561 ALOGD_IF(DEBUG_RESIZE, 562 "lockPageFlip : " 563 " (layer=%p), buffer (%ux%u, tr=%02x), " 564 "requested (%dx%d)", 565 this, 566 bufWidth, bufHeight, mCurrentTransform, 567 front.requested_w, front.requested_h); 568 } 569 } 570} 571 572void Layer::unlockPageFlip( 573 const Transform& planeTransform, Region& outDirtyRegion) 574{ 575 ATRACE_CALL(); 576 577 Region postedRegion(mPostedDirtyRegion); 578 if (!postedRegion.isEmpty()) { 579 mPostedDirtyRegion.clear(); 580 if (!visibleRegionScreen.isEmpty()) { 581 // The dirty region is given in the layer's coordinate space 582 // transform the dirty region by the surface's transformation 583 // and the global transformation. 584 const Layer::State& s(drawingState()); 585 const Transform tr(planeTransform * s.transform); 586 postedRegion = tr.transform(postedRegion); 587 588 // At this point, the dirty region is in screen space. 589 // Make sure it's constrained by the visible region (which 590 // is in screen space as well). 591 postedRegion.andSelf(visibleRegionScreen); 592 outDirtyRegion.orSelf(postedRegion); 593 } 594 } 595} 596 597void Layer::dump(String8& result, char* buffer, size_t SIZE) const 598{ 599 LayerBaseClient::dump(result, buffer, SIZE); 600 601 sp<const GraphicBuffer> buf0(mActiveBuffer); 602 uint32_t w0=0, h0=0, s0=0, f0=0; 603 if (buf0 != 0) { 604 w0 = buf0->getWidth(); 605 h0 = buf0->getHeight(); 606 s0 = buf0->getStride(); 607 f0 = buf0->format; 608 } 609 snprintf(buffer, SIZE, 610 " " 611 "format=%2d, activeBuffer=[%4ux%4u:%4u,%3X]," 612 " transform-hint=0x%02x, queued-frames=%d, mRefreshPending=%d\n", 613 mFormat, w0, h0, s0,f0, 614 getTransformHint(), mQueuedFrames, mRefreshPending); 615 616 result.append(buffer); 617 618 if (mSurfaceTexture != 0) { 619 mSurfaceTexture->dump(result, " ", buffer, SIZE); 620 } 621} 622 623void Layer::dumpStats(String8& result, char* buffer, size_t SIZE) const 624{ 625 LayerBaseClient::dumpStats(result, buffer, SIZE); 626 const size_t o = mFrameLatencyOffset; 627 const DisplayHardware& hw(graphicPlane(0).displayHardware()); 628 const nsecs_t period = hw.getRefreshPeriod(); 629 result.appendFormat("%lld\n", period); 630 for (size_t i=0 ; i<128 ; i++) { 631 const size_t index = (o+i) % 128; 632 const nsecs_t time_app = mFrameStats[index].timestamp; 633 const nsecs_t time_set = mFrameStats[index].set; 634 const nsecs_t time_vsync = mFrameStats[index].vsync; 635 result.appendFormat("%lld\t%lld\t%lld\n", 636 time_app, 637 time_vsync, 638 time_set); 639 } 640 result.append("\n"); 641} 642 643void Layer::clearStats() 644{ 645 LayerBaseClient::clearStats(); 646 memset(mFrameStats, 0, sizeof(mFrameStats)); 647} 648 649uint32_t Layer::getEffectiveUsage(uint32_t usage) const 650{ 651 // TODO: should we do something special if mSecure is set? 652 if (mProtectedByApp) { 653 // need a hardware-protected path to external video sink 654 usage |= GraphicBuffer::USAGE_PROTECTED; 655 } 656 usage |= GraphicBuffer::USAGE_HW_COMPOSER; 657 return usage; 658} 659 660uint32_t Layer::getTransformHint() const { 661 uint32_t orientation = 0; 662 if (!mFlinger->mDebugDisableTransformHint) { 663 orientation = getPlaneOrientation(); 664 if (orientation & Transform::ROT_INVALID) { 665 orientation = 0; 666 } 667 } 668 return orientation; 669} 670 671// --------------------------------------------------------------------------- 672 673 674}; // namespace android 675