am d4e70620: am 72c3f7d8: Revert "ConsumerBase: free buffers outside the lock"
* commit 'd4e706208c99ff1716fb0009ec867ff29ff04a7c':
Revert "ConsumerBase: free buffers outside the lock"
diff --git a/include/utils/Compat.h b/include/utils/Compat.h
index 1819266..fb7748e 100644
--- a/include/utils/Compat.h
+++ b/include/utils/Compat.h
@@ -39,4 +39,27 @@
#endif /* !HAVE_OFF64_T */
+#if HAVE_PRINTF_ZD
+# define ZD "%zd"
+# define ZD_TYPE ssize_t
+#else
+# define ZD "%ld"
+# define ZD_TYPE long
+#endif
+
+/*
+ * TEMP_FAILURE_RETRY is defined by some, but not all, versions of
+ * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
+ * not already defined, then define it here.
+ */
+#ifndef TEMP_FAILURE_RETRY
+/* Used to retry syscalls that can return EINTR. */
+#define TEMP_FAILURE_RETRY(exp) ({ \
+ typeof (exp) _rc; \
+ do { \
+ _rc = (exp); \
+ } while (_rc == -1 && errno == EINTR); \
+ _rc; })
+#endif
+
#endif /* __LIB_UTILS_COMPAT_H */
diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp
index ef49c0f..a1bfedb 100644
--- a/libs/utils/ZipFileRO.cpp
+++ b/libs/utils/ZipFileRO.cpp
@@ -20,6 +20,7 @@
#define LOG_TAG "zipro"
//#define LOG_NDEBUG 0
#include <utils/Log.h>
+#include <utils/Compat.h>
#include <utils/ZipFileRO.h>
#include <utils/misc.h>
#include <utils/threads.h>
@@ -32,14 +33,6 @@
#include <assert.h>
#include <unistd.h>
-#if HAVE_PRINTF_ZD
-# define ZD "%zd"
-# define ZD_TYPE ssize_t
-#else
-# define ZD "%ld"
-# define ZD_TYPE long
-#endif
-
/*
* We must open binary files using open(path, ... | O_BINARY) under Windows.
* Otherwise strange read errors will happen.
@@ -48,21 +41,6 @@
# define O_BINARY 0
#endif
-/*
- * TEMP_FAILURE_RETRY is defined by some, but not all, versions of
- * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
- * not already defined, then define it here.
- */
-#ifndef TEMP_FAILURE_RETRY
-/* Used to retry syscalls that can return EINTR. */
-#define TEMP_FAILURE_RETRY(exp) ({ \
- typeof (exp) _rc; \
- do { \
- _rc = (exp); \
- } while (_rc == -1 && errno == EINTR); \
- _rc; })
-#endif
-
using namespace android;
/*
diff --git a/libs/utils/ZipUtils.cpp b/libs/utils/ZipUtils.cpp
index cf5467b..a43bbb0 100644
--- a/libs/utils/ZipUtils.cpp
+++ b/libs/utils/ZipUtils.cpp
@@ -21,6 +21,7 @@
#define LOG_TAG "ziputil"
#include <utils/Log.h>
+#include <utils/Compat.h>
#include <utils/ZipUtils.h>
#include <utils/ZipFileRO.h>
@@ -98,10 +99,11 @@
ALOGV("+++ reading %ld bytes (%ld left)\n",
getSize, compRemaining);
- int cc = read(fd, readBuf, getSize);
- if (cc != (int) getSize) {
- ALOGD("inflate read failed (%d vs %ld)\n",
- cc, getSize);
+ int cc = TEMP_FAILURE_RETRY(read(fd, readBuf, getSize));
+ if (cc < 0) {
+ ALOGW("inflate read failed: %s", strerror(errno));
+ } else if (cc != (int) getSize) {
+ ALOGW("inflate read failed (%d vs %ld)", cc, getSize);
goto z_bail;
}
diff --git a/libs/utils/tests/Android.mk b/libs/utils/tests/Android.mk
index 0a5b379..5b2b5b1 100644
--- a/libs/utils/tests/Android.mk
+++ b/libs/utils/tests/Android.mk
@@ -4,42 +4,30 @@
# Build the unit tests.
test_src_files := \
- BasicHashtable_test.cpp \
- BlobCache_test.cpp \
- Looper_test.cpp \
- String8_test.cpp \
- Unicode_test.cpp \
- Vector_test.cpp \
- ZipFileRO_test.cpp
+ BasicHashtable_test.cpp \
+ BlobCache_test.cpp \
+ Looper_test.cpp \
+ String8_test.cpp \
+ Unicode_test.cpp \
+ Vector_test.cpp \
+ ZipFileRO_test.cpp
shared_libraries := \
- libz \
- liblog \
- libcutils \
- libutils \
- libstlport
+ libz \
+ liblog \
+ libcutils \
+ libutils \
+ libstlport
static_libraries := \
- libgtest \
- libgtest_main
-
-c_includes := \
- external/zlib \
- external/icu4c/common \
- bionic \
- bionic/libstdc++/include \
- external/gtest/include \
- external/stlport/stlport
-
-module_tags := eng tests
+ libgtest \
+ libgtest_main
$(foreach file,$(test_src_files), \
$(eval include $(CLEAR_VARS)) \
$(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \
$(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \
- $(eval LOCAL_C_INCLUDES := $(c_includes)) \
$(eval LOCAL_SRC_FILES := $(file)) \
$(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
- $(eval LOCAL_MODULE_TAGS := $(module_tags)) \
- $(eval include $(BUILD_EXECUTABLE)) \
+ $(eval include $(BUILD_NATIVE_TEST)) \
)
diff --git a/opengl/include/GLES2/gl2.h b/opengl/include/GLES2/gl2.h
index e1d3b87..c139c25 100644
--- a/opengl/include/GLES2/gl2.h
+++ b/opengl/include/GLES2/gl2.h
@@ -528,7 +528,7 @@
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
-GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL GLenum GL_APIENTRY glGetError (void);
@@ -547,7 +547,7 @@
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
-GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 23e89da..4e44941 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -1171,11 +1171,12 @@
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
+ EGLBoolean result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglDestroyImageKHR) {
- cnx->egl.eglDestroyImageKHR(dp->disp.dpy, img);
+ result = cnx->egl.eglDestroyImageKHR(dp->disp.dpy, img);
}
- return EGL_TRUE;
+ return result;
}
// ----------------------------------------------------------------------------
diff --git a/opengl/libs/GLES2/gl2_api.in b/opengl/libs/GLES2/gl2_api.in
index 9a89a52..cccf46c 100644
--- a/opengl/libs/GLES2/gl2_api.in
+++ b/opengl/libs/GLES2/gl2_api.in
@@ -169,7 +169,7 @@
void API_ENTRY(glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
CALL_GL_API(glGetAttachedShaders, program, maxcount, count, shaders);
}
-int API_ENTRY(glGetAttribLocation)(GLuint program, const GLchar* name) {
+GLint API_ENTRY(glGetAttribLocation)(GLuint program, const GLchar* name) {
CALL_GL_API_RETURN(glGetAttribLocation, program, name);
}
void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean* params) {
@@ -226,7 +226,7 @@
void API_ENTRY(glGetUniformiv)(GLuint program, GLint location, GLint* params) {
CALL_GL_API(glGetUniformiv, program, location, params);
}
-int API_ENTRY(glGetUniformLocation)(GLuint program, const GLchar* name) {
+GLint API_ENTRY(glGetUniformLocation)(GLuint program, const GLchar* name) {
CALL_GL_API_RETURN(glGetUniformLocation, program, name);
}
void API_ENTRY(glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params) {
diff --git a/opengl/libs/GLES_trace/src/gltrace_api.cpp b/opengl/libs/GLES_trace/src/gltrace_api.cpp
index cef6cbb..2ae4b11 100644
--- a/opengl/libs/GLES_trace/src/gltrace_api.cpp
+++ b/opengl/libs/GLES_trace/src/gltrace_api.cpp
@@ -2214,7 +2214,7 @@
glContext->traceGLMessage(&glmsg);
}
-int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) {
+GLint GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) {
GLMessage glmsg;
GLTraceContext *glContext = getGLTraceContext();
@@ -2235,7 +2235,7 @@
// call function
nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- int retValue = glContext->hooks->gl.glGetAttribLocation(program, name);
+ GLint retValue = glContext->hooks->gl.glGetAttribLocation(program, name);
nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
@@ -2996,7 +2996,7 @@
glContext->traceGLMessage(&glmsg);
}
-int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) {
+GLint GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) {
GLMessage glmsg;
GLTraceContext *glContext = getGLTraceContext();
@@ -3017,7 +3017,7 @@
// call function
nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- int retValue = glContext->hooks->gl.glGetUniformLocation(program, name);
+ GLint retValue = glContext->hooks->gl.glGetUniformLocation(program, name);
nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
diff --git a/opengl/libs/GLES_trace/src/gltrace_api.h b/opengl/libs/GLES_trace/src/gltrace_api.h
index debcac0..309afcb 100644
--- a/opengl/libs/GLES_trace/src/gltrace_api.h
+++ b/opengl/libs/GLES_trace/src/gltrace_api.h
@@ -78,7 +78,7 @@
void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
-int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name);
+GLint GLTrace_glGetAttribLocation(GLuint program, const GLchar* name);
void GLTrace_glGetBooleanv(GLenum pname, GLboolean* params);
void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
GLenum GLTrace_glGetError(void);
@@ -97,7 +97,7 @@
void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat* params);
void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params);
-int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name);
+GLint GLTrace_glGetUniformLocation(GLuint program, const GLchar* name);
void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer);
diff --git a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
index 1bd790e..36ae314 100644
--- a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
+++ b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
@@ -341,7 +341,7 @@
/** Given a glGetActive[Uniform|Attrib] call, obtain the location
* of the variable of given name in the call.
*/
-int getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg, GLchar *name) {
+GLint getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg, GLchar *name) {
GLMessage_Function func = glmsg->function();
if (func != GLMessage::glGetActiveAttrib && func != GLMessage::glGetActiveUniform) {
return -1;
@@ -374,7 +374,7 @@
// In order to make things simpler for the debugger, we also pass
// a hidden location argument that stores the actual location.
// append the location value to the end of the argument list
- int location = getShaderVariableLocation(context, glmsg, (GLchar*)pointersToFixup[3]);
+ GLint location = getShaderVariableLocation(context, glmsg, (GLchar*)pointersToFixup[3]);
GLMessage_DataType *arg_location = glmsg->add_args();
arg_location->set_isarray(false);
arg_location->set_type(GLMessage::DataType::INT);
diff --git a/opengl/libs/entries.in b/opengl/libs/entries.in
index 6316d78..b9a51a4 100644
--- a/opengl/libs/entries.in
+++ b/opengl/libs/entries.in
@@ -160,7 +160,7 @@
GL_ENTRY(void, glGetActiveAttrib, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
GL_ENTRY(void, glGetActiveUniform, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
GL_ENTRY(void, glGetAttachedShaders, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-GL_ENTRY(int, glGetAttribLocation, GLuint program, const GLchar* name)
+GL_ENTRY(GLint, glGetAttribLocation, GLuint program, const GLchar* name)
GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean *params)
GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint *params)
GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid ** params)
@@ -218,7 +218,7 @@
GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint *params)
GL_ENTRY(void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed *params)
GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed *params)
-GL_ENTRY(int, glGetUniformLocation, GLuint program, const GLchar* name)
+GL_ENTRY(GLint, glGetUniformLocation, GLuint program, const GLchar* name)
GL_ENTRY(void, glGetUniformfv, GLuint program, GLint location, GLfloat* params)
GL_ENTRY(void, glGetUniformiv, GLuint program, GLint location, GLint* params)
GL_ENTRY(void, glGetVertexAttribPointerv, GLuint index, GLenum pname, GLvoid** pointer)
diff --git a/opengl/libs/trace.in b/opengl/libs/trace.in
index a5c5c84..e89e456 100644
--- a/opengl/libs/trace.in
+++ b/opengl/libs/trace.in
@@ -160,7 +160,7 @@
TRACE_GL_VOID(glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufsize, "GLsizei*", length, "GLint*", size, "GLenum*", type, "GLchar*", name)
TRACE_GL_VOID(glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufsize, "GLsizei*", length, "GLint*", size, "GLenum*", type, "GLchar*", name)
TRACE_GL_VOID(glGetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders), (program, maxcount, count, shaders), 4, "GLuint", program, "GLsizei", maxcount, "GLsizei*", count, "GLuint*", shaders)
-TRACE_GL(int, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name)
+TRACE_GL(GLint, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name)
TRACE_GL_VOID(glGetBooleanv, (GLenum pname, GLboolean *params), (pname, params), 2, "GLenum", pname, "GLboolean *", params)
TRACE_GL_VOID(glGetBufferParameteriv, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params)
TRACE_GL_VOID(glGetBufferPointervOES, (GLenum target, GLenum pname, GLvoid ** params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLvoid **", params)
@@ -218,7 +218,7 @@
TRACE_GL_VOID(glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params)
TRACE_GL_VOID(glGetTexParameterxv, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params)
TRACE_GL_VOID(glGetTexParameterxvOES, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params)
-TRACE_GL(int, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name)
+TRACE_GL(GLint, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name)
TRACE_GL_VOID(glGetUniformfv, (GLuint program, GLint location, GLfloat* params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLfloat*", params)
TRACE_GL_VOID(glGetUniformiv, (GLuint program, GLint location, GLint* params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLint*", params)
TRACE_GL_VOID(glGetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid** pointer), (index, pname, pointer), 3, "GLuint", index, "GLenum", pname, "GLvoid**", pointer)
diff --git a/opengl/tests/gl_perf/fill_common.cpp b/opengl/tests/gl_perf/fill_common.cpp
index 389381f..fefedc0 100644
--- a/opengl/tests/gl_perf/fill_common.cpp
+++ b/opengl/tests/gl_perf/fill_common.cpp
@@ -189,7 +189,7 @@
}
static void randUniform(int pgm, const char *var) {
- int loc = glGetUniformLocation(pgm, var);
+ GLint loc = glGetUniformLocation(pgm, var);
if (loc >= 0) {
float x = ((float)rand()) / RAND_MAX;
float y = ((float)rand()) / RAND_MAX;
@@ -211,7 +211,7 @@
startTimer();
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
for (uint32_t ct=0; ct < passCount; ct++) {
- int loc = glGetUniformLocation(pgm, "u_texOff");
+ GLint loc = glGetUniformLocation(pgm, "u_texOff");
glUniform2f(loc, ((float)ct) / passCount, ((float)ct) / 2.f / passCount);
randUniform(pgm, "u_color");
@@ -271,7 +271,7 @@
printf("error running test\n");
return;
}
- int loc = glGetUniformLocation(pgm, "u_tex0");
+ GLint loc = glGetUniformLocation(pgm, "u_tex0");
if (loc >= 0) glUniform1i(loc, 0);
loc = glGetUniformLocation(pgm, "u_tex1");
if (loc >= 0) glUniform1i(loc, 1);
diff --git a/opengl/tools/glgen/specs/gles11/GLES20.spec b/opengl/tools/glgen/specs/gles11/GLES20.spec
index ee88f59..dda746e 100644
--- a/opengl/tools/glgen/specs/gles11/GLES20.spec
+++ b/opengl/tools/glgen/specs/gles11/GLES20.spec
@@ -56,7 +56,7 @@
void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders )
-int glGetAttribLocation ( GLuint program, const char *name )
+GLint glGetAttribLocation ( GLuint program, const char *name )
void glGetBooleanv ( GLenum pname, GLboolean *params )
void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
GLenum glGetError ( void )
@@ -75,7 +75,7 @@
void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
void glGetUniformfv ( GLuint program, GLint location, GLfloat *params )
void glGetUniformiv ( GLuint program, GLint location, GLint *params )
-int glGetUniformLocation ( GLuint program, const char *name )
+GLint glGetUniformLocation ( GLuint program, const char *name )
void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params )
void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params )
// void glGetVertexAttribPointerv ( GLuint index, GLenum pname, void **pointer )
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 842471f..9afa4c1 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -191,12 +191,22 @@
return token;
}
+void SurfaceFlinger::createBuiltinDisplayLocked(DisplayDevice::DisplayType type) {
+ ALOGW_IF(mBuiltinDisplays[type],
+ "Overwriting display token for display type %d", type);
+ mBuiltinDisplays[type] = new BBinder();
+ DisplayDeviceState info(type);
+ // All non-virtual displays are currently considered secure.
+ info.isSecure = true;
+ mCurrentState.displays.add(mBuiltinDisplays[type], info);
+}
+
sp<IBinder> SurfaceFlinger::getBuiltInDisplay(int32_t id) {
if (uint32_t(id) >= DisplayDevice::NUM_DISPLAY_TYPES) {
ALOGE("getDefaultDisplay: id=%d is not a valid default display id", id);
return NULL;
}
- return mDefaultDisplays[id];
+ return mBuiltinDisplays[id];
}
sp<IGraphicBufferAlloc> SurfaceFlinger::createGraphicBufferAlloc()
@@ -462,6 +472,8 @@
ALOGI( "SurfaceFlinger's main thread ready to run. "
"Initializing graphics H/W...");
+ Mutex::Autolock _l(mStateLock);
+
// initialize EGL for the default display
mEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(mEGLDisplay, NULL, NULL);
@@ -482,14 +494,13 @@
// initialize our non-virtual displays
for (size_t i=0 ; i<DisplayDevice::NUM_DISPLAY_TYPES ; i++) {
DisplayDevice::DisplayType type((DisplayDevice::DisplayType)i);
- mDefaultDisplays[i] = new BBinder();
- wp<IBinder> token = mDefaultDisplays[i];
-
// set-up the displays that are already connected
if (mHwc->isConnected(i) || type==DisplayDevice::DISPLAY_PRIMARY) {
// All non-virtual displays are currently considered secure.
bool isSecure = true;
- mCurrentState.displays.add(token, DisplayDeviceState(type));
+ createBuiltinDisplayLocked(type);
+ wp<IBinder> token = mBuiltinDisplays[i];
+
sp<FramebufferSurface> fbs = new FramebufferSurface(*mHwc, i);
sp<SurfaceTextureClient> stc = new SurfaceTextureClient(
static_cast< sp<ISurfaceTexture> >(fbs->getBufferQueue()));
@@ -601,9 +612,9 @@
}
status_t SurfaceFlinger::getDisplayInfo(const sp<IBinder>& display, DisplayInfo* info) {
- int32_t type = BAD_VALUE;
+ int32_t type = NAME_NOT_FOUND;
for (int i=0 ; i<DisplayDevice::NUM_DISPLAY_TYPES ; i++) {
- if (display == mDefaultDisplays[i]) {
+ if (display == mBuiltinDisplays[i]) {
type = i;
break;
}
@@ -614,10 +625,6 @@
}
const HWComposer& hwc(getHwComposer());
- if (!hwc.isConnected(type)) {
- return NAME_NOT_FOUND;
- }
-
float xdpi = hwc.getDpiX(type);
float ydpi = hwc.getDpiY(type);
@@ -745,11 +752,11 @@
if (uint32_t(type) < DisplayDevice::NUM_DISPLAY_TYPES) {
Mutex::Autolock _l(mStateLock);
- if (connected == false) {
- mCurrentState.displays.removeItem(mDefaultDisplays[type]);
+ if (connected) {
+ createBuiltinDisplayLocked((DisplayDevice::DisplayType)type);
} else {
- DisplayDeviceState info((DisplayDevice::DisplayType)type);
- mCurrentState.displays.add(mDefaultDisplays[type], info);
+ mCurrentState.displays.removeItem(mBuiltinDisplays[type]);
+ mBuiltinDisplays[type].clear();
}
setTransactionFlags(eDisplayTransactionNeeded);
@@ -1151,7 +1158,6 @@
for (size_t i=0 ; i<cc ; i++) {
if (draw.indexOfKey(curr.keyAt(i)) < 0) {
const DisplayDeviceState& state(curr[i]);
- bool isSecure = false;
sp<FramebufferSurface> fbs;
sp<SurfaceTextureClient> stc;
@@ -1162,10 +1168,6 @@
"surface is provided (%p), ignoring it",
state.surface.get());
- // All non-virtual displays are currently considered
- // secure.
- isSecure = true;
-
// for supported (by hwc) displays we provide our
// own rendering surface
fbs = new FramebufferSurface(*mHwc, state.type);
@@ -1176,13 +1178,12 @@
if (state.surface != NULL) {
stc = new SurfaceTextureClient(state.surface);
}
- isSecure = state.isSecure;
}
const wp<IBinder>& display(curr.keyAt(i));
if (stc != NULL) {
sp<DisplayDevice> hw = new DisplayDevice(this,
- state.type, isSecure, display, stc, fbs,
+ state.type, state.isSecure, display, stc, fbs,
mEGLConfig);
hw->setLayerStack(state.layerStack);
hw->setProjection(state.orientation,
@@ -2045,7 +2046,7 @@
Vector<DisplayState> displays;
DisplayState d;
d.what = DisplayState::eDisplayProjectionChanged;
- d.token = mDefaultDisplays[DisplayDevice::DISPLAY_PRIMARY];
+ d.token = mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY];
d.orientation = DisplayState::eOrientationDefault;
d.frame.makeInvalid();
d.viewport.makeInvalid();
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index b0d3bac..1b549e4 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -112,7 +112,7 @@
// returns the default Display
sp<const DisplayDevice> getDefaultDisplayDevice() const {
- return getDisplayDevice(mDefaultDisplays[DisplayDevice::DISPLAY_PRIMARY]);
+ return getDisplayDevice(mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]);
}
// utility function to delete a texture on the main thread
@@ -328,6 +328,9 @@
// called when starting, or restarting after system_server death
void initializeDisplays();
+ // Create an IBinder for a builtin display and add it to current state
+ void createBuiltinDisplayLocked(DisplayDevice::DisplayType type);
+
// NOTE: can only be called from the main thread or with mStateLock held
sp<const DisplayDevice> getDisplayDevice(const wp<IBinder>& dpy) const {
return mDisplays.valueFor(dpy);
@@ -422,7 +425,7 @@
EGLContext mEGLContext;
EGLConfig mEGLConfig;
EGLDisplay mEGLDisplay;
- sp<IBinder> mDefaultDisplays[DisplayDevice::NUM_DISPLAY_TYPES];
+ sp<IBinder> mBuiltinDisplays[DisplayDevice::NUM_DISPLAY_TYPES];
// Can only accessed from the main thread, these members
// don't need synchronization