Bug 1670543 - Remove fence argument from AndroidHardwareBuffer::Unlock() r=jnicol

The function does not need fence argument. It could be handled within AndroidHardwareBuffer. Though all tested recent Android devices did not return valid fence.

AndroidHardwareBuffer usage is not enabled on gecko.

Differential Revision: https://phabricator.services.mozilla.com/D93217
This commit is contained in:
sotaro 2020-10-13 00:31:30 +00:00
parent 88e5d3073e
commit c74c1e1e13
3 changed files with 21 additions and 4 deletions

View File

@ -249,8 +249,25 @@ int AndroidHardwareBuffer::Lock(uint64_t aUsage, const ARect* aRect,
aRect, aOutVirtualAddress);
}
int AndroidHardwareBuffer::Unlock(int32_t* aFence) {
return AndroidHardwareBufferApi::Get()->Unlock(mNativeBuffer, aFence);
int AndroidHardwareBuffer::Unlock() {
int rawFd = -1;
// XXX All tested recent Android devices did not return valid fence.
int ret = AndroidHardwareBufferApi::Get()->Unlock(mNativeBuffer, &rawFd);
if (ret != 0) {
return ret;
}
ipc::FileDescriptor acquireFenceFd;
// The value -1 indicates that unlocking has already completed before
// the function returned and no further operations are necessary.
if (rawFd >= 0) {
acquireFenceFd = ipc::FileDescriptor(UniqueFileHandle(rawFd));
}
if (acquireFenceFd.IsValid()) {
SetAcquireFence(std::move(acquireFenceFd));
}
return 0;
}
int AndroidHardwareBuffer::SendHandleToUnixSocket(int aSocketFd) {

View File

@ -103,7 +103,7 @@ class AndroidHardwareBuffer
virtual ~AndroidHardwareBuffer();
int Lock(uint64_t aUsage, const ARect* aRect, void** aOutVirtualAddress);
int Unlock(int32_t* aFence);
int Unlock();
int SendHandleToUnixSocket(int aSocketFd);

View File

@ -322,7 +322,7 @@ AndroidHardwareBufferTextureData::BorrowDrawTarget() {
void AndroidHardwareBufferTextureData::OnForwardedToHost() {
if (mIsLocked) {
mAndroidHardwareBuffer->Unlock(nullptr);
mAndroidHardwareBuffer->Unlock();
mAddress = nullptr;
mIsLocked = false;
}