[PATCH weston 3/8] compositor-drm: use weston_buffer_reference()

Pekka Paalanen ppaalanen at gmail.com
Fri Nov 23 05:56:52 PST 2012


Convert the manual reference handling into weston_buffer_reference()
calls.

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 src/compositor-drm.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 142faa5..923b3b2 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -208,10 +208,8 @@ drm_fb_destroy_callback(struct gbm_bo *bo, void *data)
 	if (fb->fb_id)
 		drmModeRmFB(gbm_device_get_fd(gbm), fb->fb_id);
 
-	if (fb->buffer) {
-		weston_buffer_post_release(fb->buffer);
-		wl_list_remove(&fb->buffer_destroy_listener.link);
-	}
+	weston_buffer_reference(&fb->buffer, NULL,
+				&fb->buffer_destroy_listener);
 
 	free(data);
 }
@@ -297,12 +295,10 @@ drm_fb_set_buffer(struct drm_fb *fb, struct wl_buffer *buffer)
 	assert(fb->buffer == NULL);
 
 	fb->is_client_buffer = 1;
-	fb->buffer = buffer;
-	fb->buffer->busy_count++;
 	fb->buffer_destroy_listener.notify = fb_handle_buffer_destroy;
 
-	wl_signal_add(&fb->buffer->resource.destroy_signal,
-		      &fb->buffer_destroy_listener);
+	weston_buffer_reference(&fb->buffer, buffer,
+				&fb->buffer_destroy_listener);
 }
 
 static struct weston_plane *
-- 
1.7.8.6



More information about the wayland-devel mailing list