From aa6433d8c59aca0be5e4588b77ac025067b954f0 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Mon, 28 Nov 2011 16:22:46 +0000 Subject: [PATCH] kms: Check for EGL_KHR_surfaceless_opengl extension This adds a check for the EGL_KHR_surfaceless_opengl extension which we depend on for being able to MakeCurrent (NO_SURFACE) as well as create a context without and EGLConfig. Reviewed-by: Rob Bradford --- cogl/winsys/cogl-winsys-egl-feature-functions.h | 5 +++++ cogl/winsys/cogl-winsys-egl-private.h | 3 ++- cogl/winsys/cogl-winsys-kms.c | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cogl/winsys/cogl-winsys-egl-feature-functions.h b/cogl/winsys/cogl-winsys-egl-feature-functions.h index 3d347b9d8..2d5301f5f 100644 --- a/cogl/winsys/cogl-winsys-egl-feature-functions.h +++ b/cogl/winsys/cogl-winsys-egl-feature-functions.h @@ -88,3 +88,8 @@ COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglUnbindWaylandDisplay, struct wl_display *wayland_display)) COGL_WINSYS_FEATURE_END () #endif +COGL_WINSYS_FEATURE_BEGIN (surfaceless_opengl, + "KHR\0", + "surfaceless_opengl\0", + COGL_EGL_WINSYS_FEATURE_SURFACELESS_OPENGL) +COGL_WINSYS_FEATURE_END () diff --git a/cogl/winsys/cogl-winsys-egl-private.h b/cogl/winsys/cogl-winsys-egl-private.h index a888aa5f6..d228ffbb1 100644 --- a/cogl/winsys/cogl-winsys-egl-private.h +++ b/cogl/winsys/cogl-winsys-egl-private.h @@ -33,7 +33,8 @@ typedef enum _CoglEGLWinsysFeature { COGL_EGL_WINSYS_FEATURE_SWAP_REGION =1L<<0, COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_X11_PIXMAP =1L<<1, - COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_WAYLAND_BUFFER =1L<<2 + COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_WAYLAND_BUFFER =1L<<2, + COGL_EGL_WINSYS_FEATURE_SURFACELESS_OPENGL =1L<<3 } CoglEGLWinsysFeature; typedef struct _CoglRendererEGL diff --git a/cogl/winsys/cogl-winsys-kms.c b/cogl/winsys/cogl-winsys-kms.c index 51ec8d853..f0ef5927c 100644 --- a/cogl/winsys/cogl-winsys-kms.c +++ b/cogl/winsys/cogl-winsys-kms.c @@ -120,6 +120,15 @@ _cogl_winsys_kms_display_setup (CoglDisplay *display, GError **error) drmModeEncoder *encoder; int i; + if (!(egl_renderer->private_features & + COGL_EGL_WINSYS_FEATURE_SURFACELESS_OPENGL)) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "EGL_KHR_surfaceless_opengl extension not available"); + return FALSE; + } + resources = drmModeGetResources (kms_renderer->fd); if (!resources) {