[mutter] native: Pass KMS fd to renderer



commit b2a62e6d5a4fd3de96ca8442a36a485198dcd091
Author: Jonas Ådahl <jadahl gmail com>
Date:   Sat May 7 23:09:59 2016 +0800

    native: Pass KMS fd to renderer
    
    Will be used in a later commit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768976

 src/backends/native/meta-backend-native.c  |   10 ++++-
 src/backends/native/meta-renderer-native.c |   63 ++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 1 deletions(-)
---
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index a348e7a..1750f2c 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -284,7 +284,15 @@ meta_backend_native_create_cursor_renderer (MetaBackend *backend)
 static MetaRenderer *
 meta_backend_native_create_renderer (MetaBackend *backend)
 {
-  return g_object_new (META_TYPE_RENDERER_NATIVE, NULL);
+  MetaBackendNative *native = META_BACKEND_NATIVE (backend);
+  MetaBackendNativePrivate *priv =
+    meta_backend_native_get_instance_private (native);
+  int kms_fd;
+
+  kms_fd = meta_launcher_get_kms_fd (priv->launcher);
+  return g_object_new (META_TYPE_RENDERER_NATIVE,
+                       "kms-fd", kms_fd,
+                       NULL);
 }
 
 static void
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 2b232c2..6e85655 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -32,15 +32,65 @@
 #include <glib-object.h>
 
 #include "backends/native/meta-renderer-native.h"
+#include "cogl/cogl.h"
+
+enum
+{
+  PROP_0,
+
+  PROP_KMS_FD,
+
+  PROP_LAST
+};
 
 struct _MetaRendererNative
 {
   MetaRenderer parent;
+
+  int kms_fd;
 };
 
 G_DEFINE_TYPE (MetaRendererNative, meta_renderer_native, META_TYPE_RENDERER)
 
 static void
+meta_renderer_native_get_property (GObject    *object,
+                                   guint       prop_id,
+                                   GValue     *value,
+                                   GParamSpec *pspec)
+{
+  MetaRendererNative *renderer_native = META_RENDERER_NATIVE (object);
+
+  switch (prop_id)
+    {
+    case PROP_KMS_FD:
+      g_value_set_int (value, renderer_native->kms_fd);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+meta_renderer_native_set_property (GObject      *object,
+                                   guint         prop_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+  MetaRendererNative *renderer_native = META_RENDERER_NATIVE (object);
+
+  switch (prop_id)
+    {
+    case PROP_KMS_FD:
+      renderer_native->kms_fd = g_value_get_int (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
 meta_renderer_native_init (MetaRendererNative *renderer_native)
 {
 }
@@ -48,4 +98,17 @@ meta_renderer_native_init (MetaRendererNative *renderer_native)
 static void
 meta_renderer_native_class_init (MetaRendererNativeClass *klass)
 {
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = meta_renderer_native_get_property;
+  object_class->set_property = meta_renderer_native_set_property;
+
+  g_object_class_install_property (object_class,
+                                   PROP_KMS_FD,
+                                   g_param_spec_int ("kms-fd",
+                                                     "KMS fd",
+                                                     "The KMS file descriptor",
+                                                     0, G_MAXINT, 0,
+                                                     G_PARAM_READWRITE |
+                                                     G_PARAM_CONSTRUCT_ONLY));
 }


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