@@ -42,13 +42,14 @@ static const char* dbgCompositionTypeStr(compositionengine::DisplaySurface::Comp
4242 switch (type) {
4343 case compositionengine::DisplaySurface::COMPOSITION_UNKNOWN:
4444 return " UNKNOWN" ;
45- case compositionengine::DisplaySurface::COMPOSITION_GLES :
46- return " GLES " ;
45+ case compositionengine::DisplaySurface::COMPOSITION_GPU :
46+ return " GPU " ;
4747 case compositionengine::DisplaySurface::COMPOSITION_HWC:
4848 return " HWC" ;
4949 case compositionengine::DisplaySurface::COMPOSITION_MIXED:
5050 return " MIXED" ;
51- default : return " <INVALID>" ;
51+ default :
52+ return " <INVALID>" ;
5253 }
5354}
5455
@@ -92,7 +93,7 @@ VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc,
9293 mSinkBufferHeight = sinkHeight;
9394
9495 // Pick the buffer format to request from the sink when not rendering to it
95- // with GLES . If the consumer needs CPU access, use the default format
96+ // with GPU . If the consumer needs CPU access, use the default format
9697 // set by the consumer. Otherwise allow gralloc to decide the format based
9798 // on usage bits.
9899 int sinkUsage;
@@ -143,10 +144,10 @@ status_t VirtualDisplaySurface::prepareFrame(CompositionType compositionType) {
143144 mDbgState = DBG_STATE_PREPARED;
144145
145146 mCompositionType = compositionType;
146- if (mForceHwcCopy && mCompositionType == COMPOSITION_GLES ) {
147+ if (mForceHwcCopy && mCompositionType == COMPOSITION_GPU ) {
147148 // Some hardware can do RGB->YUV conversion more efficiently in hardware
148149 // controlled by HWC than in hardware controlled by the video encoder.
149- // Forcing GLES -composed frames to go through an extra copy by the HWC
150+ // Forcing GPU -composed frames to go through an extra copy by the HWC
150151 // allows the format conversion to happen there, rather than passing RGB
151152 // directly to the consumer.
152153 //
@@ -161,18 +162,17 @@ status_t VirtualDisplaySurface::prepareFrame(CompositionType compositionType) {
161162 mDbgLastCompositionType = mCompositionType ;
162163 }
163164
164- if (mCompositionType != COMPOSITION_GLES &&
165- (mOutputFormat != mDefaultOutputFormat ||
166- mOutputUsage != GRALLOC_USAGE_HW_COMPOSER)) {
167- // We must have just switched from GLES-only to MIXED or HWC
168- // composition. Stop using the format and usage requested by the GLES
165+ if (mCompositionType != COMPOSITION_GPU &&
166+ (mOutputFormat != mDefaultOutputFormat || mOutputUsage != GRALLOC_USAGE_HW_COMPOSER)) {
167+ // We must have just switched from GPU-only to MIXED or HWC
168+ // composition. Stop using the format and usage requested by the GPU
169169 // driver; they may be suboptimal when HWC is writing to the output
170170 // buffer. For example, if the output is going to a video encoder, and
171171 // HWC can write directly to YUV, some hardware can skip a
172172 // memory-to-memory RGB-to-YUV conversion step.
173173 //
174- // If we just switched *to* GLES -only mode, we'll change the
175- // format/usage and get a new buffer when the GLES driver calls
174+ // If we just switched *to* GPU -only mode, we'll change the
175+ // format/usage and get a new buffer when the GPU driver calls
176176 // dequeueBuffer().
177177 mOutputFormat = mDefaultOutputFormat ;
178178 mOutputUsage = GRALLOC_USAGE_HW_COMPOSER;
@@ -192,17 +192,16 @@ status_t VirtualDisplaySurface::advanceFrame() {
192192 " Unexpected advanceFrame() in %s state on HWC frame" ,
193193 dbgStateStr ());
194194 } else {
195- VDS_LOGW_IF (mDbgState != DBG_STATE_GLES_DONE,
196- " Unexpected advanceFrame() in %s state on GLES/MIXED frame" ,
197- dbgStateStr ());
195+ VDS_LOGW_IF (mDbgState != DBG_STATE_GPU_DONE,
196+ " Unexpected advanceFrame() in %s state on GPU/MIXED frame" , dbgStateStr ());
198197 }
199198 mDbgState = DBG_STATE_HWC;
200199
201200 if (mOutputProducerSlot < 0 ||
202201 (mCompositionType != COMPOSITION_HWC && mFbProducerSlot < 0 )) {
203202 // Last chance bailout if something bad happened earlier. For example,
204- // in a GLES configuration, if the sink disappears then dequeueBuffer
205- // will fail, the GLES driver won't queue a buffer, but SurfaceFlinger
203+ // in a graphics API configuration, if the sink disappears then dequeueBuffer
204+ // will fail, the GPU driver won't queue a buffer, but SurfaceFlinger
206205 // will soldier on. So we end up here without a buffer. There should
207206 // be lots of scary messages in the log just before this.
208207 VDS_LOGE (" advanceFrame: no buffer, bailing out" );
@@ -302,9 +301,8 @@ status_t VirtualDisplaySurface::requestBuffer(int pslot,
302301 return mSource [SOURCE_SINK]->requestBuffer (pslot, outBuf);
303302 }
304303
305- VDS_LOGW_IF (mDbgState != DBG_STATE_GLES,
306- " Unexpected requestBuffer pslot=%d in %s state" ,
307- pslot, dbgStateStr ());
304+ VDS_LOGW_IF (mDbgState != DBG_STATE_GPU, " Unexpected requestBuffer pslot=%d in %s state" , pslot,
305+ dbgStateStr ());
308306
309307 *outBuf = mProducerBuffers [pslot];
310308 return NO_ERROR;
@@ -374,7 +372,7 @@ status_t VirtualDisplaySurface::dequeueBuffer(int* pslot, sp<Fence>* fence, uint
374372
375373 VDS_LOGW_IF (mDbgState != DBG_STATE_PREPARED,
376374 " Unexpected dequeueBuffer() in %s state" , dbgStateStr ());
377- mDbgState = DBG_STATE_GLES ;
375+ mDbgState = DBG_STATE_GPU ;
378376
379377 VDS_LOGV (" dequeueBuffer %dx%d fmt=%d usage=%#" PRIx64, w, h, format, usage);
380378
@@ -385,18 +383,18 @@ status_t VirtualDisplaySurface::dequeueBuffer(int* pslot, sp<Fence>* fence, uint
385383
386384 if (mOutputProducerSlot < 0 ) {
387385 // Last chance bailout if something bad happened earlier. For example,
388- // in a GLES configuration, if the sink disappears then dequeueBuffer
389- // will fail, the GLES driver won't queue a buffer, but SurfaceFlinger
386+ // in a graphics API configuration, if the sink disappears then dequeueBuffer
387+ // will fail, the GPU driver won't queue a buffer, but SurfaceFlinger
390388 // will soldier on. So we end up here without a buffer. There should
391389 // be lots of scary messages in the log just before this.
392390 VDS_LOGE (" dequeueBuffer: no buffer, bailing out" );
393391 return NO_MEMORY;
394392 }
395393
396- // We already dequeued the output buffer. If the GLES driver wants
394+ // We already dequeued the output buffer. If the GPU driver wants
397395 // something incompatible, we have to cancel and get a new one. This
398396 // will mean that HWC will see a different output buffer between
399- // prepare and set, but since we're in GLES -only mode already it
397+ // prepare and set, but since we're in GPU -only mode already it
400398 // shouldn't matter.
401399
402400 usage |= GRALLOC_USAGE_HW_COMPOSER;
@@ -458,10 +456,9 @@ status_t VirtualDisplaySurface::queueBuffer(int pslot,
458456 return mSource [SOURCE_SINK]->queueBuffer (pslot, input, output);
459457 }
460458
461- VDS_LOGW_IF (mDbgState != DBG_STATE_GLES,
462- " Unexpected queueBuffer(pslot=%d) in %s state" , pslot,
463- dbgStateStr ());
464- mDbgState = DBG_STATE_GLES_DONE;
459+ VDS_LOGW_IF (mDbgState != DBG_STATE_GPU, " Unexpected queueBuffer(pslot=%d) in %s state" , pslot,
460+ dbgStateStr ());
461+ mDbgState = DBG_STATE_GPU_DONE;
465462
466463 VDS_LOGV (" queueBuffer pslot=%d" , pslot);
467464
@@ -488,11 +485,11 @@ status_t VirtualDisplaySurface::queueBuffer(int pslot,
488485 mFbFence = mSlots [item.mSlot ].mFence ;
489486
490487 } else {
491- LOG_FATAL_IF (mCompositionType != COMPOSITION_GLES ,
492- " Unexpected queueBuffer in state %s for compositionType %s" ,
493- dbgStateStr (), dbgCompositionTypeStr (mCompositionType ));
488+ LOG_FATAL_IF (mCompositionType != COMPOSITION_GPU ,
489+ " Unexpected queueBuffer in state %s for compositionType %s" , dbgStateStr () ,
490+ dbgCompositionTypeStr (mCompositionType ));
494491
495- // Extract the GLES release fence for HWC to acquire
492+ // Extract the GPU release fence for HWC to acquire
496493 int64_t timestamp;
497494 bool isAutoTimestamp;
498495 android_dataspace dataSpace;
@@ -517,9 +514,8 @@ status_t VirtualDisplaySurface::cancelBuffer(int pslot,
517514 return mSource [SOURCE_SINK]->cancelBuffer (mapProducer2SourceSlot (SOURCE_SINK, pslot), fence);
518515 }
519516
520- VDS_LOGW_IF (mDbgState != DBG_STATE_GLES,
521- " Unexpected cancelBuffer(pslot=%d) in %s state" , pslot,
522- dbgStateStr ());
517+ VDS_LOGW_IF (mDbgState != DBG_STATE_GPU, " Unexpected cancelBuffer(pslot=%d) in %s state" , pslot,
518+ dbgStateStr ());
523519 VDS_LOGV (" cancelBuffer pslot=%d" , pslot);
524520 Source source = fbSourceForCompositionType (mCompositionType );
525521 return mSource [source]->cancelBuffer (
@@ -641,8 +637,8 @@ status_t VirtualDisplaySurface::refreshOutputBuffer() {
641637 return result;
642638 mOutputProducerSlot = mapSource2ProducerSlot (SOURCE_SINK, sslot);
643639
644- // On GLES -only frames, we don't have the right output buffer acquire fence
645- // until after GLES calls queueBuffer(). So here we just set the buffer
640+ // On GPU -only frames, we don't have the right output buffer acquire fence
641+ // until after GPU calls queueBuffer(). So here we just set the buffer
646642 // (for use in HWC prepare) but not the fence; we'll call this again with
647643 // the proper fence once we have it.
648644 result = mHwc .setOutputBuffer (*mDisplayId , Fence::NO_FENCE,
@@ -672,12 +668,18 @@ VirtualDisplaySurface::fbSourceForCompositionType(CompositionType type) {
672668
673669const char * VirtualDisplaySurface::dbgStateStr () const {
674670 switch (mDbgState ) {
675- case DBG_STATE_IDLE: return " IDLE" ;
676- case DBG_STATE_PREPARED: return " PREPARED" ;
677- case DBG_STATE_GLES: return " GLES" ;
678- case DBG_STATE_GLES_DONE: return " GLES_DONE" ;
679- case DBG_STATE_HWC: return " HWC" ;
680- default : return " INVALID" ;
671+ case DBG_STATE_IDLE:
672+ return " IDLE" ;
673+ case DBG_STATE_PREPARED:
674+ return " PREPARED" ;
675+ case DBG_STATE_GPU:
676+ return " GPU" ;
677+ case DBG_STATE_GPU_DONE:
678+ return " GPU_DONE" ;
679+ case DBG_STATE_HWC:
680+ return " HWC" ;
681+ default :
682+ return " INVALID" ;
681683 }
682684}
683685
0 commit comments