[PATCH weston 1/2] Fix build breakage when using older gbm lacking dmabuf import

Bryce Harrington bryce at osg.samsung.com
Fri Aug 14 12:53:24 PDT 2015


The buildbots discovered this issue on Ubuntu 14.04, which carries
libgbm 10.1.3-0ubuntu0.4.  The dmabuf changes need gbm 10.2, so it fails
during build like this:

  src/compositor-drm.c: In function ‘drm_output_prepare_overlay_view’:
  src/compositor-drm.c:984:10: error: variable ‘gbm_dmabuf’ has
  initializer but incomplete type
     struct gbm_import_fd_data gbm_dmabuf = {
            ^
  etc.

Proposed fix is to conditionalize the gbm fd import feature in
compositor-drm.

This fix was suggested by daniels.  I set up a synthetic test
environment to reproduce the issue as found by the buildbots and tweaked
the patch to get it to build both with and without gbm 10.2.

Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
---
 configure.ac         | 3 +++
 src/compositor-drm.c | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/configure.ac b/configure.ac
index 0f74581..e610e2d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -172,6 +172,9 @@ AM_CONDITIONAL(ENABLE_DRM_COMPOSITOR, test x$enable_drm_compositor = xyes)
 if test x$enable_drm_compositor = xyes; then
   AC_DEFINE([BUILD_DRM_COMPOSITOR], [1], [Build the DRM compositor])
   PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm mtdev >= 1.1.0])
+  PKG_CHECK_MODULES(DRM_COMPOSITOR_GBM, [gbm >= 10.2],
+		    [AC_DEFINE([HAVE_GBM_FD_IMPORT], 1, [gbm supports dmabuf import])],
+		    [AC_MSG_WARN([gbm does not support dmabuf import, will omit that capability])])
 fi
 
 
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 1bfe263..26f0012 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -974,6 +974,7 @@ drm_output_prepare_overlay_view(struct drm_output *output,
 		return NULL;
 
 	if ((dmabuf = linux_dmabuf_buffer_get(buffer_resource))) {
+#ifdef HAVE_GBM_FD_IMPORT
 		/* XXX: TODO:
 		 *
 		 * Use AddFB2 directly, do not go via GBM.
@@ -994,6 +995,9 @@ drm_output_prepare_overlay_view(struct drm_output *output,
 
 		bo = gbm_bo_import(b->gbm, GBM_BO_IMPORT_FD, &gbm_dmabuf,
 				   GBM_BO_USE_SCANOUT);
+#else
+		return NULL;
+#endif
 	} else {
 		bo = gbm_bo_import(b->gbm, GBM_BO_IMPORT_WL_BUFFER,
 				   buffer_resource, GBM_BO_USE_SCANOUT);
-- 
1.9.1



More information about the wayland-devel mailing list