summaryrefslogtreecommitdiff
path: root/present
diff options
context:
space:
mode:
authorMichel Dänzer <mdaenzer@redhat.com>2021-04-21 17:01:36 +0200
committerMichel Dänzer <michel@daenzer.net>2021-07-09 16:10:54 +0200
commitb6d54b0f5d2fb3dc8a4b2812bfee94112c332256 (patch)
tree228d47b91bdf4013b8a70f776fc53b6d5e19d293 /present
parent93666ebe37a9c8d64b814c7af6b895f89ca5ff88 (diff)
present: Dispatch clear_window_flip via present_screen_priv hook
Eliminates special cases in present_destroy_window. Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Diffstat (limited to 'present')
-rw-r--r--present/present_priv.h2
-rw-r--r--present/present_scmd.c21
-rw-r--r--present/present_screen.c49
-rw-r--r--present/present_wnmd.c28
4 files changed, 52 insertions, 48 deletions
diff --git a/present/present_priv.h b/present/present_priv.h
index 5659c7e90..921184cc6 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -108,6 +108,7 @@ typedef Bool (*present_priv_check_flip_ptr)(RRCrtcPtr crtc,
PresentFlipReason *reason);
typedef void (*present_priv_check_flip_window_ptr)(WindowPtr window);
typedef Bool (*present_priv_can_window_flip_ptr)(WindowPtr window);
+typedef void (*present_priv_clear_window_flip_ptr)(WindowPtr window);
typedef int (*present_priv_pixmap_ptr)(WindowPtr window,
PixmapPtr pixmap,
@@ -170,6 +171,7 @@ struct present_screen_priv {
present_priv_check_flip_ptr check_flip;
present_priv_check_flip_window_ptr check_flip_window;
present_priv_can_window_flip_ptr can_window_flip;
+ present_priv_clear_window_flip_ptr clear_window_flip;
present_priv_pixmap_ptr present_pixmap;
diff --git a/present/present_scmd.c b/present/present_scmd.c
index cc21007e8..da836ea6b 100644
--- a/present/present_scmd.c
+++ b/present/present_scmd.c
@@ -496,6 +496,26 @@ present_scmd_can_window_flip(WindowPtr window)
}
/*
+ * Clean up any pending or current flips for this window
+ */
+static void
+present_scmd_clear_window_flip(WindowPtr window)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+ present_vblank_ptr flip_pending = screen_priv->flip_pending;
+
+ if (flip_pending && flip_pending->window == window) {
+ present_set_abort_flip(screen);
+ flip_pending->window = NULL;
+ }
+ if (screen_priv->flip_window == window) {
+ present_restore_screen_pixmap(screen);
+ screen_priv->flip_window = NULL;
+ }
+}
+
+/*
* Once the required MSC has been reached, execute the pending request.
*
* For requests to actually present something, either blt contents to
@@ -812,6 +832,7 @@ present_scmd_init_mode_hooks(present_screen_priv_ptr screen_priv)
screen_priv->check_flip = &present_check_flip;
screen_priv->check_flip_window = &present_check_flip_window;
screen_priv->can_window_flip = &present_scmd_can_window_flip;
+ screen_priv->clear_window_flip = &present_scmd_clear_window_flip;
screen_priv->present_pixmap = &present_scmd_pixmap;
diff --git a/present/present_screen.c b/present/present_screen.c
index 05a810f5e..7372c89d7 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -87,50 +87,6 @@ present_free_window_vblank(WindowPtr window)
}
/*
- * Clean up any pending or current flips for this window
- */
-static void
-present_clear_window_flip(WindowPtr window)
-{
- ScreenPtr screen = window->drawable.pScreen;
- present_screen_priv_ptr screen_priv = present_screen_priv(screen);
- present_vblank_ptr flip_pending = screen_priv->flip_pending;
-
- if (flip_pending && flip_pending->window == window) {
- present_set_abort_flip(screen);
- flip_pending->window = NULL;
- }
- if (screen_priv->flip_window == window) {
- present_restore_screen_pixmap(screen);
- screen_priv->flip_window = NULL;
- }
-}
-
-static void
-present_wnmd_clear_window_flip(WindowPtr window)
-{
- present_window_priv_ptr window_priv = present_window_priv(window);
- present_vblank_ptr vblank, tmp;
-
- xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->flip_queue, event_queue) {
- present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
- present_vblank_destroy(vblank);
- }
-
- xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->idle_queue, event_queue) {
- present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
- present_vblank_destroy(vblank);
- }
-
- vblank = window_priv->flip_active;
- if (vblank) {
- present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
- present_vblank_destroy(vblank);
- }
- window_priv->flip_active = NULL;
-}
-
-/*
* Hook the close window function to clean up our window private
*/
static Bool
@@ -146,10 +102,7 @@ present_destroy_window(WindowPtr window)
present_free_events(window);
present_free_window_vblank(window);
- if (screen_priv->wnmd_info)
- present_wnmd_clear_window_flip(window);
- else
- present_clear_window_flip(window);
+ screen_priv->clear_window_flip(window);
free(window_priv);
}
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 27c3e8ac7..d072d191a 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -373,6 +373,33 @@ present_wnmd_check_flip_window (WindowPtr window)
}
}
+/*
+ * Clean up any pending or current flips for this window
+ */
+static void
+present_wnmd_clear_window_flip(WindowPtr window)
+{
+ present_window_priv_ptr window_priv = present_window_priv(window);
+ present_vblank_ptr vblank, tmp;
+
+ xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->flip_queue, event_queue) {
+ present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
+ present_vblank_destroy(vblank);
+ }
+
+ xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->idle_queue, event_queue) {
+ present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
+ present_vblank_destroy(vblank);
+ }
+
+ vblank = window_priv->flip_active;
+ if (vblank) {
+ present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
+ present_vblank_destroy(vblank);
+ }
+ window_priv->flip_active = NULL;
+}
+
static Bool
present_wnmd_flip(WindowPtr window,
RRCrtcPtr crtc,
@@ -689,6 +716,7 @@ present_wnmd_init_mode_hooks(present_screen_priv_ptr screen_priv)
screen_priv->check_flip = &present_wnmd_check_flip;
screen_priv->check_flip_window = &present_wnmd_check_flip_window;
+ screen_priv->clear_window_flip = &present_wnmd_clear_window_flip;
screen_priv->present_pixmap = &present_wnmd_pixmap;
screen_priv->queue_vblank = &present_wnmd_queue_vblank;