Skip to content

Commit

Permalink
[opengl] implement work around for tegra errata 657451
Browse files Browse the repository at this point in the history
copy the tegra errata work around compile flags from bionic, to
pick up the correct __get_tls implementation

Change-Id: Idf131ad536b3f6bce643a83bb99e007a9b45c3bb
  • Loading branch information
Gary King authored and bekriebel committed Nov 15, 2010
1 parent bcee4ac commit 4f7c126
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
3 changes: 3 additions & 0 deletions opengl/libagl/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ ifneq ($(TARGET_SIMULATOR),true)
ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
endif
LOCAL_C_INCLUDES += bionic/libc/private
endif

Expand Down
18 changes: 18 additions & 0 deletions opengl/libs/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ else
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
# we need to access the private Bionic header <bionic_tls.h>
ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
endif
LOCAL_C_INCLUDES += bionic/libc/private
endif

Expand All @@ -40,6 +43,9 @@ endif
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
endif

include $(BUILD_SHARED_LIBRARY)
installed_libEGL := $(LOCAL_INSTALLED_MODULE)
Expand Down Expand Up @@ -83,6 +89,9 @@ else
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
endif
LOCAL_C_INCLUDES += bionic/libc/private
endif

Expand All @@ -93,6 +102,9 @@ LOCAL_CFLAGS += -fvisibility=hidden
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
endif

include $(BUILD_SHARED_LIBRARY)

Expand All @@ -119,6 +131,9 @@ else
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
endif
LOCAL_C_INCLUDES += bionic/libc/private
endif

Expand All @@ -129,6 +144,9 @@ LOCAL_CFLAGS += -fvisibility=hidden
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
endif

include $(BUILD_SHARED_LIBRARY)

Expand Down
11 changes: 10 additions & 1 deletion opengl/libs/GLES2/gl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,18 @@ using namespace android;

#if USE_FAST_TLS_KEY

#ifdef HAVE_TEGRA_ERRATA_657451
#define MUNGE_TLS(_tls) \
"bfi " #_tls ", " #_tls ", #20, #1 \n" \
"bic " #_tls ", " #_tls ", #1 \n"
#else
#define MUNGE_TLS(_tls) "\n"
#endif

#ifdef HAVE_ARM_TLS_REGISTER
#define GET_TLS(reg) \
"mrc p15, 0, " #reg ", c13, c0, 3 \n"
"mrc p15, 0, " #reg ", c13, c0, 3 \n" \
MUNGE_TLS(reg)
#else
#define GET_TLS(reg) \
"mov " #reg ", #0xFFFF0FFF \n" \
Expand Down
11 changes: 10 additions & 1 deletion opengl/libs/GLES_CM/gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,18 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,

#if USE_FAST_TLS_KEY && !CHECK_FOR_GL_ERRORS

#ifdef HAVE_TEGRA_ERRATA_657451
#define MUNGE_TLS(_tls) \
"bfi " #_tls ", " #_tls ", #20, #1 \n" \
"bic " #_tls ", " #_tls ", #1 \n"
#else
#define MUNGE_TLS(_tls) "\n"
#endif

#ifdef HAVE_ARM_TLS_REGISTER
#define GET_TLS(reg) \
"mrc p15, 0, " #reg ", c13, c0, 3 \n"
"mrc p15, 0, " #reg ", c13, c0, 3 \n" \
MUNGE_TLS(reg)
#else
#define GET_TLS(reg) \
"mov " #reg ", #0xFFFF0FFF \n" \
Expand Down

0 comments on commit 4f7c126

Please sign in to comment.