summaryrefslogtreecommitdiffstats
path: root/test/CameraHal/camera_test_surfacetexture.cpp
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2012-05-30 18:21:07 -0500
committerDaniel Levin <dendy@ti.com>2012-11-26 20:06:51 +0200
commitb189bb4e422ccb57c1a6465531ff39bafc985e16 (patch)
tree8bdbac339a2cff8e7b3b2873a409856a46e0af27 /test/CameraHal/camera_test_surfacetexture.cpp
parent413938d209e6c838607b5eb024ad4f1f0f938495 (diff)
downloadhardware_ti_omap4-b189bb4e422ccb57c1a6465531ff39bafc985e16.zip
hardware_ti_omap4-b189bb4e422ccb57c1a6465531ff39bafc985e16.tar.gz
hardware_ti_omap4-b189bb4e422ccb57c1a6465531ff39bafc985e16.tar.bz2
Camera_test: Changes to NV12 and BAYER allocation
Adapting NV12 and BAYER system heap allocations to gralloc changes. - NV12-1D format is no longer supported. Instead, we are using existing NV12 format with the GRALLOC_USAGE_PRIVATE_0 usage flag to signal to gralloc we want allocations to come from the system heap. The same flag we are using for BAYER format also. Change-Id: Id47a8da1a5c0bde6e39125a8e0f243386cadabd5 Signed-off-by: Tyler Luu <tluu@ti.com> Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
Diffstat (limited to 'test/CameraHal/camera_test_surfacetexture.cpp')
-rw-r--r--test/CameraHal/camera_test_surfacetexture.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/test/CameraHal/camera_test_surfacetexture.cpp b/test/CameraHal/camera_test_surfacetexture.cpp
index 3c1ce91..c3b1012 100644
--- a/test/CameraHal/camera_test_surfacetexture.cpp
+++ b/test/CameraHal/camera_test_surfacetexture.cpp
@@ -51,7 +51,6 @@
//temporarily define format here
#define HAL_PIXEL_FORMAT_TI_NV12 0x100
-#define HAL_PIXEL_FORMAT_TI_NV12_1D 0x102
#define HAL_PIXEL_FORMAT_TI_Y8 0x103
#define HAL_PIXEL_FORMAT_TI_Y16 0x104
@@ -70,7 +69,7 @@ static size_t calcBufSize(int format, int width, int height)
int buf_size;
switch (format) {
- case HAL_PIXEL_FORMAT_TI_NV12_1D:
+ case HAL_PIXEL_FORMAT_TI_NV12:
buf_size = width * height * 3 /2;
break;
case HAL_PIXEL_FORMAT_TI_Y16:
@@ -87,20 +86,39 @@ static size_t calcBufSize(int format, int width, int height)
static int getHalPixFormat(const char *format)
{
- int pixformat = HAL_PIXEL_FORMAT_TI_NV12_1D;
+ int pixformat = HAL_PIXEL_FORMAT_TI_NV12;
if ( NULL != format ) {
if ( strcmp(format, CameraParameters::PIXEL_FORMAT_BAYER_RGGB) == 0 ) {
pixformat = HAL_PIXEL_FORMAT_TI_Y16;
} else if ( strcmp(format, CameraParameters::PIXEL_FORMAT_YUV420SP) == 0 ) {
- pixformat = HAL_PIXEL_FORMAT_TI_NV12_1D;
+ pixformat = HAL_PIXEL_FORMAT_TI_NV12;
} else {
- pixformat = HAL_PIXEL_FORMAT_TI_NV12_1D;
+ pixformat = HAL_PIXEL_FORMAT_TI_NV12;
}
}
return pixformat;
}
+static int getUsageFromANW(int format)
+{
+ int usage = GRALLOC_USAGE_SW_READ_RARELY |
+ GRALLOC_USAGE_SW_WRITE_NEVER;
+
+ switch (format) {
+ case HAL_PIXEL_FORMAT_TI_NV12:
+ case HAL_PIXEL_FORMAT_TI_Y16:
+ // This usage flag indicates to gralloc we want the
+ // buffers to come from system heap
+ usage |= GRALLOC_USAGE_PRIVATE_0;
+ break;
+ default:
+ // No special flags needed
+ break;
+ }
+ return usage;
+}
+
void GLSurface::initialize(int display) {
mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
ASSERT(EGL_SUCCESS == eglGetError());
@@ -470,7 +488,7 @@ void BufferSourceInput::setInput(buffer_info_t bufinfo, const char *format, Shot
GraphicBufferMapper &mapper = GraphicBufferMapper::get();
void *data = NULL;
void *input = NULL;
- int pixformat = HAL_PIXEL_FORMAT_TI_NV12_1D;
+ int pixformat = HAL_PIXEL_FORMAT_TI_NV12;
int aligned_width, aligned_height;
aligned_width = ALIGN_UP(bufinfo.width, ALIGN_WIDTH);
@@ -489,8 +507,7 @@ void BufferSourceInput::setInput(buffer_info_t bufinfo, const char *format, Shot
}
native_window_set_usage(mWindowTapIn.get(),
- GRALLOC_USAGE_SW_READ_RARELY |
- GRALLOC_USAGE_SW_WRITE_NEVER);
+ getUsageFromANW(pixformat));
native_window_set_buffer_count(mWindowTapIn.get(), 1);
native_window_set_buffers_geometry(mWindowTapIn.get(),
aligned_width, aligned_height, bufinfo.format);