@@ -451,8 +451,10 @@ status_t BufferQueueProducer::dequeueBuffer(int* outSlot, sp<android::Fence>* ou
451451 }
452452
453453 status_t returnFlags = NO_ERROR;
454+ #if !COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_GL_FENCE_CLEANUP)
454455 EGLDisplay eglDisplay = EGL_NO_DISPLAY;
455456 EGLSyncKHR eglFence = EGL_NO_SYNC_KHR;
457+ #endif
456458 bool attachedByConsumer = false ;
457459
458460 sp<IConsumerListener> listener;
@@ -569,8 +571,10 @@ status_t BufferQueueProducer::dequeueBuffer(int* outSlot, sp<android::Fence>* ou
569571 mSlots [found].mAcquireCalled = false ;
570572 mSlots [found].mGraphicBuffer = nullptr ;
571573 mSlots [found].mRequestBufferCalled = false ;
574+ #if !COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_GL_FENCE_CLEANUP)
572575 mSlots [found].mEglDisplay = EGL_NO_DISPLAY;
573576 mSlots [found].mEglFence = EGL_NO_SYNC_KHR;
577+ #endif
574578 mSlots [found].mFence = Fence::NO_FENCE;
575579 mCore ->mBufferAge = 0 ;
576580 mCore ->mIsAllocating = true ;
@@ -595,14 +599,18 @@ status_t BufferQueueProducer::dequeueBuffer(int* outSlot, sp<android::Fence>* ou
595599 found, buffer->width , buffer->height , buffer->format );
596600 }
597601
602+ #if !COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_GL_FENCE_CLEANUP)
598603 eglDisplay = mSlots [found].mEglDisplay ;
599604 eglFence = mSlots [found].mEglFence ;
605+ #endif
600606 // Don't return a fence in shared buffer mode, except for the first
601607 // frame.
602608 *outFence = (mCore ->mSharedBufferMode &&
603609 mCore ->mSharedBufferSlot == found) ?
604610 Fence::NO_FENCE : mSlots [found].mFence ;
611+ #if !COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_GL_FENCE_CLEANUP)
605612 mSlots [found].mEglFence = EGL_NO_SYNC_KHR;
613+ #endif
606614 mSlots [found].mFence = Fence::NO_FENCE;
607615
608616 // If shared buffer mode has just been enabled, cache the slot of the
@@ -691,6 +699,7 @@ status_t BufferQueueProducer::dequeueBuffer(int* outSlot, sp<android::Fence>* ou
691699 returnFlags |= BUFFER_NEEDS_REALLOCATION;
692700 }
693701
702+ #if !COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_GL_FENCE_CLEANUP)
694703 if (eglFence != EGL_NO_SYNC_KHR) {
695704 EGLint result = eglClientWaitSyncKHR (eglDisplay, eglFence, 0 ,
696705 1000000000 );
@@ -705,6 +714,7 @@ status_t BufferQueueProducer::dequeueBuffer(int* outSlot, sp<android::Fence>* ou
705714 }
706715 eglDestroySyncKHR (eglDisplay, eglFence);
707716 }
717+ #endif
708718
709719 BQ_LOGV (" dequeueBuffer: returning slot=%d/%" PRIu64 " buf=%p flags=%#x" ,
710720 *outSlot,
@@ -908,7 +918,9 @@ status_t BufferQueueProducer::attachBuffer(int* outSlot,
908918
909919 mSlots [*outSlot].mGraphicBuffer = buffer;
910920 mSlots [*outSlot].mBufferState .attachProducer ();
921+ #if !COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_GL_FENCE_CLEANUP)
911922 mSlots [*outSlot].mEglFence = EGL_NO_SYNC_KHR;
923+ #endif
912924 mSlots [*outSlot].mFence = Fence::NO_FENCE;
913925 mSlots [*outSlot].mRequestBufferCalled = true ;
914926 mSlots [*outSlot].mAcquireCalled = false ;
0 commit comments