[Mesa-dev] [PATCH] egl: Create queryable strings in eglInitialize().

Dave Airlie airlied at gmail.com
Sun Mar 15 22:19:19 PDT 2015


On 13 March 2015 at 08:37, Chad Versace <chad.versace at intel.com> wrote:
> On 03/10/2015 09:15 PM, Matt Turner wrote:
>> On Tue, Mar 10, 2015 at 8:19 PM, Ian Romanick <idr at freedesktop.org> wrote:
>>> On 03/10/2015 05:20 PM, Matt Turner wrote:
>>>> Creating/recreating the strings in eglQueryString() is extra work and
>>>> isn't thread-safe, as exhibited by shader-db's run.c using libepoxy.
>>>>
>>>> Multiple threads in run.c call eglReleaseThread() around the same time.
>>>> libepoxy calls eglQueryString() to determine whether eglReleaseThread()
>>>> exists, and our EGL implementation passes a pointer to the version
>>>> string to libepoxy while simultaneously overwriting the string, leading
>>>> to a failure in libepoxy.
>>>>
>>>> Moreover, the EGL spec says (emphasis mine):
>>>>
>>>> "eglQueryString returns a pointer to a *static*, zero-terminated string"
>>>>
>>>> This patch moves some auxiliary functions from eglmisc.c to eglapi.c so
>>>> that they may be used to create the extension, API, and version strings
>>>> once during eglInitialize(). The auxiliary functions are renamed from
>>>> _eglUpdate* to _eglCreate*, and some checks made unnecessary by calling
>>>> the functions from eglInitialize() are removed.
>>>>
>>>> It was suggested to me to simply make the generation of the version
>>>> string behave like that of the extension and API strings -- to do a
>>>> check like

This patch is causing a crash for me when I have an app that repeatedly
calls eglInitialise and eglTerminate in a loop

eventually I hit the assert for adding the APIs as the string has
grown endlessly

Dave.


More information about the mesa-dev mailing list