Bug 944069 - Remove unnecessary wait during GPU Composition. r=dwilson

This commit is contained in:
Sushil Chauhan 2013-11-27 17:38:42 -08:00
parent 860875d55a
commit 1a7cdfe805
2 changed files with 16 additions and 8 deletions

View File

@ -63,6 +63,7 @@ HwcComposer2D::HwcComposer2D()
, mHwc(nullptr)
, mColorFill(false)
, mRBSwapSupport(false)
, mPrevRetireFence(-1)
{
}
@ -492,7 +493,6 @@ HwcComposer2D::TryHwComposition()
// No composition on FB layer, so closing releaseFenceFd
close(mList->hwLayers[idx].releaseFenceFd);
mList->hwLayers[idx].releaseFenceFd = -1;
mList->numHwLayers = 0;
return true;
}
@ -573,31 +573,38 @@ HwcComposer2D::Commit()
int err = mHwc->set(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
// To avoid tearing, workaround for missing releaseFenceFd
// waits in Gecko layers, see Bug 925444.
if (!mPrevReleaseFds.IsEmpty()) {
// Wait for previous retire Fence to signal.
// Denotes contents on display have been replaced.
// For buffer-sync, framework should not over-write
// prev buffers until we close prev releaseFenceFds
sp<Fence> fence = new Fence(mPrevReleaseFds[0]);
sp<Fence> fence = new Fence(mPrevRetireFence);
if (fence->wait(1000) == -ETIME) {
LOGE("Wait timed-out for retireFenceFd %d", mPrevReleaseFds[0]);
LOGE("Wait timed-out for retireFenceFd %d", mPrevRetireFence);
}
for (int i = 0; i < mPrevReleaseFds.Length(); i++) {
close(mPrevReleaseFds[i]);
}
close(mPrevRetireFence);
mPrevReleaseFds.Clear();
}
mPrevReleaseFds.AppendElement(mList->retireFenceFd);
for (uint32_t j=0; j < (mList->numHwLayers - 1); j++) {
if (mList->hwLayers[j].compositionType == HWC_OVERLAY) {
if (mList->hwLayers[j].releaseFenceFd >= 0) {
mPrevReleaseFds.AppendElement(mList->hwLayers[j].releaseFenceFd);
mList->hwLayers[j].releaseFenceFd = -1;
}
}
mList->retireFenceFd = -1;
if (mList->retireFenceFd >= 0) {
if (!mPrevReleaseFds.IsEmpty()) {
mPrevRetireFence = mList->retireFenceFd;
} else { // GPU Composition
close(mList->retireFenceFd);
}
}
return !err;
}
#else

View File

@ -82,6 +82,7 @@ private:
//to render the current frame
std::list<RectVector> mVisibleRegions;
nsTArray<int> mPrevReleaseFds;
int mPrevRetireFence;
nsTArray<layers::LayerComposite*> mHwcLayerMap;
};