[PATCH weston 5/5] compositor-drm: Don't leak FBs when the buffer of a sprite is detroyed

Ander Conselvan de Oliveira conselvan2 at gmail.com
Tue Jun 26 07:09:15 PDT 2012


As a side effect, the overlay is disabled when the buffer is destroyed.
---
 src/compositor-drm.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 6c182d7..334a421 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1188,8 +1188,11 @@ sprite_handle_buffer_destroy(struct wl_listener *listener, void *data)
 	struct drm_sprite *sprite =
 		container_of(listener, struct drm_sprite,
 			     destroy_listener);
+	struct drm_compositor *compositor = sprite->compositor;
 
 	sprite->surface = NULL;
+	drmModeRmFB(compositor->drm.fd, sprite->fb_id);
+	sprite->fb_id = 0;
 }
 
 static void
@@ -1198,8 +1201,11 @@ sprite_handle_pending_buffer_destroy(struct wl_listener *listener, void *data)
 	struct drm_sprite *sprite =
 		container_of(listener, struct drm_sprite,
 			     pending_destroy_listener);
+	struct drm_compositor *compositor = sprite->compositor;
 
 	sprite->pending_surface = NULL;
+	drmModeRmFB(compositor->drm.fd, sprite->pending_fb_id);
+	sprite->pending_fb_id = 0;
 }
 
 /* returns a value between 0-255 range, where higher is brighter */
-- 
1.7.9.5



More information about the wayland-devel mailing list