diff options
author | Michel Dänzer <mdaenzer@redhat.com> | 2023-03-09 18:44:25 +0100 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2023-03-27 08:19:31 +0000 |
commit | 4d1cd7cdc22013ed8de17d3218b9790b7027e1fe (patch) | |
tree | 804e7b341bba3d9bea68feb38e2ad8c2cda03cee | |
parent | fc625fe172d9f6a149a594b5214364bedf680239 (diff) | |
download | xserver-4d1cd7cdc22013ed8de17d3218b9790b7027e1fe.tar.gz |
xwayland: Refactor xwl_present_for_each_frame_callback helper
Preparation for following changes, no functional change intended.
-rw-r--r-- | hw/xwayland/xwayland-present.c | 12 | ||||
-rw-r--r-- | hw/xwayland/xwayland-present.h | 2 | ||||
-rw-r--r-- | hw/xwayland/xwayland-window.c | 33 |
3 files changed, 20 insertions, 27 deletions
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c index 2c0e1a05c..e8a173774 100644 --- a/hw/xwayland/xwayland-present.c +++ b/hw/xwayland/xwayland-present.c @@ -89,6 +89,18 @@ xwl_present_event_from_id(uint64_t event_id) return (struct xwl_present_event*)(uintptr_t)event_id; } +void +xwl_present_for_each_frame_callback(struct xwl_window *xwl_window, + void iter_func(struct xwl_present_window *)) +{ + 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) + iter_func(xwl_present_window); +} + static void xwl_present_free_timer(struct xwl_present_window *xwl_present_window) { diff --git a/hw/xwayland/xwayland-present.h b/hw/xwayland/xwayland-present.h index ab7f04a3b..620e6c5ca 100644 --- a/hw/xwayland/xwayland-present.h +++ b/hw/xwayland/xwayland-present.h @@ -61,6 +61,8 @@ struct xwl_present_event { PixmapPtr pixmap; }; +void xwl_present_for_each_frame_callback(struct xwl_window *xwl_window, + void iter_func(struct xwl_present_window *)); void xwl_present_reset_timer(struct xwl_present_window *xwl_present_window); void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window); Bool xwl_present_init(ScreenPtr screen); diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index e159743a0..b80a7bf67 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -1090,15 +1090,8 @@ xwl_unrealize_window(WindowPtr window) xwl_dmabuf_feedback_destroy(&xwl_window->feedback); #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); - } - } + if (xwl_window->xwl_screen->present) + xwl_present_for_each_frame_callback(xwl_window, xwl_present_unrealize_window); #endif release_wl_surface_for_window(xwl_window); @@ -1233,15 +1226,8 @@ frame_callback(void *data, 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); - } - } + if (xwl_window->xwl_screen->present) + xwl_present_for_each_frame_callback(xwl_window, xwl_present_frame_callback); #endif } @@ -1257,15 +1243,8 @@ xwl_window_create_frame_callback(struct xwl_window *xwl_window) xwl_window); #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_reset_timer(xwl_present_window); - } - } + if (xwl_window->xwl_screen->present) + xwl_present_for_each_frame_callback(xwl_window, xwl_present_reset_timer); #endif } |