[Cogl] [PATCH] kms: Fix the version check for GBM

Neil Roberts neil at linux.intel.com
Thu Sep 6 09:33:20 PDT 2012


The check for whether to use ‘stride’ instead of ‘pitch’ from the GBM
API tries to check whether the GBM version is >= 8.1.0. However it was
comparing the major and micro components independently so any version
with the minor part set to 0 would fail. The GBM version in Mesa
master is now 9.0.0 which breaks it. This patch changes it to check
the version using the COGL_VERSION_ENCODE macro instead.
---
 cogl/winsys/cogl-winsys-egl-kms.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cogl/winsys/cogl-winsys-egl-kms.c b/cogl/winsys/cogl-winsys-egl-kms.c
index 4a9f51a..e1d098e 100644
--- a/cogl/winsys/cogl-winsys-egl-kms.c
+++ b/cogl/winsys/cogl-winsys-egl-kms.c
@@ -51,6 +51,7 @@
 #include "cogl-onscreen-private.h"
 #include "cogl-kms-renderer.h"
 #include "cogl-kms-display.h"
+#include "cogl-version.h"
 
 static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable;
 
@@ -676,7 +677,8 @@ _cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen)
   /* Now we need to set the CRTC to whatever is the front buffer */
   kms_onscreen->next_bo = gbm_surface_lock_front_buffer (kms_onscreen->surface);
 
-#if COGL_GBM_MAJOR >= 8 && COGL_GBM_MINOR >= 1
+#if (COGL_VERSION_ENCODE (COGL_GBM_MAJOR, COGL_GBM_MINOR, COGL_GBM_MICRO) >= \
+     COGL_VERSION_ENCODE (8, 1, 0))
   stride = gbm_bo_get_stride (kms_onscreen->next_bo);
 #else
   stride = gbm_bo_get_pitch (kms_onscreen->next_bo);
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list