[cogl] kms: Check for EGL_KHR_surfaceless_opengl extension



commit aa6433d8c59aca0be5e4588b77ac025067b954f0
Author: Robert Bragg <robert linux intel com>
Date:   Mon Nov 28 16:22:46 2011 +0000

    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 <rob linux intel com>

 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 deletions(-)
---
diff --git a/cogl/winsys/cogl-winsys-egl-feature-functions.h b/cogl/winsys/cogl-winsys-egl-feature-functions.h
index 3d347b9..2d5301f 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 a888aa5..d228ffb 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 51ec8d8..f0ef592 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)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]