kms: Fix the version check for GBM

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.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 38f1dc58b35023f9e6bbc0db746b1554bd0377fc)
This commit is contained in:
Neil Roberts 2012-09-06 17:33:20 +01:00
parent 023528d94e
commit 27d74f09df

View File

@ -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);