Make the native backend build-optional

This commit is contained in:
Jasper St. Pierre 2014-05-29 12:11:26 -04:00
parent b240a5e819
commit 806a666950
7 changed files with 55 additions and 18 deletions

View File

@ -199,9 +199,15 @@ AS_IF([test "x$WAYLAND_SCANNER" = "xno"],
AC_SUBST([WAYLAND_SCANNER]) AC_SUBST([WAYLAND_SCANNER])
AC_SUBST(XWAYLAND_PATH) AC_SUBST(XWAYLAND_PATH)
MUTTER_PC_MODULES="$MUTTER_PC_MODULES clutter-wayland-1.0 clutter-wayland-compositor-1.0 clutter-egl-1.0 wayland-server >= 1.4.93 libdrm libsystemd" MUTTER_PC_MODULES="$MUTTER_PC_MODULES clutter-wayland-1.0 clutter-wayland-compositor-1.0 clutter-egl-1.0 wayland-server >= 1.4.93"
PKG_CHECK_MODULES(MUTTER, $MUTTER_PC_MODULES) PKG_CHECK_MODULES(MUTTER, $MUTTER_PC_MODULES)
PKG_CHECK_MODULES(MUTTER_NATIVE_BACKEND, [libdrm libsystemd], [have_native_backend=yes], [have_native_backend=no])
if test $have_native_backend = yes; then
AC_DEFINE([HAVE_NATIVE_BACKEND],[1],[Define if you want to enable the native (KMS) backend based on systemd])
fi
AM_CONDITIONAL([HAVE_NATIVE_BACKEND],[test $have_native_backend = yes])
PKG_CHECK_EXISTS([xi >= 1.6.99.1], PKG_CHECK_EXISTS([xi >= 1.6.99.1],
AC_DEFINE([HAVE_XI23],[1],[Define if you have support for XInput 2.3 or greater])) AC_DEFINE([HAVE_XI23],[1],[Define if you have support for XInput 2.3 or greater]))

View File

@ -11,6 +11,7 @@ INCLUDES= \
-DCOGL_ENABLE_EXPERIMENTAL_API \ -DCOGL_ENABLE_EXPERIMENTAL_API \
-DCOGL_ENABLE_EXPERIMENTAL_2_0_API \ -DCOGL_ENABLE_EXPERIMENTAL_2_0_API \
$(MUTTER_CFLAGS) \ $(MUTTER_CFLAGS) \
$(MUTTER_NATIVE_BACKEND_CFLAGS) \
-I$(srcdir) \ -I$(srcdir) \
-I$(srcdir)/backends \ -I$(srcdir)/backends \
-I$(srcdir)/core \ -I$(srcdir)/core \
@ -71,18 +72,6 @@ libmutter_la_SOURCES = \
backends/meta-monitor-manager-dummy.h \ backends/meta-monitor-manager-dummy.h \
backends/edid-parse.c \ backends/edid-parse.c \
backends/edid.h \ backends/edid.h \
backends/native/meta-backend-native.c \
backends/native/meta-backend-native.h \
backends/native/meta-cursor-renderer-native.c \
backends/native/meta-cursor-renderer-native.h \
backends/native/meta-idle-monitor-native.c \
backends/native/meta-idle-monitor-native.h \
backends/native/meta-monitor-manager-kms.c \
backends/native/meta-monitor-manager-kms.h \
backends/native/meta-launcher.c \
backends/native/meta-launcher.h \
backends/native/dbus-utils.c \
backends/native/dbus-utils.h \
backends/x11/meta-backend-x11.c \ backends/x11/meta-backend-x11.c \
backends/x11/meta-backend-x11.h \ backends/x11/meta-backend-x11.h \
backends/x11/meta-cursor-renderer-x11.c \ backends/x11/meta-cursor-renderer-x11.c \
@ -243,11 +232,27 @@ libmutter_la_SOURCES = \
wayland/window-wayland.c \ wayland/window-wayland.c \
wayland/window-wayland.h wayland/window-wayland.h
if HAVE_NATIVE_BACKEND
libmutter_la_SOURCES += \
backends/native/meta-backend-native.c \
backends/native/meta-backend-native.h \
backends/native/meta-cursor-renderer-native.c \
backends/native/meta-cursor-renderer-native.h \
backends/native/meta-idle-monitor-native.c \
backends/native/meta-idle-monitor-native.h \
backends/native/meta-monitor-manager-kms.c \
backends/native/meta-monitor-manager-kms.h \
backends/native/meta-launcher.c \
backends/native/meta-launcher.h \
backends/native/dbus-utils.c \
backends/native/dbus-utils.h
endif
nodist_libmutter_la_SOURCES = \ nodist_libmutter_la_SOURCES = \
$(mutter_built_sources) $(mutter_built_sources)
libmutter_la_LDFLAGS = -no-undefined libmutter_la_LDFLAGS = -no-undefined
libmutter_la_LIBADD = $(MUTTER_LIBS) libmutter_la_LIBADD = $(MUTTER_LIBS) $(MUTTER_NATIVE_BACKEND_LIBS)
# Headers installed for plugins; introspected information will # Headers installed for plugins; introspected information will
# be extracted into Mutter-<version>.gir # be extracted into Mutter-<version>.gir

View File

@ -30,7 +30,10 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "backends/x11/meta-backend-x11.h" #include "backends/x11/meta-backend-x11.h"
#ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-backend-native.h" #include "backends/native/meta-backend-native.h"
#endif
static MetaBackend *_backend; static MetaBackend *_backend;
@ -214,7 +217,7 @@ get_backend_type (void)
return META_TYPE_BACKEND_X11; return META_TYPE_BACKEND_X11;
#endif #endif
#if defined(CLUTTER_WINDOWING_EGL) #if defined(CLUTTER_WINDOWING_EGL) && defined(HAVE_NATIVE_BACKEND)
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL)) if (clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL))
return META_TYPE_BACKEND_NATIVE; return META_TYPE_BACKEND_NATIVE;
#endif #endif

View File

@ -28,7 +28,10 @@
#include "display-private.h" #include "display-private.h"
#include "screen-private.h" #include "screen-private.h"
#include "meta-backend.h" #include "meta-backend.h"
#ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-cursor-renderer-native.h" #include "backends/native/meta-cursor-renderer-native.h"
#endif
#include <string.h> #include <string.h>
@ -171,12 +174,14 @@ meta_cursor_image_load_gbm_buffer (struct gbm_device *gbm,
static struct gbm_device * static struct gbm_device *
get_gbm_device (void) get_gbm_device (void)
{ {
#ifdef HAVE_NATIVE_BACKEND
MetaBackend *meta_backend = meta_get_backend (); MetaBackend *meta_backend = meta_get_backend ();
MetaCursorRenderer *renderer = meta_backend_get_cursor_renderer (meta_backend); MetaCursorRenderer *renderer = meta_backend_get_cursor_renderer (meta_backend);
if (META_IS_CURSOR_RENDERER_NATIVE (renderer)) if (META_IS_CURSOR_RENDERER_NATIVE (renderer))
return meta_cursor_renderer_native_get_gbm_device (META_CURSOR_RENDERER_NATIVE (renderer)); return meta_cursor_renderer_native_get_gbm_device (META_CURSOR_RENDERER_NATIVE (renderer));
else #endif
return NULL; return NULL;
} }

View File

@ -33,9 +33,12 @@
#include "bell.h" #include "bell.h"
#include "workspace-private.h" #include "workspace-private.h"
#include "backends/meta-backend.h" #include "backends/meta-backend.h"
#include "backends/x11/meta-backend-x11.h"
#ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-backend-native.h" #include "backends/native/meta-backend-native.h"
#include "backends/native/meta-idle-monitor-native.h" #include "backends/native/meta-idle-monitor-native.h"
#include "backends/x11/meta-backend-x11.h" #endif
#include "x11/window-x11.h" #include "x11/window-x11.h"
#include "x11/xprops.h" #include "x11/xprops.h"
@ -1828,6 +1831,7 @@ meta_display_handle_xevent (MetaDisplay *display,
static void static void
handle_idletime_for_event (const ClutterEvent *event) handle_idletime_for_event (const ClutterEvent *event)
{ {
#ifdef HAVE_NATIVE_BACKEND
/* This is handled by XSync under X11. */ /* This is handled by XSync under X11. */
MetaBackend *backend = meta_get_backend (); MetaBackend *backend = meta_get_backend ();
@ -1857,6 +1861,7 @@ handle_idletime_for_event (const ClutterEvent *event)
meta_idle_monitor_native_reset_idletime (device_monitor); meta_idle_monitor_native_reset_idletime (device_monitor);
} }
} }
#endif /* HAVE_NATIVE_BACKEND */
} }
static gboolean static gboolean

View File

@ -57,7 +57,10 @@
#include "wayland/meta-wayland.h" #include "wayland/meta-wayland.h"
#include "backends/x11/meta-backend-x11.h" #include "backends/x11/meta-backend-x11.h"
#ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-backend-native.h" #include "backends/native/meta-backend-native.h"
#endif
#define SCHEMA_COMMON_KEYBINDINGS "org.gnome.desktop.wm.keybindings" #define SCHEMA_COMMON_KEYBINDINGS "org.gnome.desktop.wm.keybindings"
#define SCHEMA_MUTTER_KEYBINDINGS "org.gnome.mutter.keybindings" #define SCHEMA_MUTTER_KEYBINDINGS "org.gnome.mutter.keybindings"
@ -3166,6 +3169,7 @@ handle_set_spew_mark (MetaDisplay *display,
meta_verbose ("-- MARK MARK MARK MARK --\n"); meta_verbose ("-- MARK MARK MARK MARK --\n");
} }
#ifdef HAVE_NATIVE_BACKEND
static void static void
handle_switch_vt (MetaDisplay *display, handle_switch_vt (MetaDisplay *display,
MetaScreen *screen, MetaScreen *screen,
@ -3183,6 +3187,7 @@ handle_switch_vt (MetaDisplay *display,
g_error_free (error); g_error_free (error);
} }
} }
#endif /* HAVE_NATIVE_BACKEND */
/** /**
* meta_keybindings_set_custom_handler: * meta_keybindings_set_custom_handler:
@ -3475,6 +3480,7 @@ init_builtin_key_bindings (MetaDisplay *display)
META_KEYBINDING_ACTION_SET_SPEW_MARK, META_KEYBINDING_ACTION_SET_SPEW_MARK,
handle_set_spew_mark, 0); handle_set_spew_mark, 0);
#ifdef HAVE_NATIVE_BACKEND
MetaBackend *backend = meta_get_backend (); MetaBackend *backend = meta_get_backend ();
if (META_IS_BACKEND_NATIVE (backend)) if (META_IS_BACKEND_NATIVE (backend))
{ {
@ -3527,6 +3533,7 @@ init_builtin_key_bindings (MetaDisplay *display)
META_KEYBINDING_ACTION_NONE, META_KEYBINDING_ACTION_NONE,
handle_switch_vt, 7); handle_switch_vt, 7);
} }
#endif /* HAVE_NATIVE_BACKEND */
#undef REVERSES_AND_REVERSED #undef REVERSES_AND_REVERSED

View File

@ -181,7 +181,9 @@ static gboolean opt_replace_wm;
static gboolean opt_disable_sm; static gboolean opt_disable_sm;
static gboolean opt_sync; static gboolean opt_sync;
static gboolean opt_wayland; static gboolean opt_wayland;
#ifdef HAVE_NATIVE_BACKEND
static gboolean opt_display_server; static gboolean opt_display_server;
#endif
static GOptionEntry meta_options[] = { static GOptionEntry meta_options[] = {
{ {
@ -225,11 +227,13 @@ static GOptionEntry meta_options[] = {
N_("Run as a wayland compositor"), N_("Run as a wayland compositor"),
NULL NULL
}, },
#ifdef HAVE_NATIVE_BACKEND
{ {
"display-server", 0, 0, G_OPTION_ARG_NONE, "display-server", 0, 0, G_OPTION_ARG_NONE,
&opt_display_server, &opt_display_server,
N_("Run as a full display server, rather than nested") N_("Run as a full display server, rather than nested")
}, },
#endif
{NULL} {NULL}
}; };
@ -332,8 +336,10 @@ meta_init (void)
if (g_getenv ("MUTTER_DEBUG")) if (g_getenv ("MUTTER_DEBUG"))
meta_set_debugging (TRUE); meta_set_debugging (TRUE);
#if defined(CLUTTER_WINDOWING_EGL) && defined(HAVE_NATIVE_BACKEND)
if (opt_display_server) if (opt_display_server)
clutter_set_windowing_backend (CLUTTER_WINDOWING_EGL); clutter_set_windowing_backend (CLUTTER_WINDOWING_EGL);
#endif
meta_set_is_wayland_compositor (opt_wayland); meta_set_is_wayland_compositor (opt_wayland);