[Mesa-dev] [PATCH] Fix visibility of u_thread functions

Matt Turner mattst88 at gmail.com
Tue Jan 24 07:42:16 PST 2012


On Tue, Jan 24, 2012 at 10:33 AM, Matt Turner <mattst88 at gmail.com> wrote:
> On Mon, Jan 23, 2012 at 8:59 PM, Brian Paul <brian.e.paul at gmail.com> wrote:
>> On Mon, Jan 23, 2012 at 6:41 PM, Brian Paul <brian.e.paul at gmail.com> wrote:
>>> On Mon, Jan 23, 2012 at 12:48 PM, Matt Turner <mattst88 at gmail.com> wrote:
>>>> -fvisibility=hidden was preventing them from being exported, which
>>>> combined with shared-glapi was causing undefined symbol errors at
>>>> runtime.
>>>> ---
>>>> Brian: there might be more functions that should be exported. Let
>>>> me know (or let me know what to test to find them) and I'll clean
>>>> them up too.
>>>>
>>>>  src/mapi/mapi/u_thread.c |   26 +++++++++++++-------------
>>>>  1 files changed, 13 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/src/mapi/mapi/u_thread.c b/src/mapi/mapi/u_thread.c
>>>> index 7b52ca9..393ae48 100644
>>>> --- a/src/mapi/mapi/u_thread.c
>>>> +++ b/src/mapi/mapi/u_thread.c
>>>> @@ -62,14 +62,14 @@
>>>>  */
>>>>  #ifdef PTHREADS
>>>>
>>>> -unsigned long
>>>> +PUBLIC unsigned long
>>>>  u_thread_self(void)
>>>>  {
>>>>    return (unsigned long) pthread_self();
>>>>  }
>>>>
>>>>
>>>> -void
>>>> +PUBLIC void
>>>>  u_tsd_init(struct u_tsd *tsd)
>>>>  {
>>>>    if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
>>>> @@ -80,7 +80,7 @@ u_tsd_init(struct u_tsd *tsd)
>>>>  }
>>>>
>>>>
>>>> -void *
>>>> +PUBLIC void *
>>>>  u_tsd_get(struct u_tsd *tsd)
>>>>  {
>>>>    if (tsd->initMagic != (int) INIT_MAGIC) {
>>>> @@ -90,7 +90,7 @@ u_tsd_get(struct u_tsd *tsd)
>>>>  }
>>>>
>>>>
>>>> -void
>>>> +PUBLIC void
>>>>  u_tsd_set(struct u_tsd *tsd, void *ptr)
>>>>  {
>>>>    if (tsd->initMagic != (int) INIT_MAGIC) {
>>>> @@ -113,14 +113,14 @@ u_tsd_set(struct u_tsd *tsd, void *ptr)
>>>>  */
>>>>  #ifdef WIN32
>>>>
>>>> -unsigned long
>>>> +PUBLIC unsigned long
>>>>  u_thread_self(void)
>>>>  {
>>>>    return GetCurrentThreadId();
>>>>  }
>>>>
>>>>
>>>> -void
>>>> +PUBLIC void
>>>>  u_tsd_init(struct u_tsd *tsd)
>>>>  {
>>>>    tsd->key = TlsAlloc();
>>>> @@ -132,7 +132,7 @@ u_tsd_init(struct u_tsd *tsd)
>>>>  }
>>>>
>>>>
>>>> -void
>>>> +PUBLIC void
>>>>  u_tsd_destroy(struct u_tsd *tsd)
>>>>  {
>>>>    if (tsd->initMagic != INIT_MAGIC) {
>>>> @@ -143,7 +143,7 @@ u_tsd_destroy(struct u_tsd *tsd)
>>>>  }
>>>>
>>>>
>>>> -void *
>>>> +PUBLIC void *
>>>>  u_tsd_get(struct u_tsd *tsd)
>>>>  {
>>>>    if (tsd->initMagic != INIT_MAGIC) {
>>>> @@ -153,7 +153,7 @@ u_tsd_get(struct u_tsd *tsd)
>>>>  }
>>>>
>>>>
>>>> -void
>>>> +PUBLIC void
>>>>  u_tsd_set(struct u_tsd *tsd, void *ptr)
>>>>  {
>>>>    /* the following code assumes that the struct u_tsd has been initialized
>>>> @@ -177,21 +177,21 @@ u_tsd_set(struct u_tsd *tsd, void *ptr)
>>>>  * no-op functions
>>>>  */
>>>>
>>>> -unsigned long
>>>> +PUBLIC unsigned long
>>>>  u_thread_self(void)
>>>>  {
>>>>    return 0;
>>>>  }
>>>>
>>>>
>>>> -void
>>>> +PUBLIC void
>>>>  u_tsd_init(struct u_tsd *tsd)
>>>>  {
>>>>    (void) tsd;
>>>>  }
>>>>
>>>>
>>>> -void *
>>>> +PUBLIC void *
>>>>  u_tsd_get(struct u_tsd *tsd)
>>>>  {
>>>>    (void) tsd;
>>>> @@ -199,7 +199,7 @@ u_tsd_get(struct u_tsd *tsd)
>>>>  }
>>>>
>>>>
>>>> -void
>>>> +PUBLIC void
>>>>  u_tsd_set(struct u_tsd *tsd, void *ptr)
>>>>  {
>>>>    (void) tsd;
>>>> --
>>>> 1.7.3.4
>>>>
>>>
>>> This looks good, and it's fine if you commit it, but I've still got
>>> build problems:
>>>
>>> ./configure --enable-xlib-glx --disable-dri --enable-debug
>>> [...]
>>> make
>>> [...]
>>> ar: creating libglapi.a
>>> linker.cpp: In function ‘gl_shader* link_intrastage_shaders(void*,
>>> gl_context*, gl_shader_program*, gl_shader**, unsigned int)’:
>>> linker.cpp:1008: warning: ‘link_intrastage_shaders(void*, gl_context*,
>>> gl_shader_program*, gl_shader**, unsigned int)::array_sizing_visitor’
>>> declared with greater visibility than the type of its field
>>> ‘link_intrastage_shaders(void*, gl_context*, gl_shader_program*,
>>> gl_shader**, unsigned int)::array_sizing_visitor::<anonymous>’
>>> linker.cpp:1008: warning: ‘link_intrastage_shaders(void*, gl_context*,
>>> gl_shader_program*, gl_shader**, unsigned int)::array_sizing_visitor’
>>> declared with greater visibility than its base
>>> ‘ir_hierarchical_visitor’
>>> ar: creating libglsl.a
>>> ar: creating libmesa.a
>>> ar: creating libmesagallium.a
>>> /usr/bin/ld: cannot find -lglapi
>>> collect2: ld returned 1 exit status
>>> mv: cannot stat `libGL.so.1.5.08000': No such file or directory
>>> ar: creating libegl_glx.a
>>> ar: creating libgallium.a
>>> ar: creating libgalahad.a
>>> ar: creating libidentity.a
>>> ar: creating libllvmpipe.a
>>> ar: creating libnoop.a
>>> ar: creating libr300.a
>>> r600_asm.c: In function ‘is_alu_trans_unit_inst’:
>>> r600_asm.c:505: warning: control reaches end of non-void function
>>> r600_asm.c: In function ‘is_alu_vec_unit_inst’:
>>> r600_asm.c:488: warning: control reaches end of non-void function
>>> r600_pipe.c: In function ‘r600_get_shader_param’:
>>> r600_pipe.c:459: warning: unused variable ‘rscreen’
>>> ar: creating libr600.a
>>> ar: creating librbug.a
>>> sp_state_derived.c: In function ‘softpipe_get_vertex_info’:
>>> sp_state_derived.c:91: warning: ‘interp’ may be used uninitialized in
>>> this function
>>> ar: creating libsoftpipe.a
>>> ar: creating libsvga.a
>>> ar: creating libtrace.a
>>> ar: creating libxlib.a
>>> ar: creating libws_null.a
>>> ar: creating libwsw.a
>>> ar: creating libws_xlib.a
>>> Makefile:115: depend: No such file or directory
>>> /usr/bin/ld: cannot find -lglapi
>>> collect2: ld returned 1 exit status
>>> mv: cannot stat `libGL.so.1.5.08000': No such file or directory
>>
>> Nevermind.  A clean build from scratch fixed that.
>>
>> However, any program that uses extension functions acts peculiar and dies:
>>
>> $ cd demos/src/demos
>> $ ./fbotexture
>> GL_RENDERER = Mesa X11
>> Mesa: User error: GL_INVALID_OPERATION in glEndConditionalRender()
>> Mesa: User error: GL_INVALID_ENUM in glGetIntegerIndexedv(pname=GL_FRAMEBUFFER)
>> Mesa: User error: GL_INVALID_ENUM in glTexParameter(target)
>> Mesa: User error: GL_INVALID_ENUM in glGetIntegerIndexedv(pname=GL_FRAMEBUFFER)
>> Mesa: User error: GL_INVALID_OPERATION in glBeginTransformFeedback(no
>> program active)
>> Mesa: User error: GL_INVALID_ENUM in glIsEnabledIndexed(cap=GL_RENDERBUFFER)
>> Mesa: User error: GL_INVALID_ENUM in glTransformFeedbackVaryings(bufferMode)
>> Mesa: User error: GL_INVALID_ENUM in glGetIntegerIndexedv(pname=GL_FRAMEBUFFER)
>> Mesa: User error: GL_INVALID_OPERATION in glBeginTransformFeedback(no
>> program active)
>> Mesa: User error: GL_INVALID_ENUM in glIsEnabledIndexed(cap=GL_RENDERBUFFER)
>> Mesa: User error: GL_INVALID_ENUM in glTransformFeedbackVaryings(bufferMode)
>> Unable to create/attach depth and stencil renderbuffers  to FBO!
>>
>> Clearly, the dispatch table is messed up and we're winding up in the
>> wrong functions.
>>
>> Can you investigate that?  Thanks.
>>
>> -Brian
>
> Okay, I can reproduce this. I'll take a look.
>
> Matt

In the meantime, I think we should just revert adefee50 since
shared-glapi causes a lot of problems with --enable-xlib-glx. I don't
want to hold up your renderbuffer-cleanups-v2 branch any more.

Thanks,
Matt


More information about the mesa-dev mailing list