xserver: Branch 'xwayland-1.12' - 2 commits
Kristian Høgsberg
krh at kemper.freedesktop.org
Wed May 23 06:59:38 PDT 2012
hw/xfree86/common/xf86Config.c | 12 ++++++++++
hw/xfree86/xwayland/xwayland-drm.c | 8 ++++++
hw/xfree86/xwayland/xwayland-private.h | 2 -
hw/xfree86/xwayland/xwayland.c | 39 ++++++++++++++++-----------------
hw/xfree86/xwayland/xwayland.h | 8 +++++-
5 files changed, 48 insertions(+), 21 deletions(-)
New commits:
commit e78ba7d832328848a94584044cbb8ff07e10eef0
Author: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
Date: Wed May 23 22:05:54 2012 +1000
xwayland: Decouple drm init from screen init.
The nouveau driver wants access to its drm fd well before
xwl_screen_pre_init can be called. Allow this by decoupling
xwl_screen creation, xwl drm initialisation, and xwl_screen_pre_init.
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
diff --git a/hw/xfree86/xwayland/xwayland-drm.c b/hw/xfree86/xwayland/xwayland-drm.c
index ec5d327..cf1124e 100644
--- a/hw/xfree86/xwayland/xwayland-drm.c
+++ b/hw/xfree86/xwayland/xwayland-drm.c
@@ -99,6 +99,9 @@ xwl_drm_pre_init(struct xwl_screen *xwl_screen)
wl_display_add_global_listener(xwl_screen->display,
drm_handler, xwl_screen);
+ /* Ensure drm_handler has seen all the interfaces */
+ wl_display_roundtrip(xwl_screen->display);
+ /* Ensure the xwl_drm_listener has seen the drm device, if any */
wl_display_roundtrip(xwl_screen->display);
ErrorF("wayland_drm_screen_init, device name %s\n",
@@ -129,6 +132,11 @@ xwl_drm_pre_init(struct xwl_screen *xwl_screen)
return Success;
}
+Bool xwl_drm_initialised(struct xwl_screen *xwl_screen)
+{
+ return xwl_screen->authenticated;
+}
+
int xwl_screen_get_drm_fd(struct xwl_screen *xwl_screen)
{
return xwl_screen->drm_fd;
diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h
index bde56f2..f1fec23 100644
--- a/hw/xfree86/xwayland/xwayland-private.h
+++ b/hw/xfree86/xwayland/xwayland-private.h
@@ -122,6 +122,6 @@ int wayland_screen_pre_init(struct xwl_screen *screen, int use_drm);
int wayland_screen_init(struct xwl_screen *screen);
int wayland_screen_close(struct xwl_screen *screen);
-int xwl_drm_pre_init(struct xwl_screen *screen);
+Bool xwl_drm_initialised(struct xwl_screen *screen);
#endif /* _XWAYLAND_PRIVATE_H_ */
diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c
index d04c764..fea5210 100644
--- a/hw/xfree86/xwayland/xwayland.c
+++ b/hw/xfree86/xwayland/xwayland.c
@@ -208,13 +208,10 @@ xwayland_selection_callback(CallbackListPtr *callbacks,
}
}
-
struct xwl_screen *
-xwl_screen_pre_init(ScrnInfoPtr scrninfo,
- uint32_t flags, struct xwl_driver *driver)
+xwl_screen_create(void)
{
struct xwl_screen *xwl_screen;
- int ret;
xwl_screen = calloc(sizeof *xwl_screen, 1);
if (xwl_screen == NULL) {
@@ -222,14 +219,26 @@ xwl_screen_pre_init(ScrnInfoPtr scrninfo,
return NULL;
}
+ xwl_screen->display = wl_display_connect(NULL);
+ if (xwl_screen->display == NULL) {
+ ErrorF("wl_display_create failed\n");
+ return NULL;
+ }
+
+ return xwl_screen;
+}
+
+Bool
+xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen,
+ uint32_t flags, struct xwl_driver *driver)
+{
noScreenSaverExtension = TRUE;
xdnd_atom = MakeAtom("XdndSelection", 13, 1);
ErrorF("xdnd_atom: %d\n", xdnd_atom);
if (!AddCallback(&SelectionCallback,
xwayland_selection_callback, xwl_screen)) {
- free(xwl_screen);
- return NULL;
+ return FALSE;
}
xorg_list_init(&xwl_screen->seat_list);
@@ -242,33 +251,25 @@ xwl_screen_pre_init(ScrnInfoPtr scrninfo,
if (xorgRootless)
xwl_screen->flags |= XWL_FLAGS_ROOTLESS;
- xwl_screen->display = wl_display_connect(NULL);
- if (xwl_screen->display == NULL) {
- ErrorF("wl_display_create failed\n");
- return NULL;
- }
-
/* Set up listener so we'll catch all events. */
xwl_screen->global_listener =
wl_display_add_global_listener(xwl_screen->display,
global_handler, xwl_screen);
- /* Process connection events. */
- wl_display_iterate(xwl_screen->display, WL_DISPLAY_READABLE);
+ wl_display_roundtrip(xwl_screen->display);
xwl_screen->wayland_fd =
wl_display_get_fd(xwl_screen->display, source_update, xwl_screen);
#ifdef WITH_LIBDRM
- if (xwl_screen->driver->use_drm)
- ret = xwl_drm_pre_init(xwl_screen);
- if (xwl_screen->driver->use_drm && ret != Success)
- return NULL;
+ if (xwl_screen->driver->use_drm && !xwl_drm_initialised(xwl_screen))
+ if (xwl_drm_pre_init(xwl_screen) != Success)
+ return FALSE;
#endif
xwayland_screen_preinit_output(xwl_screen, scrninfo);
- return xwl_screen;
+ return TRUE;
}
int
diff --git a/hw/xfree86/xwayland/xwayland.h b/hw/xfree86/xwayland/xwayland.h
index 5eba934..e536c42 100644
--- a/hw/xfree86/xwayland/xwayland.h
+++ b/hw/xfree86/xwayland/xwayland.h
@@ -44,13 +44,19 @@ extern _X_EXPORT int
xwl_version(void);
extern _X_EXPORT struct xwl_screen *
-xwl_screen_pre_init(ScrnInfoPtr scrninfo,
+xwl_screen_create(void);
+
+extern _X_EXPORT Bool
+xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen,
uint32_t flags, struct xwl_driver *driver);
extern _X_EXPORT int
xwl_screen_init(struct xwl_screen *xwl_screen, ScreenPtr screen);
extern _X_EXPORT int
+xwl_drm_pre_init(struct xwl_screen *xwl_screen);
+
+extern _X_EXPORT int
xwl_screen_get_drm_fd(struct xwl_screen *xwl_screen);
extern _X_EXPORT void
commit 47aeb404509cae0f58cb11cbbacae20ff585bd7f
Author: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
Date: Wed May 23 22:05:53 2012 +1000
xwayland: Automatically load module if wayland support requested
This makes life a bit easier for the drivers
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 7364a34..b916422 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -125,6 +125,7 @@ static ModuleDefault ModuleDefaults[] = {
#ifdef DRI2
{.name = "dri2", .toLoad = TRUE, .load_opt=NULL},
#endif
+ {.name = "xwayland", .toLoad = FALSE, .load_opt=NULL},
{.name = NULL, .toLoad = FALSE, .load_opt=NULL}
};
@@ -264,6 +265,17 @@ xf86ModulelistFromConfig(pointer **optlist)
xf86Msg(X_ERROR, "Cannot access global config data structure\n");
return NULL;
}
+
+ /*
+ * Set the xwayland module to autoload if requested.
+ */
+ if (xorgWayland) {
+ for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
+ if (strcmp(ModuleDefaults[i].name, "xwayland") == 0) {
+ ModuleDefaults[i].toLoad = TRUE;
+ }
+ }
+ }
if (xf86configptr->conf_modules) {
/* Walk the disable list and let people know what we've parsed to
More information about the xorg-commit
mailing list