kms: Update to latest gbm api

gbm_bo_get_pitch was renamed to gbm_bo_get_stride to be consistent with
how the terms pitch and stride are used throughout mesa. This updates
the Cogl backend to use the new gbm_bo_get_stride name.

For compatibility with previous version of libgbm we now explicitly
check the version of libgbm in configure.ac and expose
COGL_GBM_{MAJOR,MINOR,MICRO} defines to the code so we can conditionally
use the older gbm_bo_get_pitch() name with older versions.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 47c6247095e2f1f8725c4eb08d38c9de15e283cd)
This commit is contained in:
Robert Bragg 2012-08-07 14:56:45 +01:00
parent ef73e6e3b9
commit 74d749eca4
2 changed files with 16 additions and 3 deletions

View File

@ -662,7 +662,7 @@ _cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen)
CoglRendererKMS *kms_renderer = egl_renderer->platform; CoglRendererKMS *kms_renderer = egl_renderer->platform;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys; CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
CoglOnscreenKMS *kms_onscreen = egl_onscreen->platform; CoglOnscreenKMS *kms_onscreen = egl_onscreen->platform;
uint32_t handle, pitch; uint32_t handle, stride;
CoglFlipKMS *flip; CoglFlipKMS *flip;
GList *l; GList *l;
@ -676,7 +676,11 @@ _cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen)
/* Now we need to set the CRTC to whatever is the front buffer */ /* 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); kms_onscreen->next_bo = gbm_surface_lock_front_buffer (kms_onscreen->surface);
pitch = gbm_bo_get_pitch (kms_onscreen->next_bo); #if COGL_GBM_MAJOR >= 8 && COGL_GBM_MINOR >= 1
stride = gbm_bo_get_stride (kms_onscreen->next_bo);
#else
stride = gbm_bo_get_pitch (kms_onscreen->next_bo);
#endif
handle = gbm_bo_get_handle (kms_onscreen->next_bo).u32; handle = gbm_bo_get_handle (kms_onscreen->next_bo).u32;
if (drmModeAddFB (kms_renderer->fd, if (drmModeAddFB (kms_renderer->fd,
@ -684,7 +688,7 @@ _cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen)
kms_display->height, kms_display->height,
24, /* depth */ 24, /* depth */
32, /* bpp */ 32, /* bpp */
pitch, stride,
handle, handle,
&kms_onscreen->next_fb_id)) &kms_onscreen->next_fb_id))
{ {

View File

@ -859,6 +859,15 @@ AS_IF([test "x$enable_kms_egl_platform" = "xyes"],
], ],
[AC_MSG_ERROR([Unable to locate required kms libraries])]) [AC_MSG_ERROR([Unable to locate required kms libraries])])
GBM_VERSION=`$PKG_CONFIG --modversion gbm`
GBM_MAJOR=`echo $GBM_VERSION | cut -d'.' -f1`
GBM_MINOR=`echo $GBM_VERSION | cut -d'.' -f2`
GBM_MICRO=`echo $GBM_VERSION | cut -d'.' -f3`
AC_DEFINE_UNQUOTED([COGL_GBM_MAJOR], [$GBM_MAJOR], [The major version for libgbm])
AC_DEFINE_UNQUOTED([COGL_GBM_MINOR], [$GBM_MINOR], [The minor version for libgbm])
AC_DEFINE_UNQUOTED([COGL_GBM_MICRO], [$GBM_MICRO], [The micro version for libgbm])
COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_KMS_SUPPORT" COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_KMS_SUPPORT"
]) ])
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_KMS, AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_KMS,