aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwayland/xwayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwayland/xwayland.c')
-rw-r--r--xorg-server/hw/xwayland/xwayland.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/xorg-server/hw/xwayland/xwayland.c b/xorg-server/hw/xwayland/xwayland.c
index b966e5070..17b7bf7fd 100644
--- a/xorg-server/hw/xwayland/xwayland.c
+++ b/xorg-server/hw/xwayland/xwayland.c
@@ -337,7 +337,13 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen)
pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
- buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
+#if GLAMOR_HAS_GBM
+ if (xwl_screen->glamor)
+ buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap);
+#endif
+ if (!xwl_screen->glamor)
+ buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
+
wl_surface_attach(xwl_window->surface, buffer, 0, 0);
for (i = 0; i < count; i++) {
box = &RegionRects(region)[i];
@@ -373,6 +379,12 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
xwl_output_create(xwl_screen, id);
xwl_screen->expecting_event++;
}
+#ifdef GLAMOR_HAS_GBM
+ else if (xwl_screen->glamor &&
+ strcmp(interface, "wl_drm") == 0 && version >= 2) {
+ xwl_screen_init_glamor(xwl_screen, id, version);
+ }
+#endif
}
static void
@@ -495,6 +507,10 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen);
xwl_screen->screen = pScreen;
+#ifdef GLAMOR_HAS_GBM
+ xwl_screen->glamor = 1;
+#endif
+
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-rootless") == 0) {
xwl_screen->rootless = 1;
@@ -514,6 +530,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
atoi(argv[i + 1]);
i++;
}
+ else if (strcmp(argv[i], "-shm") == 0) {
+ xwl_screen->glamor = 0;
+ }
}
if (xwl_screen->listen_fd_count > 0) {
@@ -591,10 +610,19 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
if (!xwl_screen_init_cursor(xwl_screen))
return FALSE;
- xwl_screen->CreateScreenResources = pScreen->CreateScreenResources;
- pScreen->CreateScreenResources = xwl_shm_create_screen_resources;
- pScreen->CreatePixmap = xwl_shm_create_pixmap;
- pScreen->DestroyPixmap = xwl_shm_destroy_pixmap;
+#ifdef GLAMOR_HAS_GBM
+ if (xwl_screen->glamor && !xwl_glamor_init(xwl_screen)) {
+ ErrorF("Failed to initialize glamor, falling back to sw\n");
+ xwl_screen->glamor = 0;
+ }
+#endif
+
+ if (!xwl_screen->glamor) {
+ xwl_screen->CreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = xwl_shm_create_screen_resources;
+ pScreen->CreatePixmap = xwl_shm_create_pixmap;
+ pScreen->DestroyPixmap = xwl_shm_destroy_pixmap;
+ }
xwl_screen->RealizeWindow = pScreen->RealizeWindow;
pScreen->RealizeWindow = xwl_realize_window;