diff options
author | Jamie Gennis <jgennis@google.com> | 2012-06-13 16:36:01 -0700 |
---|---|---|
committer | Jesse Hall <jessehall@google.com> | 2012-06-18 15:53:25 -0700 |
commit | bd85f47ae7b6b2af30cf9d51d7039fbba5a271ed (patch) | |
tree | d49bf7c1e0ac6d900207c3cccbaf7ff07a97485b /tests | |
parent | d479ad22a0254fa0b5358fe82fa404e3e96c631a (diff) | |
download | hardware_libhardware-bd85f47ae7b6b2af30cf9d51d7039fbba5a271ed.zip hardware_libhardware-bd85f47ae7b6b2af30cf9d51d7039fbba5a271ed.tar.gz hardware_libhardware-bd85f47ae7b6b2af30cf9d51d7039fbba5a271ed.tar.bz2 |
Update ANativeWindow clients for sync
This change updates uses of ANativeWindow to use the new ANW functions that
accept and return Sync HAL fence file descriptors.
Change-Id: I8ea699ba0a9b5c4b4316f9428cbd565976899991
Diffstat (limited to 'tests')
-rw-r--r-- | tests/camera2/Android.mk | 1 | ||||
-rw-r--r-- | tests/camera2/camera2_utils.cpp | 23 |
2 files changed, 6 insertions, 18 deletions
diff --git a/tests/camera2/Android.mk b/tests/camera2/Android.mk index 38d287e..c378e12 100644 --- a/tests/camera2/Android.mk +++ b/tests/camera2/Android.mk @@ -11,6 +11,7 @@ LOCAL_SHARED_LIBRARIES := \ libhardware \ libcamera_metadata \ libgui \ + libsync \ libui LOCAL_STATIC_LIBRARIES := \ diff --git a/tests/camera2/camera2_utils.cpp b/tests/camera2/camera2_utils.cpp index e3ea99f..ba938d9 100644 --- a/tests/camera2/camera2_utils.cpp +++ b/tests/camera2/camera2_utils.cpp @@ -425,7 +425,7 @@ status_t StreamAdapter::connectToDevice(camera2_device_t *d, ANativeWindowBuffer **anwBuffers = new ANativeWindowBuffer*[totalBuffers]; int bufferIdx = 0; for (; bufferIdx < totalBuffers; bufferIdx++) { - res = mConsumerInterface->dequeueBuffer(mConsumerInterface.get(), + res = native_window_dequeue_buffer_and_wait(mConsumerInterface.get(), &anwBuffers[bufferIdx]); if (res != OK) { ALOGE("%s: Unable to dequeue buffer %d for initial registration for" @@ -433,17 +433,6 @@ status_t StreamAdapter::connectToDevice(camera2_device_t *d, mState = CONNECTED; goto cleanUpBuffers; } - - res = mConsumerInterface->lockBuffer(mConsumerInterface.get(), - anwBuffers[bufferIdx]); - if (res != OK) { - ALOGE("%s: Unable to lock buffer %d for initial registration for" - "stream %d", __FUNCTION__, bufferIdx, mId); - mState = CONNECTED; - bufferIdx++; - goto cleanUpBuffers; - } - buffers[bufferIdx] = anwBuffers[bufferIdx]->handle; } @@ -462,7 +451,7 @@ status_t StreamAdapter::connectToDevice(camera2_device_t *d, cleanUpBuffers: for (int i = 0; i < bufferIdx; i++) { res = mConsumerInterface->cancelBuffer(mConsumerInterface.get(), - anwBuffers[i]); + anwBuffers[i], -1); } delete anwBuffers; delete buffers; @@ -517,9 +506,7 @@ int StreamAdapter::dequeue_buffer(const camera2_stream_ops_t *w, ANativeWindow *a = toANW(w); ANativeWindowBuffer* anb; - res = a->dequeueBuffer(a, &anb); - if (res != OK) return res; - res = a->lockBuffer(a, anb); + res = native_window_dequeue_buffer_and_wait(a, &anb); if (res != OK) return res; *buffer = &(anb->handle); @@ -540,7 +527,7 @@ int StreamAdapter::enqueue_buffer(const camera2_stream_ops_t* w, err = native_window_set_buffers_timestamp(a, timestamp); if (err != OK) return err; return a->queueBuffer(a, - container_of(buffer, ANativeWindowBuffer, handle)); + container_of(buffer, ANativeWindowBuffer, handle), -1); } int StreamAdapter::cancel_buffer(const camera2_stream_ops_t* w, @@ -552,7 +539,7 @@ int StreamAdapter::cancel_buffer(const camera2_stream_ops_t* w, } ANativeWindow *a = toANW(w); return a->cancelBuffer(a, - container_of(buffer, ANativeWindowBuffer, handle)); + container_of(buffer, ANativeWindowBuffer, handle), -1); } int StreamAdapter::set_crop(const camera2_stream_ops_t* w, |