<br><br><div class="gmail_quote">2010/12/13 Kristian Høgsberg <span dir="ltr">&lt;<a href="mailto:krh@bitplanet.net">krh@bitplanet.net</a>&gt;</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 &lt;<a href="mailto:olvaffe@gmail.com">olvaffe@gmail.com</a>&gt; wrote:<br>
&gt; On Fri, Dec 10, 2010 at 7:03 PM, Chia-I Wu &lt;<a href="mailto:olvaffe@gmail.com">olvaffe@gmail.com</a>&gt; wrote:<br>
&gt;&gt; On Fri, Dec 10, 2010 at 4:01 PM, Jammy Zhou &lt;<a href="mailto:jammy.zhou@linaro.org">jammy.zhou@linaro.org</a>&gt; wrote:<br>
&gt;&gt;&gt; On Fri, Dec 10, 2010 at 3:13 PM, Chia-I Wu &lt;<a href="mailto:olvaffe@gmail.com">olvaffe@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt; With OpenGL ES coming to desktop, the way the current context/dispatch<br>
&gt;&gt;&gt;&gt; is stored, together with the way libGLES*.so is created, causes<br>
&gt;&gt;&gt;&gt; several issues[1].  The root of these issues is that the symbols<br>
&gt;&gt;&gt;&gt; defined in libGL.so and in libGLES*.so overlaps, and an application<br>
&gt;&gt;&gt;&gt; might link to both of them indirectly!<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; In light of GLX_EXT_create_context_es2_profile, the simplest solution<br>
&gt;&gt;&gt;&gt; would be to stop distributing libGLES*.so.  Applications will always<br>
&gt;&gt;&gt;&gt; link to libGL.so.  Those that use GLX can then call glXGetProcAddress<br>
&gt;&gt;&gt;&gt; to get the addresses of OpenGL ES 2.0 functions.  But those that use<br>
&gt;&gt;&gt;&gt; EGL will be in trouble.  eglGetProcAddress is defined not to return<br>
&gt;&gt;&gt;&gt; the addresses of non-extension functions.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I don&#39;t think it is a good solution to stop distributing libGLES*.so,<br>
&gt;&gt;&gt; because in embeded/mobile world, a lot of applications have dependency on<br>
&gt;&gt;&gt; libGLES*.so instead of libGL.so.<br>
&gt;&gt; I am curious how other vendors solve this issue.  Or more generally,<br>
&gt;&gt; how other toolkits solve providing mulitple shared libraries with<br>
&gt;&gt; overlapping symbols, and that are also supposed to be used altogether.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; If libGL.so and libGLES*.so both have to be distributed, then the<br>
&gt;&gt;&gt;&gt; question becomes how to handle symbols that overlaps gracefully.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Accessing global variables such as _glapi_Context and _glapi_Dispatch<br>
&gt;&gt;&gt;&gt; will fail.  Say libGL.so and libGLES*.so both has a copy of<br>
&gt;&gt;&gt;&gt; _glapi_Context.  There is no guarantee that GET_CURRENT_CONTEXT will<br>
&gt;&gt;&gt;&gt; return the same context set by _glapi_set_context.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Calling global functions will work as long as they are identical in<br>
&gt;&gt;&gt;&gt; both libGL.so and libGLES*.so.  This means both libraries must agree<br>
&gt;&gt;&gt;&gt; on the order of slots in the dispatch table.  And the problem with two<br>
&gt;&gt;&gt;&gt; copies of global _glapi_Dispatch also needs to be solved.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; One solution for these issues is to move _glapi_Context,<br>
&gt;&gt;&gt;&gt; _glapi_Dispatch, and _glapi_* functions to libglapi.so.  libGL.so and<br>
&gt;&gt;&gt;&gt; libGLES*.so will both link to libglapi.so.  All the libraries must be<br>
&gt;&gt;&gt;&gt; distributed together, as they must agree on the dispatch table used.<br>
&gt;&gt;&gt;&gt; This change should not break the ABI for existing DRI drivers.<br>
&gt;&gt; Or to pick one of the libraries to own libglapi, and have others link to it.<br>
&gt; I&#39;ve been working toward this direction.  libGL.so will provide<br>
&gt; _glapi_* symbols as it is now.  libGLES*.so will depend on libGL.so<br>
&gt; instead of providing another copy of _glapi_*.  On a x86 machine,<br>
&gt; libGLESv1_CM.so and libGLESv2.so are down to 17K and 18K in size<br>
&gt; respectively.  The work can be found at<br>
&gt;<br>
&gt;  <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>
&gt;<br>
&gt; Only the last commit is user-visible.  It modifies <a href="http://configure.ac" target="_blank">configure.ac</a> to<br>
&gt; define GLAPI_OWNER, which is the library that owns _glapi_* symbols.<br>
&gt; It is always $(GL_LIB) unless --disable-opengl is given.  When<br>
&gt; libGLES*.so is built, Makefile will check if libGLES*.so is<br>
&gt; GLAPI_OWNER and decide whether libGLES*.so should define _glapi_*<br>
&gt; symbols itself, or use those from GLAPI_OWNER.<br>
<br>
</div></div>I really don&#39;t think this is something we should go out of our way to<br>
support.  It&#39;s broken by design, and even if we could fix it with<br>
library tricks, it&#39;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&#39;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&#39;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&#39;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&#39;s no harm in adding this to mesa, but I don&#39;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>