[PATCH 5/5] Weston: fix drmModeRmFB

Martin Minarik minarik11 at student.fiit.stuba.sk
Sat Mar 31 03:58:00 PDT 2012


fb_id is unsigned integer, we are assigning -1 to it. Changed to 0xFFFF
should be better.



diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 4305cd5..f43f652 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1041,8 +1041,9 @@ create_output_for_connector(struct drm_compositor *ec,
 		drmModeFreeEncoder(encoder);
 		return -1;
 	}
-	output->fb_id[0] = -1;
-	output->fb_id[1] = -1;
+
+	output->fb_id[0] = 0xFFFF;
+	output->fb_id[1] = 0xFFFF;

 	memset(output, 0, sizeof *output);
 	output->base.subpixel = drm_subpixel_to_wayland(connector->subpixel);
@@ -1158,7 +1159,7 @@ err_fb:
 				  0);
 err_bufs:
 	for (i = 0; i < 2; i++) {
-		if (output->fb_id[i] != -1)
+		if (output->fb_id[i] != 0xFFFF)
 			drmModeRmFB(ec->drm.fd, output->fb_id[i]);
 		if (output->image[i])
 			ec->base.destroy_image(ec->base.display,



More information about the wayland-devel mailing list