<br><br><div class="gmail_quote">2010/12/13 Kristian Høgsberg <span dir="ltr"><<a href="mailto:krh@bitplanet.net">krh@bitplanet.net</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">On Sun, Dec 12, 2010 at 12:45 PM, Chia-I Wu <<a href="mailto:olvaffe@gmail.com">olvaffe@gmail.com</a>> wrote:<br>
> On Fri, Dec 10, 2010 at 7:03 PM, Chia-I Wu <<a href="mailto:olvaffe@gmail.com">olvaffe@gmail.com</a>> wrote:<br>
>> On Fri, Dec 10, 2010 at 4:01 PM, Jammy Zhou <<a href="mailto:jammy.zhou@linaro.org">jammy.zhou@linaro.org</a>> wrote:<br>
>>> On Fri, Dec 10, 2010 at 3:13 PM, Chia-I Wu <<a href="mailto:olvaffe@gmail.com">olvaffe@gmail.com</a>> wrote:<br>
>>>> With OpenGL ES coming to desktop, the way the current context/dispatch<br>
>>>> is stored, together with the way libGLES*.so is created, causes<br>
>>>> several issues[1]. The root of these issues is that the symbols<br>
>>>> defined in libGL.so and in libGLES*.so overlaps, and an application<br>
>>>> might link to both of them indirectly!<br>
>>>><br>
>>>> In light of GLX_EXT_create_context_es2_profile, the simplest solution<br>
>>>> would be to stop distributing libGLES*.so. Applications will always<br>
>>>> link to libGL.so. Those that use GLX can then call glXGetProcAddress<br>
>>>> to get the addresses of OpenGL ES 2.0 functions. But those that use<br>
>>>> EGL will be in trouble. eglGetProcAddress is defined not to return<br>
>>>> the addresses of non-extension functions.<br>
>>><br>
>>> I don't think it is a good solution to stop distributing libGLES*.so,<br>
>>> because in embeded/mobile world, a lot of applications have dependency on<br>
>>> libGLES*.so instead of libGL.so.<br>
>> I am curious how other vendors solve this issue. Or more generally,<br>
>> how other toolkits solve providing mulitple shared libraries with<br>
>> overlapping symbols, and that are also supposed to be used altogether.<br>
>>>><br>
>>>> If libGL.so and libGLES*.so both have to be distributed, then the<br>
>>>> question becomes how to handle symbols that overlaps gracefully.<br>
>>>><br>
>>>> Accessing global variables such as _glapi_Context and _glapi_Dispatch<br>
>>>> will fail. Say libGL.so and libGLES*.so both has a copy of<br>
>>>> _glapi_Context. There is no guarantee that GET_CURRENT_CONTEXT will<br>
>>>> return the same context set by _glapi_set_context.<br>
>>>><br>
>>>> Calling global functions will work as long as they are identical in<br>
>>>> both libGL.so and libGLES*.so. This means both libraries must agree<br>
>>>> on the order of slots in the dispatch table. And the problem with two<br>
>>>> copies of global _glapi_Dispatch also needs to be solved.<br>
>>>><br>
>>>> One solution for these issues is to move _glapi_Context,<br>
>>>> _glapi_Dispatch, and _glapi_* functions to libglapi.so. libGL.so and<br>
>>>> libGLES*.so will both link to libglapi.so. All the libraries must be<br>
>>>> distributed together, as they must agree on the dispatch table used.<br>
>>>> This change should not break the ABI for existing DRI drivers.<br>
>> Or to pick one of the libraries to own libglapi, and have others link to it.<br>
> I've been working toward this direction. libGL.so will provide<br>
> _glapi_* symbols as it is now. libGLES*.so will depend on libGL.so<br>
> instead of providing another copy of _glapi_*. On a x86 machine,<br>
> libGLESv1_CM.so and libGLESv2.so are down to 17K and 18K in size<br>
> respectively. The work can be found at<br>
><br>
> <a href="http://cgit.freedesktop.org/%7Eolv/mesa/log/?h=esapi-rework" target="_blank">http://cgit.freedesktop.org/~olv/mesa/log/?h=esapi-rework</a><br>
><br>
> Only the last commit is user-visible. It modifies <a href="http://configure.ac" target="_blank">configure.ac</a> to<br>
> define GLAPI_OWNER, which is the library that owns _glapi_* symbols.<br>
> It is always $(GL_LIB) unless --disable-opengl is given. When<br>
> libGLES*.so is built, Makefile will check if libGLES*.so is<br>
> GLAPI_OWNER and decide whether libGLES*.so should define _glapi_*<br>
> symbols itself, or use those from GLAPI_OWNER.<br>
<br>
</div></div>I really don't think this is something we should go out of our way to<br>
support. It's broken by design, and even if we could fix it with<br>
library tricks, it's not something any GLES2/GL application could<br>
depend on, since it would be Mesa specific. And if we do some kind of<br>
hack to make this work, I don't want libGLESv2 ending up depending on<br>
libGL.so and all the X dependencies in there. Better to have a shared<br>
glapi-only type library and then put GLX in a library that links to<br>
that and make libGLESv2 just a symlink to that. But again, even if we<br>
do that, linking to both libGL and libGLESv2 isn't going to be widely<br>
supported, so GL applications and libraries will have to come up with<br>
their own workarounds anyway or use something like<br>
<br>
<a href="https://blueprints.launchpad.net/linaro-graphics-wg/+spec/multimedia-linaro-runtime-gl-proxy" target="_blank">https://blueprints.launchpad.net/linaro-graphics-wg/+spec/multimedia-linaro-runtime-gl-proxy</a><br>
<br></blockquote><div><br>I'm working on this GL proxy project. And the problem in this thread is found when I tried to check the renderer info of OpenGL and OpenGL ES2.0 driver in one process to select proper backend automatically.<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I suppose there's no harm in adding this to mesa, but I don't see it<br>
solving the problem.<br>
<font color="#888888"><br>
Kristian<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br>