[PATCH] compositor-drm: Check that that we have a valid bo for scanout

Rob Bradford rob at robster.org.uk
Fri Sep 14 15:25:41 PDT 2012

From: Rob Bradford <rob at linux.intel.com>

If gbm_bo_import does not return a valid buffer for usage of
GBM_BO_USE_SCANOUT don't try and scan out the surface directly.

We've caught the SHM case explicitly earlier - this is to prevent other cases
where the bo cannot be scanned out.

Signed-off-by: Rob Bradford <rob at linux.intel.com>
 src/compositor-drm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 10f16bd..afaa2a9 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -295,6 +295,10 @@ drm_output_prepare_scanout_surface(struct weston_output *_output,
 	bo = gbm_bo_import(c->gbm, GBM_BO_IMPORT_WL_BUFFER,
 			   es->buffer, GBM_BO_USE_SCANOUT);
+	/* Unable to use the buffer for scanout */
+	if (!bo)
+		return NULL;
 	/* Need to verify output->region contained in surface opaque
 	 * region.  Or maybe just that format doesn't have alpha.
 	 * For now, scanout only if format is XRGB8888. */

More information about the wayland-devel mailing list