Bug 1155495 - Part 1: Remove TextureHostOGL and integrate the platform specific API into TextureHost. r=nical, r=sotaro
This commit is contained in:
@@ -110,77 +110,6 @@ FlagsToGLFlags(TextureFlags aFlags)
|
||||
return static_cast<gl::TextureImage::Flags>(result);
|
||||
}
|
||||
|
||||
bool
|
||||
TextureHostOGL::SetReleaseFence(const FenceHandle& aReleaseFence)
|
||||
{
|
||||
if (!aReleaseFence.IsValid()) {
|
||||
// HWC might not provide Fence.
|
||||
// In this case, HWC implicitly handles buffer's fence.
|
||||
return false;
|
||||
}
|
||||
|
||||
mReleaseFence.Merge(aReleaseFence);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FenceHandle
|
||||
TextureHostOGL::GetAndResetReleaseFence()
|
||||
{
|
||||
FenceHandle fence;
|
||||
mReleaseFence.TransferToAnotherFenceHandle(fence);
|
||||
return fence;
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostOGL::SetAcquireFence(const FenceHandle& aAcquireFence)
|
||||
{
|
||||
mAcquireFence = aAcquireFence;
|
||||
}
|
||||
|
||||
FenceHandle
|
||||
TextureHostOGL::GetAndResetAcquireFence()
|
||||
{
|
||||
nsRefPtr<FenceHandle::FdObj> fdObj = mAcquireFence.GetAndResetFdObj();
|
||||
return FenceHandle(fdObj);
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostOGL::WaitAcquireFenceSyncComplete()
|
||||
{
|
||||
if (!mAcquireFence.IsValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<FenceHandle::FdObj> fence = mAcquireFence.GetAndResetFdObj();
|
||||
int fenceFd = fence->GetAndResetFd();
|
||||
|
||||
EGLint attribs[] = {
|
||||
LOCAL_EGL_SYNC_NATIVE_FENCE_FD_ANDROID, fenceFd,
|
||||
LOCAL_EGL_NONE
|
||||
};
|
||||
|
||||
EGLSync sync = sEGLLibrary.fCreateSync(EGL_DISPLAY(),
|
||||
LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID,
|
||||
attribs);
|
||||
if (!sync) {
|
||||
NS_WARNING("failed to create native fence sync");
|
||||
return;
|
||||
}
|
||||
|
||||
// Wait sync complete with timeout.
|
||||
// If a source of the fence becomes invalid because of error,
|
||||
// fene complete is not signaled. See Bug 1061435.
|
||||
EGLint status = sEGLLibrary.fClientWaitSync(EGL_DISPLAY(),
|
||||
sync,
|
||||
0,
|
||||
400000000 /*400 usec*/);
|
||||
if (status != LOCAL_EGL_CONDITION_SATISFIED) {
|
||||
NS_ERROR("failed to wait native fence sync");
|
||||
}
|
||||
MOZ_ALWAYS_TRUE( sEGLLibrary.fDestroySync(EGL_DISPLAY(), sync) );
|
||||
}
|
||||
|
||||
bool
|
||||
TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
|
||||
nsIntRegion* aDestRegion,
|
||||
|
||||
Reference in New Issue
Block a user