Update ANativeWindow clients for sync
This change updates the uses of ANativeWindow to use the new ANW functions that
accept and return Sync HAL fence file descriptors.
Change-Id: I701729e34e00944709c4477acf9d63ca6a2ab0f6
diff --git a/Android.mk b/Android.mk
index 5084d65..867cc84 100644
--- a/Android.mk
+++ b/Android.mk
@@ -34,7 +34,7 @@
driver/rsdVertexArray.cpp
LOCAL_SHARED_LIBRARIES += libcutils libutils libEGL libGLESv1_CM libGLESv2
-LOCAL_SHARED_LIBRARIES += libbcc libbcinfo libgui
+LOCAL_SHARED_LIBRARIES += libbcc libbcinfo libgui libsync
LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
@@ -143,7 +143,7 @@
rsType.cpp
LOCAL_SHARED_LIBRARIES += libcutils libutils libEGL libGLESv1_CM libGLESv2 libbcc
-LOCAL_SHARED_LIBRARIES += libui libbcinfo libgui
+LOCAL_SHARED_LIBRARIES += libui libbcinfo libgui libsync
LOCAL_STATIC_LIBRARIES := libft2 libRSDriver
diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp
index 4eb5a46..20c2165 100644
--- a/driver/rsdAllocation.cpp
+++ b/driver/rsdAllocation.cpp
@@ -399,19 +399,12 @@
static bool IoGetBuffer(const Context *rsc, Allocation *alloc, ANativeWindow *nw) {
DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
- int32_t r = nw->dequeueBuffer(nw, &drv->wndBuffer);
+ int32_t r = native_window_dequeue_buffer_and_wait(nw, &drv->wndBuffer);
if (r) {
rsc->setError(RS_ERROR_DRIVER, "Error getting next IO output buffer.");
return false;
}
- // This lock is implicitly released by the queue buffer in IoSend
- r = nw->lockBuffer(nw, drv->wndBuffer);
- if (r) {
- rsc->setError(RS_ERROR_DRIVER, "Error locking next IO output buffer.");
- return false;
- }
-
// Must lock the whole surface
GraphicBufferMapper &mapper = GraphicBufferMapper::get();
Rect bounds(drv->wndBuffer->width, drv->wndBuffer->height);
@@ -443,7 +436,7 @@
ANativeWindow *old = alloc->mHal.state.wndSurface;
GraphicBufferMapper &mapper = GraphicBufferMapper::get();
mapper.unlock(drv->wndBuffer->handle);
- old->queueBuffer(old, drv->wndBuffer);
+ old->queueBuffer(old, drv->wndBuffer, -1);
}
if (nw != NULL) {
@@ -492,7 +485,7 @@
if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT) {
GraphicBufferMapper &mapper = GraphicBufferMapper::get();
mapper.unlock(drv->wndBuffer->handle);
- int32_t r = nw->queueBuffer(nw, drv->wndBuffer);
+ int32_t r = nw->queueBuffer(nw, drv->wndBuffer, -1);
if (r) {
rsc->setError(RS_ERROR_DRIVER, "Error sending IO output buffer.");
return;