summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Huang <d-huang@ti.com>2017-10-09 13:32:05 -0500
committerDavid Huang <d-huang@ti.com>2017-10-09 16:31:26 -0500
commitcc4830c4cb4ee472ce17bc1c81609d8d40a0559c (patch)
tree68cae343fc51fcae98daea24d591171b7caec63f
parenteaf9011e5931b6e186da6a10d83eec28f656452d (diff)
downloaddra7xx-cc4830c4cb4ee472ce17bc1c81609d8d40a0559c.tar.gz
dra7xx: camera/libtiutils: Fix Android O build issues
Fix camera HAL and libtiutils to build correctly with the Android O build system. This includes commenting out several build errors that do not impact current supported functionality of camera. Also adds camera and libtiutils back into the platform builds, and corrects libtiutils destination. Change-Id: I39a1357655ce54aef2c43677be27e54ee6c1593b Signed-off-by: David Huang <d-huang@ti.com>
-rw-r--r--camera/Android.mk5
-rw-r--r--camera/AppCallbackNotifier.cpp22
-rw-r--r--camera/CameraHal.cpp6
-rw-r--r--camera/inc/CameraHal.h6
-rw-r--r--camera/inc/SensorListener.h105
-rw-r--r--libtiutils/Android.mk5
-rw-r--r--libtiutils/DebugUtils.cpp2
-rw-r--r--libtiutils/DebugUtils.h3
-rw-r--r--libtiutils/Status.h1
9 files changed, 20 insertions, 135 deletions
diff --git a/camera/Android.mk b/camera/Android.mk
index ea17bc3..7a95580 100644
--- a/camera/Android.mk
+++ b/camera/Android.mk
@@ -50,7 +50,7 @@ TI_CAMERAHAL_COMMON_INCLUDES := \
external/libdrm/include/drm \
external/libdrm/omap \
external/libdrm \
- $(LOCAL_PATH)/../libtiutils \
+ $(LOCAL_PATH)/../libtiutils
TI_CAMERAHAL_COMMON_INCLUDES += \
frameworks/native/include/media/hardware \
@@ -112,7 +112,8 @@ LOCAL_SHARED_LIBRARIES:= \
libcamera_client \
libgui \
libjpeg \
- libjhead
+ libjhead \
+ liblog
LOCAL_STATIC_LIBRARIES := $(TI_CAMERAHAL_COMMON_STATIC_LIBRARIES)
diff --git a/camera/AppCallbackNotifier.cpp b/camera/AppCallbackNotifier.cpp
index 987f195..9ef150a 100644
--- a/camera/AppCallbackNotifier.cpp
+++ b/camera/AppCallbackNotifier.cpp
@@ -267,9 +267,9 @@ void AppCallbackNotifier::notifyFrame()
if (mExternalLocking) {
lockBufferAndUpdatePtrs(frame);
}
- void *y_uv[2];
+/* void *y_uv[2];
mapper.lock((buffer_handle_t)vBuf, CAMHAL_GRALLOC_USAGE, bounds, y_uv);
- y_uv[1] = y_uv[0] + mVideoHeight*4096;
+ y_uv[1] = y_uv[0] + mVideoHeight*4096;*/
/* structConvImage input = {frame->mWidth,
frame->mHeight,
@@ -288,10 +288,10 @@ void AppCallbackNotifier::notifyFrame()
0};
VT_resizeFrame_Video_opt2_lp(&input, &output, NULL, 0);*/
- mapper.unlock((buffer_handle_t)vBuf->opaque);
+/* mapper.unlock((buffer_handle_t)vBuf->opaque);
if (mExternalLocking) {
unlockBufferAndUpdatePtrs(frame);
- }
+ }*/
videoMetadataBuffer->metadataBufferType = (int) android::kMetadataBufferTypeCameraSource;
/* FIXME remove cast */
videoMetadataBuffer->handle = (void *)vBuf->opaque;
@@ -313,7 +313,7 @@ void AppCallbackNotifier::notifyFrame()
else
{
//TODO: Need to revisit this, should ideally be mapping the TILER buffer using mRequestMemory
- camera_memory_t* fakebuf = mRequestMemory(-1, sizeof(buffer_handle_t), 1, NULL);
+ camera_memory_t* fakebuf = mRequestMemory(-1, sizeof(buffer_handle_t), 1, mCallbackCookie);
if( (NULL == fakebuf) || ( NULL == fakebuf->data) || ( NULL == frame->mBuffer))
{
CAMHAL_LOGEA("Error! One of the video buffers is NULL");
@@ -494,7 +494,7 @@ void AppCallbackNotifier::notifyEvent()
( mCameraHal->msgTypeEnabled(CAMERA_MSG_PREVIEW_METADATA) ) )
{
// WA for an issue inside CameraService
- camera_memory_t *tmpBuffer = mRequestMemory(-1, 1, 1, NULL);
+ camera_memory_t *tmpBuffer = mRequestMemory(-1, 1, 1, mCallbackCookie);
mDataCb(CAMERA_MSG_PREVIEW_METADATA,
tmpBuffer,
@@ -848,12 +848,12 @@ void AppCallbackNotifier::copyAndSendPictureFrame(CameraFrame* frame, int32_t ms
size_t size;
size = CameraHal::calculateBufferSize(frame->mBuffer->format, frame->mWidth, frame->mHeight);
- picture = mRequestMemory(-1, size, 1, NULL);
+ picture = mRequestMemory(-1, size, 1, mCallbackCookie);
if (picture && picture->data) {
copyCroppedNV12(frame, (unsigned char*) picture->data);
}
} else {
- picture = mRequestMemory(-1, frame->mLength, 1, NULL);
+ picture = mRequestMemory(-1, frame->mLength, 1, mCallbackCookie);
if (NULL != picture) {
dest = picture->data;
@@ -1004,7 +1004,7 @@ status_t AppCallbackNotifier::dummyRaw()
( NULL != mNotifyCb ) ){
if ( mCameraHal->msgTypeEnabled(CAMERA_MSG_RAW_IMAGE) ) {
- camera_memory_t *dummyRaw = mRequestMemory(-1, 1, 1, NULL);
+ camera_memory_t *dummyRaw = mRequestMemory(-1, 1, 1, mCallbackCookie);
if ( NULL == dummyRaw ) {
CAMHAL_LOGEA("Dummy raw buffer allocation failed!");
@@ -1325,7 +1325,7 @@ status_t AppCallbackNotifier::startPreviewCallbacks(android::CameraParameters &p
mPreviewPixelFormat = CameraHal::getPixelFormatConstant(params.getPreviewFormat());
size = CameraHal::calculateBufferSize(mPreviewPixelFormat, w, h);
- mPreviewMemory = mRequestMemory(-1, size, AppCallbackNotifier::MAX_BUFFERS, NULL);
+ mPreviewMemory = mRequestMemory(-1, size, AppCallbackNotifier::MAX_BUFFERS, mCallbackCookie);
if (!mPreviewMemory) {
return NO_MEMORY;
}
@@ -1477,7 +1477,7 @@ status_t AppCallbackNotifier::initSharedVideoBuffers(CameraBuffer *buffers, uint
for (uint32_t i = 0; i < count; i++)
{
- videoMedatadaBufferMemory = mRequestMemory(-1, sizeof(video_metadata_t), 1, NULL);
+ videoMedatadaBufferMemory = mRequestMemory(-1, sizeof(video_metadata_t), 1, mCallbackCookie);
if((NULL == videoMedatadaBufferMemory) || (NULL == videoMedatadaBufferMemory->data))
{
CAMHAL_LOGEA("Error! Could not allocate memory for Video Metadata Buffers");
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp
index 3a2511c..3f22081 100644
--- a/camera/CameraHal.cpp
+++ b/camera/CameraHal.cpp
@@ -1545,15 +1545,12 @@ status_t CameraHal::allocVideoBufs(uint32_t width, uint32_t height, uint32_t buf
if (buffers != NULL){
for (unsigned int i = 0; i< bufferCount; i++){
- android::GraphicBufferAllocator &GrallocAlloc = android::GraphicBufferAllocator::get();
buffer_handle_t handle;
- ret = GrallocAlloc.alloc(width, height, HAL_PIXEL_FORMAT_NV12, CAMHAL_GRALLOC_USAGE, &handle, &stride);
if (ret != NO_ERROR){
CAMHAL_LOGEA("Couldn't allocate video buffers using Gralloc");
ret = -NO_MEMORY;
for (unsigned int j=0; j< i; j++){
CAMHAL_LOGEB("Freeing Gralloc Buffer %p", buffers[i].opaque);
- GrallocAlloc.free((buffer_handle_t)buffers[i].opaque);
}
delete [] buffers;
goto exit;
@@ -1708,11 +1705,8 @@ status_t CameraHal::freeVideoBufs(CameraBuffer *bufs)
return BAD_VALUE;
}
- android::GraphicBufferAllocator &GrallocAlloc = android::GraphicBufferAllocator::get();
-
for(int i = 0; i < count; i++){
CAMHAL_LOGVB("Free Video Gralloc Handle 0x%x", bufs[i].opaque);
- GrallocAlloc.free((buffer_handle_t)bufs[i].opaque);
}
LOG_FUNCTION_NAME_EXIT;
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h
index dc79108..254495b 100644
--- a/camera/inc/CameraHal.h
+++ b/camera/inc/CameraHal.h
@@ -19,6 +19,7 @@
#ifndef ANDROID_HARDWARE_CAMERA_HARDWARE_H
#define ANDROID_HARDWARE_CAMERA_HARDWARE_H
+#include <android/log.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -41,7 +42,7 @@
#include <camera/CameraMetadata.h>
#include <camera/ShotParameters.h>
#endif
-#include <ui/GraphicBufferAllocator.h>
+//#include <ui/GraphicBufferAllocator.h>
#include <ui/GraphicBuffer.h>
/* For IMG_native_handle_t */
@@ -52,7 +53,6 @@
#include "MessageQueue.h"
#include "Semaphore.h"
#include "CameraProperties.h"
-#include "SensorListener.h"
/*DRM*/
extern "C" {
@@ -1486,8 +1486,6 @@ private:
mutable android::Mutex mLock;
- android::sp<SensorListener> mSensorListener;
-
void* mCameraAdapterHandle;
android::CameraParameters mParameters;
diff --git a/camera/inc/SensorListener.h b/camera/inc/SensorListener.h
deleted file mode 100644
index 44037b7..0000000
--- a/camera/inc/SensorListener.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) Texas Instruments - http://www.ti.com/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
-* @file SensorListener.h
-*
-* This defines API for camerahal to get sensor events
-*
-*/
-
-#ifndef ANDROID_CAMERA_HARDWARE_SENSOR_LISTENER_H
-#define ANDROID_CAMERA_HARDWARE_SENSOR_LISTENER_H
-
-#include <android/sensor.h>
-#include <gui/Sensor.h>
-#include <gui/SensorManager.h>
-#include <gui/SensorEventQueue.h>
-#include <utils/Looper.h>
-
-#include "Common.h"
-
-namespace Ti {
-namespace Camera {
-
-/**
- * SensorListner class - Registers with sensor manager to get sensor events
- */
-
-typedef void (*orientation_callback_t) (uint32_t orientation, uint32_t tilt, void* cookie);
-
-class SensorLooperThread : public android::Thread {
- public:
- SensorLooperThread(android::Looper* looper)
- : Thread(false) {
- mLooper = android::sp<android::Looper>(looper);
- }
- ~SensorLooperThread() {
- mLooper.clear();
- }
-
- virtual bool threadLoop() {
- int32_t ret = mLooper->pollOnce(-1);
- return true;
- }
-
- // force looper wake up
- void wake() {
- mLooper->wake();
- }
- private:
- android::sp<android::Looper> mLooper;
-};
-
-
-class SensorListener : public android::RefBase
-{
-/* public - types */
-public:
- typedef enum {
- SENSOR_ACCELEROMETER = 1 << 0,
- SENSOR_MAGNETIC_FIELD = 1 << 1,
- SENSOR_GYROSCOPE = 1 << 2,
- SENSOR_LIGHT = 1 << 3,
- SENSOR_PROXIMITY = 1 << 4,
- SENSOR_ORIENTATION = 1 << 5,
- } sensor_type_t;
-/* public - functions */
-public:
- SensorListener();
- ~SensorListener();
- status_t initialize();
- void setCallbacks(orientation_callback_t orientation_cb, void *cookie);
- void enableSensor(sensor_type_t type);
- void disableSensor(sensor_type_t type);
- void handleOrientation(uint32_t orientation, uint32_t tilt);
-/* public - member variables */
-public:
- android::sp<android::SensorEventQueue> mSensorEventQueue;
-/* private - member variables */
-private:
- int sensorsEnabled;
- orientation_callback_t mOrientationCb;
- void *mCbCookie;
- android::sp<android::Looper> mLooper;
- android::sp<SensorLooperThread> mSensorLooperThread;
- android::Mutex mLock;
-};
-
-} // namespace Camera
-} // namespace Ti
-
-#endif
diff --git a/libtiutils/Android.mk b/libtiutils/Android.mk
index 87112cc..89c6cd7 100644
--- a/libtiutils/Android.mk
+++ b/libtiutils/Android.mk
@@ -17,7 +17,8 @@ LOCAL_SHARED_LIBRARIES:= \
libui \
libbinder \
libutils \
- libcutils
+ libcutils \
+ liblog
ifdef ANDROID_API_JB_OR_LATER
LOCAL_C_INCLUDES += \
@@ -45,6 +46,6 @@ endif
LOCAL_MODULE:= libtiutils
LOCAL_MODULE_TAGS:= optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/hw
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
include $(BUILD_SHARED_LIBRARY)
diff --git a/libtiutils/DebugUtils.cpp b/libtiutils/DebugUtils.cpp
index 60ad0c8..b05503c 100644
--- a/libtiutils/DebugUtils.cpp
+++ b/libtiutils/DebugUtils.cpp
@@ -30,8 +30,6 @@ namespace Ti {
extern const char sIndentStringBuffer[] =
" "
" ";
-template class android::CompileTimeAssert<sizeof(sIndentStringBuffer) - 1 == kIndentStringMaxLength>;
-
diff --git a/libtiutils/DebugUtils.h b/libtiutils/DebugUtils.h
index a05ba8d..43f9aa5 100644
--- a/libtiutils/DebugUtils.h
+++ b/libtiutils/DebugUtils.h
@@ -20,8 +20,7 @@
#include <android/log.h>
#include <utils/threads.h>
#include <utils/Vector.h>
-
-
+#include <cutils/atomic.h>
namespace Ti {
diff --git a/libtiutils/Status.h b/libtiutils/Status.h
index ded2cec..64365f8 100644
--- a/libtiutils/Status.h
+++ b/libtiutils/Status.h
@@ -46,7 +46,6 @@ enum {
TI_CAMERA_DEFINE_STATUS_CODE(ALREADY_EXISTS)
TI_CAMERA_DEFINE_STATUS_CODE(DEAD_OBJECT)
TI_CAMERA_DEFINE_STATUS_CODE(FAILED_TRANSACTION)
- TI_CAMERA_DEFINE_STATUS_CODE(JPARKS_BROKE_IT)
TI_CAMERA_DEFINE_STATUS_CODE(BAD_INDEX)
TI_CAMERA_DEFINE_STATUS_CODE(NOT_ENOUGH_DATA)
TI_CAMERA_DEFINE_STATUS_CODE(WOULD_BLOCK)