зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1155498 - Part 3 - Use new FenceHandle to handle the fence in Compositor. r=sotaro
--HG-- extra : rebase_source : cca9aa2fbb07f2c00741fb33ce33d7e2db1ba0f2
This commit is contained in:
Родитель
aac29696f5
Коммит
cdc345235c
|
@ -1297,11 +1297,8 @@ CompositorOGL::SetDispAcquireFence(Layer* aLayer)
|
|||
return;
|
||||
}
|
||||
|
||||
android::sp<android::Fence> fence = new android::Fence(GetGonkDisplay()->GetPrevDispAcquireFd());
|
||||
if (fence.get() && fence->isValid()) {
|
||||
FenceHandle handle = FenceHandle(fence);
|
||||
mReleaseFenceHandle.Merge(handle);
|
||||
}
|
||||
RefPtr<FenceHandle::FdObj> fence = new FenceHandle::FdObj(GetGonkDisplay()->GetPrevDispAcquireFd());
|
||||
mReleaseFenceHandle.Merge(FenceHandle(fence));
|
||||
}
|
||||
|
||||
FenceHandle
|
||||
|
@ -1310,7 +1307,9 @@ CompositorOGL::GetReleaseFence()
|
|||
if (!mReleaseFenceHandle.IsValid()) {
|
||||
return FenceHandle();
|
||||
}
|
||||
return FenceHandle(new android::Fence(mReleaseFenceHandle.mFence->dup()));
|
||||
|
||||
nsRefPtr<FenceHandle::FdObj> fdObj = mReleaseFenceHandle.GetDupFdObj();
|
||||
return FenceHandle(fdObj);
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
#include "nsThreadUtils.h" // for nsRunnable
|
||||
#include "nsXULAppAPI.h" // for XRE_GetProcessType
|
||||
#include "nscore.h" // for NS_IMETHOD
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include <ui/GraphicBuffer.h>
|
||||
#endif
|
||||
#include "gfxVR.h"
|
||||
|
||||
class nsIWidget;
|
||||
|
|
|
@ -117,10 +117,6 @@ HwcComposer2D::HwcComposer2D()
|
|||
, mMaxLayerCount(0)
|
||||
, mColorFill(false)
|
||||
, mRBSwapSupport(false)
|
||||
#if ANDROID_VERSION >= 17
|
||||
, mPrevRetireFence(Fence::NO_FENCE)
|
||||
, mPrevDisplayFence(Fence::NO_FENCE)
|
||||
#endif
|
||||
, mPrepared(false)
|
||||
, mHasHWVsync(false)
|
||||
, mLock("mozilla.HwcComposer2D.mLock")
|
||||
|
@ -857,22 +853,23 @@ HwcComposer2D::Commit()
|
|||
if (!texture) {
|
||||
continue;
|
||||
}
|
||||
sp<Fence> fence = texture->GetAndResetAcquireFence();
|
||||
if (fence.get() && fence->isValid()) {
|
||||
mList->hwLayers[j].acquireFenceFd = fence->dup();
|
||||
FenceHandle fence = texture->GetAndResetAcquireFence();
|
||||
if (fence.IsValid()) {
|
||||
nsRefPtr<FenceHandle::FdObj> fdObj = fence.GetAndResetFdObj();
|
||||
mList->hwLayers[j].acquireFenceFd = fdObj->GetAndResetFd();
|
||||
}
|
||||
}
|
||||
|
||||
int err = mHwc->set(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
|
||||
|
||||
mPrevDisplayFence = mPrevRetireFence;
|
||||
mPrevRetireFence = Fence::NO_FENCE;
|
||||
mPrevRetireFence.TransferToAnotherFenceHandle(mPrevDisplayFence);
|
||||
|
||||
for (uint32_t j=0; j < (mList->numHwLayers - 1); j++) {
|
||||
if (mList->hwLayers[j].releaseFenceFd >= 0) {
|
||||
int fd = mList->hwLayers[j].releaseFenceFd;
|
||||
mList->hwLayers[j].releaseFenceFd = -1;
|
||||
sp<Fence> fence = new Fence(fd);
|
||||
nsRefPtr<FenceHandle::FdObj> fdObj = new FenceHandle::FdObj(fd);
|
||||
FenceHandle fence(fdObj);
|
||||
|
||||
LayerRenderState state = mHwcLayerMap[j]->GetLayer()->GetRenderState();
|
||||
if (!state.mTexture) {
|
||||
|
@ -883,11 +880,11 @@ HwcComposer2D::Commit()
|
|||
continue;
|
||||
}
|
||||
texture->SetReleaseFence(fence);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mList->retireFenceFd >= 0) {
|
||||
mPrevRetireFence = new Fence(mList->retireFenceFd);
|
||||
mPrevRetireFence = FenceHandle(new FenceHandle::FdObj(mList->retireFenceFd));
|
||||
}
|
||||
|
||||
mPrepared = false;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "Composer2D.h"
|
||||
#include "Layers.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/layers/FenceUtils.h" // for FenceHandle
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
@ -124,10 +125,8 @@ private:
|
|||
//Holds all the dynamically allocated RectVectors needed
|
||||
//to render the current frame
|
||||
std::list<RectVector> mVisibleRegions;
|
||||
#if ANDROID_VERSION >= 17
|
||||
android::sp<android::Fence> mPrevRetireFence;
|
||||
android::sp<android::Fence> mPrevDisplayFence;
|
||||
#endif
|
||||
layers::FenceHandle mPrevRetireFence;
|
||||
layers::FenceHandle mPrevDisplayFence;
|
||||
nsTArray<layers::LayerComposite*> mHwcLayerMap;
|
||||
bool mPrepared;
|
||||
bool mHasHWVsync;
|
||||
|
|
Загрузка…
Ссылка в новой задаче