[Mesa-dev] EGL: Question about deferred context and surface destroy

Mike Gorchak mike.gorchak.qnx at gmail.com
Wed Apr 26 14:08:54 UTC 2017


Hi Tapani,

Sure, I can share them, but they are QNX based. And as far as I remember it
was an issue in the past :)

I think the simplest way for you is to add following calls to function
eglutCreateWindow():

https://cgit.freedesktop.org/mesa/demos/tree/src/egl/eglut/eglut.c#n321

   if (!eglMakeCurrent(_eglut->dpy, win->surface, win->surface, win->context))
      _eglutFatal("failed to make window current");

to

   if (!eglMakeCurrent(_eglut->dpy, win->surface, win->surface, win->context))
      _eglutFatal("failed to make window current");

   eglDestroySurface(_eglut->dpy, win->surface);

   eglDestroyContext(_eglut->dpy, win->context);

And then run GLES 1.x gears for example. According to EGL specification,
these Destroy calls should be delayed till surface and context is not
current in any thread. Perhaps I understand specification too literally,
that's why I'm asking rather than reporting it as a bug.

Thank you!


On Wed, Apr 26, 2017 at 2:09 AM, Tapani Pälli <tapani.palli at intel.com>
wrote:

> On 04/25/2017 10:20 PM, Mike Gorchak wrote:
>
> Hi all,
>
> During a quick tests of latest Mesa3D versions at different branches 12.x,
> 13.x, 17.x we have found that deferred context and surface destroy doesn't
> work properly.
>
>
> What kind of test case are you using, could you share this?
>
> According to docs:
> https://www.khronos.org/registry/EGL/sdk/docs/man/
> html/eglDestroySurface.xhtml
>
> Description
> If the EGL surface is not current to any thread, eglDestroySurface
> destroys it immediately. Otherwise, surface is destroyed when it becomes
> not current to any thread. Furthermore, resources associated with a pbuffer
> surface are not released until all color buffers of that pbuffer bound to a
> texture object have been released.
>
> Same for context destroy:
> https://www.khronos.org/registry/EGL/sdk/docs/man/
> html/eglDestroyContext.xhtml
>
> Description
> If the EGL rendering context is not current to any thread,
> eglDestroyContext destroys it immediately. Otherwise, context is destroyed
> when it becomes not current to any thread.
>
> Should this behavior be handled at EGL common DRI2 level or DRI2 platform
> driver level or it should be handled by EGL itself? I can see some
> refcounts implemented for EGL surfaces, buteglMakeCurrent seems don't
> increment them for surfaces and contexts.
>
> Thanks!
>
>
>
> _______________________________________________
> mesa-dev mailing listmesa-dev at lists.freedesktop.orghttps://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170426/4d5a4e30/attachment-0001.html>


More information about the mesa-dev mailing list