<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:rhyskidd@gmail.com" title="Rhys Kidd <rhyskidd@gmail.com>"> <span class="fn">Rhys Kidd</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - eglTerminate then eglMakeCurrent crahes"
href="https://bugs.freedesktop.org/show_bug.cgi?id=69622">bug 69622</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>ASSIGNED
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>FIXED
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - eglTerminate then eglMakeCurrent crahes"
href="https://bugs.freedesktop.org/show_bug.cgi?id=69622#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - eglTerminate then eglMakeCurrent crahes"
href="https://bugs.freedesktop.org/show_bug.cgi?id=69622">bug 69622</a>
from <span class="vcard"><a class="email" href="mailto:rhyskidd@gmail.com" title="Rhys Kidd <rhyskidd@gmail.com>"> <span class="fn">Rhys Kidd</span></a>
</span></b>
<pre>Resolved with:
commit 9ee683f877b283020c6f24776236f1145cb7a4ea
Author: Nicolas Boichat <<a href="mailto:drinkcat@chromium.org">drinkcat@chromium.org</a>>
Date: Fri Jul 22 11:27:41 2016 +0800
egl/dri2: Add reference count for dri2_egl_display
android.opengl.cts.WrapperTest#testGetIntegerv1 CTS test calls
eglTerminate, followed by eglReleaseThread. A similar case is
observed in this bug: <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - eglTerminate then eglMakeCurrent crahes"
href="show_bug.cgi?id=69622">https://bugs.freedesktop.org/show_bug.cgi?id=69622</a>,
where the test calls eglTerminate, then eglMakeCurrent(dpy, NULL, NULL,
NULL).
With the current code, dri2_dpy structure is freed on eglTerminate
call, so the display is not initialized when eglReleaseThread calls
MakeCurrent with NULL parameters, to unbind the context, which
causes a a segfault in drv->API.MakeCurrent (dri2_make_current),
either in glFlush or in a latter call.
eglTerminate specifies that "If contexts or surfaces associated
with display is current to any thread, they are not released until
they are no longer current as a result of eglMakeCurrent."
However, to properly free the current context/surface (i.e., call
glFlush, unbindContext, driDestroyContext), we still need the
display vtbl (and possibly an active dri dpy connection). Therefore,
we add some reference counter to dri2_egl_display, to make sure
the structure is kept allocated as long as it is required.
One drawback of this is that eglInitialize may not completely reinitialize
the display (if eglTerminate was called with a current context), however,
this seems to meet the EGL spec quite well, and does not permanently
leak any context/display even for incorrectly written apps.
Cc: "12.0" <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.org</a>>
Signed-off-by: Nicolas Boichat <<a href="mailto:drinkcat@chromium.org">drinkcat@chromium.org</a>>
Reviewed-by: Eric Engestrom <<a href="mailto:eric.engestrom@imgtec.com">eric.engestrom@imgtec.com</a>>
Reviewed-by: Emil Velikov <<a href="mailto:emil.velikov@collabora.com">emil.velikov@collabora.com</a>></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>