mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
Fix memory leak in Gallium EGL driver
With this patch, the reference count of the textures created in 'Surface::_validate()' gets decreased in the '~Surface()' destructor. Fixes #1012.
This commit is contained in:
parent
cca2dbc400
commit
5df654ace4
@ -411,6 +411,13 @@ class Surface : public native_surface
|
|||||||
wait = _wait;
|
wait = _wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~Surface()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NUM_NATIVE_ATTACHMENTS; i++)
|
||||||
|
if (_textures[i])
|
||||||
|
pipe_texture_reference(&_textures[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return texture used as backing store for the surface
|
* Return texture used as backing store for the surface
|
||||||
*/
|
*/
|
||||||
|
@ -81,13 +81,6 @@ bool QNitpickerGLContext::makeCurrent(QPlatformSurface *surface)
|
|||||||
if (qnglc_verbose)
|
if (qnglc_verbose)
|
||||||
PDBG("w->framebuffer() = %p", w->framebuffer());
|
PDBG("w->framebuffer() = %p", w->framebuffer());
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unfortunalety, this code triggers a memory leak somewhere,
|
|
||||||
* so it cannot be used yet.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (w->egl_surface() != EGL_NO_SURFACE)
|
if (w->egl_surface() != EGL_NO_SURFACE)
|
||||||
if (!eglDestroySurface(_egl_display, w->egl_surface()))
|
if (!eglDestroySurface(_egl_display, w->egl_surface()))
|
||||||
qFatal("eglDestroySurface() failed");
|
qFatal("eglDestroySurface() failed");
|
||||||
@ -100,23 +93,6 @@ bool QNitpickerGLContext::makeCurrent(QPlatformSurface *surface)
|
|||||||
|
|
||||||
w->egl_surface(egl_surface);
|
w->egl_surface(egl_surface);
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* temporary workaround, the surface gets created only once */
|
|
||||||
|
|
||||||
if (w->egl_surface() == EGL_NO_SURFACE) {
|
|
||||||
|
|
||||||
EGLSurface egl_surface =
|
|
||||||
eglCreateWindowSurface(_egl_display, _egl_config, &egl_window, 0);
|
|
||||||
|
|
||||||
if (egl_surface == EGL_NO_SURFACE)
|
|
||||||
qFatal("eglCreateiWindowSurface() failed");
|
|
||||||
|
|
||||||
w->egl_surface(egl_surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!eglMakeCurrent(_egl_display, w->egl_surface(), w->egl_surface(), _egl_context))
|
if (!eglMakeCurrent(_egl_display, w->egl_surface(), w->egl_surface(), _egl_context))
|
||||||
qFatal("eglMakeCurrent() failed");
|
qFatal("eglMakeCurrent() failed");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user