Personally i don't care much about non-autoconf builds, but as this relies on a -DTLS= setting during configuration time, it will break non-ac builds (which need tls), no?
Other than that, LGTM. -tom On 15.02.2012, at 12:41, zhigang.g...@linux.intel.com wrote: > From: Zhigang Gong <zhigang.g...@linux.intel.com> > > Use the properate way detected in autoconf stage to define > those TLS variables rather than using hard coded > "attribute..." > > Signed-off-by: Zhigang Gong <zhigang.g...@linux.intel.com> > --- > src/egl/main/eglcurrent.c | 3 +-- > src/glx/glxclient.h | 3 +-- > src/glx/glxcurrent.c | 3 +-- > src/mapi/glapi/glapi.h | 6 ++---- > src/mapi/mapi/u_current.c | 6 ++---- > src/mapi/mapi/u_current.h | 6 ++---- > src/mesa/drivers/dri/common/dri_test.c | 6 ++---- > src/mesa/drivers/x11/glxapi.c | 3 +-- > 8 files changed, 12 insertions(+), 24 deletions(-) > > diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c > index 54fc4f7..bbd46ac 100644 > --- a/src/egl/main/eglcurrent.c > +++ b/src/egl/main/eglcurrent.c > @@ -51,8 +51,7 @@ static pthread_key_t _egl_TSD; > static void (*_egl_FreeTSD)(_EGLThreadInfo *); > > #ifdef GLX_USE_TLS > -static __thread const _EGLThreadInfo *_egl_TLS > - __attribute__ ((tls_model("initial-exec"))); > +static TLS const _EGLThreadInfo * _egl_TLS; > #endif > > static INLINE void _eglSetTSD(const _EGLThreadInfo *t) > diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h > index f8ae450..06785df 100644 > --- a/src/glx/glxclient.h > +++ b/src/glx/glxclient.h > @@ -630,9 +630,8 @@ extern void __glXSetCurrentContext(struct glx_context * > c); > > # if defined( GLX_USE_TLS ) > > -extern __thread void *__glX_tls_Context > - __attribute__ ((tls_model("initial-exec"))); > > +extern TLS void *__glX_tls_Context; > # define __glXGetCurrentContext() __glX_tls_Context > > # else > diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c > index c92a2fd..f295d2c 100644 > --- a/src/glx/glxcurrent.c > +++ b/src/glx/glxcurrent.c > @@ -86,8 +86,7 @@ _X_HIDDEN pthread_mutex_t __glXmutex = > PTHREAD_MUTEX_INITIALIZER; > * \b never be \c NULL. This is important! Because of this > * \c __glXGetCurrentContext can be implemented as trivial macro. > */ > -__thread void *__glX_tls_Context __attribute__ ((tls_model("initial-exec"))) > - = &dummyContext; > +TLS void *__glX_tls_Context = &dummyContext; > > _X_HIDDEN void > __glXSetCurrentContext(struct glx_context * c) > diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h > index f685475..ef69e64 100644 > --- a/src/mapi/glapi/glapi.h > +++ b/src/mapi/glapi/glapi.h > @@ -85,11 +85,9 @@ struct _glapi_table; > > #if defined (GLX_USE_TLS) > > -_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch > - __attribute__((tls_model("initial-exec"))); > +_GLAPI_EXPORT extern TLS struct _glapi_table * _glapi_tls_Dispatch; > > -_GLAPI_EXPORT extern __thread void * _glapi_tls_Context > - __attribute__((tls_model("initial-exec"))); > +_GLAPI_EXPORT extern TLS void * _glapi_tls_Context; > > _GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; > _GLAPI_EXPORT extern const void *_glapi_Context; > diff --git a/src/mapi/mapi/u_current.c b/src/mapi/mapi/u_current.c > index 21a07ab..f4e241e 100644 > --- a/src/mapi/mapi/u_current.c > +++ b/src/mapi/mapi/u_current.c > @@ -99,12 +99,10 @@ extern void (*__glapi_noop_table[])(void); > /*@{*/ > #if defined(GLX_USE_TLS) > > -__thread struct mapi_table *u_current_table > - __attribute__((tls_model("initial-exec"))) > +TLS struct mapi_table *u_current_table > = (struct mapi_table *) table_noop_array; > > -__thread void *u_current_user > - __attribute__((tls_model("initial-exec"))); > +TLS void *u_current_user; > > #else > > diff --git a/src/mapi/mapi/u_current.h b/src/mapi/mapi/u_current.h > index f9cffd8..0584dc8 100644 > --- a/src/mapi/mapi/u_current.h > +++ b/src/mapi/mapi/u_current.h > @@ -30,11 +30,9 @@ struct mapi_table; > > #ifdef GLX_USE_TLS > > -extern __thread struct mapi_table *u_current_table > - __attribute__((tls_model("initial-exec"))); > +extern TLS struct mapi_table *u_current_table; > > -extern __thread void *u_current_user > - __attribute__((tls_model("initial-exec"))); > +extern TLS void *u_current_user; > > #else /* GLX_USE_TLS */ > > diff --git a/src/mesa/drivers/dri/common/dri_test.c > b/src/mesa/drivers/dri/common/dri_test.c > index 793f0c3..aaad90c 100644 > --- a/src/mesa/drivers/dri/common/dri_test.c > +++ b/src/mesa/drivers/dri/common/dri_test.c > @@ -11,11 +11,9 @@ extern char __driDriverExtensions[]; > > #if defined(GLX_USE_TLS) > > -PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch > - __attribute__((tls_model("initial-exec"))); > +PUBLIC TLS struct _glapi_table * _glapi_tls_Dispatch; > > -PUBLIC __thread void * _glapi_tls_Context > - __attribute__((tls_model("initial-exec"))); > +PUBLIC TLS void * _glapi_tls_Context; > > PUBLIC const struct _glapi_table *_glapi_Dispatch; > PUBLIC const void *_glapi_Context; > diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c > index 255a37b..57f3e9d 100644 > --- a/src/mesa/drivers/x11/glxapi.c > +++ b/src/mesa/drivers/x11/glxapi.c > @@ -159,8 +159,7 @@ get_dispatch(Display *dpy) > * GLX API current context. > */ > #if defined(GLX_USE_TLS) > -PUBLIC __thread void * CurrentContext > - __attribute__((tls_model("initial-exec"))); > +PUBLIC TLS void * CurrentContext; > #elif defined(THREADS) > static _glthread_TSD ContextTSD; /**< Per-thread context pointer */ > #else > -- > 1.7.4.4 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev