native: Pass KMS fd to renderer

Will be used in a later commit.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
This commit is contained in:
Jonas Ådahl 2016-05-07 23:09:59 +08:00
parent a54042e938
commit b2a62e6d5a
2 changed files with 72 additions and 1 deletions

View File

@ -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

View File

@ -32,14 +32,64 @@
#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));
}