[Mesa-dev] [PATCH 04/11] egl/x11_dri3: Notify the dri3 loader when we're about to close a screen
Thomas Hellstrom
thellstrom at vmware.com
Fri Aug 11 14:14:13 UTC 2017
This gives the dri3 loader a chance to clean up the blit context cache.
Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
---
src/egl/drivers/dri2/egl_dri2.c | 5 ++++-
src/egl/drivers/dri2/egl_dri2.h | 2 ++
src/egl/drivers/dri2/platform_x11_dri3.c | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index f584740..a6ac49a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -945,8 +945,11 @@ dri2_display_destroy(_EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
- if (dri2_dpy->own_dri_screen)
+ if (dri2_dpy->own_dri_screen) {
+ if (dri2_dpy->vtbl->close_screen_notify)
+ dri2_dpy->vtbl->close_screen_notify(disp);
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
+ }
if (dri2_dpy->fd >= 0)
close(dri2_dpy->fd);
if (dri2_dpy->driver)
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 751e7a4..f471561 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -154,6 +154,8 @@ struct dri2_egl_display_vtbl {
EGLuint64KHR *sbc);
__DRIdrawable *(*get_dri_drawable)(_EGLSurface *surf);
+
+ void (*close_screen_notify)(_EGLDisplay *dpy);
};
struct dri2_egl_display
diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c
index 9917498..290b150 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -401,6 +401,14 @@ dri3_get_dri_drawable(_EGLSurface *surf)
return dri3_surf->loader_drawable.dri_drawable;
}
+static void
+dri3_close_screen_notify(_EGLDisplay *dpy)
+{
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+
+ loader_dri3_close_screen(dri2_dpy->dri_screen);
+}
+
struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
.authenticate = dri3_authenticate,
.create_window_surface = dri3_create_window_surface,
@@ -420,6 +428,7 @@ struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
.create_wayland_buffer_from_image = dri2_fallback_create_wayland_buffer_from_image,
.get_sync_values = dri3_get_sync_values,
.get_dri_drawable = dri3_get_dri_drawable,
+ .close_screen_notify = dri3_close_screen_notify,
};
EGLBoolean
--
2.7.4
More information about the mesa-dev
mailing list