summaryrefslogtreecommitdiffstats
path: root/opengl/system/egl/egl.cpp
diff options
context:
space:
mode:
authorbohu <bohu@google.com>2014-12-02 11:44:44 -0800
committerbohu <bohu@google.com>2014-12-02 11:44:44 -0800
commit8d97f57470bcb540bf7bf60c0b23391942838271 (patch)
tree5e99ddb9caa643ac352b263829b2ab12a30b40e7 /opengl/system/egl/egl.cpp
parent758ef0bc56397ba50f96b7b9109cb6c50a7cdf29 (diff)
downloadandroid_device_generic_goldfish-8d97f57470bcb540bf7bf60c0b23391942838271.tar.gz
android_device_generic_goldfish-8d97f57470bcb540bf7bf60c0b23391942838271.tar.bz2
android_device_generic_goldfish-8d97f57470bcb540bf7bf60c0b23391942838271.zip
Update goldfish from aosp/master
Merge aosp/master fixes into lmp-dev This patch updates the goldfish device to match the following patches: 1c9492dd Fix GPU emulation crash. 1da62b8c opengl: Fix a few function name typos. a4d0e1ca opengl: Remove accessor functions from encoders. 223a765d opengl: Remove compiler warnings. b7837c3c opengl: Regenerate GPU emulation encoder sources. 622970b4 opengl: Fix 64-bit build. 5fa17220 Unbind buffer when buffer is deleted 4a01a642 Properly initialize GLClientState's m_states 2c71ccd4 handles glGetBooleanv when value is nonboolean 4f9ec391 Fix eglDestroyContext and glTexImage2D 585a4b03 opengl: Fix pixelDataSize() ambiguity. Change-Id: I3f574149558b4b4cee8a3e354314f6da8f49957d
Diffstat (limited to 'opengl/system/egl/egl.cpp')
-rw-r--r--opengl/system/egl/egl.cpp71
1 files changed, 60 insertions, 11 deletions
diff --git a/opengl/system/egl/egl.cpp b/opengl/system/egl/egl.cpp
index daa52de..8499229 100644
--- a/opengl/system/egl/egl.cpp
+++ b/opengl/system/egl/egl.cpp
@@ -140,7 +140,8 @@ EGLContext_t::EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* share
versionString(NULL),
vendorString(NULL),
rendererString(NULL),
- extensionString(NULL)
+ extensionString(NULL),
+ deletePending(0)
{
flags = 0;
version = 1;
@@ -336,7 +337,7 @@ struct egl_pbuffer_surface_t : public egl_surface_t {
virtual ~egl_pbuffer_surface_t();
- virtual void setSwapInterval(int interval) {}
+ virtual void setSwapInterval(int interval) { (void)interval; }
virtual EGLBoolean swapBuffers() { return EGL_TRUE; }
uint32_t getRcColorBuffer() { return rcColorBuffer; }
@@ -542,7 +543,7 @@ const char* eglQueryString(EGLDisplay dpy, EGLint name)
EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
- VALIDATE_DISPLAY_INIT(dpy, NULL);
+ VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
if(!num_config) {
RETURN_ERROR(EGL_FALSE,EGL_BAD_PARAMETER);
@@ -554,9 +555,9 @@ EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size,
return EGL_TRUE;
}
- uintptr_t i=0;
- for (i=0 ; i<numConfigs && i<config_size ; i++) {
- *configs++ = (EGLConfig)i;
+ EGLint i;
+ for (i = 0 ; i < numConfigs && i < config_size ; i++) {
+ *configs++ = (EGLConfig)(uintptr_t)i;
}
*num_config = i;
return EGL_TRUE;
@@ -593,7 +594,7 @@ EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig
EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
{
- VALIDATE_DISPLAY_INIT(dpy, NULL);
+ VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
VALIDATE_CONFIG(config, EGL_FALSE);
if (s_display.getConfigAttrib(config, attribute, value))
@@ -608,6 +609,8 @@ EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute
EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
{
+ (void)attrib_list;
+
VALIDATE_DISPLAY_INIT(dpy, NULL);
VALIDATE_CONFIG(config, EGL_FALSE);
if (win == 0) {
@@ -699,6 +702,10 @@ EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePix
// to s/w rendering -or- let the host render to a buffer that will be
// copied back to guest at some sync point. None of those methods not
// implemented and pixmaps are not used with OpenGL anyway ...
+ (void)dpy;
+ (void)config;
+ (void)pixmap;
+ (void)attrib_list;
return EGL_NO_SURFACE;
}
@@ -783,6 +790,11 @@ EGLBoolean eglReleaseThread()
EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
{
//TODO
+ (void)dpy;
+ (void)buftype;
+ (void)buffer;
+ (void)config;
+ (void)attrib_list;
ALOGW("%s not implemented", __FUNCTION__);
return 0;
}
@@ -790,6 +802,10 @@ EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGL
EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
{
//TODO
+ (void)dpy;
+ (void)surface;
+ (void)attribute;
+ (void)value;
ALOGW("%s not implemented", __FUNCTION__);
return 0;
}
@@ -828,6 +844,9 @@ EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface eglSurface, EGLint buffer)
EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
//TODO
+ (void)dpy;
+ (void)surface;
+ (void)buffer;
ALOGW("%s not implemented", __FUNCTION__);
return 0;
}
@@ -897,9 +916,11 @@ EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
EGLContext_t * context = static_cast<EGLContext_t*>(ctx);
- if (getEGLThreadInfo()->currentContext == context)
- {
- eglMakeCurrent(dpy, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
+ if (!context) return EGL_TRUE;
+
+ if (getEGLThreadInfo()->currentContext == context) {
+ getEGLThreadInfo()->currentContext->deletePending = 1;
+ return EGL_TRUE;
}
if (context->rcContext) {
@@ -934,12 +955,21 @@ EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLC
// Nothing to do if no binding change has made
//
EGLThreadInfo *tInfo = getEGLThreadInfo();
+
if (tInfo->currentContext == context &&
(context == NULL ||
(context && context->draw == draw && context->read == read))) {
return EGL_TRUE;
}
+ if (tInfo->currentContext && tInfo->currentContext->deletePending) {
+ if (tInfo->currentContext != context) {
+ EGLContext_t * contextToDelete = tInfo->currentContext;
+ tInfo->currentContext = 0;
+ eglDestroyContext(dpy, contextToDelete);
+ }
+ }
+
if (context && (context->flags & EGLContext_t::IS_CURRENT) && (context != tInfo->currentContext)) {
//context is current to another thread
setErrorReturn(EGL_BAD_ACCESS, EGL_FALSE);
@@ -966,7 +996,7 @@ EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLC
hostCon->glEncoder()->setSharedGroup(context->getSharedGroup());
}
}
- else {
+ else if (tInfo->currentContext) {
//release ClientState & SharedGroup
if (tInfo->currentContext->version == 2) {
hostCon->gl2Encoder()->setClientState(NULL);
@@ -1088,6 +1118,7 @@ EGLBoolean eglWaitGL()
EGLBoolean eglWaitNative(EGLint engine)
{
+ (void)engine;
return EGL_TRUE;
}
@@ -1113,23 +1144,33 @@ EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface eglSurface)
EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
{
//TODO :later
+ (void)dpy;
+ (void)surface;
+ (void)target;
return 0;
}
EGLBoolean eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list)
{
//TODO later
+ (void)display;
+ (void)surface;
+ (void)attrib_list;
return 0;
}
EGLBoolean eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface)
{
//TODO later
+ (void)display;
+ (void)surface;
return 0;
}
EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
{
+ (void)attrib_list;
+
VALIDATE_DISPLAY_INIT(dpy, EGL_NO_IMAGE_KHR);
if (ctx != EGL_NO_CONTEXT) {
setErrorReturn(EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
@@ -1212,6 +1253,8 @@ EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type,
EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
{
+ (void)dpy;
+
if (sync != FENCE_SYNC_HANDLE) {
setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
}
@@ -1222,6 +1265,10 @@ EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags,
EGLTimeKHR timeout)
{
+ (void)dpy;
+ (void)flags;
+ (void)timeout;
+
if (sync != FENCE_SYNC_HANDLE) {
setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
}
@@ -1232,6 +1279,8 @@ EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags,
EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync,
EGLint attribute, EGLint *value)
{
+ (void)dpy;
+
if (sync != FENCE_SYNC_HANDLE) {
setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
}