Return fence to client in dequeuBuffer
Change-Id: Ic19750793ad993f0e85391f3cabd743ba565d4c9
This commit is contained in:
parent
b7c839b110
commit
f9783af225
|
@ -69,6 +69,11 @@ public:
|
||||||
static sp<Fence> merge(const String8& name, const sp<Fence>& f1,
|
static sp<Fence> merge(const String8& name, const sp<Fence>& f1,
|
||||||
const sp<Fence>& f2);
|
const sp<Fence>& f2);
|
||||||
|
|
||||||
|
// Return a duplicate of the fence file descriptor. The caller is
|
||||||
|
// responsible for closing the returned file descriptor. On error, -1 will
|
||||||
|
// be returned and errno will indicate the problem.
|
||||||
|
int dup() const;
|
||||||
|
|
||||||
// Flattenable interface
|
// Flattenable interface
|
||||||
size_t getFlattenedSize() const;
|
size_t getFlattenedSize() const;
|
||||||
size_t getFdCount() const;
|
size_t getFdCount() const;
|
||||||
|
|
|
@ -222,15 +222,18 @@ int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fence.get()) {
|
if (fence.get()) {
|
||||||
status_t err = fence->wait(Fence::TIMEOUT_NEVER);
|
*fenceFd = fence->dup();
|
||||||
if (err != OK) {
|
if (*fenceFd == -1) {
|
||||||
ALOGE("dequeueBuffer: error waiting for fence: %d", err);
|
ALOGE("dequeueBuffer: error duping fence: %d", errno);
|
||||||
|
// dup() should never fail; something is badly wrong. Soldier on
|
||||||
|
// and hope for the best; the worst that should happen is some
|
||||||
|
// visible corruption that lasts until the next frame.
|
||||||
}
|
}
|
||||||
fence.clear();
|
} else {
|
||||||
|
*fenceFd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*buffer = gbuf.get();
|
*buffer = gbuf.get();
|
||||||
*fenceFd = -1;
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,10 @@ sp<Fence> Fence::merge(const String8& name, const sp<Fence>& f1,
|
||||||
return sp<Fence>(new Fence(result));
|
return sp<Fence>(new Fence(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Fence::dup() const {
|
||||||
|
return ::dup(mFenceFd);
|
||||||
|
}
|
||||||
|
|
||||||
size_t Fence::getFlattenedSize() const {
|
size_t Fence::getFlattenedSize() const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue