build: add build-time check for gbm_bo_get_stride()
authorDavid Herrmann <dh.herrmann@googlemail.com>
Tue, 21 Aug 2012 12:38:30 +0000 (14:38 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Tue, 21 Aug 2012 12:38:30 +0000 (14:38 +0200)
Upstream mesa renamed gbm_bo_get_pitch() to gbm_bo_get_stride(). As gbm
has not seen an official release, they actually don't care but several
users complained about this. Therefore, we simply add a build-time check
for this. However, this may break when mesa is updated without recompiling
kmscon but that is less intrusive.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
configure.ac
src/uterm_video_drm.c

index b0c005e..3ea4ce3 100644 (file)
@@ -362,6 +362,8 @@ AM_CONDITIONAL([UTERM_HAVE_DUMB], [test x$dumb_enabled = xyes])
 AM_CONDITIONAL([UTERM_HAVE_DRM], [test x$drm_enabled = xyes])
 AM_CONDITIONAL([KMSCON_HAVE_GLES2], [test x$gles2_enabled = xyes])
 
+AC_CHECK_DECLS([gbm_bo_get_stride], [], [], [[#include <gbm.h>]])
+
 #
 # xkbcommon keyboard backend
 # This checks for the xkbcommon library for keyboard handling in uterm. If it is
index c271df5..179fb3a 100644 (file)
@@ -83,7 +83,11 @@ static int init_rb(struct uterm_display *disp, struct drm_rb *rb)
                return -EFAULT;
        }
 
+#if defined(HAVE_DECL_GBM_BO_GET_STRIDE) && HAVE_DECL_GBM_BO_GET_STRIDE
        stride = gbm_bo_get_stride(rb->bo);
+#else
+       stride = gbm_bo_get_pitch(rb->bo);
+#endif
        handle = gbm_bo_get_handle(rb->bo).u32;
 
        /* TODO: how can we choose 24/32 dynamically? */