VirtualDisplaySurface.cpp revision d9822a3843017444364899afc3c23fb5be6b9cb9
1/* 2 * Copyright 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17// #define LOG_NDEBUG 0 18#include "VirtualDisplaySurface.h" 19#include "HWComposer.h" 20 21// --------------------------------------------------------------------------- 22namespace android { 23// --------------------------------------------------------------------------- 24 25#if defined(FORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS) 26static const bool sForceHwcCopy = true; 27#else 28static const bool sForceHwcCopy = false; 29#endif 30 31#define VDS_LOGE(msg, ...) ALOGE("[%s] "msg, \ 32 mDisplayName.string(), ##__VA_ARGS__) 33#define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] "msg, \ 34 mDisplayName.string(), ##__VA_ARGS__) 35#define VDS_LOGV(msg, ...) ALOGV("[%s] "msg, \ 36 mDisplayName.string(), ##__VA_ARGS__) 37 38static const char* dbgCompositionTypeStr(DisplaySurface::CompositionType type) { 39 switch (type) { 40 case DisplaySurface::COMPOSITION_UNKNOWN: return "UNKNOWN"; 41 case DisplaySurface::COMPOSITION_GLES: return "GLES"; 42 case DisplaySurface::COMPOSITION_HWC: return "HWC"; 43 case DisplaySurface::COMPOSITION_MIXED: return "MIXED"; 44 default: return "<INVALID>"; 45 } 46} 47 48VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc, int32_t dispId, 49 const sp<IGraphicBufferProducer>& sink, 50 const sp<IGraphicBufferProducer>& bqProducer, 51 const sp<IGraphicBufferConsumer>& bqConsumer, 52 const String8& name) 53: ConsumerBase(bqConsumer), 54 mHwc(hwc), 55 mDisplayId(dispId), 56 mDisplayName(name), 57 mOutputUsage(GRALLOC_USAGE_HW_COMPOSER), 58 mProducerSlotSource(0), 59 mDbgState(DBG_STATE_IDLE), 60 mDbgLastCompositionType(COMPOSITION_UNKNOWN), 61 mMustRecompose(false) 62{ 63 mSource[SOURCE_SINK] = sink; 64 mSource[SOURCE_SCRATCH] = bqProducer; 65 66 resetPerFrameState(); 67 68 int sinkWidth, sinkHeight; 69 sink->query(NATIVE_WINDOW_WIDTH, &sinkWidth); 70 sink->query(NATIVE_WINDOW_HEIGHT, &sinkHeight); 71 72 // Pick the buffer format to request from the sink when not rendering to it 73 // with GLES. If the consumer needs CPU access, use the default format 74 // set by the consumer. Otherwise allow gralloc to decide the format based 75 // on usage bits. 76 int sinkUsage; 77 sink->query(NATIVE_WINDOW_CONSUMER_USAGE_BITS, &sinkUsage); 78 if (sinkUsage & (GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK)) { 79 int sinkFormat; 80 sink->query(NATIVE_WINDOW_FORMAT, &sinkFormat); 81 mDefaultOutputFormat = sinkFormat; 82 } else { 83 mDefaultOutputFormat = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED; 84 } 85 mOutputFormat = mDefaultOutputFormat; 86 87 ConsumerBase::mName = String8::format("VDS: %s", mDisplayName.string()); 88 mConsumer->setConsumerName(ConsumerBase::mName); 89 mConsumer->setConsumerUsageBits(GRALLOC_USAGE_HW_COMPOSER); 90 mConsumer->setDefaultBufferSize(sinkWidth, sinkHeight); 91 mConsumer->setDefaultMaxBufferCount(2); 92} 93 94VirtualDisplaySurface::~VirtualDisplaySurface() { 95} 96 97status_t VirtualDisplaySurface::beginFrame(bool mustRecompose) { 98 if (mDisplayId < 0) 99 return NO_ERROR; 100 101 mMustRecompose = mustRecompose; 102 103 VDS_LOGW_IF(mDbgState != DBG_STATE_IDLE, 104 "Unexpected beginFrame() in %s state", dbgStateStr()); 105 mDbgState = DBG_STATE_BEGUN; 106 107 uint32_t transformHint, numPendingBuffers; 108 mQueueBufferOutput.deflate(&mSinkBufferWidth, &mSinkBufferHeight, 109 &transformHint, &numPendingBuffers); 110 111 return refreshOutputBuffer(); 112} 113 114status_t VirtualDisplaySurface::prepareFrame(CompositionType compositionType) { 115 if (mDisplayId < 0) 116 return NO_ERROR; 117 118 VDS_LOGW_IF(mDbgState != DBG_STATE_BEGUN, 119 "Unexpected prepareFrame() in %s state", dbgStateStr()); 120 mDbgState = DBG_STATE_PREPARED; 121 122 mCompositionType = compositionType; 123 if (sForceHwcCopy && mCompositionType == COMPOSITION_GLES) { 124 // Some hardware can do RGB->YUV conversion more efficiently in hardware 125 // controlled by HWC than in hardware controlled by the video encoder. 126 // Forcing GLES-composed frames to go through an extra copy by the HWC 127 // allows the format conversion to happen there, rather than passing RGB 128 // directly to the consumer. 129 // 130 // On the other hand, when the consumer prefers RGB or can consume RGB 131 // inexpensively, this forces an unnecessary copy. 132 mCompositionType = COMPOSITION_MIXED; 133 } 134 135 if (mCompositionType != mDbgLastCompositionType) { 136 VDS_LOGV("prepareFrame: composition type changed to %s", 137 dbgCompositionTypeStr(mCompositionType)); 138 mDbgLastCompositionType = mCompositionType; 139 } 140 141 if (mCompositionType != COMPOSITION_GLES && 142 (mOutputFormat != mDefaultOutputFormat || 143 mOutputUsage != GRALLOC_USAGE_HW_COMPOSER)) { 144 // We must have just switched from GLES-only to MIXED or HWC 145 // composition. Stop using the format and usage requested by the GLES 146 // driver; they may be suboptimal when HWC is writing to the output 147 // buffer. For example, if the output is going to a video encoder, and 148 // HWC can write directly to YUV, some hardware can skip a 149 // memory-to-memory RGB-to-YUV conversion step. 150 // 151 // If we just switched *to* GLES-only mode, we'll change the 152 // format/usage and get a new buffer when the GLES driver calls 153 // dequeueBuffer(). 154 mOutputFormat = mDefaultOutputFormat; 155 mOutputUsage = GRALLOC_USAGE_HW_COMPOSER; 156 refreshOutputBuffer(); 157 } 158 159 return NO_ERROR; 160} 161 162status_t VirtualDisplaySurface::compositionComplete() { 163 return NO_ERROR; 164} 165 166status_t VirtualDisplaySurface::advanceFrame() { 167 if (mDisplayId < 0) 168 return NO_ERROR; 169 170 if (mCompositionType == COMPOSITION_HWC) { 171 VDS_LOGW_IF(mDbgState != DBG_STATE_PREPARED, 172 "Unexpected advanceFrame() in %s state on HWC frame", 173 dbgStateStr()); 174 } else { 175 VDS_LOGW_IF(mDbgState != DBG_STATE_GLES_DONE, 176 "Unexpected advanceFrame() in %s state on GLES/MIXED frame", 177 dbgStateStr()); 178 } 179 mDbgState = DBG_STATE_HWC; 180 181 if (mOutputProducerSlot < 0 || 182 (mCompositionType != COMPOSITION_HWC && mFbProducerSlot < 0)) { 183 // Last chance bailout if something bad happened earlier. For example, 184 // in a GLES configuration, if the sink disappears then dequeueBuffer 185 // will fail, the GLES driver won't queue a buffer, but SurfaceFlinger 186 // will soldier on. So we end up here without a buffer. There should 187 // be lots of scary messages in the log just before this. 188 VDS_LOGE("advanceFrame: no buffer, bailing out"); 189 return NO_MEMORY; 190 } 191 192 sp<GraphicBuffer> fbBuffer = mFbProducerSlot >= 0 ? 193 mProducerBuffers[mFbProducerSlot] : sp<GraphicBuffer>(NULL); 194 sp<GraphicBuffer> outBuffer = mProducerBuffers[mOutputProducerSlot]; 195 VDS_LOGV("advanceFrame: fb=%d(%p) out=%d(%p)", 196 mFbProducerSlot, fbBuffer.get(), 197 mOutputProducerSlot, outBuffer.get()); 198 199 // At this point we know the output buffer acquire fence, 200 // so update HWC state with it. 201 mHwc.setOutputBuffer(mDisplayId, mOutputFence, outBuffer); 202 203 status_t result = NO_ERROR; 204 if (fbBuffer != NULL) { 205 result = mHwc.fbPost(mDisplayId, mFbFence, fbBuffer); 206 } 207 208 return result; 209} 210 211void VirtualDisplaySurface::onFrameCommitted() { 212 if (mDisplayId < 0) 213 return; 214 215 VDS_LOGW_IF(mDbgState != DBG_STATE_HWC, 216 "Unexpected onFrameCommitted() in %s state", dbgStateStr()); 217 mDbgState = DBG_STATE_IDLE; 218 219 sp<Fence> fbFence = mHwc.getAndResetReleaseFence(mDisplayId); 220 if (mCompositionType == COMPOSITION_MIXED && mFbProducerSlot >= 0) { 221 // release the scratch buffer back to the pool 222 Mutex::Autolock lock(mMutex); 223 int sslot = mapProducer2SourceSlot(SOURCE_SCRATCH, mFbProducerSlot); 224 VDS_LOGV("onFrameCommitted: release scratch sslot=%d", sslot); 225 addReleaseFenceLocked(sslot, mProducerBuffers[mFbProducerSlot], fbFence); 226 releaseBufferLocked(sslot, mProducerBuffers[mFbProducerSlot], 227 EGL_NO_DISPLAY, EGL_NO_SYNC_KHR); 228 } 229 230 if (mOutputProducerSlot >= 0) { 231 int sslot = mapProducer2SourceSlot(SOURCE_SINK, mOutputProducerSlot); 232 QueueBufferOutput qbo; 233 sp<Fence> outFence = mHwc.getLastRetireFence(mDisplayId); 234 VDS_LOGV("onFrameCommitted: queue sink sslot=%d", sslot); 235 if (mMustRecompose) { 236 status_t result = mSource[SOURCE_SINK]->queueBuffer(sslot, 237 QueueBufferInput( 238 systemTime(), false /* isAutoTimestamp */, 239 Rect(mSinkBufferWidth, mSinkBufferHeight), 240 NATIVE_WINDOW_SCALING_MODE_FREEZE, 0 /* transform */, 241 true /* async*/, 242 outFence), 243 &qbo); 244 if (result == NO_ERROR) { 245 updateQueueBufferOutput(qbo); 246 } 247 } else { 248 // If the surface hadn't actually been updated, then we only went 249 // through the motions of updating the display to keep our state 250 // machine happy. We cancel the buffer to avoid triggering another 251 // re-composition and causing an infinite loop. 252 mSource[SOURCE_SINK]->cancelBuffer(sslot, outFence); 253 } 254 } 255 256 resetPerFrameState(); 257} 258 259void VirtualDisplaySurface::dump(String8& result) const { 260} 261 262status_t VirtualDisplaySurface::requestBuffer(int pslot, 263 sp<GraphicBuffer>* outBuf) { 264 VDS_LOGW_IF(mDbgState != DBG_STATE_GLES, 265 "Unexpected requestBuffer pslot=%d in %s state", 266 pslot, dbgStateStr()); 267 268 *outBuf = mProducerBuffers[pslot]; 269 return NO_ERROR; 270} 271 272status_t VirtualDisplaySurface::setBufferCount(int bufferCount) { 273 return mSource[SOURCE_SINK]->setBufferCount(bufferCount); 274} 275 276status_t VirtualDisplaySurface::dequeueBuffer(Source source, 277 uint32_t format, uint32_t usage, int* sslot, sp<Fence>* fence) { 278 // Don't let a slow consumer block us 279 bool async = (source == SOURCE_SINK); 280 281 status_t result = mSource[source]->dequeueBuffer(sslot, fence, async, 282 mSinkBufferWidth, mSinkBufferHeight, format, usage); 283 if (result < 0) 284 return result; 285 int pslot = mapSource2ProducerSlot(source, *sslot); 286 VDS_LOGV("dequeueBuffer(%s): sslot=%d pslot=%d result=%d", 287 dbgSourceStr(source), *sslot, pslot, result); 288 uint32_t sourceBit = static_cast<uint32_t>(source) << pslot; 289 290 if ((mProducerSlotSource & (1u << pslot)) != sourceBit) { 291 // This slot was previously dequeued from the other source; must 292 // re-request the buffer. 293 result |= BUFFER_NEEDS_REALLOCATION; 294 mProducerSlotSource &= ~(1u << pslot); 295 mProducerSlotSource |= sourceBit; 296 } 297 298 if (result & RELEASE_ALL_BUFFERS) { 299 for (uint32_t i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { 300 if ((mProducerSlotSource & (1u << i)) == sourceBit) 301 mProducerBuffers[i].clear(); 302 } 303 } 304 if (result & BUFFER_NEEDS_REALLOCATION) { 305 mSource[source]->requestBuffer(*sslot, &mProducerBuffers[pslot]); 306 VDS_LOGV("dequeueBuffer(%s): buffers[%d]=%p fmt=%d usage=%#x", 307 dbgSourceStr(source), pslot, mProducerBuffers[pslot].get(), 308 mProducerBuffers[pslot]->getPixelFormat(), 309 mProducerBuffers[pslot]->getUsage()); 310 } 311 312 return result; 313} 314 315status_t VirtualDisplaySurface::dequeueBuffer(int* pslot, sp<Fence>* fence, bool async, 316 uint32_t w, uint32_t h, uint32_t format, uint32_t usage) { 317 VDS_LOGW_IF(mDbgState != DBG_STATE_PREPARED, 318 "Unexpected dequeueBuffer() in %s state", dbgStateStr()); 319 mDbgState = DBG_STATE_GLES; 320 321 VDS_LOGW_IF(!async, "EGL called dequeueBuffer with !async despite eglSwapInterval(0)"); 322 VDS_LOGV("dequeueBuffer %dx%d fmt=%d usage=%#x", w, h, format, usage); 323 324 status_t result = NO_ERROR; 325 Source source = fbSourceForCompositionType(mCompositionType); 326 327 if (source == SOURCE_SINK) { 328 329 if (mOutputProducerSlot < 0) { 330 // Last chance bailout if something bad happened earlier. For example, 331 // in a GLES configuration, if the sink disappears then dequeueBuffer 332 // will fail, the GLES driver won't queue a buffer, but SurfaceFlinger 333 // will soldier on. So we end up here without a buffer. There should 334 // be lots of scary messages in the log just before this. 335 VDS_LOGE("dequeueBuffer: no buffer, bailing out"); 336 return NO_MEMORY; 337 } 338 339 // We already dequeued the output buffer. If the GLES driver wants 340 // something incompatible, we have to cancel and get a new one. This 341 // will mean that HWC will see a different output buffer between 342 // prepare and set, but since we're in GLES-only mode already it 343 // shouldn't matter. 344 345 usage |= GRALLOC_USAGE_HW_COMPOSER; 346 const sp<GraphicBuffer>& buf = mProducerBuffers[mOutputProducerSlot]; 347 if ((usage & ~buf->getUsage()) != 0 || 348 (format != 0 && format != (uint32_t)buf->getPixelFormat()) || 349 (w != 0 && w != mSinkBufferWidth) || 350 (h != 0 && h != mSinkBufferHeight)) { 351 VDS_LOGV("dequeueBuffer: dequeueing new output buffer: " 352 "want %dx%d fmt=%d use=%#x, " 353 "have %dx%d fmt=%d use=%#x", 354 w, h, format, usage, 355 mSinkBufferWidth, mSinkBufferHeight, 356 buf->getPixelFormat(), buf->getUsage()); 357 mOutputFormat = format; 358 mOutputUsage = usage; 359 result = refreshOutputBuffer(); 360 if (result < 0) 361 return result; 362 } 363 } 364 365 if (source == SOURCE_SINK) { 366 *pslot = mOutputProducerSlot; 367 *fence = mOutputFence; 368 } else { 369 int sslot; 370 result = dequeueBuffer(source, format, usage, &sslot, fence); 371 if (result >= 0) { 372 *pslot = mapSource2ProducerSlot(source, sslot); 373 } 374 } 375 return result; 376} 377 378status_t VirtualDisplaySurface::detachBuffer(int /* slot */) { 379 VDS_LOGE("detachBuffer is not available for VirtualDisplaySurface"); 380 return INVALID_OPERATION; 381} 382 383status_t VirtualDisplaySurface::detachNextBuffer( 384 sp<GraphicBuffer>* /* outBuffer */, sp<Fence>* /* outFence */) { 385 VDS_LOGE("detachNextBuffer is not available for VirtualDisplaySurface"); 386 return INVALID_OPERATION; 387} 388 389status_t VirtualDisplaySurface::attachBuffer(int* /* outSlot */, 390 const sp<GraphicBuffer>& /* buffer */) { 391 VDS_LOGE("attachBuffer is not available for VirtualDisplaySurface"); 392 return INVALID_OPERATION; 393} 394 395status_t VirtualDisplaySurface::queueBuffer(int pslot, 396 const QueueBufferInput& input, QueueBufferOutput* output) { 397 VDS_LOGW_IF(mDbgState != DBG_STATE_GLES, 398 "Unexpected queueBuffer(pslot=%d) in %s state", pslot, 399 dbgStateStr()); 400 mDbgState = DBG_STATE_GLES_DONE; 401 402 VDS_LOGV("queueBuffer pslot=%d", pslot); 403 404 status_t result; 405 if (mCompositionType == COMPOSITION_MIXED) { 406 // Queue the buffer back into the scratch pool 407 QueueBufferOutput scratchQBO; 408 int sslot = mapProducer2SourceSlot(SOURCE_SCRATCH, pslot); 409 result = mSource[SOURCE_SCRATCH]->queueBuffer(sslot, input, &scratchQBO); 410 if (result != NO_ERROR) 411 return result; 412 413 // Now acquire the buffer from the scratch pool -- should be the same 414 // slot and fence as we just queued. 415 Mutex::Autolock lock(mMutex); 416 BufferQueue::BufferItem item; 417 result = acquireBufferLocked(&item, 0); 418 if (result != NO_ERROR) 419 return result; 420 VDS_LOGW_IF(item.mBuf != sslot, 421 "queueBuffer: acquired sslot %d from SCRATCH after queueing sslot %d", 422 item.mBuf, sslot); 423 mFbProducerSlot = mapSource2ProducerSlot(SOURCE_SCRATCH, item.mBuf); 424 mFbFence = mSlots[item.mBuf].mFence; 425 426 } else { 427 LOG_FATAL_IF(mCompositionType != COMPOSITION_GLES, 428 "Unexpected queueBuffer in state %s for compositionType %s", 429 dbgStateStr(), dbgCompositionTypeStr(mCompositionType)); 430 431 // Extract the GLES release fence for HWC to acquire 432 int64_t timestamp; 433 bool isAutoTimestamp; 434 Rect crop; 435 int scalingMode; 436 uint32_t transform; 437 bool async; 438 input.deflate(×tamp, &isAutoTimestamp, &crop, &scalingMode, 439 &transform, &async, &mFbFence); 440 441 mFbProducerSlot = pslot; 442 mOutputFence = mFbFence; 443 } 444 445 *output = mQueueBufferOutput; 446 return NO_ERROR; 447} 448 449void VirtualDisplaySurface::cancelBuffer(int pslot, const sp<Fence>& fence) { 450 VDS_LOGW_IF(mDbgState != DBG_STATE_GLES, 451 "Unexpected cancelBuffer(pslot=%d) in %s state", pslot, 452 dbgStateStr()); 453 VDS_LOGV("cancelBuffer pslot=%d", pslot); 454 Source source = fbSourceForCompositionType(mCompositionType); 455 return mSource[source]->cancelBuffer( 456 mapProducer2SourceSlot(source, pslot), fence); 457} 458 459int VirtualDisplaySurface::query(int what, int* value) { 460 return mSource[SOURCE_SINK]->query(what, value); 461} 462 463status_t VirtualDisplaySurface::connect(const sp<IProducerListener>& listener, 464 int api, bool producerControlledByApp, 465 QueueBufferOutput* output) { 466 QueueBufferOutput qbo; 467 status_t result = mSource[SOURCE_SINK]->connect(listener, api, 468 producerControlledByApp, &qbo); 469 if (result == NO_ERROR) { 470 updateQueueBufferOutput(qbo); 471 *output = mQueueBufferOutput; 472 } 473 return result; 474} 475 476status_t VirtualDisplaySurface::disconnect(int api) { 477 return mSource[SOURCE_SINK]->disconnect(api); 478} 479 480status_t VirtualDisplaySurface::setSidebandStream(const sp<NativeHandle>& /*stream*/) { 481 return INVALID_OPERATION; 482} 483 484void VirtualDisplaySurface::updateQueueBufferOutput( 485 const QueueBufferOutput& qbo) { 486 uint32_t w, h, transformHint, numPendingBuffers; 487 qbo.deflate(&w, &h, &transformHint, &numPendingBuffers); 488 mQueueBufferOutput.inflate(w, h, 0, numPendingBuffers); 489} 490 491void VirtualDisplaySurface::resetPerFrameState() { 492 mCompositionType = COMPOSITION_UNKNOWN; 493 mSinkBufferWidth = 0; 494 mSinkBufferHeight = 0; 495 mFbFence = Fence::NO_FENCE; 496 mOutputFence = Fence::NO_FENCE; 497 mOutputProducerSlot = -1; 498 mFbProducerSlot = -1; 499} 500 501status_t VirtualDisplaySurface::refreshOutputBuffer() { 502 if (mOutputProducerSlot >= 0) { 503 mSource[SOURCE_SINK]->cancelBuffer( 504 mapProducer2SourceSlot(SOURCE_SINK, mOutputProducerSlot), 505 mOutputFence); 506 } 507 508 int sslot; 509 status_t result = dequeueBuffer(SOURCE_SINK, mOutputFormat, mOutputUsage, 510 &sslot, &mOutputFence); 511 if (result < 0) 512 return result; 513 mOutputProducerSlot = mapSource2ProducerSlot(SOURCE_SINK, sslot); 514 515 // On GLES-only frames, we don't have the right output buffer acquire fence 516 // until after GLES calls queueBuffer(). So here we just set the buffer 517 // (for use in HWC prepare) but not the fence; we'll call this again with 518 // the proper fence once we have it. 519 result = mHwc.setOutputBuffer(mDisplayId, Fence::NO_FENCE, 520 mProducerBuffers[mOutputProducerSlot]); 521 522 return result; 523} 524 525// This slot mapping function is its own inverse, so two copies are unnecessary. 526// Both are kept to make the intent clear where the function is called, and for 527// the (unlikely) chance that we switch to a different mapping function. 528int VirtualDisplaySurface::mapSource2ProducerSlot(Source source, int sslot) { 529 if (source == SOURCE_SCRATCH) { 530 return BufferQueue::NUM_BUFFER_SLOTS - sslot - 1; 531 } else { 532 return sslot; 533 } 534} 535int VirtualDisplaySurface::mapProducer2SourceSlot(Source source, int pslot) { 536 return mapSource2ProducerSlot(source, pslot); 537} 538 539VirtualDisplaySurface::Source 540VirtualDisplaySurface::fbSourceForCompositionType(CompositionType type) { 541 return type == COMPOSITION_MIXED ? SOURCE_SCRATCH : SOURCE_SINK; 542} 543 544const char* VirtualDisplaySurface::dbgStateStr() const { 545 switch (mDbgState) { 546 case DBG_STATE_IDLE: return "IDLE"; 547 case DBG_STATE_PREPARED: return "PREPARED"; 548 case DBG_STATE_GLES: return "GLES"; 549 case DBG_STATE_GLES_DONE: return "GLES_DONE"; 550 case DBG_STATE_HWC: return "HWC"; 551 default: return "INVALID"; 552 } 553} 554 555const char* VirtualDisplaySurface::dbgSourceStr(Source s) { 556 switch (s) { 557 case SOURCE_SINK: return "SINK"; 558 case SOURCE_SCRATCH: return "SCRATCH"; 559 default: return "INVALID"; 560 } 561} 562 563// --------------------------------------------------------------------------- 564} // namespace android 565// --------------------------------------------------------------------------- 566