fix x86 build

Change-Id: I03cfbfeaeb8b13842248856b14b4a23711036e10
This commit is contained in:
Mathias Agopian 2011-05-23 17:26:14 -07:00
parent d31099f021
commit 1cadb25da1
11 changed files with 162 additions and 152 deletions

View File

@ -14,7 +14,6 @@ LOCAL_SRC_FILES:= \
EGL/eglApi.cpp \
EGL/trace.cpp \
EGL/getProcAddress.cpp.arm \
EGL/hooks.cpp \
EGL/Loader.cpp \
#

View File

@ -26,11 +26,10 @@
#include <EGL/egl.h>
#include "hooks.h"
#include "egl_impl.h"
#include "Loader.h"
#include "egldefs.h"
#include "glesv2dbg.h"
#include "hooks.h"
#include "Loader.h"
// ----------------------------------------------------------------------------
namespace android {

View File

@ -33,6 +33,7 @@
#include <utils/String8.h>
#include "egldefs.h"
#include "egl_impl.h"
#include "egl_tls.h"
#include "glesv2dbg.h"
@ -278,6 +279,71 @@ EGLBoolean egl_init_drivers() {
return res;
}
void gl_unimplemented() {
LOGE("called unimplemented OpenGL ES API");
}
// ----------------------------------------------------------------------------
#if USE_FAST_TLS_KEY
// We have a dedicated TLS slot in bionic
static inline gl_hooks_t const * volatile * get_tls_hooks() {
volatile void *tls_base = __get_tls();
gl_hooks_t const * volatile * tls_hooks =
reinterpret_cast<gl_hooks_t const * volatile *>(tls_base);
return tls_hooks;
}
void setGlThreadSpecific(gl_hooks_t const *value) {
gl_hooks_t const * volatile * tls_hooks = get_tls_hooks();
tls_hooks[TLS_SLOT_OPENGL_API] = value;
}
gl_hooks_t const* getGlThreadSpecific() {
gl_hooks_t const * volatile * tls_hooks = get_tls_hooks();
gl_hooks_t const* hooks = tls_hooks[TLS_SLOT_OPENGL_API];
if (hooks) return hooks;
return &gHooksNoContext;
}
#else
void setGlThreadSpecific(gl_hooks_t const *value) {
pthread_setspecific(gGLWrapperKey, value);
}
gl_hooks_t const* getGlThreadSpecific() {
gl_hooks_t const* hooks = static_cast<gl_hooks_t*>(pthread_getspecific(gGLWrapperKey));
if (hooks) return hooks;
return &gHooksNoContext;
}
#endif
// ----------------------------------------------------------------------------
// GL / EGL hooks
// ----------------------------------------------------------------------------
#undef GL_ENTRY
#undef EGL_ENTRY
#define GL_ENTRY(_r, _api, ...) #_api,
#define EGL_ENTRY(_r, _api, ...) #_api,
char const * const gl_names[] = {
#include "entries.in"
NULL
};
char const * const egl_names[] = {
#include "egl_entries.in"
NULL
};
#undef GL_ENTRY
#undef EGL_ENTRY
// ----------------------------------------------------------------------------
}; // namespace android
// ----------------------------------------------------------------------------

View File

@ -30,6 +30,7 @@
#include <utils/SortedVector.h>
#include <utils/threads.h>
#include "egldefs.h"
#include "hooks.h"
// ----------------------------------------------------------------------------

View File

@ -21,7 +21,12 @@
#include <EGL/egl.h>
#include "egldefs.h"
#include "hooks.h"
// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------
class DbgContext;
@ -58,6 +63,16 @@ public:
#define setError(_e, _r) egl_tls_t::setErrorEtc(__FUNCTION__, __LINE__, _e, _r)
// ----------------------------------------------------------------------------
#if EGL_TRACE
extern gl_hooks_t const* getGLTraceThreadSpecific();
#endif
// ----------------------------------------------------------------------------
}; // namespace android
// ----------------------------------------------------------------------------
#endif // ANDROID_EGL_TLS_H

71
opengl/libs/EGL/egldefs.h Normal file
View File

@ -0,0 +1,71 @@
/*
** Copyright 2011, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#ifndef ANDROID_EGLDEFS_H
#define ANDROID_EGLDEFS_H
#include "hooks.h"
// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------
#define VERSION_MAJOR 1
#define VERSION_MINOR 4
// EGLDisplay are global, not attached to a given thread
const unsigned int NUM_DISPLAYS = 1;
enum {
IMPL_HARDWARE = 0,
IMPL_SOFTWARE,
IMPL_NUM_IMPLEMENTATIONS
};
enum {
GLESv1_INDEX = 0,
GLESv2_INDEX = 1,
};
// ----------------------------------------------------------------------------
struct egl_connection_t
{
inline egl_connection_t() : dso(0) { }
void * dso;
gl_hooks_t * hooks[2];
EGLint major;
EGLint minor;
egl_t egl;
};
// ----------------------------------------------------------------------------
extern gl_hooks_t gHooks[2][IMPL_NUM_IMPLEMENTATIONS];
extern gl_hooks_t gHooksNoContext;
extern pthread_key_t gGLWrapperKey;
extern "C" void gl_unimplemented();
extern char const * const gl_names[];
extern char const * const egl_names[];
extern egl_connection_t gEGLImpl[IMPL_NUM_IMPLEMENTATIONS];
// ----------------------------------------------------------------------------
}; // namespace android
// ----------------------------------------------------------------------------
#endif /* ANDROID_EGLDEFS_H */

View File

@ -20,6 +20,7 @@
#include <cutils/log.h>
#include "egldefs.h"
#include "hooks.h"
// ----------------------------------------------------------------------------
@ -34,7 +35,7 @@ namespace android {
#undef GL_EXTENSION_LIST
#undef GET_TLS
#if defined(__arm__)
#if USE_FAST_TLS_KEY
#ifdef HAVE_ARM_TLS_REGISTER
#define GET_TLS(reg) \
@ -77,7 +78,7 @@ namespace android {
#define GL_EXTENSION(_n)
#warning "eglGetProcAddress() partially supported on this architecture"
#warning "eglGetProcAddress() partially supported"
#endif

View File

@ -1,60 +0,0 @@
/*
** Copyright 2009, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#include <ctype.h>
#include <stdlib.h>
#include <errno.h>
#include <cutils/log.h>
#include "hooks.h"
// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------
void gl_unimplemented() {
LOGE("called unimplemented OpenGL ES API");
}
// ----------------------------------------------------------------------------
// GL / EGL hooks
// ----------------------------------------------------------------------------
#undef GL_ENTRY
#undef EGL_ENTRY
#define GL_ENTRY(_r, _api, ...) #_api,
#define EGL_ENTRY(_r, _api, ...) #_api,
char const * const gl_names[] = {
#include "entries.in"
NULL
};
char const * const egl_names[] = {
#include "egl_entries.in"
NULL
};
#undef GL_ENTRY
#undef EGL_ENTRY
// ----------------------------------------------------------------------------
}; // namespace android
// ----------------------------------------------------------------------------

View File

@ -26,6 +26,7 @@
#include <cutils/log.h>
#include "egl_tls.h"
#include "hooks.h"
// ----------------------------------------------------------------------------

View File

@ -25,27 +25,12 @@
#include "hooks.h"
#define VERSION_MAJOR 1
#define VERSION_MINOR 4
// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------
struct egl_connection_t
{
inline egl_connection_t() : dso(0) { }
void * dso;
gl_hooks_t * hooks[2];
EGLint major;
EGLint minor;
egl_t egl;
};
EGLAPI EGLImageKHR egl_get_image_for_current_context(EGLImageKHR image);
extern egl_connection_t gEGLImpl[IMPL_NUM_IMPLEMENTATIONS];
// ----------------------------------------------------------------------------
}; // namespace android
// ----------------------------------------------------------------------------

View File

@ -54,22 +54,6 @@
namespace android {
// ----------------------------------------------------------------------------
// EGLDisplay are global, not attached to a given thread
const unsigned int NUM_DISPLAYS = 1;
enum {
IMPL_HARDWARE = 0,
IMPL_SOFTWARE,
IMPL_NUM_IMPLEMENTATIONS
};
enum {
GLESv1_INDEX = 0,
GLESv2_INDEX = 1,
};
// ----------------------------------------------------------------------------
// GL / EGL hooks
#undef GL_ENTRY
@ -92,60 +76,8 @@ struct gl_hooks_t {
#undef GL_ENTRY
#undef EGL_ENTRY
// ----------------------------------------------------------------------------
extern gl_hooks_t gHooks[2][IMPL_NUM_IMPLEMENTATIONS];
extern gl_hooks_t gHooksNoContext;
extern pthread_key_t gGLWrapperKey;
extern "C" void gl_unimplemented();
extern char const * const gl_names[];
extern char const * const egl_names[];
// ----------------------------------------------------------------------------
#if USE_FAST_TLS_KEY
// We have a dedicated TLS slot in bionic
static inline gl_hooks_t const * volatile * get_tls_hooks() {
volatile void *tls_base = __get_tls();
gl_hooks_t const * volatile * tls_hooks =
reinterpret_cast<gl_hooks_t const * volatile *>(tls_base);
return tls_hooks;
}
static inline void setGlThreadSpecific(gl_hooks_t const *value) {
gl_hooks_t const * volatile * tls_hooks = get_tls_hooks();
tls_hooks[TLS_SLOT_OPENGL_API] = value;
}
static gl_hooks_t const* getGlThreadSpecific() {
gl_hooks_t const * volatile * tls_hooks = get_tls_hooks();
gl_hooks_t const* hooks = tls_hooks[TLS_SLOT_OPENGL_API];
if (hooks) return hooks;
return &gHooksNoContext;
}
#else
static inline void setGlThreadSpecific(gl_hooks_t const *value) {
pthread_setspecific(gGLWrapperKey, value);
}
static gl_hooks_t const* getGlThreadSpecific() {
gl_hooks_t const* hooks = static_cast<gl_hooks_t*>(pthread_getspecific(gGLWrapperKey));
if (hooks) return hooks;
return &gHooksNoContext;
}
#endif
#if EGL_TRACE
extern gl_hooks_t const* getGLTraceThreadSpecific();
#endif
EGLAPI void setGlThreadSpecific(gl_hooks_t const *value);
EGLAPI gl_hooks_t const* getGlThreadSpecific();
// ----------------------------------------------------------------------------
}; // namespace android