[cogl] kms: Check for the right surfaceless extension depending on driver



commit 889e4aba9cc47ade5a8113c4e2e980e0b236f2e2
Author: Neil Roberts <neil linux intel com>
Date:   Wed Dec 7 18:43:41 2011 +0000

    kms: Check for the right surfaceless extension depending on driver
    
    There are three separate EGL_KHR_surfaceless_* extensions depending on
    which GL API is being used so we should probably check the right one
    depending on which driver Cogl has selected.
    
    Reviewed-by: Robert Bragg <robert linux intel com>

 cogl/winsys/cogl-winsys-egl-feature-functions.h |   10 +++++++++
 cogl/winsys/cogl-winsys-egl-private.h           |    4 ++-
 cogl/winsys/cogl-winsys-kms.c                   |   24 ++++++++++++++++++++--
 3 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/cogl/winsys/cogl-winsys-egl-feature-functions.h b/cogl/winsys/cogl-winsys-egl-feature-functions.h
index c043020..e979724 100644
--- a/cogl/winsys/cogl-winsys-egl-feature-functions.h
+++ b/cogl/winsys/cogl-winsys-egl-feature-functions.h
@@ -93,3 +93,13 @@ COGL_WINSYS_FEATURE_BEGIN (surfaceless_opengl,
                            "surfaceless_opengl\0",
                            COGL_EGL_WINSYS_FEATURE_SURFACELESS_OPENGL)
 COGL_WINSYS_FEATURE_END ()
+COGL_WINSYS_FEATURE_BEGIN (surfaceless_gles1,
+                           "KHR\0",
+                           "surfaceless_gles1\0",
+                           COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES1)
+COGL_WINSYS_FEATURE_END ()
+COGL_WINSYS_FEATURE_BEGIN (surfaceless_gles2,
+                           "KHR\0",
+                           "surfaceless_gles2\0",
+                           COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES2)
+COGL_WINSYS_FEATURE_END ()
diff --git a/cogl/winsys/cogl-winsys-egl-private.h b/cogl/winsys/cogl-winsys-egl-private.h
index 85af2f0..713cfce 100644
--- a/cogl/winsys/cogl-winsys-egl-private.h
+++ b/cogl/winsys/cogl-winsys-egl-private.h
@@ -45,7 +45,9 @@ 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_SURFACELESS_OPENGL            =1L<<3
+  COGL_EGL_WINSYS_FEATURE_SURFACELESS_OPENGL            =1L<<3,
+  COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES1             =1L<<4,
+  COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES2             =1L<<5
 } CoglEGLWinsysFeature;
 
 typedef struct _CoglRendererEGL
diff --git a/cogl/winsys/cogl-winsys-kms.c b/cogl/winsys/cogl-winsys-kms.c
index 4271788..f6acc59 100644
--- a/cogl/winsys/cogl-winsys-kms.c
+++ b/cogl/winsys/cogl-winsys-kms.c
@@ -115,17 +115,35 @@ _cogl_winsys_kms_display_setup (CoglDisplay *display, GError **error)
   CoglDisplayKMS *kms_display = &egl_display->kms_display;
   CoglRendererEGL *egl_renderer = display->renderer->winsys;
   CoglRendererKMS *kms_renderer = &egl_renderer->kms_renderer;
+  CoglEGLWinsysFeature surfaceless_feature = 0;
+  const char *surfaceless_feature_name = "";
   drmModeRes *resources;
   drmModeConnector *connector;
   drmModeEncoder *encoder;
   int i;
 
-  if (!(egl_renderer->private_features &
-        COGL_EGL_WINSYS_FEATURE_SURFACELESS_OPENGL))
+  switch (display->renderer->driver)
+    {
+    case COGL_DRIVER_GL:
+      surfaceless_feature = COGL_EGL_WINSYS_FEATURE_SURFACELESS_OPENGL;
+      surfaceless_feature_name = "opengl";
+      break;
+    case COGL_DRIVER_GLES1:
+      surfaceless_feature = COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES1;
+      surfaceless_feature_name = "gles1";
+      break;
+    case COGL_DRIVER_GLES2:
+      surfaceless_feature = COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES2;
+      surfaceless_feature_name = "gles2";
+      break;
+    }
+
+  if (!(egl_renderer->private_features & surfaceless_feature))
     {
       g_set_error (error, COGL_WINSYS_ERROR,
                    COGL_WINSYS_ERROR_INIT,
-                   "EGL_KHR_surfaceless_opengl extension not available");
+                   "EGL_KHR_surfaceless_%s extension not available",
+                   surfaceless_feature_name);
       return FALSE;
     }
 



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