summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChirayu Desai <cdesai@cyanogenmod.org>2013-11-29 12:05:29 +0530
committerChirayu Desai <cdesai@cyanogenmod.org>2013-11-29 20:14:16 +0530
commitc4d26b7cff1d839b5156c54d9be3a8c07423a59f (patch)
tree2cbfd4ff120da2ea2901720fe0044a977fdefa99
parent01952d0dd1703db66503aaa07956ba5032570324 (diff)
parentb9a62053cf74025a43c8baa118d52729e38cc176 (diff)
downloadandroid_device_generic_goldfish-c4d26b7cff1d839b5156c54d9be3a8c07423a59f.tar.gz
android_device_generic_goldfish-c4d26b7cff1d839b5156c54d9be3a8c07423a59f.tar.bz2
android_device_generic_goldfish-c4d26b7cff1d839b5156c54d9be3a8c07423a59f.zip
Merge branch 'master' of https://android.googlesource.com/device/generic/goldfish into HEAD
Change-Id: I562aec2c45bdbdd656822266cb7c2bc8a1a4ad4b
-rwxr-xr-xcamera/EmulatedFakeCameraDevice.cpp7
-rw-r--r--init.goldfish.rc4
-rw-r--r--opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp50
-rw-r--r--opengl/system/egl/Android.mk2
-rw-r--r--opengl/system/egl/egl.cpp2
5 files changed, 46 insertions, 19 deletions
diff --git a/camera/EmulatedFakeCameraDevice.cpp b/camera/EmulatedFakeCameraDevice.cpp
index 0bc4c54..4afadc1 100755
--- a/camera/EmulatedFakeCameraDevice.cpp
+++ b/camera/EmulatedFakeCameraDevice.cpp
@@ -243,6 +243,13 @@ void EmulatedFakeCameraDevice::drawCheckerboard()
const int size = mFrameWidth / 10;
bool black = true;
+ if (size == 0) {
+ // When this happens, it happens at a very high rate,
+ // so don't log any messages and just return.
+ return;
+ }
+
+
if((mCheckX / size) & 1)
black = false;
if((mCheckY / size) & 1)
diff --git a/init.goldfish.rc b/init.goldfish.rc
index 9c08c6e..ead468d 100644
--- a/init.goldfish.rc
+++ b/init.goldfish.rc
@@ -14,10 +14,6 @@ on init
symlink /storage/sdcard /mnt/sdcard
on boot
- setsebool in_qemu 1
- restorecon /sys/qemu_trace/process_name
- restorecon /sys/qemu_trace/state
- restorecon /sys/qemu_trace/symbol
setprop ARGH ARGH
setprop net.eth0.gw 10.0.2.2
setprop net.eth0.dns1 10.0.2.3
diff --git a/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp b/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp
index 8504f7f..c7da37a 100644
--- a/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp
+++ b/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp
@@ -16,10 +16,19 @@
#include "GLSharedGroup.h"
+/**** KeyedVector utilities ****/
+
+template <typename T>
+static void clearObjectMap(android::DefaultKeyedVector<GLuint, T>& v) {
+ for (size_t i = 0; i < v.size(); i++)
+ delete v.valueAt(i);
+ v.clear();
+}
+
/**** BufferData ****/
BufferData::BufferData() : m_size(0) {};
-BufferData::BufferData(GLsizeiptr size, void * data) : m_size(size)
+BufferData::BufferData(GLsizeiptr size, void * data) : m_size(size)
{
void * buffer = NULL;
if (size>0) buffer = m_fixedBuffer.alloc(size);
@@ -55,7 +64,7 @@ ProgramData::~ProgramData()
}
void ProgramData::setIndexInfo(GLuint index, GLint base, GLint size, GLenum type)
-{
+{
if (index>=m_numIndexes)
return;
m_Indexes[index].base = base;
@@ -87,7 +96,7 @@ GLuint ProgramData::getIndexForLocation(GLint location)
for (GLuint i=0;i<m_numIndexes;++i)
{
GLint dist = location - m_Indexes[i].base;
- if (dist >= 0 &&
+ if (dist >= 0 &&
(minDist < 0 || dist < minDist)) {
index = i;
minDist = dist;
@@ -126,7 +135,7 @@ GLint ProgramData::locationWARHostToApp(GLint hostLoc, GLint arrIndex)
GLuint index = getIndexForLocation(hostLoc);
if (index<m_numIndexes) {
if (arrIndex > 0) {
- m_Indexes[index].hostLocsPerElement =
+ m_Indexes[index].hostLocsPerElement =
(hostLoc - m_Indexes[index].base) / arrIndex;
}
return m_Indexes[index].appBase + arrIndex;
@@ -226,12 +235,15 @@ GLSharedGroup::~GLSharedGroup()
{
m_buffers.clear();
m_programs.clear();
+ clearObjectMap(m_buffers);
+ clearObjectMap(m_programs);
+ clearObjectMap(m_shaders);
}
BufferData * GLSharedGroup::getBufferData(GLuint bufferId)
{
android::AutoMutex _lock(m_lock);
- return m_buffers.valueFor(bufferId);
+ return m_buffers.valueFor(bufferId);
}
void GLSharedGroup::addBufferData(GLuint bufferId, GLsizeiptr size, void * data)
@@ -243,32 +255,42 @@ void GLSharedGroup::addBufferData(GLuint bufferId, GLsizeiptr size, void * data)
void GLSharedGroup::updateBufferData(GLuint bufferId, GLsizeiptr size, void * data)
{
android::AutoMutex _lock(m_lock);
- m_buffers.replaceValueFor(bufferId, new BufferData(size, data));
+ ssize_t idx = m_buffers.indexOfKey(bufferId);
+ if (idx >= 0) {
+ delete m_buffers.valueAt(idx);
+ m_buffers.editValueAt(idx) = new BufferData(size, data);
+ } else {
+ m_buffers.add(bufferId, new BufferData(size, data));
+ }
}
GLenum GLSharedGroup::subUpdateBufferData(GLuint bufferId, GLintptr offset, GLsizeiptr size, void * data)
{
android::AutoMutex _lock(m_lock);
BufferData * buf = m_buffers.valueFor(bufferId);
- if ((!buf) || (buf->m_size < offset+size) || (offset < 0) || (size<0)) return GL_INVALID_VALUE;
+ if ((!buf) || (buf->m_size < offset+size) || (offset < 0) || (size<0)) return GL_INVALID_VALUE;
//it's safe to update now
memcpy((char*)buf->m_fixedBuffer.ptr() + offset, data, size);
- return GL_NO_ERROR;
+ return GL_NO_ERROR;
}
void GLSharedGroup::deleteBufferData(GLuint bufferId)
{
android::AutoMutex _lock(m_lock);
- m_buffers.removeItem(bufferId);
+ ssize_t idx = m_buffers.indexOfKey(bufferId);
+ if (idx >= 0) {
+ delete m_buffers.valueAt(idx);
+ m_buffers.removeItemsAt(idx);
+ }
}
void GLSharedGroup::addProgramData(GLuint program)
{
android::AutoMutex _lock(m_lock);
ProgramData *pData = m_programs.valueFor(program);
- if (pData)
- {
+ if (pData)
+ {
m_programs.removeItem(program);
delete pData;
}
@@ -290,7 +312,7 @@ bool GLSharedGroup::isProgramInitialized(GLuint program)
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
- if (pData)
+ if (pData)
{
return pData->isInitialized();
}
@@ -303,7 +325,7 @@ void GLSharedGroup::deleteProgramData(GLuint program)
ProgramData *pData = m_programs.valueFor(program);
if (pData)
delete pData;
- m_programs.removeItem(program);
+ m_programs.removeItem(program);
}
void GLSharedGroup::attachShader(GLuint program, GLuint shader)
@@ -363,7 +385,7 @@ GLenum GLSharedGroup::getProgramUniformType(GLuint program, GLint location)
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
GLenum type=0;
- if (pData)
+ if (pData)
{
type = pData->getTypeForLocation(location);
}
diff --git a/opengl/system/egl/Android.mk b/opengl/system/egl/Android.mk
index a979089..241cefe 100644
--- a/opengl/system/egl/Android.mk
+++ b/opengl/system/egl/Android.mk
@@ -26,7 +26,7 @@ $(call emugl-end-module)
# Other builds are device-specific and will provide their own
# version of this file to point to the appropriate HW EGL libraries.
#
-ifneq (,$(filter full full_x86 full_mips sdk sdk_x86 sdk_mips google_sdk google_sdk_x86 google_sdk_mips,$(TARGET_PRODUCT)))
+ifneq (,$(filter aosp_arm aosp_x86 aosp_mips full full_x86 full_mips sdk sdk_x86 sdk_mips google_sdk google_sdk_x86 google_sdk_mips,$(TARGET_PRODUCT)))
include $(CLEAR_VARS)
LOCAL_MODULE := egl.cfg
diff --git a/opengl/system/egl/egl.cpp b/opengl/system/egl/egl.cpp
index 2ec17fb..cf3df52 100644
--- a/opengl/system/egl/egl.cpp
+++ b/opengl/system/egl/egl.cpp
@@ -588,6 +588,8 @@ EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
*num_config = rcEnc->rcChooseConfig(rcEnc, (EGLint*)attrib_list, attribs_size * sizeof(EGLint), (uint32_t*)configs, config_size);
+ if (*num_config <= 0)
+ return EGL_FALSE;
return EGL_TRUE;
}