Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/#/c/157220 Bug: 5449033 Change-Id: Ic6cac56d137f705dfa7266f21e9b0269219bd5d1
This commit is contained in:
@@ -44,11 +44,11 @@ static int registerNativeMethods(JNIEnv* env, const char* className,
|
|||||||
|
|
||||||
clazz = env->FindClass(className);
|
clazz = env->FindClass(className);
|
||||||
if (clazz == NULL) {
|
if (clazz == NULL) {
|
||||||
LOGE("Native registration unable to find class '%s'", className);
|
ALOGE("Native registration unable to find class '%s'", className);
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
|
if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
|
||||||
LOGE("RegisterNatives failed for '%s'", className);
|
ALOGE("RegisterNatives failed for '%s'", className);
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,13 +92,13 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
|||||||
ALOGI("JNI_OnLoad");
|
ALOGI("JNI_OnLoad");
|
||||||
|
|
||||||
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
|
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
|
||||||
LOGE("ERROR: GetEnv failed");
|
ALOGE("ERROR: GetEnv failed");
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
env = uenv.env;
|
env = uenv.env;
|
||||||
|
|
||||||
if (registerNatives(env) != JNI_TRUE) {
|
if (registerNatives(env) != JNI_TRUE) {
|
||||||
LOGE("ERROR: registerNatives failed");
|
ALOGE("ERROR: registerNatives failed");
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -462,7 +462,8 @@ int ApiGen::genEncoderImpl(const std::string &filename)
|
|||||||
size_t n = size();
|
size_t n = size();
|
||||||
|
|
||||||
// unsupport printout
|
// unsupport printout
|
||||||
fprintf(fp, "static void enc_unsupported()\n{\n\tLOGE(\"Function is unsupported\\n\");\n}\n\n");
|
fprintf(fp,
|
||||||
|
"static void enc_unsupported()\n{\n\tALOGE(\"Function is unsupported\\n\");\n}\n\n");
|
||||||
|
|
||||||
// entry points;
|
// entry points;
|
||||||
for (size_t i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#if (HAVE_ANDROID_OS == 1)
|
#if (HAVE_ANDROID_OS == 1)
|
||||||
# include <cutils/log.h>
|
# include <cutils/log.h>
|
||||||
# define ERR(...) LOGE(__VA_ARGS__)
|
# define ERR(...) ALOGE(__VA_ARGS__)
|
||||||
# ifdef EMUGL_DEBUG
|
# ifdef EMUGL_DEBUG
|
||||||
# define DBG(...) ALOGD(__VA_ARGS__)
|
# define DBG(...) ALOGD(__VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ static EGLClient_glesInterface * s_gl = NULL;
|
|||||||
#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
|
#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
|
||||||
HostConnection *hostCon = HostConnection::get(); \
|
HostConnection *hostCon = HostConnection::get(); \
|
||||||
if (!hostCon) { \
|
if (!hostCon) { \
|
||||||
LOGE("egl: Failed to get host connection\n"); \
|
ALOGE("egl: Failed to get host connection\n"); \
|
||||||
return ret; \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
|
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
|
||||||
if (!rcEnc) { \
|
if (!rcEnc) { \
|
||||||
LOGE("egl: Failed to get renderControl encoder context\n"); \
|
ALOGE("egl: Failed to get renderControl encoder context\n"); \
|
||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ static GLubyte *gVersionString= (GLubyte *) "OpenGL ES-CM 1.0";
|
|||||||
static GLubyte *gExtensionsString= (GLubyte *) ""; // no extensions at this point;
|
static GLubyte *gExtensionsString= (GLubyte *) ""; // no extensions at this point;
|
||||||
|
|
||||||
#define SET_ERROR_IF(condition,err) if((condition)) { \
|
#define SET_ERROR_IF(condition,err) if((condition)) { \
|
||||||
LOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
|
ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
|
||||||
ctx->setError(err); \
|
ctx->setError(err); \
|
||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define RET_AND_SET_ERROR_IF(condition,err,ret) if((condition)) { \
|
#define RET_AND_SET_ERROR_IF(condition,err,ret) if((condition)) { \
|
||||||
LOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
|
ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
|
||||||
ctx->setError(err); \
|
ctx->setError(err); \
|
||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
@@ -537,7 +537,7 @@ void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!has_immediate_arrays && !has_indirect_arrays) {
|
if (!has_immediate_arrays && !has_indirect_arrays) {
|
||||||
LOGE("glDrawElements: no data bound to the command - ignoring\n");
|
ALOGE("glDrawElements: no data bound to the command - ignoring\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,7 +580,7 @@ void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOGE("unsupported index buffer type %d\n", type);
|
ALOGE("unsupported index buffer type %d\n", type);
|
||||||
}
|
}
|
||||||
if (has_indirect_arrays || 1) {
|
if (has_indirect_arrays || 1) {
|
||||||
ctx->sendVertexData(minIndex, maxIndex - minIndex + 1);
|
ctx->sendVertexData(minIndex, maxIndex - minIndex + 1);
|
||||||
@@ -593,7 +593,7 @@ void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum
|
|||||||
} else {
|
} else {
|
||||||
// we are all direct arrays and immidate mode index array -
|
// we are all direct arrays and immidate mode index array -
|
||||||
// rebuild the arrays and the index array;
|
// rebuild the arrays and the index array;
|
||||||
LOGE("glDrawElements: direct index & direct buffer data - will be implemented in later versions;\n");
|
ALOGE("glDrawElements: direct index & direct buffer data - will be implemented in later versions;\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -605,7 +605,7 @@ void GLEncoder::s_glActiveTexture(void* self, GLenum texture)
|
|||||||
GLenum err;
|
GLenum err;
|
||||||
|
|
||||||
if ((err = state->setActiveTextureUnit(texture)) != GL_NO_ERROR) {
|
if ((err = state->setActiveTextureUnit(texture)) != GL_NO_ERROR) {
|
||||||
LOGE("%s:%s:%d GL error %#x\n", __FILE__, __FUNCTION__, __LINE__, err);
|
ALOGE("%s:%s:%d GL error %#x\n", __FILE__, __FUNCTION__, __LINE__, err);
|
||||||
ctx->setError(err);
|
ctx->setError(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -621,7 +621,7 @@ void GLEncoder::s_glBindTexture(void* self, GLenum target, GLuint texture)
|
|||||||
|
|
||||||
GLboolean firstUse;
|
GLboolean firstUse;
|
||||||
if ((err = state->bindTexture(target, texture, &firstUse)) != GL_NO_ERROR) {
|
if ((err = state->bindTexture(target, texture, &firstUse)) != GL_NO_ERROR) {
|
||||||
LOGE("%s:%s:%d GL error %#x\n", __FILE__, __FUNCTION__, __LINE__, err);
|
ALOGE("%s:%s:%d GL error %#x\n", __FILE__, __FUNCTION__, __LINE__, err);
|
||||||
ctx->setError(err);
|
ctx->setError(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ static EGLClient_glesInterface * s_gl = NULL;
|
|||||||
#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
|
#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
|
||||||
HostConnection *hostCon = HostConnection::get(); \
|
HostConnection *hostCon = HostConnection::get(); \
|
||||||
if (!hostCon) { \
|
if (!hostCon) { \
|
||||||
LOGE("egl: Failed to get host connection\n"); \
|
ALOGE("egl: Failed to get host connection\n"); \
|
||||||
return ret; \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
|
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
|
||||||
if (!rcEnc) { \
|
if (!rcEnc) { \
|
||||||
LOGE("egl: Failed to get renderControl encoder context\n"); \
|
ALOGE("egl: Failed to get renderControl encoder context\n"); \
|
||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ static GLubyte *gVersionString= (GLubyte *) "OpenGL ES 2.0";
|
|||||||
static GLubyte *gExtensionsString= (GLubyte *) ""; // no extensions at this point;
|
static GLubyte *gExtensionsString= (GLubyte *) ""; // no extensions at this point;
|
||||||
|
|
||||||
#define SET_ERROR_IF(condition,err) if((condition)) { \
|
#define SET_ERROR_IF(condition,err) if((condition)) { \
|
||||||
LOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
|
ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
|
||||||
ctx->setError(err); \
|
ctx->setError(err); \
|
||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define RET_AND_SET_ERROR_IF(condition,err,ret) if((condition)) { \
|
#define RET_AND_SET_ERROR_IF(condition,err,ret) if((condition)) { \
|
||||||
LOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
|
ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
|
||||||
ctx->setError(err); \
|
ctx->setError(err); \
|
||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
@@ -355,7 +355,7 @@ void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!has_immediate_arrays && !has_indirect_arrays) {
|
if (!has_immediate_arrays && !has_indirect_arrays) {
|
||||||
LOGE("glDrawElements: no data bound to the command - ignoring\n");
|
ALOGE("glDrawElements: no data bound to the command - ignoring\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOGE("unsupported index buffer type %d\n", type);
|
ALOGE("unsupported index buffer type %d\n", type);
|
||||||
}
|
}
|
||||||
if (has_indirect_arrays || 1) {
|
if (has_indirect_arrays || 1) {
|
||||||
ctx->sendVertexAttributes(minIndex, maxIndex - minIndex + 1);
|
ctx->sendVertexAttributes(minIndex, maxIndex - minIndex + 1);
|
||||||
@@ -411,7 +411,7 @@ void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum
|
|||||||
} else {
|
} else {
|
||||||
// we are all direct arrays and immidate mode index array -
|
// we are all direct arrays and immidate mode index array -
|
||||||
// rebuild the arrays and the index array;
|
// rebuild the arrays and the index array;
|
||||||
LOGE("glDrawElements: direct index & direct buffer data - will be implemented in later versions;\n");
|
ALOGE("glDrawElements: direct index & direct buffer data - will be implemented in later versions;\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,12 +63,12 @@ HostConnection *HostConnection::get()
|
|||||||
if (useQemuPipe) {
|
if (useQemuPipe) {
|
||||||
QemuPipeStream *stream = new QemuPipeStream(STREAM_BUFFER_SIZE);
|
QemuPipeStream *stream = new QemuPipeStream(STREAM_BUFFER_SIZE);
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
LOGE("Failed to create QemuPipeStream for host connection!!!\n");
|
ALOGE("Failed to create QemuPipeStream for host connection!!!\n");
|
||||||
delete con;
|
delete con;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (stream->connect() < 0) {
|
if (stream->connect() < 0) {
|
||||||
LOGE("Failed to connect to host (QemuPipeStream)!!!\n");
|
ALOGE("Failed to connect to host (QemuPipeStream)!!!\n");
|
||||||
delete stream;
|
delete stream;
|
||||||
delete con;
|
delete con;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -79,13 +79,13 @@ HostConnection *HostConnection::get()
|
|||||||
{
|
{
|
||||||
TcpStream *stream = new TcpStream(STREAM_BUFFER_SIZE);
|
TcpStream *stream = new TcpStream(STREAM_BUFFER_SIZE);
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
LOGE("Failed to create TcpStream for host connection!!!\n");
|
ALOGE("Failed to create TcpStream for host connection!!!\n");
|
||||||
delete con;
|
delete con;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream->connect("10.0.2.2", STREAM_PORT_NUM) < 0) {
|
if (stream->connect("10.0.2.2", STREAM_PORT_NUM) < 0) {
|
||||||
LOGE("Failed to connect to host (TcpStream)!!!\n");
|
ALOGE("Failed to connect to host (TcpStream)!!!\n");
|
||||||
delete stream;
|
delete stream;
|
||||||
delete con;
|
delete con;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -65,12 +65,12 @@ const char * eglStrError(EGLint err)
|
|||||||
|
|
||||||
#define setErrorReturn(error, retVal) \
|
#define setErrorReturn(error, retVal) \
|
||||||
{ \
|
{ \
|
||||||
LOGE("tid %d: %s(%d): error 0x%x (%s)", gettid(), __FUNCTION__, __LINE__, error, eglStrError(error)); \
|
ALOGE("tid %d: %s(%d): error 0x%x (%s)", gettid(), __FUNCTION__, __LINE__, error, eglStrError(error)); \
|
||||||
return setErrorFunc(error, retVal); \
|
return setErrorFunc(error, retVal); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RETURN_ERROR(ret,err) \
|
#define RETURN_ERROR(ret,err) \
|
||||||
LOGE("tid %d: %s(%d): error 0x%x (%s)", gettid(), __FUNCTION__, __LINE__, err, eglStrError(err)); \
|
ALOGE("tid %d: %s(%d): error 0x%x (%s)", gettid(), __FUNCTION__, __LINE__, err, eglStrError(err)); \
|
||||||
getEGLThreadInfo()->eglError = err; \
|
getEGLThreadInfo()->eglError = err; \
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@@ -107,12 +107,12 @@ const char * eglStrError(EGLint err)
|
|||||||
#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
|
#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
|
||||||
HostConnection *hostCon = HostConnection::get(); \
|
HostConnection *hostCon = HostConnection::get(); \
|
||||||
if (!hostCon) { \
|
if (!hostCon) { \
|
||||||
LOGE("egl: Failed to get host connection\n"); \
|
ALOGE("egl: Failed to get host connection\n"); \
|
||||||
return ret; \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
|
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
|
||||||
if (!rcEnc) { \
|
if (!rcEnc) { \
|
||||||
LOGE("egl: Failed to get renderControl encoder context\n"); \
|
ALOGE("egl: Failed to get renderControl encoder context\n"); \
|
||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ EGLBoolean egl_window_surface_t::rcCreate()
|
|||||||
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
|
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
|
||||||
rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uint32_t)config, getWidth(), getHeight());
|
rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uint32_t)config, getWidth(), getHeight());
|
||||||
if (!rcSurface) {
|
if (!rcSurface) {
|
||||||
LOGE("rcCreateWindowSurface returned 0");
|
ALOGE("rcCreateWindowSurface returned 0");
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
valid = EGL_TRUE;
|
valid = EGL_TRUE;
|
||||||
@@ -292,7 +292,7 @@ EGLBoolean egl_window_surface_t::rcCreate()
|
|||||||
EGLBoolean egl_window_surface_t::rcDestroy()
|
EGLBoolean egl_window_surface_t::rcDestroy()
|
||||||
{
|
{
|
||||||
if (!rcSurface) {
|
if (!rcSurface) {
|
||||||
LOGE("rcDestroy called on invalid rcSurface");
|
ALOGE("rcDestroy called on invalid rcSurface");
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,12 +395,12 @@ EGLBoolean egl_pbuffer_surface_t::rcCreate()
|
|||||||
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
|
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
|
||||||
rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uint32_t)config, getWidth(), getHeight());
|
rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uint32_t)config, getWidth(), getHeight());
|
||||||
if (!rcSurface) {
|
if (!rcSurface) {
|
||||||
LOGE("rcCreateWindowSurface returned 0");
|
ALOGE("rcCreateWindowSurface returned 0");
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
rcColorBuffer = rcEnc->rcCreateColorBuffer(rcEnc, getWidth(), getHeight(), format);
|
rcColorBuffer = rcEnc->rcCreateColorBuffer(rcEnc, getWidth(), getHeight(), format);
|
||||||
if (!rcColorBuffer) {
|
if (!rcColorBuffer) {
|
||||||
LOGE("rcCreateColorBuffer returned 0");
|
ALOGE("rcCreateColorBuffer returned 0");
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ EGLBoolean egl_pbuffer_surface_t::rcCreate()
|
|||||||
EGLBoolean egl_pbuffer_surface_t::rcDestroy()
|
EGLBoolean egl_pbuffer_surface_t::rcDestroy()
|
||||||
{
|
{
|
||||||
if ((!rcSurface)||(!rcColorBuffer)) {
|
if ((!rcSurface)||(!rcColorBuffer)) {
|
||||||
LOGE("destroyRc called on invalid rcSurface");
|
ALOGE("destroyRc called on invalid rcSurface");
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -782,7 +782,7 @@ EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface eglSurface, EGLint attribu
|
|||||||
break;
|
break;
|
||||||
//TODO: complete other attributes
|
//TODO: complete other attributes
|
||||||
default:
|
default:
|
||||||
LOGE("eglQuerySurface %x EGL_BAD_ATTRIBUTE", attribute);
|
ALOGE("eglQuerySurface %x EGL_BAD_ATTRIBUTE", attribute);
|
||||||
ret = setErrorFunc(EGL_BAD_ATTRIBUTE, EGL_FALSE);
|
ret = setErrorFunc(EGL_BAD_ATTRIBUTE, EGL_FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -900,7 +900,7 @@ EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_c
|
|||||||
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_NO_CONTEXT);
|
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_NO_CONTEXT);
|
||||||
uint32_t rcContext = rcEnc->rcCreateContext(rcEnc, (uint32_t)config, rcShareCtx, version);
|
uint32_t rcContext = rcEnc->rcCreateContext(rcEnc, (uint32_t)config, rcShareCtx, version);
|
||||||
if (!rcContext) {
|
if (!rcContext) {
|
||||||
LOGE("rcCreateContext returned 0");
|
ALOGE("rcCreateContext returned 0");
|
||||||
setErrorReturn(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
|
setErrorReturn(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,7 +972,7 @@ EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLC
|
|||||||
|
|
||||||
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
|
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
|
||||||
if (rcEnc->rcMakeCurrent(rcEnc, ctxHandle, drawHandle, readHandle) == EGL_FALSE) {
|
if (rcEnc->rcMakeCurrent(rcEnc, ctxHandle, drawHandle, readHandle) == EGL_FALSE) {
|
||||||
LOGE("rcMakeCurrent returned EGL_FALSE");
|
ALOGE("rcMakeCurrent returned EGL_FALSE");
|
||||||
setErrorReturn(EGL_BAD_CONTEXT, EGL_FALSE);
|
setErrorReturn(EGL_BAD_CONTEXT, EGL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1098,7 +1098,7 @@ EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGL
|
|||||||
*value = EGL_BACK_BUFFER; //single buffer not supported
|
*value = EGL_BACK_BUFFER; //single buffer not supported
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOGE("eglQueryContext %x EGL_BAD_ATTRIBUTE", attribute);
|
ALOGE("eglQueryContext %x EGL_BAD_ATTRIBUTE", attribute);
|
||||||
setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_FALSE);
|
setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ bool eglDisplay::initialize(EGLClient_eglInterface *eglIface)
|
|||||||
&s_gles_lib);
|
&s_gles_lib);
|
||||||
if (!m_gles_iface) {
|
if (!m_gles_iface) {
|
||||||
pthread_mutex_unlock(&m_lock);
|
pthread_mutex_unlock(&m_lock);
|
||||||
LOGE("Failed to load gles1 iface");
|
ALOGE("Failed to load gles1 iface");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ bool eglDisplay::initialize(EGLClient_eglInterface *eglIface)
|
|||||||
HostConnection *hcon = HostConnection::get();
|
HostConnection *hcon = HostConnection::get();
|
||||||
if (!hcon) {
|
if (!hcon) {
|
||||||
pthread_mutex_unlock(&m_lock);
|
pthread_mutex_unlock(&m_lock);
|
||||||
LOGE("Failed to establish connection with the host\n");
|
ALOGE("Failed to establish connection with the host\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ bool eglDisplay::initialize(EGLClient_eglInterface *eglIface)
|
|||||||
renderControl_encoder_context_t *rcEnc = hcon->rcEncoder();
|
renderControl_encoder_context_t *rcEnc = hcon->rcEncoder();
|
||||||
if (!rcEnc) {
|
if (!rcEnc) {
|
||||||
pthread_mutex_unlock(&m_lock);
|
pthread_mutex_unlock(&m_lock);
|
||||||
LOGE("Failed to get renderControl encoder instance");
|
ALOGE("Failed to get renderControl encoder instance");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,13 +228,13 @@ EGLClient_glesInterface *eglDisplay::loadGLESClientAPI(const char *libName,
|
|||||||
{
|
{
|
||||||
void *lib = dlopen(libName, RTLD_NOW);
|
void *lib = dlopen(libName, RTLD_NOW);
|
||||||
if (!lib) {
|
if (!lib) {
|
||||||
LOGE("Failed to dlopen %s", libName);
|
ALOGE("Failed to dlopen %s", libName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_emul_gles_t init_gles_func = (init_emul_gles_t)dlsym(lib,"init_emul_gles");
|
init_emul_gles_t init_gles_func = (init_emul_gles_t)dlsym(lib,"init_emul_gles");
|
||||||
if (!init_gles_func) {
|
if (!init_gles_func) {
|
||||||
LOGE("Failed to find init_emul_gles");
|
ALOGE("Failed to find init_emul_gles");
|
||||||
dlclose((void*)lib);
|
dlclose((void*)lib);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -385,7 +385,7 @@ const char *eglDisplay::queryString(EGLint name)
|
|||||||
return m_extensionString;
|
return m_extensionString;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOGE("[%s] Unknown name %d\n", __FUNCTION__, name);
|
ALOGE("[%s] Unknown name %d\n", __FUNCTION__, name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -397,7 +397,7 @@ EGLBoolean eglDisplay::getAttribValue(EGLConfig config, EGLint attribIdx, EGLint
|
|||||||
{
|
{
|
||||||
if (attribIdx == ATTRIBUTE_NONE)
|
if (attribIdx == ATTRIBUTE_NONE)
|
||||||
{
|
{
|
||||||
LOGE("[%s] Bad attribute idx\n", __FUNCTION__);
|
ALOGE("[%s] Bad attribute idx\n", __FUNCTION__);
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
*value = *(m_configs + (int)config*m_numConfigAttribs + attribIdx);
|
*value = *(m_configs + (int)config*m_numConfigAttribs + attribIdx);
|
||||||
@@ -430,7 +430,7 @@ EGLBoolean eglDisplay::setAttribValue(EGLConfig config, EGLint attribIdx, EGLint
|
|||||||
{
|
{
|
||||||
if (attribIdx == ATTRIBUTE_NONE)
|
if (attribIdx == ATTRIBUTE_NONE)
|
||||||
{
|
{
|
||||||
LOGE("[%s] Bad attribute idx\n", __FUNCTION__);
|
ALOGE("[%s] Bad attribute idx\n", __FUNCTION__);
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
*(m_configs + (int)config*m_numConfigAttribs + attribIdx) = value;
|
*(m_configs + (int)config*m_numConfigAttribs + attribIdx) = value;
|
||||||
@@ -456,7 +456,7 @@ EGLBoolean eglDisplay::getConfigNativePixelFormat(EGLConfig config, PixelFormat
|
|||||||
getAttribValue(config, m_attribs.valueFor(EGL_GREEN_SIZE), &greenSize) &&
|
getAttribValue(config, m_attribs.valueFor(EGL_GREEN_SIZE), &greenSize) &&
|
||||||
getAttribValue(config, m_attribs.valueFor(EGL_ALPHA_SIZE), &alphaSize)) )
|
getAttribValue(config, m_attribs.valueFor(EGL_ALPHA_SIZE), &alphaSize)) )
|
||||||
{
|
{
|
||||||
LOGE("Couldn't find value for one of the pixel format attributes");
|
ALOGE("Couldn't find value for one of the pixel format attributes");
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,7 +480,7 @@ EGLBoolean eglDisplay::getConfigGLPixelFormat(EGLConfig config, GLenum * format)
|
|||||||
getAttribValue(config, m_attribs.valueFor(EGL_GREEN_SIZE), &greenSize) &&
|
getAttribValue(config, m_attribs.valueFor(EGL_GREEN_SIZE), &greenSize) &&
|
||||||
getAttribValue(config, m_attribs.valueFor(EGL_ALPHA_SIZE), &alphaSize)) )
|
getAttribValue(config, m_attribs.valueFor(EGL_ALPHA_SIZE), &alphaSize)) )
|
||||||
{
|
{
|
||||||
LOGE("Couldn't find value for one of the pixel format attributes");
|
ALOGE("Couldn't find value for one of the pixel format attributes");
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,12 +113,12 @@ static int map_buffer(cb_handle_t *cb, void **vaddr)
|
|||||||
#define DEFINE_AND_VALIDATE_HOST_CONNECTION \
|
#define DEFINE_AND_VALIDATE_HOST_CONNECTION \
|
||||||
HostConnection *hostCon = HostConnection::get(); \
|
HostConnection *hostCon = HostConnection::get(); \
|
||||||
if (!hostCon) { \
|
if (!hostCon) { \
|
||||||
LOGE("gralloc: Failed to get host connection\n"); \
|
ALOGE("gralloc: Failed to get host connection\n"); \
|
||||||
return -EIO; \
|
return -EIO; \
|
||||||
} \
|
} \
|
||||||
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
|
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
|
||||||
if (!rcEnc) { \
|
if (!rcEnc) { \
|
||||||
LOGE("gralloc: Failed to get renderControl encoder context\n"); \
|
ALOGE("gralloc: Failed to get renderControl encoder context\n"); \
|
||||||
return -EIO; \
|
return -EIO; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ static int gralloc_alloc(alloc_device_t* dev,
|
|||||||
|
|
||||||
fd = ashmem_create_region("gralloc-buffer", ashmem_size);
|
fd = ashmem_create_region("gralloc-buffer", ashmem_size);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
LOGE("gralloc_alloc failed to create ashmem region: %s\n", strerror(errno));
|
ALOGE("gralloc_alloc failed to create ashmem region: %s\n", strerror(errno));
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -503,7 +503,7 @@ static int gralloc_lock(gralloc_module_t const* module,
|
|||||||
private_module_t *gr = (private_module_t *)module;
|
private_module_t *gr = (private_module_t *)module;
|
||||||
cb_handle_t *cb = (cb_handle_t *)handle;
|
cb_handle_t *cb = (cb_handle_t *)handle;
|
||||||
if (!gr || !cb_handle_t::validate(cb)) {
|
if (!gr || !cb_handle_t::validate(cb)) {
|
||||||
LOGE("gralloc_lock bad handle\n");
|
ALOGE("gralloc_lock bad handle\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@ static int gralloc_lock(gralloc_module_t const* module,
|
|||||||
(!sw_read && !sw_write) ||
|
(!sw_read && !sw_write) ||
|
||||||
(sw_read && !sw_read_allowed) ||
|
(sw_read && !sw_read_allowed) ||
|
||||||
(sw_write && !sw_write_allowed) ) {
|
(sw_write && !sw_write_allowed) ) {
|
||||||
LOGE("gralloc_lock usage mismatch usage=0x%x cb->usage=0x%x\n", usage, cb->usage);
|
ALOGE("gralloc_lock usage mismatch usage=0x%x cb->usage=0x%x\n", usage, cb->usage);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,7 +559,7 @@ static int gralloc_lock(gralloc_module_t const* module,
|
|||||||
if (hostSyncStatus < 0) {
|
if (hostSyncStatus < 0) {
|
||||||
// host failed the color buffer sync - probably since it was already
|
// host failed the color buffer sync - probably since it was already
|
||||||
// locked for write access. fail the lock.
|
// locked for write access. fail the lock.
|
||||||
LOGE("gralloc_lock cacheFlush failed postCount=%d sw_read=%d\n",
|
ALOGE("gralloc_lock cacheFlush failed postCount=%d sw_read=%d\n",
|
||||||
postCount, sw_read);
|
postCount, sw_read);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
@@ -669,7 +669,7 @@ static int gralloc_device_open(const hw_module_t* module,
|
|||||||
// return error if connection with host can not be established
|
// return error if connection with host can not be established
|
||||||
HostConnection *hostCon = HostConnection::get();
|
HostConnection *hostCon = HostConnection::get();
|
||||||
if (!hostCon) {
|
if (!hostCon) {
|
||||||
LOGE("gralloc: failed to get host connection while opening %s\n", name);
|
ALOGE("gralloc: failed to get host connection while opening %s\n", name);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -814,6 +814,6 @@ fallback_init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sFallback == NULL) {
|
if (sFallback == NULL) {
|
||||||
LOGE("Could not find software fallback module!?");
|
ALOGE("Could not find software fallback module!?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ int ServerConnection::create(size_t bufsize,
|
|||||||
QemuPipeStream* pipeStream = new QemuPipeStream(bufsize);
|
QemuPipeStream* pipeStream = new QemuPipeStream(bufsize);
|
||||||
|
|
||||||
if (pipeStream->connect() < 0) {
|
if (pipeStream->connect() < 0) {
|
||||||
LOGE("couldn't connect to host server\n");
|
ALOGE("couldn't connect to host server\n");
|
||||||
delete pipeStream;
|
delete pipeStream;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ int ServerConnection::create(size_t bufsize,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tcpStream->connect(hostname, CODEC_SERVER_PORT) < 0) {
|
if (tcpStream->connect(hostname, CODEC_SERVER_PORT) < 0) {
|
||||||
LOGE("couldn't connect to %s\n", hostname);
|
ALOGE("couldn't connect to %s\n", hostname);
|
||||||
free(hostname);
|
free(hostname);
|
||||||
delete tcpStream;
|
delete tcpStream;
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ int initApi(const char *driverLibName, const char *implLibName, T **dispatchTabl
|
|||||||
{
|
{
|
||||||
void *driverLib = dlopen(driverLibName, RTLD_NOW | RTLD_LOCAL);
|
void *driverLib = dlopen(driverLibName, RTLD_NOW | RTLD_LOCAL);
|
||||||
if (driverLib == NULL) {
|
if (driverLib == NULL) {
|
||||||
LOGE("failed to load %s : %s\n", driverLibName, dlerror());
|
ALOGE("failed to load %s : %s\n", driverLibName, dlerror());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,13 +66,13 @@ int initApi(const char *driverLibName, const char *implLibName, T **dispatchTabl
|
|||||||
createFcn_t createFcn;
|
createFcn_t createFcn;
|
||||||
createFcn = (createFcn_t) dlsym(driverLib, "createFromLib");
|
createFcn = (createFcn_t) dlsym(driverLib, "createFromLib");
|
||||||
if (createFcn == NULL) {
|
if (createFcn == NULL) {
|
||||||
LOGE("failed to load createFromLib constructor function\n");
|
ALOGE("failed to load createFromLib constructor function\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *implLib = dlopen(implLibName, RTLD_NOW | RTLD_LOCAL);
|
void *implLib = dlopen(implLibName, RTLD_NOW | RTLD_LOCAL);
|
||||||
if (implLib == NULL) {
|
if (implLib == NULL) {
|
||||||
LOGE("couldn't open %s", implLibName);
|
ALOGE("couldn't open %s", implLibName);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
*dispatchTable = createFcn(implLib, accessor);
|
*dispatchTable = createFcn(implLib, accessor);
|
||||||
@@ -112,20 +112,20 @@ const char *getProcName()
|
|||||||
// we need to obtain our process name from the command line;
|
// we need to obtain our process name from the command line;
|
||||||
FILE *fp = fopen("/proc/self/cmdline", "rt");
|
FILE *fp = fopen("/proc/self/cmdline", "rt");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
LOGE("couldn't open /proc/self/cmdline\n");
|
ALOGE("couldn't open /proc/self/cmdline\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char line[1000];
|
char line[1000];
|
||||||
if (fgets(line, sizeof(line), fp) == NULL) {
|
if (fgets(line, sizeof(line), fp) == NULL) {
|
||||||
LOGE("couldn't read the self cmdline from \n");
|
ALOGE("couldn't read the self cmdline from \n");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
if (line[0] == '\0') {
|
if (line[0] == '\0') {
|
||||||
LOGE("cmdline is empty\n");
|
ALOGE("cmdline is empty\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ bool isNeedEncode()
|
|||||||
// check on our whitelist
|
// check on our whitelist
|
||||||
FILE *fp = fopen(GLES_EMUL_TARGETS_FILE, "rt");
|
FILE *fp = fopen(GLES_EMUL_TARGETS_FILE, "rt");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
LOGE("couldn't open %s\n", GLES_EMUL_TARGETS_FILE);
|
ALOGE("couldn't open %s\n", GLES_EMUL_TARGETS_FILE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ void initDispatchTables()
|
|||||||
// initialize a connection to the server, and the GLESv1/v2 encoders;
|
// initialize a connection to the server, and the GLESv1/v2 encoders;
|
||||||
ServerConnection * connection = ServerConnection::s_getServerConnection();
|
ServerConnection * connection = ServerConnection::s_getServerConnection();
|
||||||
if (connection == NULL) {
|
if (connection == NULL) {
|
||||||
LOGE("couldn't create server connection\n");
|
ALOGE("couldn't create server connection\n");
|
||||||
s_needEncode = false;
|
s_needEncode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ void init_gles(void *gles_android)
|
|||||||
{
|
{
|
||||||
s_dispatch = create_gles_dispatch(gles_android);
|
s_dispatch = create_gles_dispatch(gles_android);
|
||||||
if (s_dispatch == NULL) {
|
if (s_dispatch == NULL) {
|
||||||
LOGE("failed to create gles dispatch\n");
|
ALOGE("failed to create gles dispatch\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ void CallbackNotifier::onNextFrameAvailable(const void* frame,
|
|||||||
mDataCBTimestamp(timestamp, CAMERA_MSG_VIDEO_FRAME,
|
mDataCBTimestamp(timestamp, CAMERA_MSG_VIDEO_FRAME,
|
||||||
cam_buff, 0, mCBOpaque);
|
cam_buff, 0, mCBOpaque);
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Memory failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__);
|
ALOGE("%s: Memory failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ void CallbackNotifier::onNextFrameAvailable(const void* frame,
|
|||||||
mDataCB(CAMERA_MSG_PREVIEW_FRAME, cam_buff, 0, NULL, mCBOpaque);
|
mDataCB(CAMERA_MSG_PREVIEW_FRAME, cam_buff, 0, NULL, mCBOpaque);
|
||||||
cam_buff->release(cam_buff);
|
cam_buff->release(cam_buff);
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__);
|
ALOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,10 +261,10 @@ void CallbackNotifier::onNextFrameAvailable(const void* frame,
|
|||||||
mDataCB(CAMERA_MSG_COMPRESSED_IMAGE, jpeg_buff, 0, NULL, mCBOpaque);
|
mDataCB(CAMERA_MSG_COMPRESSED_IMAGE, jpeg_buff, 0, NULL, mCBOpaque);
|
||||||
jpeg_buff->release(jpeg_buff);
|
jpeg_buff->release(jpeg_buff);
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Memory failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__);
|
ALOGE("%s: Memory failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Compression failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__);
|
ALOGE("%s: Compression failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ status_t EmulatedCamera::connectCamera(hw_device_t** device)
|
|||||||
|
|
||||||
status_t res = EINVAL;
|
status_t res = EINVAL;
|
||||||
EmulatedCameraDevice* const camera_dev = getCameraDevice();
|
EmulatedCameraDevice* const camera_dev = getCameraDevice();
|
||||||
LOGE_IF(camera_dev == NULL, "%s: No camera device instance.", __FUNCTION__);
|
ALOGE_IF(camera_dev == NULL, "%s: No camera device instance.", __FUNCTION__);
|
||||||
|
|
||||||
if (camera_dev != NULL) {
|
if (camera_dev != NULL) {
|
||||||
/* Connect to the camera device. */
|
/* Connect to the camera device. */
|
||||||
@@ -358,7 +358,7 @@ status_t EmulatedCamera::takePicture()
|
|||||||
/* We only have JPEG converted for NV21 format. */
|
/* We only have JPEG converted for NV21 format. */
|
||||||
org_fmt = V4L2_PIX_FMT_NV21;
|
org_fmt = V4L2_PIX_FMT_NV21;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unsupported pixel format %s", __FUNCTION__, pix_fmt);
|
ALOGE("%s: Unsupported pixel format %s", __FUNCTION__, pix_fmt);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
/* Get JPEG quality. */
|
/* Get JPEG quality. */
|
||||||
@@ -496,7 +496,7 @@ char* EmulatedCamera::getParameters()
|
|||||||
strncpy(ret_str, params.string(), params.length()+1);
|
strncpy(ret_str, params.string(), params.length()+1);
|
||||||
return ret_str;
|
return ret_str;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unable to allocate string for %s", __FUNCTION__, params.string());
|
ALOGE("%s: Unable to allocate string for %s", __FUNCTION__, params.string());
|
||||||
/* Apparently, we can't return NULL fron this routine. */
|
/* Apparently, we can't return NULL fron this routine. */
|
||||||
return &lNoParam;
|
return &lNoParam;
|
||||||
}
|
}
|
||||||
@@ -590,7 +590,7 @@ status_t EmulatedCamera::doStartPreview()
|
|||||||
pix_fmt = mParameters.getPreviewFormat();
|
pix_fmt = mParameters.getPreviewFormat();
|
||||||
}
|
}
|
||||||
if (pix_fmt == NULL) {
|
if (pix_fmt == NULL) {
|
||||||
LOGE("%s: Unable to obtain video format", __FUNCTION__);
|
ALOGE("%s: Unable to obtain video format", __FUNCTION__);
|
||||||
mPreviewWindow.stopPreview();
|
mPreviewWindow.stopPreview();
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -604,7 +604,7 @@ status_t EmulatedCamera::doStartPreview()
|
|||||||
} else if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_YUV420SP) == 0) {
|
} else if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_YUV420SP) == 0) {
|
||||||
org_fmt = V4L2_PIX_FMT_NV21;
|
org_fmt = V4L2_PIX_FMT_NV21;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unsupported pixel format %s", __FUNCTION__, pix_fmt);
|
ALOGE("%s: Unsupported pixel format %s", __FUNCTION__, pix_fmt);
|
||||||
mPreviewWindow.stopPreview();
|
mPreviewWindow.stopPreview();
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -695,7 +695,7 @@ int EmulatedCamera::set_preview_window(struct camera_device* dev,
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->setPreviewWindow(window);
|
return ec->setPreviewWindow(window);
|
||||||
@@ -711,7 +711,7 @@ void EmulatedCamera::set_callbacks(
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ec->setCallbacks(notify_cb, data_cb, data_cb_timestamp, get_memory, user);
|
ec->setCallbacks(notify_cb, data_cb, data_cb_timestamp, get_memory, user);
|
||||||
@@ -721,7 +721,7 @@ void EmulatedCamera::enable_msg_type(struct camera_device* dev, int32_t msg_type
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ec->enableMsgType(msg_type);
|
ec->enableMsgType(msg_type);
|
||||||
@@ -731,7 +731,7 @@ void EmulatedCamera::disable_msg_type(struct camera_device* dev, int32_t msg_typ
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ec->disableMsgType(msg_type);
|
ec->disableMsgType(msg_type);
|
||||||
@@ -741,7 +741,7 @@ int EmulatedCamera::msg_type_enabled(struct camera_device* dev, int32_t msg_type
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->isMsgTypeEnabled(msg_type);
|
return ec->isMsgTypeEnabled(msg_type);
|
||||||
@@ -751,7 +751,7 @@ int EmulatedCamera::start_preview(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->startPreview();
|
return ec->startPreview();
|
||||||
@@ -761,7 +761,7 @@ void EmulatedCamera::stop_preview(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ec->stopPreview();
|
ec->stopPreview();
|
||||||
@@ -771,7 +771,7 @@ int EmulatedCamera::preview_enabled(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->isPreviewEnabled();
|
return ec->isPreviewEnabled();
|
||||||
@@ -782,7 +782,7 @@ int EmulatedCamera::store_meta_data_in_buffers(struct camera_device* dev,
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->storeMetaDataInBuffers(enable);
|
return ec->storeMetaDataInBuffers(enable);
|
||||||
@@ -792,7 +792,7 @@ int EmulatedCamera::start_recording(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->startRecording();
|
return ec->startRecording();
|
||||||
@@ -802,7 +802,7 @@ void EmulatedCamera::stop_recording(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ec->stopRecording();
|
ec->stopRecording();
|
||||||
@@ -812,7 +812,7 @@ int EmulatedCamera::recording_enabled(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->isRecordingEnabled();
|
return ec->isRecordingEnabled();
|
||||||
@@ -823,7 +823,7 @@ void EmulatedCamera::release_recording_frame(struct camera_device* dev,
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ec->releaseRecordingFrame(opaque);
|
ec->releaseRecordingFrame(opaque);
|
||||||
@@ -833,7 +833,7 @@ int EmulatedCamera::auto_focus(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->setAutoFocus();
|
return ec->setAutoFocus();
|
||||||
@@ -843,7 +843,7 @@ int EmulatedCamera::cancel_auto_focus(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->cancelAutoFocus();
|
return ec->cancelAutoFocus();
|
||||||
@@ -853,7 +853,7 @@ int EmulatedCamera::take_picture(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->takePicture();
|
return ec->takePicture();
|
||||||
@@ -863,7 +863,7 @@ int EmulatedCamera::cancel_picture(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->cancelPicture();
|
return ec->cancelPicture();
|
||||||
@@ -873,7 +873,7 @@ int EmulatedCamera::set_parameters(struct camera_device* dev, const char* parms)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->setParameters(parms);
|
return ec->setParameters(parms);
|
||||||
@@ -883,7 +883,7 @@ char* EmulatedCamera::get_parameters(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return ec->getParameters();
|
return ec->getParameters();
|
||||||
@@ -893,7 +893,7 @@ void EmulatedCamera::put_parameters(struct camera_device* dev, char* params)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ec->putParameters(params);
|
ec->putParameters(params);
|
||||||
@@ -906,7 +906,7 @@ int EmulatedCamera::send_command(struct camera_device* dev,
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->sendCommand(cmd, arg1, arg2);
|
return ec->sendCommand(cmd, arg1, arg2);
|
||||||
@@ -916,7 +916,7 @@ void EmulatedCamera::release(struct camera_device* dev)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ec->releaseCamera();
|
ec->releaseCamera();
|
||||||
@@ -926,7 +926,7 @@ int EmulatedCamera::dump(struct camera_device* dev, int fd)
|
|||||||
{
|
{
|
||||||
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->dumpCamera(fd);
|
return ec->dumpCamera(fd);
|
||||||
@@ -937,7 +937,7 @@ int EmulatedCamera::close(struct hw_device_t* device)
|
|||||||
EmulatedCamera* ec =
|
EmulatedCamera* ec =
|
||||||
reinterpret_cast<EmulatedCamera*>(reinterpret_cast<struct camera_device*>(device)->priv);
|
reinterpret_cast<EmulatedCamera*>(reinterpret_cast<struct camera_device*>(device)->priv);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
LOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ec->closeCamera();
|
return ec->closeCamera();
|
||||||
@@ -997,7 +997,7 @@ static char* AddValue(const char* param, const char* val)
|
|||||||
const size_t len1 = strlen(param);
|
const size_t len1 = strlen(param);
|
||||||
const size_t len2 = strlen(val);
|
const size_t len2 = strlen(val);
|
||||||
char* ret = reinterpret_cast<char*>(malloc(len1 + len2 + 2));
|
char* ret = reinterpret_cast<char*>(malloc(len1 + len2 + 2));
|
||||||
LOGE_IF(ret == NULL, "%s: Memory failure", __FUNCTION__);
|
ALOGE_IF(ret == NULL, "%s: Memory failure", __FUNCTION__);
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
memcpy(ret, param, len1);
|
memcpy(ret, param, len1);
|
||||||
ret[len1] = ',';
|
ret[len1] = ',';
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ status_t EmulatedCameraDevice::Initialize()
|
|||||||
/* Instantiate worker thread object. */
|
/* Instantiate worker thread object. */
|
||||||
mWorkerThread = new WorkerThread(this);
|
mWorkerThread = new WorkerThread(this);
|
||||||
if (getWorkerThread() == NULL) {
|
if (getWorkerThread() == NULL) {
|
||||||
LOGE("%s: Unable to instantiate worker thread object", __FUNCTION__);
|
ALOGE("%s: Unable to instantiate worker thread object", __FUNCTION__);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,13 +87,13 @@ status_t EmulatedCameraDevice::startDeliveringFrames(bool one_burst)
|
|||||||
ALOGV("%s", __FUNCTION__);
|
ALOGV("%s", __FUNCTION__);
|
||||||
|
|
||||||
if (!isStarted()) {
|
if (!isStarted()) {
|
||||||
LOGE("%s: Device is not started", __FUNCTION__);
|
ALOGE("%s: Device is not started", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Frames will be delivered from the thread routine. */
|
/* Frames will be delivered from the thread routine. */
|
||||||
const status_t res = startWorkerThread(one_burst);
|
const status_t res = startWorkerThread(one_burst);
|
||||||
LOGE_IF(res != NO_ERROR, "%s: startWorkerThread failed", __FUNCTION__);
|
ALOGE_IF(res != NO_ERROR, "%s: startWorkerThread failed", __FUNCTION__);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ status_t EmulatedCameraDevice::stopDeliveringFrames()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const status_t res = stopWorkerThread();
|
const status_t res = stopWorkerThread();
|
||||||
LOGE_IF(res != NO_ERROR, "%s: startWorkerThread failed", __FUNCTION__);
|
ALOGE_IF(res != NO_ERROR, "%s: startWorkerThread failed", __FUNCTION__);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,11 +158,11 @@ void EmulatedCameraDevice::changeWhiteBalance(uint8_t& y,
|
|||||||
status_t EmulatedCameraDevice::getCurrentPreviewFrame(void* buffer)
|
status_t EmulatedCameraDevice::getCurrentPreviewFrame(void* buffer)
|
||||||
{
|
{
|
||||||
if (!isStarted()) {
|
if (!isStarted()) {
|
||||||
LOGE("%s: Device is not started", __FUNCTION__);
|
ALOGE("%s: Device is not started", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (mCurrentFrame == NULL || buffer == NULL) {
|
if (mCurrentFrame == NULL || buffer == NULL) {
|
||||||
LOGE("%s: No framebuffer", __FUNCTION__);
|
ALOGE("%s: No framebuffer", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ status_t EmulatedCameraDevice::getCurrentPreviewFrame(void* buffer)
|
|||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOGE("%s: Unknown pixel format %.4s",
|
ALOGE("%s: Unknown pixel format %.4s",
|
||||||
__FUNCTION__, reinterpret_cast<const char*>(&mPixelFormat));
|
__FUNCTION__, reinterpret_cast<const char*>(&mPixelFormat));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,7 @@ status_t EmulatedCameraDevice::commonStartDevice(int width,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOGE("%s: Unknown pixel format %.4s",
|
ALOGE("%s: Unknown pixel format %.4s",
|
||||||
__FUNCTION__, reinterpret_cast<const char*>(&pix_fmt));
|
__FUNCTION__, reinterpret_cast<const char*>(&pix_fmt));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ status_t EmulatedCameraDevice::commonStartDevice(int width,
|
|||||||
/* Allocate framebuffer. */
|
/* Allocate framebuffer. */
|
||||||
mCurrentFrame = new uint8_t[mFrameBufferSize];
|
mCurrentFrame = new uint8_t[mFrameBufferSize];
|
||||||
if (mCurrentFrame == NULL) {
|
if (mCurrentFrame == NULL) {
|
||||||
LOGE("%s: Unable to allocate framebuffer", __FUNCTION__);
|
ALOGE("%s: Unable to allocate framebuffer", __FUNCTION__);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
ALOGV("%s: Allocated %p %d bytes for %d pixels in %.4s[%dx%d] frame",
|
ALOGV("%s: Allocated %p %d bytes for %d pixels in %.4s[%dx%d] frame",
|
||||||
@@ -249,12 +249,12 @@ status_t EmulatedCameraDevice::startWorkerThread(bool one_burst)
|
|||||||
ALOGV("%s", __FUNCTION__);
|
ALOGV("%s", __FUNCTION__);
|
||||||
|
|
||||||
if (!isInitialized()) {
|
if (!isInitialized()) {
|
||||||
LOGE("%s: Emulated camera device is not initialized", __FUNCTION__);
|
ALOGE("%s: Emulated camera device is not initialized", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const status_t res = getWorkerThread()->startThread(one_burst);
|
const status_t res = getWorkerThread()->startThread(one_burst);
|
||||||
LOGE_IF(res != NO_ERROR, "%s: Unable to start worker thread", __FUNCTION__);
|
ALOGE_IF(res != NO_ERROR, "%s: Unable to start worker thread", __FUNCTION__);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,12 +263,12 @@ status_t EmulatedCameraDevice::stopWorkerThread()
|
|||||||
ALOGV("%s", __FUNCTION__);
|
ALOGV("%s", __FUNCTION__);
|
||||||
|
|
||||||
if (!isInitialized()) {
|
if (!isInitialized()) {
|
||||||
LOGE("%s: Emulated camera device is not initialized", __FUNCTION__);
|
ALOGE("%s: Emulated camera device is not initialized", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const status_t res = getWorkerThread()->stopThread();
|
const status_t res = getWorkerThread()->stopThread();
|
||||||
LOGE_IF(res != NO_ERROR, "%s: Unable to stop worker thread", __FUNCTION__);
|
ALOGE_IF(res != NO_ERROR, "%s: Unable to stop worker thread", __FUNCTION__);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@ status_t EmulatedCameraDevice::WorkerThread::readyToRun()
|
|||||||
ALOGV("Emulated device's worker thread has been started.");
|
ALOGV("Emulated device's worker thread has been started.");
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unable to create thread control FDs: %d -> %s",
|
ALOGE("%s: Unable to create thread control FDs: %d -> %s",
|
||||||
__FUNCTION__, errno, strerror(errno));
|
__FUNCTION__, errno, strerror(errno));
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
@@ -328,16 +328,16 @@ status_t EmulatedCameraDevice::WorkerThread::stopThread()
|
|||||||
}
|
}
|
||||||
ALOGV("Emulated camera device's worker thread has been stopped.");
|
ALOGV("Emulated camera device's worker thread has been stopped.");
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: requestExitAndWait failed: %d -> %s",
|
ALOGE("%s: requestExitAndWait failed: %d -> %s",
|
||||||
__FUNCTION__, res, strerror(-res));
|
__FUNCTION__, res, strerror(-res));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unable to send THREAD_STOP message: %d -> %s",
|
ALOGE("%s: Unable to send THREAD_STOP message: %d -> %s",
|
||||||
__FUNCTION__, errno, strerror(errno));
|
__FUNCTION__, errno, strerror(errno));
|
||||||
res = errno ? errno : EINVAL;
|
res = errno ? errno : EINVAL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Thread control FDs are not opened", __FUNCTION__);
|
ALOGE("%s: Thread control FDs are not opened", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@@ -363,7 +363,7 @@ EmulatedCameraDevice::WorkerThread::Select(int fd, int timeout)
|
|||||||
}
|
}
|
||||||
int res = TEMP_FAILURE_RETRY(select(fd_num, fds, NULL, NULL, tvp));
|
int res = TEMP_FAILURE_RETRY(select(fd_num, fds, NULL, NULL, tvp));
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
LOGE("%s: select returned %d and failed: %d -> %s",
|
ALOGE("%s: select returned %d and failed: %d -> %s",
|
||||||
__FUNCTION__, res, errno, strerror(errno));
|
__FUNCTION__, res, errno, strerror(errno));
|
||||||
return ERROR;
|
return ERROR;
|
||||||
} else if (res == 0) {
|
} else if (res == 0) {
|
||||||
@@ -374,7 +374,7 @@ EmulatedCameraDevice::WorkerThread::Select(int fd, int timeout)
|
|||||||
ControlMessage msg;
|
ControlMessage msg;
|
||||||
res = TEMP_FAILURE_RETRY(read(mControlFD, &msg, sizeof(msg)));
|
res = TEMP_FAILURE_RETRY(read(mControlFD, &msg, sizeof(msg)));
|
||||||
if (res != sizeof(msg)) {
|
if (res != sizeof(msg)) {
|
||||||
LOGE("%s: Unexpected message size %d, or an error %d -> %s",
|
ALOGE("%s: Unexpected message size %d, or an error %d -> %s",
|
||||||
__FUNCTION__, res, errno, strerror(errno));
|
__FUNCTION__, res, errno, strerror(errno));
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,7 @@ EmulatedCameraDevice::WorkerThread::Select(int fd, int timeout)
|
|||||||
ALOGV("%s: THREAD_STOP message is received", __FUNCTION__);
|
ALOGV("%s: THREAD_STOP message is received", __FUNCTION__);
|
||||||
return EXIT_THREAD;
|
return EXIT_THREAD;
|
||||||
} else {
|
} else {
|
||||||
LOGE("Unknown worker thread message %d", msg);
|
ALOGE("Unknown worker thread message %d", msg);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline int getFrameWidth() const
|
inline int getFrameWidth() const
|
||||||
{
|
{
|
||||||
LOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
|
ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
|
||||||
return mFrameWidth;
|
return mFrameWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline int getFrameHeight() const
|
inline int getFrameHeight() const
|
||||||
{
|
{
|
||||||
LOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
|
ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
|
||||||
return mFrameHeight;
|
return mFrameHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline size_t getFrameBufferSize() const
|
inline size_t getFrameBufferSize() const
|
||||||
{
|
{
|
||||||
LOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
|
ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
|
||||||
return mFrameBufferSize;
|
return mFrameBufferSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline int getPixelNum() const
|
inline int getPixelNum() const
|
||||||
{
|
{
|
||||||
LOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
|
ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
|
||||||
return mTotalPixels;
|
return mTotalPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline uint32_t getOriginalPixelFormat() const
|
inline uint32_t getOriginalPixelFormat() const
|
||||||
{
|
{
|
||||||
LOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
|
ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
|
||||||
return mPixelFormat;
|
return mPixelFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ EmulatedCameraFactory::EmulatedCameraFactory()
|
|||||||
if (mEmulatedCameras == NULL) {
|
if (mEmulatedCameras == NULL) {
|
||||||
mEmulatedCameras = new EmulatedCamera*[mEmulatedCameraNum];
|
mEmulatedCameras = new EmulatedCamera*[mEmulatedCameraNum];
|
||||||
if (mEmulatedCameras == NULL) {
|
if (mEmulatedCameras == NULL) {
|
||||||
LOGE("%s: Unable to allocate emulated camera array for %d entries",
|
ALOGE("%s: Unable to allocate emulated camera array for %d entries",
|
||||||
__FUNCTION__, mEmulatedCameraNum);
|
__FUNCTION__, mEmulatedCameraNum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ EmulatedCameraFactory::EmulatedCameraFactory()
|
|||||||
} else {
|
} else {
|
||||||
mEmulatedCameras--;
|
mEmulatedCameras--;
|
||||||
mFakeCameraID = -1;
|
mFakeCameraID = -1;
|
||||||
LOGE("%s: Unable to instantiate fake camera class", __FUNCTION__);
|
ALOGE("%s: Unable to instantiate fake camera class", __FUNCTION__);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ALOGD("Fake camera emulation is disabled.");
|
ALOGD("Fake camera emulation is disabled.");
|
||||||
@@ -119,12 +119,12 @@ int EmulatedCameraFactory::cameraDeviceOpen(int camera_id, hw_device_t** device)
|
|||||||
*device = NULL;
|
*device = NULL;
|
||||||
|
|
||||||
if (!isConstructedOK()) {
|
if (!isConstructedOK()) {
|
||||||
LOGE("%s: EmulatedCameraFactory has failed to initialize", __FUNCTION__);
|
ALOGE("%s: EmulatedCameraFactory has failed to initialize", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camera_id < 0 || camera_id >= getEmulatedCameraNum()) {
|
if (camera_id < 0 || camera_id >= getEmulatedCameraNum()) {
|
||||||
LOGE("%s: Camera id %d is out of bounds (%d)",
|
ALOGE("%s: Camera id %d is out of bounds (%d)",
|
||||||
__FUNCTION__, camera_id, getEmulatedCameraNum());
|
__FUNCTION__, camera_id, getEmulatedCameraNum());
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -137,12 +137,12 @@ int EmulatedCameraFactory::getCameraInfo(int camera_id, struct camera_info* info
|
|||||||
ALOGV("%s: id = %d", __FUNCTION__, camera_id);
|
ALOGV("%s: id = %d", __FUNCTION__, camera_id);
|
||||||
|
|
||||||
if (!isConstructedOK()) {
|
if (!isConstructedOK()) {
|
||||||
LOGE("%s: EmulatedCameraFactory has failed to initialize", __FUNCTION__);
|
ALOGE("%s: EmulatedCameraFactory has failed to initialize", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camera_id < 0 || camera_id >= getEmulatedCameraNum()) {
|
if (camera_id < 0 || camera_id >= getEmulatedCameraNum()) {
|
||||||
LOGE("%s: Camera id %d is out of bounds (%d)",
|
ALOGE("%s: Camera id %d is out of bounds (%d)",
|
||||||
__FUNCTION__, camera_id, getEmulatedCameraNum());
|
__FUNCTION__, camera_id, getEmulatedCameraNum());
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -164,12 +164,12 @@ int EmulatedCameraFactory::device_open(const hw_module_t* module,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (module != &HAL_MODULE_INFO_SYM.common) {
|
if (module != &HAL_MODULE_INFO_SYM.common) {
|
||||||
LOGE("%s: Invalid module %p expected %p",
|
ALOGE("%s: Invalid module %p expected %p",
|
||||||
__FUNCTION__, module, &HAL_MODULE_INFO_SYM.common);
|
__FUNCTION__, module, &HAL_MODULE_INFO_SYM.common);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
LOGE("%s: NULL name is not expected here", __FUNCTION__);
|
ALOGE("%s: NULL name is not expected here", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ void EmulatedCameraFactory::createQemuCameras()
|
|||||||
* one more entry for the fake camera emulation. */
|
* one more entry for the fake camera emulation. */
|
||||||
mEmulatedCameras = new EmulatedCamera*[num + 1];
|
mEmulatedCameras = new EmulatedCamera*[num + 1];
|
||||||
if (mEmulatedCameras == NULL) {
|
if (mEmulatedCameras == NULL) {
|
||||||
LOGE("%s: Unable to allocate emulated camera array for %d entries",
|
ALOGE("%s: Unable to allocate emulated camera array for %d entries",
|
||||||
__FUNCTION__, num + 1);
|
__FUNCTION__, num + 1);
|
||||||
free(camera_list);
|
free(camera_list);
|
||||||
return;
|
return;
|
||||||
@@ -292,7 +292,7 @@ void EmulatedCameraFactory::createQemuCameras()
|
|||||||
delete qemu_cam;
|
delete qemu_cam;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unable to instantiate EmulatedQemuCamera",
|
ALOGE("%s: Unable to instantiate EmulatedQemuCamera",
|
||||||
__FUNCTION__);
|
__FUNCTION__);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ status_t EmulatedFakeCameraDevice::connectDevice()
|
|||||||
|
|
||||||
Mutex::Autolock locker(&mObjectLock);
|
Mutex::Autolock locker(&mObjectLock);
|
||||||
if (!isInitialized()) {
|
if (!isInitialized()) {
|
||||||
LOGE("%s: Fake camera device is not initialized.", __FUNCTION__);
|
ALOGE("%s: Fake camera device is not initialized.", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
@@ -91,7 +91,7 @@ status_t EmulatedFakeCameraDevice::disconnectDevice()
|
|||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
if (isStarted()) {
|
if (isStarted()) {
|
||||||
LOGE("%s: Cannot disconnect from the started device.", __FUNCTION__);
|
ALOGE("%s: Cannot disconnect from the started device.", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,11 +109,11 @@ status_t EmulatedFakeCameraDevice::startDevice(int width,
|
|||||||
|
|
||||||
Mutex::Autolock locker(&mObjectLock);
|
Mutex::Autolock locker(&mObjectLock);
|
||||||
if (!isConnected()) {
|
if (!isConnected()) {
|
||||||
LOGE("%s: Fake camera device is not connected.", __FUNCTION__);
|
ALOGE("%s: Fake camera device is not connected.", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (isStarted()) {
|
if (isStarted()) {
|
||||||
LOGE("%s: Fake camera device is already started.", __FUNCTION__);
|
ALOGE("%s: Fake camera device is already started.", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ status_t EmulatedFakeCameraDevice::startDevice(int width,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOGE("%s: Unknown pixel format %.4s", __FUNCTION__,
|
ALOGE("%s: Unknown pixel format %.4s", __FUNCTION__,
|
||||||
reinterpret_cast<const char*>(&mPixelFormat));
|
reinterpret_cast<const char*>(&mPixelFormat));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ status_t EmulatedFakeCameraDevice::startDevice(int width,
|
|||||||
mUVInRow = (width / 2) * mUVStep;
|
mUVInRow = (width / 2) * mUVStep;
|
||||||
mState = ECDS_STARTED;
|
mState = ECDS_STARTED;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: commonStartDevice failed", __FUNCTION__);
|
ALOGE("%s: commonStartDevice failed", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ status_t EmulatedQemuCamera::Initialize(const char* device_name,
|
|||||||
/* Width and height are separated with 'x' */
|
/* Width and height are separated with 'x' */
|
||||||
char* sep = strchr(first_dim, 'x');
|
char* sep = strchr(first_dim, 'x');
|
||||||
if (sep == NULL) {
|
if (sep == NULL) {
|
||||||
LOGE("%s: Invalid first dimension format in %s",
|
ALOGE("%s: Invalid first dimension format in %s",
|
||||||
__FUNCTION__, frame_dims);
|
__FUNCTION__, frame_dims);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ status_t EmulatedQemuCameraDevice::connectDevice()
|
|||||||
|
|
||||||
Mutex::Autolock locker(&mObjectLock);
|
Mutex::Autolock locker(&mObjectLock);
|
||||||
if (!isInitialized()) {
|
if (!isInitialized()) {
|
||||||
LOGE("%s: Qemu camera device is not initialized.", __FUNCTION__);
|
ALOGE("%s: Qemu camera device is not initialized.", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
@@ -94,7 +94,7 @@ status_t EmulatedQemuCameraDevice::connectDevice()
|
|||||||
__FUNCTION__, (const char*)mDeviceName);
|
__FUNCTION__, (const char*)mDeviceName);
|
||||||
mState = ECDS_CONNECTED;
|
mState = ECDS_CONNECTED;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Connection to device '%s' failed",
|
ALOGE("%s: Connection to device '%s' failed",
|
||||||
__FUNCTION__, (const char*)mDeviceName);
|
__FUNCTION__, (const char*)mDeviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ status_t EmulatedQemuCameraDevice::disconnectDevice()
|
|||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
if (isStarted()) {
|
if (isStarted()) {
|
||||||
LOGE("%s: Cannot disconnect from the started device '%s.",
|
ALOGE("%s: Cannot disconnect from the started device '%s.",
|
||||||
__FUNCTION__, (const char*)mDeviceName);
|
__FUNCTION__, (const char*)mDeviceName);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ status_t EmulatedQemuCameraDevice::disconnectDevice()
|
|||||||
__FUNCTION__, (const char*)mDeviceName);
|
__FUNCTION__, (const char*)mDeviceName);
|
||||||
mState = ECDS_INITIALIZED;
|
mState = ECDS_INITIALIZED;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Disconnection from device '%s' failed",
|
ALOGE("%s: Disconnection from device '%s' failed",
|
||||||
__FUNCTION__, (const char*)mDeviceName);
|
__FUNCTION__, (const char*)mDeviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ status_t EmulatedQemuCameraDevice::startDevice(int width,
|
|||||||
|
|
||||||
Mutex::Autolock locker(&mObjectLock);
|
Mutex::Autolock locker(&mObjectLock);
|
||||||
if (!isConnected()) {
|
if (!isConnected()) {
|
||||||
LOGE("%s: Qemu camera device '%s' is not connected.",
|
ALOGE("%s: Qemu camera device '%s' is not connected.",
|
||||||
__FUNCTION__, (const char*)mDeviceName);
|
__FUNCTION__, (const char*)mDeviceName);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ status_t EmulatedQemuCameraDevice::startDevice(int width,
|
|||||||
|
|
||||||
status_t res = EmulatedCameraDevice::commonStartDevice(width, height, pix_fmt);
|
status_t res = EmulatedCameraDevice::commonStartDevice(width, height, pix_fmt);
|
||||||
if (res != NO_ERROR) {
|
if (res != NO_ERROR) {
|
||||||
LOGE("%s: commonStartDevice failed", __FUNCTION__);
|
ALOGE("%s: commonStartDevice failed", __FUNCTION__);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ status_t EmulatedQemuCameraDevice::startDevice(int width,
|
|||||||
* RGB32 only.*/
|
* RGB32 only.*/
|
||||||
mPreviewFrame = new uint32_t[mTotalPixels];
|
mPreviewFrame = new uint32_t[mTotalPixels];
|
||||||
if (mPreviewFrame == NULL) {
|
if (mPreviewFrame == NULL) {
|
||||||
LOGE("%s: Unable to allocate %d bytes for preview frame",
|
ALOGE("%s: Unable to allocate %d bytes for preview frame",
|
||||||
__FUNCTION__, mTotalPixels);
|
__FUNCTION__, mTotalPixels);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ status_t EmulatedQemuCameraDevice::startDevice(int width,
|
|||||||
mFrameWidth, mFrameHeight);
|
mFrameWidth, mFrameHeight);
|
||||||
mState = ECDS_STARTED;
|
mState = ECDS_STARTED;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unable to start device '%s' for %.4s[%dx%d] frames",
|
ALOGE("%s: Unable to start device '%s' for %.4s[%dx%d] frames",
|
||||||
__FUNCTION__, (const char*)mDeviceName,
|
__FUNCTION__, (const char*)mDeviceName,
|
||||||
reinterpret_cast<const char*>(&pix_fmt), width, height);
|
reinterpret_cast<const char*>(&pix_fmt), width, height);
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ status_t EmulatedQemuCameraDevice::stopDevice()
|
|||||||
ALOGV("%s: Qemu camera device '%s' is stopped",
|
ALOGV("%s: Qemu camera device '%s' is stopped",
|
||||||
__FUNCTION__, (const char*)mDeviceName);
|
__FUNCTION__, (const char*)mDeviceName);
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unable to stop device '%s'",
|
ALOGE("%s: Unable to stop device '%s'",
|
||||||
__FUNCTION__, (const char*)mDeviceName);
|
__FUNCTION__, (const char*)mDeviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ bool EmulatedQemuCameraDevice::inWorkerThread()
|
|||||||
mCameraHAL->onNextFrameAvailable(mCurrentFrame, mCurFrameTimestamp, this);
|
mCameraHAL->onNextFrameAvailable(mCurrentFrame, mCurFrameTimestamp, this);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unable to get current video frame: %s",
|
ALOGE("%s: Unable to get current video frame: %s",
|
||||||
__FUNCTION__, strerror(query_res));
|
__FUNCTION__, strerror(query_res));
|
||||||
mCameraHAL->onCameraDeviceError(CAMERA_ERROR_SERVER_DIED);
|
mCameraHAL->onCameraDeviceError(CAMERA_ERROR_SERVER_DIED);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ status_t NV21JpegCompressor::compressRawImage(const void* image,
|
|||||||
__FUNCTION__, (width * height * 12) / 8, width, height, mStream.getOffset());
|
__FUNCTION__, (width * height * 12) / 8, width, height, mStream.getOffset());
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: JPEG compression failed", __FUNCTION__);
|
ALOGE("%s: JPEG compression failed", __FUNCTION__);
|
||||||
return errno ? errno : EINVAL;
|
return errno ? errno : EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ status_t PreviewWindow::setPreviewWindow(struct preview_stream_ops* window,
|
|||||||
} else {
|
} else {
|
||||||
window = NULL;
|
window = NULL;
|
||||||
res = -res; // set_usage returns a negative errno.
|
res = -res; // set_usage returns a negative errno.
|
||||||
LOGE("%s: Error setting preview window usage %d -> %s",
|
ALOGE("%s: Error setting preview window usage %d -> %s",
|
||||||
__FUNCTION__, res, strerror(res));
|
__FUNCTION__, res, strerror(res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ void PreviewWindow::onNextFrameAvailable(const void* frame,
|
|||||||
mPreviewFrameHeight,
|
mPreviewFrameHeight,
|
||||||
HAL_PIXEL_FORMAT_RGBA_8888);
|
HAL_PIXEL_FORMAT_RGBA_8888);
|
||||||
if (res != NO_ERROR) {
|
if (res != NO_ERROR) {
|
||||||
LOGE("%s: Error in set_buffers_geometry %d -> %s",
|
ALOGE("%s: Error in set_buffers_geometry %d -> %s",
|
||||||
__FUNCTION__, -res, strerror(-res));
|
__FUNCTION__, -res, strerror(-res));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ void PreviewWindow::onNextFrameAvailable(const void* frame,
|
|||||||
int stride = 0;
|
int stride = 0;
|
||||||
res = mPreviewWindow->dequeue_buffer(mPreviewWindow, &buffer, &stride);
|
res = mPreviewWindow->dequeue_buffer(mPreviewWindow, &buffer, &stride);
|
||||||
if (res != NO_ERROR || buffer == NULL) {
|
if (res != NO_ERROR || buffer == NULL) {
|
||||||
LOGE("%s: Unable to dequeue preview window buffer: %d -> %s",
|
ALOGE("%s: Unable to dequeue preview window buffer: %d -> %s",
|
||||||
__FUNCTION__, -res, strerror(-res));
|
__FUNCTION__, -res, strerror(-res));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ void PreviewWindow::onNextFrameAvailable(const void* frame,
|
|||||||
/* Let the preview window to lock the buffer. */
|
/* Let the preview window to lock the buffer. */
|
||||||
res = mPreviewWindow->lock_buffer(mPreviewWindow, buffer);
|
res = mPreviewWindow->lock_buffer(mPreviewWindow, buffer);
|
||||||
if (res != NO_ERROR) {
|
if (res != NO_ERROR) {
|
||||||
LOGE("%s: Unable to lock preview window buffer: %d -> %s",
|
ALOGE("%s: Unable to lock preview window buffer: %d -> %s",
|
||||||
__FUNCTION__, -res, strerror(-res));
|
__FUNCTION__, -res, strerror(-res));
|
||||||
mPreviewWindow->cancel_buffer(mPreviewWindow, buffer);
|
mPreviewWindow->cancel_buffer(mPreviewWindow, buffer);
|
||||||
return;
|
return;
|
||||||
@@ -161,7 +161,7 @@ void PreviewWindow::onNextFrameAvailable(const void* frame,
|
|||||||
GraphicBufferMapper& grbuffer_mapper(GraphicBufferMapper::get());
|
GraphicBufferMapper& grbuffer_mapper(GraphicBufferMapper::get());
|
||||||
res = grbuffer_mapper.lock(*buffer, GRALLOC_USAGE_SW_WRITE_OFTEN, rect, &img);
|
res = grbuffer_mapper.lock(*buffer, GRALLOC_USAGE_SW_WRITE_OFTEN, rect, &img);
|
||||||
if (res != NO_ERROR) {
|
if (res != NO_ERROR) {
|
||||||
LOGE("%s: grbuffer_mapper.lock failure: %d -> %s",
|
ALOGE("%s: grbuffer_mapper.lock failure: %d -> %s",
|
||||||
__FUNCTION__, res, strerror(res));
|
__FUNCTION__, res, strerror(res));
|
||||||
mPreviewWindow->cancel_buffer(mPreviewWindow, buffer);
|
mPreviewWindow->cancel_buffer(mPreviewWindow, buffer);
|
||||||
return;
|
return;
|
||||||
@@ -174,7 +174,7 @@ void PreviewWindow::onNextFrameAvailable(const void* frame,
|
|||||||
/* Show it. */
|
/* Show it. */
|
||||||
mPreviewWindow->enqueue_buffer(mPreviewWindow, buffer);
|
mPreviewWindow->enqueue_buffer(mPreviewWindow, buffer);
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unable to obtain preview frame: %d", __FUNCTION__, res);
|
ALOGE("%s: Unable to obtain preview frame: %d", __FUNCTION__, res);
|
||||||
mPreviewWindow->cancel_buffer(mPreviewWindow, buffer);
|
mPreviewWindow->cancel_buffer(mPreviewWindow, buffer);
|
||||||
}
|
}
|
||||||
grbuffer_mapper.unlock(*buffer);
|
grbuffer_mapper.unlock(*buffer);
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ status_t QemuQuery::createQuery(const char* name, const char* param)
|
|||||||
|
|
||||||
/* Query name cannot be NULL or an empty string. */
|
/* Query name cannot be NULL or an empty string. */
|
||||||
if (name == NULL || *name == '\0') {
|
if (name == NULL || *name == '\0') {
|
||||||
LOGE("%s: NULL or an empty string is passed as query name.",
|
ALOGE("%s: NULL or an empty string is passed as query name.",
|
||||||
__FUNCTION__);
|
__FUNCTION__);
|
||||||
mQueryDeliveryStatus = EINVAL;
|
mQueryDeliveryStatus = EINVAL;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
@@ -100,7 +100,7 @@ status_t QemuQuery::createQuery(const char* name, const char* param)
|
|||||||
/* Preallocated buffer was too small. Allocate a bigger query buffer. */
|
/* Preallocated buffer was too small. Allocate a bigger query buffer. */
|
||||||
mQuery = new char[required];
|
mQuery = new char[required];
|
||||||
if (mQuery == NULL) {
|
if (mQuery == NULL) {
|
||||||
LOGE("%s: Unable to allocate %d bytes for query buffer",
|
ALOGE("%s: Unable to allocate %d bytes for query buffer",
|
||||||
__FUNCTION__, required);
|
__FUNCTION__, required);
|
||||||
mQueryDeliveryStatus = ENOMEM;
|
mQueryDeliveryStatus = ENOMEM;
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
@@ -131,7 +131,7 @@ status_t QemuQuery::completeQuery(status_t status)
|
|||||||
* with a ':'. If there is no more data in the reply, the prefix will be
|
* with a ':'. If there is no more data in the reply, the prefix will be
|
||||||
* zero-terminated, and the terminator will be inculded in the reply. */
|
* zero-terminated, and the terminator will be inculded in the reply. */
|
||||||
if (mReplyBuffer == NULL || mReplySize < 3) {
|
if (mReplyBuffer == NULL || mReplySize < 3) {
|
||||||
LOGE("%s: Invalid reply to the query", __FUNCTION__);
|
ALOGE("%s: Invalid reply to the query", __FUNCTION__);
|
||||||
mQueryDeliveryStatus = EINVAL;
|
mQueryDeliveryStatus = EINVAL;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ status_t QemuQuery::completeQuery(status_t status)
|
|||||||
} else if (!memcmp(mReplyBuffer, "ko", 2)) {
|
} else if (!memcmp(mReplyBuffer, "ko", 2)) {
|
||||||
mReplyStatus = 0;
|
mReplyStatus = 0;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Invalid query reply: '%s'", __FUNCTION__, mReplyBuffer);
|
ALOGE("%s: Invalid query reply: '%s'", __FUNCTION__, mReplyBuffer);
|
||||||
mQueryDeliveryStatus = EINVAL;
|
mQueryDeliveryStatus = EINVAL;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ status_t QemuQuery::completeQuery(status_t status)
|
|||||||
/* There are extra data. Make sure they are separated from the status
|
/* There are extra data. Make sure they are separated from the status
|
||||||
* with a ':' */
|
* with a ':' */
|
||||||
if (mReplyBuffer[2] != ':') {
|
if (mReplyBuffer[2] != ':') {
|
||||||
LOGE("%s: Invalid query reply: '%s'", __FUNCTION__, mReplyBuffer);
|
ALOGE("%s: Invalid query reply: '%s'", __FUNCTION__, mReplyBuffer);
|
||||||
mQueryDeliveryStatus = EINVAL;
|
mQueryDeliveryStatus = EINVAL;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ status_t QemuQuery::completeQuery(status_t status)
|
|||||||
/* Make sure reply buffer containing just 'ok'/'ko' ends with
|
/* Make sure reply buffer containing just 'ok'/'ko' ends with
|
||||||
* zero-terminator. */
|
* zero-terminator. */
|
||||||
if (mReplyBuffer[2] != '\0') {
|
if (mReplyBuffer[2] != '\0') {
|
||||||
LOGE("%s: Invalid query reply: '%s'", __FUNCTION__, mReplyBuffer);
|
ALOGE("%s: Invalid query reply: '%s'", __FUNCTION__, mReplyBuffer);
|
||||||
mQueryDeliveryStatus = EINVAL;
|
mQueryDeliveryStatus = EINVAL;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ status_t QemuClient::connectClient(const char* param)
|
|||||||
|
|
||||||
/* Make sure that client is not connected already. */
|
/* Make sure that client is not connected already. */
|
||||||
if (mPipeFD >= 0) {
|
if (mPipeFD >= 0) {
|
||||||
LOGE("%s: Qemu client is already connected", __FUNCTION__);
|
ALOGE("%s: Qemu client is already connected", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ status_t QemuClient::connectClient(const char* param)
|
|||||||
delete[] connection_str;
|
delete[] connection_str;
|
||||||
}
|
}
|
||||||
if (mPipeFD < 0) {
|
if (mPipeFD < 0) {
|
||||||
LOGE("%s: Unable to connect to the camera service '%s': %s",
|
ALOGE("%s: Unable to connect to the camera service '%s': %s",
|
||||||
__FUNCTION__, param ? param : "Factory", strerror(errno));
|
__FUNCTION__, param ? param : "Factory", strerror(errno));
|
||||||
return errno ? errno : EINVAL;
|
return errno ? errno : EINVAL;
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ void QemuClient::disconnectClient()
|
|||||||
status_t QemuClient::sendMessage(const void* data, size_t data_size)
|
status_t QemuClient::sendMessage(const void* data, size_t data_size)
|
||||||
{
|
{
|
||||||
if (mPipeFD < 0) {
|
if (mPipeFD < 0) {
|
||||||
LOGE("%s: Qemu client is not connected", __FUNCTION__);
|
ALOGE("%s: Qemu client is not connected", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ status_t QemuClient::sendMessage(const void* data, size_t data_size)
|
|||||||
if (written == data_size) {
|
if (written == data_size) {
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Error sending data via qemu pipe: '%s'",
|
ALOGE("%s: Error sending data via qemu pipe: '%s'",
|
||||||
__FUNCTION__, strerror(errno));
|
__FUNCTION__, strerror(errno));
|
||||||
return errno ? errno : EIO;
|
return errno ? errno : EIO;
|
||||||
}
|
}
|
||||||
@@ -282,7 +282,7 @@ status_t QemuClient::receiveMessage(void** data, size_t* data_size)
|
|||||||
*data_size = 0;
|
*data_size = 0;
|
||||||
|
|
||||||
if (mPipeFD < 0) {
|
if (mPipeFD < 0) {
|
||||||
LOGE("%s: Qemu client is not connected", __FUNCTION__);
|
ALOGE("%s: Qemu client is not connected", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ status_t QemuClient::receiveMessage(void** data, size_t* data_size)
|
|||||||
char payload_size_str[9];
|
char payload_size_str[9];
|
||||||
int rd_res = qemud_fd_read(mPipeFD, payload_size_str, 8);
|
int rd_res = qemud_fd_read(mPipeFD, payload_size_str, 8);
|
||||||
if (rd_res != 8) {
|
if (rd_res != 8) {
|
||||||
LOGE("%s: Unable to obtain payload size: %s",
|
ALOGE("%s: Unable to obtain payload size: %s",
|
||||||
__FUNCTION__, strerror(errno));
|
__FUNCTION__, strerror(errno));
|
||||||
return errno ? errno : EIO;
|
return errno ? errno : EIO;
|
||||||
}
|
}
|
||||||
@@ -304,14 +304,14 @@ status_t QemuClient::receiveMessage(void** data, size_t* data_size)
|
|||||||
payload_size_str[8] = '\0';
|
payload_size_str[8] = '\0';
|
||||||
payload_size = strtol(payload_size_str, NULL, 16);
|
payload_size = strtol(payload_size_str, NULL, 16);
|
||||||
if (errno) {
|
if (errno) {
|
||||||
LOGE("%s: Invalid payload size '%s'", __FUNCTION__, payload_size_str);
|
ALOGE("%s: Invalid payload size '%s'", __FUNCTION__, payload_size_str);
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate payload data buffer, and read the payload there. */
|
/* Allocate payload data buffer, and read the payload there. */
|
||||||
*data = malloc(payload_size);
|
*data = malloc(payload_size);
|
||||||
if (*data == NULL) {
|
if (*data == NULL) {
|
||||||
LOGE("%s: Unable to allocate %d bytes payload buffer",
|
ALOGE("%s: Unable to allocate %d bytes payload buffer",
|
||||||
__FUNCTION__, payload_size);
|
__FUNCTION__, payload_size);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -320,7 +320,7 @@ status_t QemuClient::receiveMessage(void** data, size_t* data_size)
|
|||||||
*data_size = payload_size;
|
*data_size = payload_size;
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Read size %d doesnt match expected payload size %d: %s",
|
ALOGE("%s: Read size %d doesnt match expected payload size %d: %s",
|
||||||
__FUNCTION__, rd_res, payload_size, strerror(errno));
|
__FUNCTION__, rd_res, payload_size, strerror(errno));
|
||||||
free(*data);
|
free(*data);
|
||||||
*data = NULL;
|
*data = NULL;
|
||||||
@@ -332,7 +332,7 @@ status_t QemuClient::doQuery(QemuQuery* query)
|
|||||||
{
|
{
|
||||||
/* Make sure that query has been successfuly constructed. */
|
/* Make sure that query has been successfuly constructed. */
|
||||||
if (query->mQueryDeliveryStatus != NO_ERROR) {
|
if (query->mQueryDeliveryStatus != NO_ERROR) {
|
||||||
LOGE("%s: Query is invalid", __FUNCTION__);
|
ALOGE("%s: Query is invalid", __FUNCTION__);
|
||||||
return query->mQueryDeliveryStatus;
|
return query->mQueryDeliveryStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,17 +348,17 @@ status_t QemuClient::doQuery(QemuQuery* query)
|
|||||||
LOGQ("Response to query '%s': Status = '%.2s', %d bytes in response",
|
LOGQ("Response to query '%s': Status = '%.2s', %d bytes in response",
|
||||||
query->mQuery, query->mReplyBuffer, query->mReplySize);
|
query->mQuery, query->mReplyBuffer, query->mReplySize);
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s Response to query '%s' has failed: %s",
|
ALOGE("%s Response to query '%s' has failed: %s",
|
||||||
__FUNCTION__, query->mQuery, strerror(res));
|
__FUNCTION__, query->mQuery, strerror(res));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Send query '%s' failed: %s",
|
ALOGE("%s: Send query '%s' failed: %s",
|
||||||
__FUNCTION__, query->mQuery, strerror(res));
|
__FUNCTION__, query->mQuery, strerror(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Complete the query, and return its completion handling status. */
|
/* Complete the query, and return its completion handling status. */
|
||||||
const status_t res1 = query->completeQuery(res);
|
const status_t res1 = query->completeQuery(res);
|
||||||
LOGE_IF(res1 != NO_ERROR && res1 != res,
|
ALOGE_IF(res1 != NO_ERROR && res1 != res,
|
||||||
"%s: Error %d in query '%s' completion",
|
"%s: Error %d in query '%s' completion",
|
||||||
__FUNCTION__, res1, query->mQuery);
|
__FUNCTION__, res1, query->mQuery);
|
||||||
return res1;
|
return res1;
|
||||||
@@ -390,14 +390,14 @@ status_t FactoryQemuClient::listCameras(char** list)
|
|||||||
|
|
||||||
QemuQuery query(mQueryList);
|
QemuQuery query(mQueryList);
|
||||||
if (doQuery(&query) || !query.isQuerySucceeded()) {
|
if (doQuery(&query) || !query.isQuerySucceeded()) {
|
||||||
LOGE("%s: List cameras query failed: %s", __FUNCTION__,
|
ALOGE("%s: List cameras query failed: %s", __FUNCTION__,
|
||||||
query.mReplyData ? query.mReplyData : "No error message");
|
query.mReplyData ? query.mReplyData : "No error message");
|
||||||
return query.getCompletionStatus();
|
return query.getCompletionStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure there is a list returned. */
|
/* Make sure there is a list returned. */
|
||||||
if (query.mReplyDataSize == 0) {
|
if (query.mReplyDataSize == 0) {
|
||||||
LOGE("%s: No camera list is returned.", __FUNCTION__);
|
ALOGE("%s: No camera list is returned.", __FUNCTION__);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ status_t FactoryQemuClient::listCameras(char** list)
|
|||||||
ALOGD("Emulated camera list: %s", *list);
|
ALOGD("Emulated camera list: %s", *list);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Unable to allocate %d bytes",
|
ALOGE("%s: Unable to allocate %d bytes",
|
||||||
__FUNCTION__, query.mReplyDataSize);
|
__FUNCTION__, query.mReplyDataSize);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,7 @@ status_t CameraQemuClient::queryConnect()
|
|||||||
QemuQuery query(mQueryConnect);
|
QemuQuery query(mQueryConnect);
|
||||||
doQuery(&query);
|
doQuery(&query);
|
||||||
const status_t res = query.getCompletionStatus();
|
const status_t res = query.getCompletionStatus();
|
||||||
LOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
|
ALOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
|
||||||
__FUNCTION__, query.mReplyData ? query.mReplyData :
|
__FUNCTION__, query.mReplyData ? query.mReplyData :
|
||||||
"No error message");
|
"No error message");
|
||||||
return res;
|
return res;
|
||||||
@@ -463,7 +463,7 @@ status_t CameraQemuClient::queryDisconnect()
|
|||||||
QemuQuery query(mQueryDisconnect);
|
QemuQuery query(mQueryDisconnect);
|
||||||
doQuery(&query);
|
doQuery(&query);
|
||||||
const status_t res = query.getCompletionStatus();
|
const status_t res = query.getCompletionStatus();
|
||||||
LOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
|
ALOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
|
||||||
__FUNCTION__, query.mReplyData ? query.mReplyData :
|
__FUNCTION__, query.mReplyData ? query.mReplyData :
|
||||||
"No error message");
|
"No error message");
|
||||||
return res;
|
return res;
|
||||||
@@ -481,7 +481,7 @@ status_t CameraQemuClient::queryStart(uint32_t pixel_format,
|
|||||||
QemuQuery query(query_str);
|
QemuQuery query(query_str);
|
||||||
doQuery(&query);
|
doQuery(&query);
|
||||||
const status_t res = query.getCompletionStatus();
|
const status_t res = query.getCompletionStatus();
|
||||||
LOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
|
ALOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
|
||||||
__FUNCTION__, query.mReplyData ? query.mReplyData :
|
__FUNCTION__, query.mReplyData ? query.mReplyData :
|
||||||
"No error message");
|
"No error message");
|
||||||
return res;
|
return res;
|
||||||
@@ -494,7 +494,7 @@ status_t CameraQemuClient::queryStop()
|
|||||||
QemuQuery query(mQueryStop);
|
QemuQuery query(mQueryStop);
|
||||||
doQuery(&query);
|
doQuery(&query);
|
||||||
const status_t res = query.getCompletionStatus();
|
const status_t res = query.getCompletionStatus();
|
||||||
LOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
|
ALOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
|
||||||
__FUNCTION__, query.mReplyData ? query.mReplyData :
|
__FUNCTION__, query.mReplyData ? query.mReplyData :
|
||||||
"No error message");
|
"No error message");
|
||||||
return res;
|
return res;
|
||||||
@@ -520,7 +520,7 @@ status_t CameraQemuClient::queryFrame(void* vframe,
|
|||||||
doQuery(&query);
|
doQuery(&query);
|
||||||
const status_t res = query.getCompletionStatus();
|
const status_t res = query.getCompletionStatus();
|
||||||
if( res != NO_ERROR) {
|
if( res != NO_ERROR) {
|
||||||
LOGE("%s: Query failed: %s",
|
ALOGE("%s: Query failed: %s",
|
||||||
__FUNCTION__, query.mReplyData ? query.mReplyData :
|
__FUNCTION__, query.mReplyData ? query.mReplyData :
|
||||||
"No error message");
|
"No error message");
|
||||||
return res;
|
return res;
|
||||||
@@ -536,7 +536,7 @@ status_t CameraQemuClient::queryFrame(void* vframe,
|
|||||||
memcpy(vframe, frame, vframe_size);
|
memcpy(vframe, frame, vframe_size);
|
||||||
cur_offset += vframe_size;
|
cur_offset += vframe_size;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Reply %d bytes is to small to contain %d bytes video frame",
|
ALOGE("%s: Reply %d bytes is to small to contain %d bytes video frame",
|
||||||
__FUNCTION__, query.mReplyDataSize - cur_offset, vframe_size);
|
__FUNCTION__, query.mReplyDataSize - cur_offset, vframe_size);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -547,7 +547,7 @@ status_t CameraQemuClient::queryFrame(void* vframe,
|
|||||||
memcpy(pframe, frame + cur_offset, pframe_size);
|
memcpy(pframe, frame + cur_offset, pframe_size);
|
||||||
cur_offset += pframe_size;
|
cur_offset += pframe_size;
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s: Reply %d bytes is to small to contain %d bytes preview frame",
|
ALOGE("%s: Reply %d bytes is to small to contain %d bytes preview frame",
|
||||||
__FUNCTION__, query.mReplyDataSize - cur_offset, pframe_size);
|
__FUNCTION__, query.mReplyDataSize - cur_offset, pframe_size);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -686,13 +686,13 @@ gps_state_thread( void* arg )
|
|||||||
nevents = epoll_wait( epoll_fd, events, 2, -1 );
|
nevents = epoll_wait( epoll_fd, events, 2, -1 );
|
||||||
if (nevents < 0) {
|
if (nevents < 0) {
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
LOGE("epoll_wait() unexpected error: %s", strerror(errno));
|
ALOGE("epoll_wait() unexpected error: %s", strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
D("gps thread received %d events", nevents);
|
D("gps thread received %d events", nevents);
|
||||||
for (ne = 0; ne < nevents; ne++) {
|
for (ne = 0; ne < nevents; ne++) {
|
||||||
if ((events[ne].events & (EPOLLERR|EPOLLHUP)) != 0) {
|
if ((events[ne].events & (EPOLLERR|EPOLLHUP)) != 0) {
|
||||||
LOGE("EPOLLERR or EPOLLHUP after epoll_wait() !?");
|
ALOGE("EPOLLERR or EPOLLHUP after epoll_wait() !?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((events[ne].events & EPOLLIN) != 0) {
|
if ((events[ne].events & EPOLLIN) != 0) {
|
||||||
@@ -738,7 +738,7 @@ gps_state_thread( void* arg )
|
|||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
if (errno != EWOULDBLOCK)
|
if (errno != EWOULDBLOCK)
|
||||||
LOGE("error while reading from gps daemon socket: %s:", strerror(errno));
|
ALOGE("error while reading from gps daemon socket: %s:", strerror(errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
D("received %d bytes: %.*s", ret, ret, buff);
|
D("received %d bytes: %.*s", ret, ret, buff);
|
||||||
@@ -749,7 +749,7 @@ gps_state_thread( void* arg )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGE("epoll_wait() returned unkown fd %d ?", fd);
|
ALOGE("epoll_wait() returned unkown fd %d ?", fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -775,14 +775,14 @@ gps_state_init( GpsState* state, GpsCallbacks* callbacks )
|
|||||||
D("gps emulation will read from '%s' qemud channel", QEMU_CHANNEL_NAME );
|
D("gps emulation will read from '%s' qemud channel", QEMU_CHANNEL_NAME );
|
||||||
|
|
||||||
if ( socketpair( AF_LOCAL, SOCK_STREAM, 0, state->control ) < 0 ) {
|
if ( socketpair( AF_LOCAL, SOCK_STREAM, 0, state->control ) < 0 ) {
|
||||||
LOGE("could not create thread control socket pair: %s", strerror(errno));
|
ALOGE("could not create thread control socket pair: %s", strerror(errno));
|
||||||
goto Fail;
|
goto Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
state->thread = callbacks->create_thread_cb( "gps_state_thread", gps_state_thread, state );
|
state->thread = callbacks->create_thread_cb( "gps_state_thread", gps_state_thread, state );
|
||||||
|
|
||||||
if ( !state->thread ) {
|
if ( !state->thread ) {
|
||||||
LOGE("could not create gps thread: %s", strerror(errno));
|
ALOGE("could not create gps thread: %s", strerror(errno));
|
||||||
goto Fail;
|
goto Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
# define D(...) do{}while(0)
|
# define D(...) do{}while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define E(...) LOGE(__VA_ARGS__)
|
#define E(...) ALOGE(__VA_ARGS__)
|
||||||
|
|
||||||
/* Get brightness(0~255) from state. */
|
/* Get brightness(0~255) from state. */
|
||||||
static int
|
static int
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#define D(...) ((void)0)
|
#define D(...) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define E(...) LOGE(__VA_ARGS__)
|
#define E(...) ALOGE(__VA_ARGS__)
|
||||||
|
|
||||||
#include <hardware/qemud.h>
|
#include <hardware/qemud.h>
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ pick_sensor(SensorPoll* data,
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOGE("No sensor to return!!! pendingSensors=%08x", data->pendingSensors);
|
ALOGE("No sensor to return!!! pendingSensors=%08x", data->pendingSensors);
|
||||||
// we may end-up in a busy loop, slow things down, just in case.
|
// we may end-up in a busy loop, slow things down, just in case.
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user