summaryrefslogtreecommitdiff
path: root/hw/xwayland/xwayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xwayland/xwayland.c')
-rw-r--r--hw/xwayland/xwayland.c68
1 files changed, 35 insertions, 33 deletions
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 1d6b49979..7e6e0ab25 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -96,9 +96,7 @@ ddxUseMsg(void)
ErrorF("-rootless run rootless, requires wm support\n");
ErrorF("-wm fd create X client for wm on given fd\n");
ErrorF("-listen fd add give fd as a listen socket\n");
-#ifdef XWL_HAS_EGLSTREAM
ErrorF("-eglstream use eglstream backend for nvidia GPUs\n");
-#endif
}
int
@@ -117,11 +115,9 @@ ddxProcessArgument(int argc, char *argv[], int i)
else if (strcmp(argv[i], "-shm") == 0) {
return 1;
}
-#ifdef XWL_HAS_EGLSTREAM
else if (strcmp(argv[i], "-eglstream") == 0) {
return 1;
}
-#endif
return 0;
}
@@ -374,6 +370,18 @@ damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data)
struct xwl_window *xwl_window = data;
struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+#ifdef GLAMOR_HAS_GBM
+ if (xwl_window->present_flipped) {
+ /* This damage is from a Present flip, which already committed a new
+ * buffer for the surface, so we don't need to do anything in response
+ */
+ RegionEmpty(DamageRegion(pDamage));
+ xorg_list_del(&xwl_window->link_damage);
+ xwl_window->present_flipped = FALSE;
+ return;
+ }
+#endif
+
xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list);
}
@@ -601,6 +609,11 @@ xwl_unrealize_window(WindowPtr window)
xwl_screen->UnrealizeWindow = screen->UnrealizeWindow;
screen->UnrealizeWindow = xwl_unrealize_window;
+#ifdef GLAMOR_HAS_GBM
+ if (xwl_screen->present)
+ xwl_present_unrealize_window(window);
+#endif
+
xwl_window = xwl_window_get(window);
if (!xwl_window)
return ret;
@@ -682,8 +695,6 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
#ifdef XWL_HAS_GLAMOR
if (xwl_screen->glamor)
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap,
- pixmap->drawable.width,
- pixmap->drawable.height,
NULL);
else
#endif
@@ -727,11 +738,6 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen)
xorg_list_for_each_entry_safe(xwl_window, next_xwl_window,
&xwl_screen->damage_window_list, link_damage) {
-#ifdef GLAMOR_HAS_GBM
- /* Present on the main surface. So don't commit here as well. */
- if (xwl_window->present_window)
- continue;
-#endif
/* If we're waiting on a frame callback from the server,
* don't attach a new buffer. */
if (xwl_window->frame_callback)
@@ -741,7 +747,7 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen)
continue;
#ifdef XWL_HAS_GLAMOR
- if (!xwl_glamor_allow_commits(xwl_window))
+ if (xwl_screen->glamor && !xwl_glamor_allow_commits(xwl_window))
continue;
#endif
@@ -943,9 +949,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
struct xwl_screen *xwl_screen;
Pixel red_mask, blue_mask, green_mask;
int ret, bpc, green_bpc, i;
-#ifdef XWL_HAS_EGLSTREAM
Bool use_eglstreams = FALSE;
-#endif
xwl_screen = calloc(1, sizeof *xwl_screen);
if (xwl_screen == NULL)
@@ -988,28 +992,18 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
else if (strcmp(argv[i], "-shm") == 0) {
xwl_screen->glamor = 0;
}
-#ifdef XWL_HAS_EGLSTREAM
else if (strcmp(argv[i], "-eglstream") == 0) {
+#ifdef XWL_HAS_EGLSTREAM
use_eglstreams = TRUE;
- }
+#else
+ ErrorF("xwayland glamor: this build does not have EGLStream support\n");
#endif
+ }
}
#ifdef XWL_HAS_GLAMOR
- if (xwl_screen->glamor) {
-#ifdef XWL_HAS_EGLSTREAM
- if (use_eglstreams) {
- if (!xwl_glamor_init_eglstream(xwl_screen)) {
- ErrorF("xwayland glamor: failed to setup eglstream backend, falling back to swaccel\n");
- xwl_screen->glamor = 0;
- }
- } else
-#endif
- if (!xwl_glamor_init_gbm(xwl_screen)) {
- ErrorF("xwayland glamor: failed to setup GBM backend, falling back to sw accel\n");
- xwl_screen->glamor = 0;
- }
- }
+ if (xwl_screen->glamor)
+ xwl_glamor_init_backends(xwl_screen, use_eglstreams);
#endif
/* In rootless mode, we don't have any screen storage, and the only
@@ -1095,9 +1089,13 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
return FALSE;
#ifdef XWL_HAS_GLAMOR
- if (xwl_screen->glamor && !xwl_glamor_init(xwl_screen)) {
- ErrorF("Failed to initialize glamor, falling back to sw\n");
- xwl_screen->glamor = 0;
+ if (xwl_screen->glamor) {
+ xwl_glamor_select_backend(xwl_screen, use_eglstreams);
+
+ if (xwl_screen->egl_backend == NULL || !xwl_glamor_init(xwl_screen)) {
+ ErrorF("Failed to initialize glamor, falling back to sw\n");
+ xwl_screen->glamor = 0;
+ }
}
if (xwl_screen->glamor && xwl_screen->rootless)
@@ -1134,6 +1132,10 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
AddCallback(&PropertyStateCallback, xwl_property_callback, pScreen);
+ wl_display_roundtrip(xwl_screen->display);
+ while (xwl_screen->expecting_event)
+ wl_display_roundtrip(xwl_screen->display);
+
return ret;
}