summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2012-05-31 13:32:38 -0500
committerDaniel Levin <dendy@ti.com>2012-11-26 18:22:46 +0200
commit6ead645a25586f167ec39e9e2e5553f8ec02527c (patch)
tree491236d2295bd5f67c69ef4d9fcaca1c7f0226ab /test
parent3345eff7f63625f3f7c8c56a905b6b729bc2bc84 (diff)
downloadhardware_ti_omap4-6ead645a25586f167ec39e9e2e5553f8ec02527c.zip
hardware_ti_omap4-6ead645a25586f167ec39e9e2e5553f8ec02527c.tar.gz
hardware_ti_omap4-6ead645a25586f167ec39e9e2e5553f8ec02527c.tar.bz2
camera_test: Queue tap-out directly to tap-in
Add support to queue tap-out buffer directly to tap-in surface. This is only possible if the stride of the tap-out buffer is aligned properly for ISS. We will fall back to previous method of copying the tap-out buffer to tap-in if this condition is not met. Depends on system/core change Ic65652a5: http://review.omapzoom.org/#/c/24869/ Depends on frameworks/native change Ia5f695b3: http://review.omapzoom.org/#/c/25509/ Change-Id: I186bd7e7a41074cb7fcfe1961b709b96e5187b2c Signed-off-by: Tyler Luu <tluu@ti.com> Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com> Signed-off-by: Daniel Levin <dendy@ti.com>
Diffstat (limited to 'test')
-rw-r--r--test/CameraHal/camera_test_surfacetexture.cpp75
1 files changed, 43 insertions, 32 deletions
diff --git a/test/CameraHal/camera_test_surfacetexture.cpp b/test/CameraHal/camera_test_surfacetexture.cpp
index 4f1066a..cec076a 100644
--- a/test/CameraHal/camera_test_surfacetexture.cpp
+++ b/test/CameraHal/camera_test_surfacetexture.cpp
@@ -483,44 +483,55 @@ void BufferSourceInput::setInput(buffer_info_t bufinfo, const char *format) {
native_window_set_buffer_count(mWindowTapIn.get(), 1);
native_window_set_buffers_geometry(mWindowTapIn.get(),
aligned_width, aligned_height, bufinfo.format);
- mWindowTapIn->dequeueBuffer(mWindowTapIn.get(), &anb);
- mapper.lock(anb->handle, GRALLOC_USAGE_SW_READ_RARELY, bounds, &data);
- // copy buffer to input buffer if available
- if (bufinfo.buf.get()) {
- bufinfo.buf->lock(GRALLOC_USAGE_SW_READ_RARELY, &input);
- }
- if (input) {
- if ( HAL_PIXEL_FORMAT_TI_Y16 == pixformat ) {
- int size = calcBufSize(pixformat, bufinfo.width, bufinfo.height);
- memcpy(data, input, size);
- } else {
- if (bufinfo.width == aligned_width) {
- memcpy(data, input, bufinfo.size);
+
+ // if buffer dimensions are the same as the aligned dimensions, then we can
+ // queue the buffer directly to tapin surface. if the dimensions are different
+ // then the aligned ones, then we have to copy the buffer into our own buffer
+ // to make sure the stride of the buffer is correct
+ if ((aligned_width != bufinfo.width) || (aligned_height != bufinfo.height)) {
+ mWindowTapIn->dequeueBuffer(mWindowTapIn.get(), &anb);
+ mapper.lock(anb->handle, GRALLOC_USAGE_SW_READ_RARELY, bounds, &data);
+ // copy buffer to input buffer if available
+ if (bufinfo.buf.get()) {
+ bufinfo.buf->lock(GRALLOC_USAGE_SW_READ_RARELY, &input);
+ }
+ if (input) {
+ if ( HAL_PIXEL_FORMAT_TI_Y16 == pixformat ) {
+ int size = calcBufSize(pixformat, bufinfo.width, bufinfo.height);
+ memcpy(data, input, size);
} else {
- // need to copy line by line to adjust for stride
- uint8_t *dst = (uint8_t*) data;
- uint8_t *src = (uint8_t*) input;
- // hrmm this copy only works for NV12 and YV12
- // copy Y first
- for (int i = 0; i < aligned_height; i++) {
- memcpy(dst, src, bufinfo.width);
- dst += aligned_width;
- src += bufinfo.width;
- }
- // copy UV plane
- for (int i = 0; i < (aligned_height / 2); i++) {
- memcpy(dst, src, bufinfo.width);
- dst += aligned_width ;
- src += bufinfo.width ;
+ if (bufinfo.width == aligned_width) {
+ memcpy(data, input, bufinfo.size);
+ } else {
+ // need to copy line by line to adjust for stride
+ uint8_t *dst = (uint8_t*) data;
+ uint8_t *src = (uint8_t*) input;
+ // hrmm this copy only works for NV12 and YV12
+ // copy Y first
+ for (int i = 0; i < aligned_height; i++) {
+ memcpy(dst, src, bufinfo.width);
+ dst += aligned_width;
+ src += bufinfo.width;
+ }
+ // copy UV plane
+ for (int i = 0; i < (aligned_height / 2); i++) {
+ memcpy(dst, src, bufinfo.width);
+ dst += aligned_width ;
+ src += bufinfo.width ;
+ }
}
}
}
- }
- if (bufinfo.buf.get()) {
- bufinfo.buf->unlock();
+ if (bufinfo.buf.get()) {
+ bufinfo.buf->unlock();
+ }
+
+ mapper.unlock(anb->handle);
+ } else {
+ mWindowTapIn->perform(mWindowTapIn.get(), NATIVE_WINDOW_ADD_BUFFER_SLOT, &bufinfo.buf);
+ anb = bufinfo.buf->getNativeBuffer();
}
- mapper.unlock(anb->handle);
mWindowTapIn->queueBuffer(mWindowTapIn.get(), anb);
}