[clutter/wip/wayland-for-demo: 3/5] kms fd



commit 62e46ff3a96eafea7582d6127971f487e31163ea
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Feb 28 09:48:10 2014 -0500

    kms fd

 clutter/egl/clutter-backend-eglnative.c |   31 +++++++++++++++++++++++++++++++
 clutter/egl/clutter-egl.h               |    2 ++
 2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/clutter/egl/clutter-backend-eglnative.c b/clutter/egl/clutter-backend-eglnative.c
index a99d374..b2794b5 100644
--- a/clutter/egl/clutter-backend-eglnative.c
+++ b/clutter/egl/clutter-backend-eglnative.c
@@ -57,6 +57,8 @@
 
 G_DEFINE_TYPE (ClutterBackendEglNative, clutter_backend_egl_native, CLUTTER_TYPE_BACKEND);
 
+static int _kms_fd = -1;
+
 static void
 clutter_backend_egl_native_dispose (GObject *gobject)
 {
@@ -71,6 +73,18 @@ clutter_backend_egl_native_dispose (GObject *gobject)
   G_OBJECT_CLASS (clutter_backend_egl_native_parent_class)->dispose (gobject);
 }
 
+static CoglRenderer *
+clutter_backend_egl_native_get_renderer (ClutterBackend  *backend,
+                                         GError         **error)
+{
+  CoglRenderer *renderer;
+
+  renderer = cogl_renderer_new ();
+  cogl_renderer_set_winsys_id (renderer, COGL_WINSYS_ID_EGL_KMS);
+  cogl_kms_renderer_set_kms_fd (renderer, _kms_fd);
+  return renderer;
+}
+
 static void
 clutter_backend_egl_native_class_init (ClutterBackendEglNativeClass *klass)
 {
@@ -80,6 +94,8 @@ clutter_backend_egl_native_class_init (ClutterBackendEglNativeClass *klass)
   gobject_class->dispose = clutter_backend_egl_native_dispose;
 
   backend_class->stage_window_type = CLUTTER_TYPE_STAGE_COGL;
+
+  backend_class->get_renderer = clutter_backend_egl_native_get_renderer;
 }
 
 static void
@@ -157,3 +173,18 @@ clutter_egl_get_egl_display (void)
   return 0;
 #endif
 }
+
+/**
+ * clutter_egl_native_set_kms_fd:
+ * @fd: The fd to talk to the kms driver with
+ *
+ * Sets the fd that Cogl should use to talk to the
+ * kms driver.
+ *
+ * Since: 1.18
+ */
+void
+clutter_egl_native_set_kms_fd (int fd)
+{
+  _kms_fd = fd;
+}
diff --git a/clutter/egl/clutter-egl.h b/clutter/egl/clutter-egl.h
index c15cd15..58d10bd 100644
--- a/clutter/egl/clutter-egl.h
+++ b/clutter/egl/clutter-egl.h
@@ -87,6 +87,8 @@ EGLDisplay      clutter_egl_display             (void);
  */
 EGLDisplay      clutter_egl_get_egl_display     (void);
 
+void clutter_egl_native_set_kms_fd (int fd);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_EGL_H__ */


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