[PATCH weston] gl-renderer: Fix an invalid write when closing a Weston window

Daniel Stone daniel at fooishbar.org
Mon Nov 28 11:30:06 UTC 2016


Hi Dima,
Apparently my reply here got lost in the ether ...

On 24 November 2016 at 12:50, Dima Ryazanov <dima at gmail.com> wrote:
> Forgot to mention: this only happens when using the wayland backend, not
> x11. It's triggered by the next call to eglMakeCurrent (when the remaining
> window is repainted), so it might not happen immediately, either. I'm using
> an Intel graphics card and Mesa 12.0.3.

Right, I was using the Wayland backend there too. Maybe it's fixed in
a newer Mesa.

> I actually saw the comment in gl_renderer_destroy and searched for Mesa
> bugs, but found this email:
> https://lists.freedesktop.org/archives/wayland-devel/2013-October/011622.html
> "[...] An EGLSurface is current for a context from eglMakeCurrent up until
> eglMakeCurrent is called for the conetxte with another surface or the
> context is destroyed.  The wl_egl_surface (the native window object) has to
> be available (can not be destroyed) for the entire time the EGLSurface
> exists."
> (Though it's from 2013, so maybe things have changed since.)
>
> There was also a similar fix for the simple-egl client a while ago:
> https://lists.freedesktop.org/archives/wayland-devel/2013-April/008718.html

Hm, yeah. Indeed it is consistent, but I hadn't realised that the
_client_ needed to ensure the NativeWindow stuck around until the
destroy took effect. That's pretty painful. I'll merge this then -
thanks!

To ssh://git.freedesktop.org/git/wayland/weston
   e3a582f..89c2f63  upstream -> master

Cheers,
Daniel

> On Thu, Nov 24, 2016 at 3:51 AM, Daniel Stone <daniel at fooishbar.org> wrote:
>>
>> Hi Dima,
>>
>> On 24 November 2016 at 02:41, Dima Ryazanov <dima at gmail.com> wrote:
>> > Call eglMakeCurrent before destroying the native EGL window, similar to
>> > what
>> > other sample clients are already doing.
>>
>> This doesn't show as an error here, with your suggested reproduction
>> instructions. From eglDestroySurface:
>> 'If the EGL surface surface is not current to any thread,
>> eglDestroySurface destroys it immediately. Otherwise, surface is
>> destroyed when it becomes not current to any thread.'
>>
>> Which GL stack are you using? The comment above the no-surface
>> MakeCurrent in gl_renderer_destroy() is probably pretty telling, that
>> Mesa once had a bug.
>>
>> Regardless of this, I am inclined to apply it to match the others,
>> even just so we can be sure that the destroy takes effect immediately.
>>
>> Cheers,
>> Daniel
>
>


More information about the wayland-devel mailing list