Timo Aaltonen pushed to branch upstream-unstable at X Strike Force / wayland / xwayland
Commits:
-
b211df90
by Olivier Fourdan at 2022-03-15T09:47:53+00:00
-
c5b89441
by Olivier Fourdan at 2022-03-15T09:47:53+00:00
-
88ed88e8
by Michel Dänzer at 2022-03-15T09:47:53+00:00
-
1a7e4e72
by Michel Dänzer at 2022-03-24T09:22:29+01:00
-
2bddb5ad
by Olivier Fourdan at 2022-03-30T12:17:04+02:00
4 changed files:
- hw/xwayland/xwayland-present.c
- hw/xwayland/xwayland-present.h
- hw/xwayland/xwayland-window.c
- meson.build
Changes:
... | ... | @@ -66,6 +66,7 @@ xwl_present_window_get_priv(WindowPtr window) |
66 | 66 | if (!xwl_present_window)
|
67 | 67 | return NULL;
|
68 | 68 | |
69 | + xwl_present_window->window = window;
|
|
69 | 70 | xwl_present_window->msc = 1;
|
70 | 71 | xwl_present_window->ust = GetTimeInMicros();
|
71 | 72 | |
... | ... | @@ -127,14 +128,16 @@ xwl_present_has_pending_events(struct xwl_present_window *xwl_present_window) |
127 | 128 | !xorg_list_is_empty(&xwl_present_window->wait_list);
|
128 | 129 | }
|
129 | 130 | |
130 | -static void
|
|
131 | +void
|
|
131 | 132 | xwl_present_reset_timer(struct xwl_present_window *xwl_present_window)
|
132 | 133 | {
|
133 | 134 | if (xwl_present_has_pending_events(xwl_present_window)) {
|
135 | + struct xwl_window *xwl_window = xwl_window_from_window(xwl_present_window->window);
|
|
134 | 136 | CARD32 now = GetTimeInMillis();
|
135 | 137 | CARD32 timeout;
|
136 | 138 | |
137 | - if (!xorg_list_is_empty(&xwl_present_window->frame_callback_list))
|
|
139 | + if (xwl_window && xwl_window->frame_callback &&
|
|
140 | + !xorg_list_is_empty(&xwl_present_window->frame_callback_list))
|
|
138 | 141 | timeout = TIMER_LEN_FLIP;
|
139 | 142 | else
|
140 | 143 | timeout = TIMER_LEN_COPY;
|
... | ... | @@ -505,8 +508,8 @@ xwl_present_queue_vblank(ScreenPtr screen, |
505 | 508 | xorg_list_del(&event->vblank.event_queue);
|
506 | 509 | xorg_list_append(&event->vblank.event_queue, &xwl_present_window->wait_list);
|
507 | 510 | |
508 | - /* If there's a pending frame callback, use that */
|
|
509 | - if (xwl_window && xwl_window->frame_callback &&
|
|
511 | + /* Hook up to frame callback */
|
|
512 | + if (xwl_window &&
|
|
510 | 513 | xorg_list_is_empty(&xwl_present_window->frame_callback_list)) {
|
511 | 514 | xorg_list_add(&xwl_present_window->frame_callback_list,
|
512 | 515 | &xwl_window->frame_callback_list);
|
... | ... | @@ -700,14 +703,14 @@ xwl_present_flip(WindowPtr present_window, |
700 | 703 | /* We can flip directly to the main surface (full screen window without clips) */
|
701 | 704 | wl_surface_attach(xwl_window->surface, buffer, 0, 0);
|
702 | 705 | |
703 | - if (!xwl_window->frame_callback)
|
|
704 | - xwl_window_create_frame_callback(xwl_window);
|
|
705 | - |
|
706 | 706 | if (xorg_list_is_empty(&xwl_present_window->frame_callback_list)) {
|
707 | 707 | xorg_list_add(&xwl_present_window->frame_callback_list,
|
708 | 708 | &xwl_window->frame_callback_list);
|
709 | 709 | }
|
710 | 710 | |
711 | + if (!xwl_window->frame_callback)
|
|
712 | + xwl_window_create_frame_callback(xwl_window);
|
|
713 | + |
|
711 | 714 | xwl_surface_damage(xwl_window->xwl_screen, xwl_window->surface,
|
712 | 715 | damage_box->x1 - present_window->drawable.x,
|
713 | 716 | damage_box->y1 - present_window->drawable.y,
|
... | ... | @@ -942,6 +945,9 @@ xwl_present_unrealize_window(struct xwl_present_window *xwl_present_window) |
942 | 945 | * the frame timer interval.
|
943 | 946 | */
|
944 | 947 | xorg_list_del(&xwl_present_window->frame_callback_list);
|
948 | + |
|
949 | + /* Make sure the timer callback doesn't get called */
|
|
950 | + xwl_present_window->timer_armed = 0;
|
|
945 | 951 | xwl_present_reset_timer(xwl_present_window);
|
946 | 952 | }
|
947 | 953 |
... | ... | @@ -35,6 +35,8 @@ |
35 | 35 | |
36 | 36 | #ifdef GLAMOR_HAS_GBM
|
37 | 37 | struct xwl_present_window {
|
38 | + WindowPtr window;
|
|
39 | + |
|
38 | 40 | struct xorg_list frame_callback_list;
|
39 | 41 | |
40 | 42 | uint64_t msc;
|
... | ... | @@ -59,6 +61,7 @@ struct xwl_present_event { |
59 | 61 | PixmapPtr pixmap;
|
60 | 62 | };
|
61 | 63 | |
64 | +void xwl_present_reset_timer(struct xwl_present_window *xwl_present_window);
|
|
62 | 65 | void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window);
|
63 | 66 | Bool xwl_present_init(ScreenPtr screen);
|
64 | 67 | void xwl_present_cleanup(WindowPtr window);
|
... | ... | @@ -522,6 +522,7 @@ Bool |
522 | 522 | xwl_realize_window(WindowPtr window)
|
523 | 523 | {
|
524 | 524 | ScreenPtr screen = window->drawable.pScreen;
|
525 | + CompScreenPtr comp_screen = GetCompScreen(screen);
|
|
525 | 526 | struct xwl_screen *xwl_screen;
|
526 | 527 | Bool ret;
|
527 | 528 | |
... | ... | @@ -535,12 +536,20 @@ xwl_realize_window(WindowPtr window) |
535 | 536 | if (!ret)
|
536 | 537 | return FALSE;
|
537 | 538 | |
538 | - if (xwl_screen->rootless && !window->parent) {
|
|
539 | - BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height };
|
|
539 | + if (xwl_screen->rootless) {
|
|
540 | + /* We do not want the COW to be mapped when rootless in Xwayland */
|
|
541 | + if (window == comp_screen->pOverlayWin) {
|
|
542 | + window->mapped = FALSE;
|
|
543 | + return TRUE;
|
|
544 | + }
|
|
540 | 545 | |
541 | - RegionReset(&window->winSize, &box);
|
|
542 | - RegionNull(&window->clipList);
|
|
543 | - RegionNull(&window->borderClip);
|
|
546 | + if (!window->parent) {
|
|
547 | + BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height };
|
|
548 | + |
|
549 | + RegionReset(&window->winSize, &box);
|
|
550 | + RegionNull(&window->clipList);
|
|
551 | + RegionNull(&window->borderClip);
|
|
552 | + }
|
|
544 | 553 | }
|
545 | 554 | |
546 | 555 | if (xwl_screen->rootless ?
|
... | ... | @@ -596,16 +605,6 @@ xwl_unrealize_window(WindowPtr window) |
596 | 605 | if (xwl_window_has_viewport_enabled(xwl_window))
|
597 | 606 | xwl_window_disable_viewport(xwl_window);
|
598 | 607 | |
599 | - wl_surface_destroy(xwl_window->surface);
|
|
600 | - xorg_list_del(&xwl_window->link_damage);
|
|
601 | - xorg_list_del(&xwl_window->link_window);
|
|
602 | - unregister_damage(window);
|
|
603 | - |
|
604 | - xwl_window_buffers_dispose(xwl_window);
|
|
605 | - |
|
606 | - if (xwl_window->frame_callback)
|
|
607 | - wl_callback_destroy(xwl_window->frame_callback);
|
|
608 | - |
|
609 | 608 | #ifdef GLAMOR_HAS_GBM
|
610 | 609 | if (xwl_screen->present) {
|
611 | 610 | struct xwl_present_window *xwl_present_window, *tmp;
|
... | ... | @@ -618,6 +617,16 @@ xwl_unrealize_window(WindowPtr window) |
618 | 617 | }
|
619 | 618 | #endif
|
620 | 619 | |
620 | + wl_surface_destroy(xwl_window->surface);
|
|
621 | + xorg_list_del(&xwl_window->link_damage);
|
|
622 | + xorg_list_del(&xwl_window->link_window);
|
|
623 | + unregister_damage(window);
|
|
624 | + |
|
625 | + xwl_window_buffers_dispose(xwl_window);
|
|
626 | + |
|
627 | + if (xwl_window->frame_callback)
|
|
628 | + wl_callback_destroy(xwl_window->frame_callback);
|
|
629 | + |
|
621 | 630 | free(xwl_window);
|
622 | 631 | dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL);
|
623 | 632 | |
... | ... | @@ -756,6 +765,18 @@ xwl_window_create_frame_callback(struct xwl_window *xwl_window) |
756 | 765 | xwl_window->frame_callback = wl_surface_frame(xwl_window->surface);
|
757 | 766 | wl_callback_add_listener(xwl_window->frame_callback, &frame_listener,
|
758 | 767 | xwl_window);
|
768 | + |
|
769 | +#ifdef GLAMOR_HAS_GBM
|
|
770 | + if (xwl_window->xwl_screen->present) {
|
|
771 | + struct xwl_present_window *xwl_present_window, *tmp;
|
|
772 | + |
|
773 | + xorg_list_for_each_entry_safe(xwl_present_window, tmp,
|
|
774 | + &xwl_window->frame_callback_list,
|
|
775 | + frame_callback_list) {
|
|
776 | + xwl_present_reset_timer(xwl_present_window);
|
|
777 | + }
|
|
778 | + }
|
|
779 | +#endif
|
|
759 | 780 | }
|
760 | 781 | |
761 | 782 | Bool
|
... | ... | @@ -3,7 +3,7 @@ project('xwayland', 'c', |
3 | 3 | 'buildtype=debugoptimized',
|
4 | 4 | 'c_std=gnu99',
|
5 | 5 | ],
|
6 | - version: '22.1.0',
|
|
6 | + version: '22.1.1',
|
|
7 | 7 | meson_version: '>= 0.47.0',
|
8 | 8 | )
|
9 | 9 | release_date = '2021-07-05'
|