hardware/intel/common/utils: use proper nativehelper headers
am: 740af2fef0
Change-Id: Ida69760bd70af02b05fb1a3ade1452946308c98a
diff --git a/ISV/Android.mk b/ISV/Android.mk
index 07cf4c7..168b532 100644
--- a/ISV/Android.mk
+++ b/ISV/Android.mk
@@ -26,9 +26,11 @@
libva-android \
libmrm_omx_adaptor \
libmedia \
+ libsync \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
+ system/core/libsync/include \
$(call include-path-for, frameworks-openmax) \
$(TARGET_OUT_HEADERS)/libmedia_utils_vpp \
$(TARGET_OUT_HEADERS)/display \
diff --git a/ISV/base/isv_bufmanager.cpp b/ISV/base/isv_bufmanager.cpp
index 3b02ab4..8e5aa2d 100644
--- a/ISV/base/isv_bufmanager.cpp
+++ b/ISV/base/isv_bufmanager.cpp
@@ -22,6 +22,7 @@
#include "isv_bufmanager.h"
#ifndef TARGET_VPP_USE_GEN
#include "hal_public.h"
+#include <sync/sync.h>
#endif
//#define LOG_NDEBUG 0
@@ -69,12 +70,12 @@
}
int32_t err = 0;
+#ifdef TARGET_VPP_USE_GEN
if (!mpGralloc) {
err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (hw_module_t const**)&mpGralloc);
if (0 != err)
return UNKNOWN_ERROR;
}
-#ifdef TARGET_VPP_USE_GEN
ufo_buffer_details_t info;
memset(&info, 0, sizeof(ufo_buffer_details_t));
@@ -88,6 +89,11 @@
mStride = info.pitch;
mColorFormat = info.format;
#else
+ if (!mpGralloc) {
+ err = gralloc_open_img(&mpGralloc);
+ if (0 != err)
+ return UNKNOWN_ERROR;
+ }
IMG_native_handle_t* grallocHandle = (IMG_native_handle_t*)mGrallocHandle;
mStride = grallocHandle->aiStride[0];
mSurfaceHeight = grallocHandle->iHeight;
@@ -126,9 +132,13 @@
if ((mFlags & ISV_BUFFER_NEED_CLEAR) && mpGralloc) {
int32_t usage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN;
void *vaddr[GRALLOC_SUB_BUFFER_MAX];
+ const gralloc1_rect_t r = {
+ .width = (int32_t)mStride,
+ .height = (int32_t)mSurfaceHeight
+ };
+ int err, releaseFence = -1;
- int32_t err = mpGralloc->lock(mpGralloc, (buffer_handle_t)mGrallocHandle, usage, 0, 0, mStride, mSurfaceHeight, &vaddr[0]);
-
+ err = gralloc_lock_async_img(mpGralloc, (buffer_handle_t)mGrallocHandle, usage, &r, &vaddr[0], -1);
if (0 != err) {
ALOGE("%s: get graphic buffer ptr failed", __func__);
return UNKNOWN_ERROR;
@@ -140,7 +150,11 @@
memcpy(ptr, random_buf, sizeof(random_buf));
ptr += sizeof(random_buf);
}
- mpGralloc->unlock(mpGralloc, (buffer_handle_t)mGrallocHandle);
+ gralloc_unlock_async_img(mpGralloc, (buffer_handle_t)mGrallocHandle, &releaseFence);
+ if (releaseFence >= 0) {
+ sync_wait(releaseFence, -1);
+ close(releaseFence);
+ }
ALOGD_IF(ISV_BUFFER_MANAGER_DEBUG, "%s: clear isv buffer %p finished, buffer size %d", __func__, this, buffer_size);
mFlags &= ~ISV_BUFFER_NEED_CLEAR;
}
diff --git a/ISV/include/isv_bufmanager.h b/ISV/include/isv_bufmanager.h
index 18c3209..7b0bfb0 100644
--- a/ISV/include/isv_bufmanager.h
+++ b/ISV/include/isv_bufmanager.h
@@ -134,7 +134,11 @@
ISV_BUFFERTYPE mType;
int32_t mSurface;
uint32_t mFlags;
+#ifdef TARGET_VPP_USE_GEN
gralloc_module_t* mpGralloc;
+#else
+ const hw_device_t* mpGralloc;
+#endif
};
class ISVBufferManager: public RefBase
diff --git a/ISV/omx/isv_omxcomponent.cpp b/ISV/omx/isv_omxcomponent.cpp
index 1f87deb..043da1b 100644
--- a/ISV/omx/isv_omxcomponent.cpp
+++ b/ISV/omx/isv_omxcomponent.cpp
@@ -710,7 +710,7 @@
return OMX_ErrorUndefined;
}
- if(!mVPPEnabled || !mVPPOn || mVPPFlushing || pBuffer->nFilledLen == 0) {
+ if(!mVPPEnabled || !mVPPOn || mVPPFlushing || (pBuffer->nFilledLen == 0 && !(pBuffer->nFlags & OMX_BUFFERFLAG_EOS))) {
ALOGD_IF(ISV_COMPONENT_DEBUG, "%s: FillBufferDone pBuffer %p, timeStamp %.2f ms", __func__, pBuffer, pBuffer->nTimeStamp/1E3);
return mpCallBacks->FillBufferDone(&mBaseComponent, pAppData, pBuffer);
}
diff --git a/ituxd/jni/onload.cpp b/ituxd/jni/onload.cpp
index 7b650d1..78e06f0 100644
--- a/ituxd/jni/onload.cpp
+++ b/ituxd/jni/onload.cpp
@@ -25,10 +25,13 @@
using namespace android;
+#define UNUSED(expr) (void)(expr)
+
extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
JNIEnv* env = NULL;
jint result = -1;
+ UNUSED(reserved);
if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
ALOGE("GetEnv failed!");
diff --git a/ituxd/jni/thermalJNI.cpp b/ituxd/jni/thermalJNI.cpp
index 27bcef7..2a1360f 100644
--- a/ituxd/jni/thermalJNI.cpp
+++ b/ituxd/jni/thermalJNI.cpp
@@ -33,6 +33,8 @@
#define THERMAL_ZONE_PATH "/sys/class/thermal/thermal_zone"
#define COOLING_DEV_PATH "/sys/class/thermal/cooling_device"
+#define UNUSED(expr) (void)(expr)
+
static int readFromFile(const char *path, char* buf, size_t size, bool throwError)
{
if (!path)
@@ -130,6 +132,7 @@
{
const char *path = NULL;
jboolean ret = true;
+ UNUSED(obj);
path = jPath ? env->GetStringUTFChars(jPath, NULL) : NULL;
if (!path) {
@@ -151,6 +154,7 @@
{
int ret;
const char *type = NULL;
+ UNUSED(obj);
type = jType ? env->GetStringUTFChars(jType, NULL) : NULL;
if (!type) {
@@ -167,6 +171,7 @@
{
int ret;
const char *type = NULL;
+ UNUSED(obj);
type = jType ? env->GetStringUTFChars(jType, NULL) : NULL;
if (!type) {
@@ -183,6 +188,7 @@
{
int ret;
const char *type = NULL;
+ UNUSED(obj);
type = jType ? env->GetStringUTFChars(jType, NULL) : NULL;
if (!type) {
@@ -199,6 +205,7 @@
{
int ret;
const char *type = NULL;
+ UNUSED(obj);
type = jType ? env->GetStringUTFChars(jType, NULL) : NULL;
if (!type) {
@@ -215,6 +222,7 @@
{
int ret;
const char *path = NULL;
+ UNUSED(obj);
path = jPath ? env->GetStringUTFChars(jPath, NULL) : NULL;
if (!path) {
@@ -232,6 +240,7 @@
const char *path = NULL;
const int SIZE = 512;
char buf[SIZE];
+ UNUSED(obj);
path = jPath ? env->GetStringUTFChars(jPath, NULL) : NULL;
if (!path) {
@@ -258,6 +267,7 @@
// absolute zero millidegree C.
const int ABS_ZERO = -273000;
int ret;
+ UNUSED(obj);
path = jPath ? env->GetStringUTFChars(jPath, NULL) : NULL;
if (!path) {
diff --git a/ituxd/src/com/intel/thermal/ThermalService.java b/ituxd/src/com/intel/thermal/ThermalService.java
index 0751885..a7f2dc1 100644
--- a/ituxd/src/com/intel/thermal/ThermalService.java
+++ b/ituxd/src/com/intel/thermal/ThermalService.java
@@ -16,7 +16,6 @@
package com.intel.thermal;
-import android.app.ActivityManagerNative;
import android.app.IntentService;
import android.app.Service;
import android.content.BroadcastReceiver;
diff --git a/media_resource_manager/arbitrator/Android.mk b/media_resource_manager/arbitrator/Android.mk
index d665c24..044d2ac 100644
--- a/media_resource_manager/arbitrator/Android.mk
+++ b/media_resource_manager/arbitrator/Android.mk
@@ -11,7 +11,6 @@
libexpat \
libdl \
-
LOCAL_C_INCLUDES := \
$(TARGET_OUT_HEADERS)/khronos/openmax \
$(call include-path-for, frameworks-native)/media/openmax
@@ -21,6 +20,6 @@
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libmrm_arbitrator
-#LOCAL_CFLAGS += -Werror
+LOCAL_CFLAGS += -Werror
include $(BUILD_SHARED_LIBRARY)
diff --git a/media_resource_manager/arbitrator/MediaResourceArbitrator.cpp b/media_resource_manager/arbitrator/MediaResourceArbitrator.cpp
index e2f9501..b809281 100644
--- a/media_resource_manager/arbitrator/MediaResourceArbitrator.cpp
+++ b/media_resource_manager/arbitrator/MediaResourceArbitrator.cpp
@@ -47,7 +47,7 @@
fp = ::fopen(configFilePath, "r");
if (fp == NULL) {
ALOGV("%s: can not open config xml file.\
- try to set up default codec limitation");
+ try to set up default codec limitation", __FUNCTION__);
SetupDefaultCodecLimitation();
return ArbitratorErrorNone;
}
diff --git a/media_resource_manager/omx_adaptor/Android.mk b/media_resource_manager/omx_adaptor/Android.mk
index 63638db..c843d9b 100644
--- a/media_resource_manager/omx_adaptor/Android.mk
+++ b/media_resource_manager/omx_adaptor/Android.mk
@@ -23,6 +23,6 @@
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libmrm_omx_adaptor
-#LOCAL_CFLAGS += -Werror
+LOCAL_CFLAGS += -Werror
include $(BUILD_SHARED_LIBRARY)
diff --git a/media_resource_manager/omx_adaptor/OMX_adaptor.cpp b/media_resource_manager/omx_adaptor/OMX_adaptor.cpp
index 10c8293..55650b0 100644
--- a/media_resource_manager/omx_adaptor/OMX_adaptor.cpp
+++ b/media_resource_manager/omx_adaptor/OMX_adaptor.cpp
@@ -109,7 +109,7 @@
OMX_STRING cComponentName) {
ALOGV("MRM_OMX_SetComponent: %s", cComponentName);
String8 sComponentName(cComponentName);
- ALOGV("pComponentHandle = 0x%x, componentName = %s", pComponentHandle, sComponentName.string());
+ ALOGV("pComponentHandle = %p, componentName = %s", pComponentHandle, sComponentName.string());
mComponentNameMap.add(pComponentHandle, sComponentName);
}
@@ -119,7 +119,7 @@
OMX_INDEXTYPE nIndex,
OMX_PTR pComponentParameterStructure) {
ALOGV("MRM_OMX_SetParameter");
- ALOGV("hComponent = 0x%x", hComponent);
+ ALOGV("hComponent = %p", hComponent);
OMX_ERRORTYPE err = OMX_ErrorNone;
Mutex::Autolock lock(sLock);
@@ -131,7 +131,7 @@
if (def->nPortIndex == kPortIndexInput) {
ALOGV("MRM_OMX_SetParameter for inport param def");
if (mComponentFramerateMap.indexOfKey(hComponent) >= 0) {
- ALOGV("setParameter is called again for component 0x%x inport", hComponent);
+ ALOGV("setParameter is called again for component %p inport", hComponent);
return OMX_ErrorNone;
}
@@ -147,7 +147,7 @@
// if setParameter is not first called to this component's outport
// do not try to record its info for the second time
if (mComponentInfoMap.indexOfKey(hComponent) >= 0) {
- ALOGV("setParameter is called again for component 0x%x outport", hComponent);
+ ALOGV("setParameter is called again for component %p outport", hComponent);
return OMX_ErrorNone;
}
@@ -161,7 +161,7 @@
return OMX_ErrorInsufficientResources;
}
- ResolutionType resolution;
+ ResolutionType resolution = Resolution_CIF;
unsigned int height = video_def->nFrameHeight;
ALOGV("video resulotion = %d x %d", video_def->nFrameWidth, video_def->nFrameHeight);
if (height <= 480) {
@@ -216,6 +216,18 @@
OMX_U32 nSizeBytes,
OMX_U8 *pBuffer) {
ALOGV("MRM_OMX_UseBuffer");
+ if(pBuffer == 0 || ppBufferHdr == 0) {
+ ALOGV("%s: Null buffer. hComponent:%p, ppBufferHdr:%p, "
+ "nPortIndex:%d, pAppPrivate:%p, nSizeBytes:%d, pBuffer:%p",
+ __FUNCTION__,
+ hComponent,
+ ppBufferHdr,
+ nPortIndex,
+ pAppPrivate,
+ nSizeBytes,
+ pBuffer);
+ }
+
OMX_ERRORTYPE err = OMX_ErrorNone;
return err;
}
@@ -223,11 +235,11 @@
OMX_ERRORTYPE MRM_OMX_Adaptor::MRM_OMX_RemoveComponent(
OMX_HANDLETYPE pComponentHandle) {
- ALOGV("MRM_OMX_RemoveComponent 0x%x", pComponentHandle);
+ ALOGV("MRM_OMX_RemoveComponent %p", pComponentHandle);
OMX_ERRORTYPE err = OMX_ErrorNone;
if (mComponentInfoMap.indexOfKey(pComponentHandle) < 0) {
- ALOGE("component 0x%x was not added by setParameter before! something is wrong?",pComponentHandle);
+ ALOGE("component %p was not added by setParameter before! something is wrong?", pComponentHandle);
return OMX_ErrorNone; // TODO: change to specific error.
}
diff --git a/media_resource_manager/test/Android.mk b/media_resource_manager/test/Android.mk
index 7703265..70984f2 100644
--- a/media_resource_manager/test/Android.mk
+++ b/media_resource_manager/test/Android.mk
@@ -19,5 +19,7 @@
#LOCAL_32_BIT_ONLY := true
+LOCAL_CFLAGS += -Werror
+
include $(BUILD_NATIVE_TEST)
diff --git a/media_resource_manager/test/MediaResourceManager_test.cpp b/media_resource_manager/test/MediaResourceManager_test.cpp
index 4531d8c..72171e5 100644
--- a/media_resource_manager/test/MediaResourceManager_test.cpp
+++ b/media_resource_manager/test/MediaResourceManager_test.cpp
@@ -53,7 +53,7 @@
Resolution_1080,
30);
if (err == ArbitratorErrorInsufficientResources) {
- ALOGE("%dth codec can not be added anymore.");
+ ALOGE("%dth codec can not be added anymore.", i);
return;
}
}