summaryrefslogtreecommitdiff
path: root/xserver/hw/xwayland
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2020-04-13 08:07:01 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2020-04-13 08:07:01 +0000
commit482328525369e54161ccc11c7a2ea4475aaa58fc (patch)
tree0b7b779c3aab9a33bf3ac34cbd75581bbecb9972 /xserver/hw/xwayland
parentc6893de69de1189cf7230e18ebfe8ebafb5ff2f0 (diff)
Update to xserver 1.20.8. ok jsg@ robert@
Diffstat (limited to 'xserver/hw/xwayland')
-rw-r--r--xserver/hw/xwayland/xwayland-glamor-gbm.c10
-rw-r--r--xserver/hw/xwayland/xwayland-present.c66
-rw-r--r--xserver/hw/xwayland/xwayland.c75
-rw-r--r--xserver/hw/xwayland/xwayland.h10
4 files changed, 106 insertions, 55 deletions
diff --git a/xserver/hw/xwayland/xwayland-glamor-gbm.c b/xserver/hw/xwayland/xwayland-glamor-gbm.c
index febc0b910..dce782fc3 100644
--- a/xserver/hw/xwayland/xwayland-glamor-gbm.c
+++ b/xserver/hw/xwayland/xwayland-glamor-gbm.c
@@ -242,8 +242,12 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen,
if (bo) {
pixmap = xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth);
- if (!pixmap)
+ if (!pixmap) {
gbm_bo_destroy(bo);
+ }
+ else if (xwl_screen->rootless && hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP) {
+ glamor_clear_pixmap(pixmap);
+ }
}
}
@@ -794,6 +798,10 @@ xwl_dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
struct xwl_format *xwl_format = NULL;
int i;
+ if (modifier_hi == (DRM_FORMAT_MOD_INVALID >> 32) &&
+ modifier_lo == (DRM_FORMAT_MOD_INVALID & 0xffffffff))
+ return;
+
for (i = 0; i < xwl_screen->num_formats; i++) {
if (xwl_screen->formats[i].format == format) {
xwl_format = &xwl_screen->formats[i];
diff --git a/xserver/hw/xwayland/xwayland-present.c b/xserver/hw/xwayland/xwayland-present.c
index 31c276623..5ba7dce08 100644
--- a/xserver/hw/xwayland/xwayland-present.c
+++ b/xserver/hw/xwayland/xwayland-present.c
@@ -60,6 +60,7 @@ xwl_present_window_get_priv(WindowPtr window)
xwl_present_window->msc = 1;
xwl_present_window->ust = GetTimeInMicros();
+ xorg_list_init(&xwl_present_window->frame_callback_list);
xorg_list_init(&xwl_present_window->event_list);
xorg_list_init(&xwl_present_window->release_queue);
@@ -96,7 +97,7 @@ xwl_present_reset_timer(struct xwl_present_window *xwl_present_window)
if (xwl_present_has_events(xwl_present_window)) {
CARD32 timeout;
- if (xwl_present_window->frame_callback)
+ if (!xorg_list_is_empty(&xwl_present_window->frame_callback_list))
timeout = TIMER_LEN_FLIP;
else
timeout = TIMER_LEN_COPY;
@@ -119,10 +120,7 @@ xwl_present_cleanup(WindowPtr window)
if (!xwl_present_window)
return;
- if (xwl_present_window->frame_callback) {
- wl_callback_destroy(xwl_present_window->frame_callback);
- xwl_present_window->frame_callback = NULL;
- }
+ xorg_list_del(&xwl_present_window->frame_callback_list);
if (xwl_present_window->sync_callback) {
wl_callback_destroy(xwl_present_window->sync_callback);
@@ -244,7 +242,10 @@ xwl_present_timer_callback(OsTimerPtr timer,
{
struct xwl_present_window *xwl_present_window = arg;
- xwl_present_window->frame_timer_firing = TRUE;
+ /* If we were expecting a frame callback for this window, it didn't arrive
+ * in a second. Stop listening to it to avoid double-bumping the MSC
+ */
+ xorg_list_del(&xwl_present_window->frame_callback_list);
xwl_present_msc_bump(xwl_present_window);
xwl_present_reset_timer(xwl_present_window);
@@ -252,20 +253,10 @@ xwl_present_timer_callback(OsTimerPtr timer,
return 0;
}
-static void
-xwl_present_frame_callback(void *data,
- struct wl_callback *callback,
- uint32_t time)
+void
+xwl_present_frame_callback(struct xwl_present_window *xwl_present_window)
{
- struct xwl_present_window *xwl_present_window = data;
-
- wl_callback_destroy(xwl_present_window->frame_callback);
- xwl_present_window->frame_callback = NULL;
-
- if (xwl_present_window->frame_timer_firing) {
- /* If the timer is firing, this frame callback is too late */
- return;
- }
+ xorg_list_del(&xwl_present_window->frame_callback_list);
xwl_present_msc_bump(xwl_present_window);
@@ -275,10 +266,6 @@ xwl_present_frame_callback(void *data,
xwl_present_reset_timer(xwl_present_window);
}
-static const struct wl_callback_listener xwl_present_frame_listener = {
- xwl_present_frame_callback
-};
-
static void
xwl_present_sync_callback(void *data,
struct wl_callback *callback,
@@ -360,6 +347,7 @@ xwl_present_queue_vblank(WindowPtr present_window,
uint64_t msc)
{
struct xwl_present_window *xwl_present_window = xwl_present_window_get_priv(present_window);
+ struct xwl_window *xwl_window = xwl_window_from_window(present_window);
struct xwl_present_event *event;
event = malloc(sizeof *event);
@@ -372,7 +360,15 @@ xwl_present_queue_vblank(WindowPtr present_window,
xorg_list_append(&event->list, &xwl_present_window->event_list);
- if (!xwl_present_window->frame_timer)
+ /* If there's a pending frame callback, use that */
+ if (xwl_window && xwl_window->frame_callback &&
+ xorg_list_is_empty(&xwl_present_window->frame_callback_list)) {
+ xorg_list_add(&xwl_present_window->frame_callback_list,
+ &xwl_window->frame_callback_list);
+ }
+
+ if ((xwl_window && xwl_window->frame_callback) ||
+ !xwl_present_window->frame_timer)
xwl_present_reset_timer(xwl_present_window);
return Success;
@@ -488,15 +484,15 @@ xwl_present_flip(WindowPtr present_window,
/* We can flip directly to the main surface (full screen window without clips) */
wl_surface_attach(xwl_window->surface, buffer, 0, 0);
- if (!xwl_present_window->frame_callback) {
- xwl_present_window->frame_callback = wl_surface_frame(xwl_window->surface);
- wl_callback_add_listener(xwl_present_window->frame_callback,
- &xwl_present_frame_listener,
- xwl_present_window);
+ if (!xwl_window->frame_callback)
+ xwl_window_create_frame_callback(xwl_window);
+
+ if (xorg_list_is_empty(&xwl_present_window->frame_callback_list)) {
+ xorg_list_add(&xwl_present_window->frame_callback_list,
+ &xwl_window->frame_callback_list);
}
/* Realign timer */
- xwl_present_window->frame_timer_firing = FALSE;
xwl_present_reset_timer(xwl_present_window);
wl_surface_damage(xwl_window->surface, 0, 0,
@@ -528,18 +524,12 @@ xwl_present_flips_stop(WindowPtr window)
}
void
-xwl_present_unrealize_window(WindowPtr window)
+xwl_present_unrealize_window(struct xwl_present_window *xwl_present_window)
{
- struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window);
-
- if (!xwl_present_window || !xwl_present_window->frame_callback)
- return;
-
/* The pending frame callback may never be called, so drop it and shorten
* the frame timer interval.
*/
- wl_callback_destroy(xwl_present_window->frame_callback);
- xwl_present_window->frame_callback = NULL;
+ xorg_list_del(&xwl_present_window->frame_callback_list);
xwl_present_reset_timer(xwl_present_window);
}
diff --git a/xserver/hw/xwayland/xwayland.c b/xserver/hw/xwayland/xwayland.c
index 324c68ccf..ed9f2e3c2 100644
--- a/xserver/hw/xwayland/xwayland.c
+++ b/xserver/hw/xwayland/xwayland.c
@@ -40,7 +40,11 @@
#ifdef XF86VIDMODE
#include <X11/extensions/xf86vmproto.h>
-_X_EXPORT Bool noXFree86VidModeExtension;
+extern _X_EXPORT Bool noXFree86VidModeExtension;
+#endif
+
+#ifdef XWL_HAS_GLAMOR
+#include <glamor.h>
#endif
void
@@ -596,6 +600,10 @@ ensure_surface_for_window(WindowPtr window)
dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window);
xorg_list_init(&xwl_window->link_damage);
+#ifdef GLAMOR_HAS_GBM
+ xorg_list_init(&xwl_window->frame_callback_list);
+#endif
+
xwl_window_init_allow_commits(xwl_window);
return TRUE;
@@ -680,11 +688,6 @@ 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;
@@ -696,6 +699,18 @@ xwl_unrealize_window(WindowPtr window)
if (xwl_window->frame_callback)
wl_callback_destroy(xwl_window->frame_callback);
+#ifdef GLAMOR_HAS_GBM
+ if (xwl_screen->present) {
+ struct xwl_present_window *xwl_present_window, *tmp;
+
+ xorg_list_for_each_entry_safe(xwl_present_window, tmp,
+ &xwl_window->frame_callback_list,
+ frame_callback_list) {
+ xwl_present_unrealize_window(xwl_present_window);
+ }
+ }
+#endif
+
free(xwl_window);
dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL);
@@ -737,12 +752,32 @@ frame_callback(void *data,
wl_callback_destroy (xwl_window->frame_callback);
xwl_window->frame_callback = NULL;
+
+#ifdef GLAMOR_HAS_GBM
+ if (xwl_window->xwl_screen->present) {
+ struct xwl_present_window *xwl_present_window, *tmp;
+
+ xorg_list_for_each_entry_safe(xwl_present_window, tmp,
+ &xwl_window->frame_callback_list,
+ frame_callback_list) {
+ xwl_present_frame_callback(xwl_present_window);
+ }
+ }
+#endif
}
static const struct wl_callback_listener frame_listener = {
frame_callback
};
+void
+xwl_window_create_frame_callback(struct xwl_window *xwl_window)
+{
+ xwl_window->frame_callback = wl_surface_frame(xwl_window->surface);
+ wl_callback_add_listener(xwl_window->frame_callback, &frame_listener,
+ xwl_window);
+}
+
static Bool
xwl_destroy_window(WindowPtr window)
{
@@ -813,19 +848,17 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
box->x2 - box->x1, box->y2 - box->y1);
}
- xwl_window->frame_callback = wl_surface_frame(xwl_window->surface);
- wl_callback_add_listener(xwl_window->frame_callback, &frame_listener, xwl_window);
-
- wl_surface_commit(xwl_window->surface);
+ xwl_window_create_frame_callback(xwl_window);
DamageEmpty(window_get_damage(xwl_window->window));
-
- xorg_list_del(&xwl_window->link_damage);
}
static void
xwl_screen_post_damage(struct xwl_screen *xwl_screen)
{
struct xwl_window *xwl_window, *next_xwl_window;
+ struct xorg_list commit_window_list;
+
+ xorg_list_init(&commit_window_list);
xorg_list_for_each_entry_safe(xwl_window, next_xwl_window,
&xwl_screen->damage_window_list, link_damage) {
@@ -843,6 +876,24 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen)
#endif
xwl_window_post_damage(xwl_window);
+ xorg_list_del(&xwl_window->link_damage);
+ xorg_list_append(&xwl_window->link_damage, &commit_window_list);
+ }
+
+ if (xorg_list_is_empty(&commit_window_list))
+ return;
+
+#ifdef XWL_HAS_GLAMOR
+ if (xwl_screen->glamor &&
+ xwl_screen->egl_backend == &xwl_screen->gbm_backend) {
+ glamor_block_handler(xwl_screen->screen);
+ }
+#endif
+
+ xorg_list_for_each_entry_safe(xwl_window, next_xwl_window,
+ &commit_window_list, link_damage) {
+ wl_surface_commit(xwl_window->surface);
+ xorg_list_del(&xwl_window->link_damage);
}
}
diff --git a/xserver/hw/xwayland/xwayland.h b/xserver/hw/xwayland/xwayland.h
index 0854df456..daa719209 100644
--- a/xserver/hw/xwayland/xwayland.h
+++ b/xserver/hw/xwayland/xwayland.h
@@ -183,6 +183,7 @@ struct xwl_window {
struct wl_callback *frame_callback;
Bool allow_commits;
#ifdef GLAMOR_HAS_GBM
+ struct xorg_list frame_callback_list;
Bool present_flipped;
#endif
};
@@ -192,15 +193,13 @@ struct xwl_present_window {
struct xwl_screen *xwl_screen;
struct xwl_present_event *sync_flip;
WindowPtr window;
- struct xorg_list link;
+ struct xorg_list frame_callback_list;
uint64_t msc;
uint64_t ust;
OsTimerPtr frame_timer;
- Bool frame_timer_firing;
- struct wl_callback *frame_callback;
struct wl_callback *sync_callback;
struct xorg_list event_list;
@@ -378,6 +377,8 @@ struct xwl_output {
Bool xdg_output_done;
};
+void xwl_window_create_frame_callback(struct xwl_window *xwl_window);
+
void xwl_sync_events (struct xwl_screen *xwl_screen);
Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen);
@@ -452,9 +453,10 @@ Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window);
void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
#ifdef GLAMOR_HAS_GBM
+void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window);
Bool xwl_present_init(ScreenPtr screen);
void xwl_present_cleanup(WindowPtr window);
-void xwl_present_unrealize_window(WindowPtr window);
+void xwl_present_unrealize_window(struct xwl_present_window *xwl_present_window);
#endif /* GLAMOR_HAS_GBM */
#ifdef XV