void Layer::setAcquireFence(const sp<const DisplayDevice>& hw, HWComposer::HWCLayerInterface& layer) { int fenceFd = -1; // TODO: there is a possible optimization here: we only need to set the // acquire fence the first time a new buffer is acquired on EACH display. #ifdef QCOM_HARDWARE if (layer.getCompositionType() == HWC_OVERLAY || layer.getCompositionType() == HWC_BLIT) { #else if (layer.getCompositionType() == HWC_OVERLAY) { #endif sp<Fence> fence = mSurfaceFlingerConsumer->getCurrentFence(); if (fence->isValid()) { fenceFd = fence->dup(); if (fenceFd == -1) { ALOGW("failed to dup layer fence, skipping sync: %d", errno); } } } layer.setAcquireFenceFd(fenceFd); } // --------------------------------------------------------------------------- // drawing... // --------------------------------------------------------------------------- void Layer::draw(const sp<const DisplayDevice>& hw, const Region& clip) const { onDraw(hw, clip); }
void Layer::setAcquireFence(const sp<const DisplayDevice>& hw, HWComposer::HWCLayerInterface& layer) { int fenceFd = -1; // TODO: there is a possible optimization here: we only need to set the // acquire fence the first time a new buffer is acquired on EACH display. if (layer.getCompositionType() == HWC_OVERLAY) { sp<Fence> fence = mSurfaceTexture->getCurrentFence(); if (fence.get()) { fenceFd = fence->dup(); if (fenceFd == -1) { ALOGW("failed to dup layer fence, skipping sync: %d", errno); } } } layer.setAcquireFenceFd(fenceFd); }