From 7ad970c1f4abe6efa3bf48db093c3f750030e1f2 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Tue, 21 Aug 2012 14:38:30 +0200 Subject: [PATCH] build: add build-time check for gbm_bo_get_stride() 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 --- configure.ac | 2 ++ src/uterm_video_drm.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index b0c005e..3ea4ce3 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]]) + # # xkbcommon keyboard backend # This checks for the xkbcommon library for keyboard handling in uterm. If it is diff --git a/src/uterm_video_drm.c b/src/uterm_video_drm.c index c271df5..179fb3a 100644 --- a/src/uterm_video_drm.c +++ b/src/uterm_video_drm.c @@ -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? */