<div class="gmail_quote">On Thu, Dec 1, 2011 at 11:43 PM, Alexandros Frantzis <span dir="ltr">&lt;<a href="mailto:alexandros.frantzis@linaro.org">alexandros.frantzis@linaro.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Dec 01, 2011 at 09:42:03PM +0000, José Fonseca wrote:<br>
&gt; Hi Alexandros,<br>
&gt;<br>
&gt; Looks good overall.<br>
&gt;<br>
&gt; But there&#39;s one detail I&#39;d prefer see done differently: it&#39;s better not to<br>
&gt; introduce this reverse/cyclic dependency from glproc to glws. glproc should<br>
&gt; be self-sufficient, and the code organized in the following layers:<br>
&gt;<br>
&gt;   (e)glimports  // type definitions<br>
&gt;    |<br>
&gt;    V<br>
&gt;   glproc        // dynamic binding of the entrypoints<br>
&gt;    |<br>
&gt;    V<br>
&gt;   glws          // window system abstraction<br>
&gt;    |<br>
&gt;    V<br>
&gt;  (e)glretrace   // actual application<br>
&gt;<br>
&gt; The <a href="https://github.com/apitrace/apitrace/tree/glproc-cleanup" target="_blank">https://github.com/apitrace/apitrace/tree/glproc-cleanup</a> takes some of<br>
&gt; your changes but obverses the above scheme.  There&#39;s more stuff I wanna do<br>
&gt; in glproc, but it&#39;s a good step. I&#39;ve already tested it on<br>
&gt; Linux/MacOSX/Windows, so if it doesn&#39;t regress Android for you I&#39;ll merge<br>
&gt; it.<br>
<br>
</div>The main problem I see, is that __libegl_sym() opens only libEGL.so, so<br>
it can only access egl (not gl) symbols through dlsym(). On Mesa, the<br>
core gl* symbols are actually returned by the call to eglGetProcAddress(),<br>
but this behavior goes against the EGL spec: &quot;eglGetProcAddress may not<br>
be queried for core (non-extension) functions in EGL or client APIs&quot;,<br>
and is not supported by strictly conforming drivers. For example, this<br>
fails with the PVR driver for the embedded SGX cores.<br></blockquote><div><br></div><div>hmm.. this is very confusing. I&#39;ll need to read more about EGL ABI.</div><div><br></div><div>So, in summary:</div><div>- dlsym(dlopen(&quot;libGL.so&quot;), XXX) for core GL functions</div>
<div>- dlsym(dlopen(&quot;libGLESv1_CM.so&quot;), XXX) for for GLES 1 core functions</div><div><div>- dlsym(dlopen(&quot;libGLESv2.so&quot;), XXX) for for GLES 2 core functions</div></div><div><div>- eglGetProcAddress(XXX) for extensions (any API)</div>
</div><div><br></div><div>What about the functions which are common to all? e.g., glEnable? can we pick any of the libGL(ES)*.so libraries or do we need to ensure that they are only used in the right context?</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Consequently, we need a mechanism, like the one in the<br>
&#39;retrace-no-link-gl-wip&#39; patchset, to select and dlopen() the correct gl<br>
library depending on the current context. Of course, in this case we<br>
don&#39;t have access to saved glws state, but we can easily figure out the<br>
current API and version using EGL functions.</blockquote><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">If you&#39;d like, I can work on a patch for this. We just need to make sure<br>

we don&#39;t both start working on it :)<br></blockquote><div><br></div><div>I&#39;ll be offline soon, so feel free to work on a follow on patch.</div><div><br></div><div>Jose</div></div><br>