xserver: Branch 'master' - 6 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 27 15:22:50 UTC 2020


 hw/xwayland/xwayland-present.c |   49 ++++++++++----------------
 hw/xwayland/xwayland-present.h |    5 +-
 present/present.h              |   14 +++++++
 present/present_priv.h         |    3 -
 present/present_wnmd.c         |   76 +++++++++++++++++++++++++----------------
 5 files changed, 82 insertions(+), 65 deletions(-)

New commits:
commit 591916ea9e7a77f68f436b4a541402d9deadfe64
Author: Roman Gilg <subdiff at gmail.com>
Date:   Fri Jul 24 12:21:37 2020 +0200

    present: Check valid region in window mode flips
    
    For Pixmap flips to have well defined outcomes the window must be contained by
    the valid region if such region was specified.
    
    The valid region is inserted as an argument to the check in window mode.
    Setting this argument is missing in screen mode as well but we ignore it for now
    and only add it to window mode.
    
    It seems there are none or only very few clients actually making use of valid
    regions at the moment. For simplicity we therefore just check if a valid region
    was set by the client and in this case do never flip, independently of the
    window being contained by the region or not.
    
    Signed-off-by: Roman Gilg <subdiff at gmail.com>

diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 23a8863fc..b0d79b80f 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -294,7 +294,9 @@ present_wnmd_check_flip(RRCrtcPtr           crtc,
     if (x_off || y_off)
         return FALSE;
 
-    // TODO: Check for valid region?
+    /* Valid area must contain window (for simplicity for now just never flip when one is set). */
+    if (valid)
+        return FALSE;
 
     /* Flip pixmap must have same dimensions as window */
     if (window->drawable.width != pixmap->drawable.width ||
@@ -341,11 +343,11 @@ present_wnmd_check_flip_window (WindowPtr window)
 
     if (flip_pending) {
         if (!present_wnmd_check_flip(flip_pending->crtc, flip_pending->window, flip_pending->pixmap,
-                                flip_pending->sync_flip, NULL, 0, 0, NULL))
+                                flip_pending->sync_flip, flip_pending->valid, 0, 0, NULL))
             window_priv->flip_pending->abort_flip = TRUE;
     } else if (flip_active) {
         if (!present_wnmd_check_flip(flip_active->crtc, flip_active->window, flip_active->pixmap,
-                                     flip_active->sync_flip, NULL, 0, 0, NULL))
+                                     flip_active->sync_flip, flip_active->valid, 0, 0, NULL))
             present_wnmd_flips_stop(window);
     }
 
@@ -353,7 +355,7 @@ present_wnmd_check_flip_window (WindowPtr window)
     xorg_list_for_each_entry(vblank, &window_priv->vblank, window_list) {
         if (vblank->queued && vblank->flip &&
                 !present_wnmd_check_flip(vblank->crtc, window, vblank->pixmap,
-                                         vblank->sync_flip, NULL, 0, 0, &reason)) {
+                                         vblank->sync_flip, vblank->valid, 0, 0, &reason)) {
             vblank->flip = FALSE;
             vblank->reason = reason;
             if (vblank->sync_flip)
commit bf794bd7bfa3bdcf7de95ce237eb50ecc6ec11d2
Author: Roman Gilg <subdiff at gmail.com>
Date:   Tue Jul 14 14:32:25 2020 +0200

    present: Remove superfluous set abort flip function in window mode
    
    The function is never called from present_screen.c in contrast to the behavior
    in screen mode.
    
    In present_wnmd.c we can simply remove the function which does an unnecessary
    check of the property before setting it and directly set the property at the
    two locations the function was called previously.
    
    Signed-off-by: Roman Gilg <subdiff at gmail.com>

diff --git a/present/present_priv.h b/present/present_priv.h
index 2bd6b4062..dabf4c9d0 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -481,9 +481,6 @@ present_vblank_destroy(present_vblank_ptr vblank);
 /*
  * present_wnmd.c
  */
-void
-present_wnmd_set_abort_flip(WindowPtr window);
-
 void
 present_wnmd_init_mode_hooks(present_screen_priv_ptr screen_priv);
 
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 37f1f84f6..23a8863fc 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -138,16 +138,6 @@ present_wnmd_toplvl_pixmap_window(WindowPtr window)
     return w;
 }
 
-void
-present_wnmd_set_abort_flip(WindowPtr window)
-{
-    present_window_priv_ptr window_priv = present_window_priv(window);
-
-    if (!window_priv->flip_pending->abort_flip) {
-        window_priv->flip_pending->abort_flip = TRUE;
-    }
-}
-
 static void
 present_wnmd_flips_stop(WindowPtr window)
 {
@@ -352,7 +342,7 @@ present_wnmd_check_flip_window (WindowPtr window)
     if (flip_pending) {
         if (!present_wnmd_check_flip(flip_pending->crtc, flip_pending->window, flip_pending->pixmap,
                                 flip_pending->sync_flip, NULL, 0, 0, NULL))
-            present_wnmd_set_abort_flip(window);
+            window_priv->flip_pending->abort_flip = TRUE;
     } else if (flip_active) {
         if (!present_wnmd_check_flip(flip_active->crtc, flip_active->window, flip_active->pixmap,
                                      flip_active->sync_flip, NULL, 0, 0, NULL))
@@ -399,7 +389,7 @@ present_wnmd_cancel_flip(WindowPtr window)
     present_window_priv_ptr window_priv = present_window_priv(window);
 
     if (window_priv->flip_pending)
-        present_wnmd_set_abort_flip(window);
+        window_priv->flip_pending->abort_flip = TRUE;
     else if (window_priv->flip_active)
         present_wnmd_flips_stop(window);
 }
commit ab880b8b9e8d67a05fcb085097c94bbddf7dcb95
Author: Roman Gilg <subdiff at gmail.com>
Date:   Sun Jul 12 13:42:31 2020 +0200

    present: Idle vblanks any time in window mode
    
    With the newly introduced separate API method for idling a presented Pixmap in
    window mode we can simplify the logic by allowing calls to it at any point in
    time.
    
    This is done by setting the flip_idler flag if the Pixmap was idled before
    being presented.
    
    Signed-off-by: Roman Gilg <subdiff at gmail.com>

diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 4d148257b..7ef57e1f5 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -191,8 +191,9 @@ xwl_present_buffer_release(void *data)
         return;
     }
 
+    present_wnmd_idle_notify(event->xwl_present_window->window, event->event_id);
+
     if (!event->pending) {
-        present_wnmd_idle_notify(event->xwl_present_window->window, event->event_id);
         xwl_present_free_event(event);
     }
 }
@@ -215,7 +216,6 @@ xwl_present_msc_bump(struct xwl_present_window *xwl_present_window)
 
         if (!event->pixmap) {
             /* If the buffer was already released, clean up now */
-            present_wnmd_idle_notify(xwl_present_window->window, event->event_id);
             xwl_present_free_event(event);
         } else {
             xorg_list_add(&event->list, &xwl_present_window->release_list);
@@ -291,8 +291,6 @@ xwl_present_sync_callback(void *data,
                              xwl_present_window->ust, xwl_present_window->msc);
 
     if (!event->pixmap) {
-        /* If the buffer was already released, send the event now again */
-        present_wnmd_idle_notify(xwl_present_window->window, event->event_id);
         xwl_present_free_event(event);
     }
 }
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 2cb3f7523..37f1f84f6 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -257,6 +257,13 @@ present_wnmd_idle_notify(WindowPtr window, uint64_t event_id)
             return;
         }
     }
+
+    xorg_list_for_each_entry(vblank, &window_priv->flip_queue, event_queue) {
+        if (vblank->event_id == event_id) {
+            vblank->flip_idler = TRUE;
+            return;
+        }
+    }
 }
 
 static Bool
commit 932c6baca274f57beab51cd0dff1f7fa934e0ed0
Author: Roman Gilg <subdiff at gmail.com>
Date:   Sat Jul 11 19:15:46 2020 +0200

    present: Notify via distinct API functions in window mode
    
    Notifying Present about events' states was done prior with the single function
    present_wnmd_event_notify just like in screen mode. But it is more intelligible
    if at least in window mode we make use of three different functions with names
    that directly indicate what their purpose is:
    
    * present_wnmd_event_notify only for queued events feedback.
    * present_wnmd_flip_notify for when a presentation occured (flip).
    * present_wnmd_idle_notify for when the Pixmap of the event can be reused.
    
    This is an API-breaking change in regards to window mode. DDX written against
    the previous version won't work anymore. It is assumed that there only exists
    the XWayland DDX at the moment using the window mode such that this is not an
    issue for the overall ecosystem.
    
    Signed-off-by: Roman Gilg <subdiff at gmail.com>

diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 4f7530e3d..4d148257b 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -192,10 +192,7 @@ xwl_present_buffer_release(void *data)
     }
 
     if (!event->pending) {
-        present_wnmd_event_notify(event->xwl_present_window->window,
-                                  event->event_id,
-                                  event->xwl_present_window->ust,
-                                  event->xwl_present_window->msc);
+        present_wnmd_idle_notify(event->xwl_present_window->window, event->event_id);
         xwl_present_free_event(event);
     }
 }
@@ -213,13 +210,12 @@ xwl_present_msc_bump(struct xwl_present_window *xwl_present_window)
     if (event) {
         event->pending = FALSE;
 
-        present_wnmd_event_notify(xwl_present_window->window, event->event_id,
-                                  xwl_present_window->ust, msc);
+        present_wnmd_flip_notify(xwl_present_window->window, event->event_id,
+                                 xwl_present_window->ust, msc);
 
         if (!event->pixmap) {
             /* If the buffer was already released, clean up now */
-            present_wnmd_event_notify(xwl_present_window->window, event->event_id,
-                                      xwl_present_window->ust, msc);
+            present_wnmd_idle_notify(xwl_present_window->window, event->event_id);
             xwl_present_free_event(event);
         } else {
             xorg_list_add(&event->list, &xwl_present_window->release_list);
@@ -291,17 +287,12 @@ xwl_present_sync_callback(void *data,
         return;
     }
 
-    present_wnmd_event_notify(xwl_present_window->window,
-                              event->event_id,
-                              xwl_present_window->ust,
-                              xwl_present_window->msc);
+    present_wnmd_flip_notify(xwl_present_window->window, event->event_id,
+                             xwl_present_window->ust, xwl_present_window->msc);
 
     if (!event->pixmap) {
         /* If the buffer was already released, send the event now again */
-        present_wnmd_event_notify(xwl_present_window->window,
-                                  event->event_id,
-                                  xwl_present_window->ust,
-                                  xwl_present_window->msc);
+        present_wnmd_idle_notify(xwl_present_window->window, event->event_id);
         xwl_present_free_event(event);
     }
 }
diff --git a/present/present.h b/present/present.h
index 9d0ecb48d..86744a838 100644
--- a/present/present.h
+++ b/present/present.h
@@ -160,6 +160,7 @@ typedef struct present_wnmd_info {
  */
 extern _X_EXPORT void
 present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc);
+
 /*
  * Called when 'event_id' occurs for 'window'.
  * 'ust' and 'msc' indicate when the event actually happened
@@ -167,6 +168,19 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc);
 extern _X_EXPORT void
 present_wnmd_event_notify(WindowPtr window, uint64_t event_id, uint64_t ust, uint64_t msc);
 
+/*
+ * Called when presentation 'event_id' occurs for 'window'.
+ * 'ust' and 'msc' indicate when the presentation actually happened.
+ */
+extern _X_EXPORT void
+present_wnmd_flip_notify(WindowPtr window, uint64_t event_id, uint64_t ust, uint64_t msc);
+
+/*
+ * Called when the flipped Pixmap associated with 'event_id' is not used anymore by the DDX.
+ */
+extern _X_EXPORT void
+present_wnmd_idle_notify(WindowPtr window, uint64_t event_id);
+
 extern _X_EXPORT Bool
 present_screen_init(ScreenPtr screen, present_screen_info_ptr info);
 extern _X_EXPORT Bool
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index b5a9a995e..2cb3f7523 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -163,7 +163,7 @@ present_wnmd_flips_stop(WindowPtr window)
 }
 
 static void
-present_wnmd_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
+present_wnmd_flip_notify_vblank(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
 {
     WindowPtr                   window = vblank->window;
     present_window_priv_ptr     window_priv = present_window_priv(window);
@@ -207,12 +207,6 @@ present_wnmd_event_notify(WindowPtr window, uint64_t event_id, uint64_t ust, uin
     if (!event_id)
         return;
 
-    if (window_priv->flip_active && window_priv->flip_active->event_id == event_id) {
-        /* Notify for active flip, means it is allowed to become idle */
-        window_priv->flip_active->flip_idler = TRUE;
-        return;
-    }
-
     DebugPresent(("\te %" PRIu64 " ust %" PRIu64 " msc %" PRIu64 "\n", event_id, ust, msc));
     xorg_list_for_each_entry(vblank, &window_priv->exec_queue, event_queue) {
         if (event_id == vblank->event_id) {
@@ -222,15 +216,40 @@ present_wnmd_event_notify(WindowPtr window, uint64_t event_id, uint64_t ust, uin
     }
     xorg_list_for_each_entry(vblank, &window_priv->flip_queue, event_queue) {
         if (vblank->event_id == event_id) {
-            if (vblank->queued) {
-                present_wnmd_execute(vblank, ust, msc);
-            } else {
-                assert(vblank->window);
-                present_wnmd_flip_notify(vblank, ust, msc);
-            }
+            assert(vblank->queued);
+            present_wnmd_execute(vblank, ust, msc);
+            return;
+        }
+    }
+}
+
+void
+present_wnmd_flip_notify(WindowPtr window, uint64_t event_id, uint64_t ust, uint64_t msc)
+{
+    present_window_priv_ptr     window_priv = present_window_priv(window);
+    present_vblank_ptr          vblank;
+
+    xorg_list_for_each_entry(vblank, &window_priv->flip_queue, event_queue) {
+        if (vblank->event_id == event_id) {
+            assert(!vblank->queued);
+            assert(vblank->window);
+            present_wnmd_flip_notify_vblank(vblank, ust, msc);
             return;
         }
     }
+}
+
+void
+present_wnmd_idle_notify(WindowPtr window, uint64_t event_id)
+{
+    present_window_priv_ptr     window_priv = present_window_priv(window);
+    present_vblank_ptr          vblank;
+
+    if (window_priv->flip_active && window_priv->flip_active->event_id == event_id) {
+        /* Active flip is allowed to become idle directly when it becomes unactive again. */
+        window_priv->flip_active->flip_idler = TRUE;
+        return;
+    }
 
     xorg_list_for_each_entry(vblank, &window_priv->idle_queue, event_queue) {
         if (vblank->event_id == event_id) {
commit f8211095c3d94307225318902598e8f79d038f26
Author: Roman Gilg <subdiff at gmail.com>
Date:   Sat Feb 15 01:58:22 2020 +0100

    xwayland: Rename present event lists
    
    Rename the lists release_queue to release_list and event_list to
    wait_list.
    
    The prior names release_queue and event_list were ambiguous: in both are event-
    like vblanks which can be removed from the lists in random order. In the
    release_queue can be flips that are already released but still wait for the
    sync or frame callback but normally the release comes later. In the event_list
    are queued events waiting for a later msc.
    
    Signed-off-by: Roman Gilg <subdiff at gmail.com>

diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index b1a050a7c..4f7530e3d 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -67,8 +67,8 @@ xwl_present_window_get_priv(WindowPtr window)
         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);
+        xorg_list_init(&xwl_present_window->wait_list);
+        xorg_list_init(&xwl_present_window->release_list);
 
         dixSetPrivate(&window->devPrivates,
                       &xwl_present_window_private_key,
@@ -91,16 +91,16 @@ xwl_present_timer_callback(OsTimerPtr timer,
                            void *arg);
 
 static inline Bool
-xwl_present_has_events(struct xwl_present_window *xwl_present_window)
+xwl_present_has_pending_events(struct xwl_present_window *xwl_present_window)
 {
     return !!xwl_present_window->sync_flip ||
-           !xorg_list_is_empty(&xwl_present_window->event_list);
+           !xorg_list_is_empty(&xwl_present_window->wait_list);
 }
 
 static void
 xwl_present_reset_timer(struct xwl_present_window *xwl_present_window)
 {
-    if (xwl_present_has_events(xwl_present_window)) {
+    if (xwl_present_has_pending_events(xwl_present_window)) {
         CARD32 timeout;
 
         if (!xorg_list_is_empty(&xwl_present_window->frame_callback_list))
@@ -156,12 +156,12 @@ xwl_present_cleanup(WindowPtr window)
     }
 
     /* Clear remaining events */
-    xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list)
+    xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->wait_list, list)
         xwl_present_free_event(event);
 
     xwl_present_free_event(xwl_present_window->sync_flip);
 
-    xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->release_queue, list)
+    xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->release_list, list)
         xwl_present_free_event(event);
 
     /* Clear timer */
@@ -222,12 +222,12 @@ xwl_present_msc_bump(struct xwl_present_window *xwl_present_window)
                                       xwl_present_window->ust, msc);
             xwl_present_free_event(event);
         } else {
-            xorg_list_add(&event->list, &xwl_present_window->release_queue);
+            xorg_list_add(&event->list, &xwl_present_window->release_list);
         }
     }
 
     xorg_list_for_each_entry_safe(event, tmp,
-                                  &xwl_present_window->event_list,
+                                  &xwl_present_window->wait_list,
                                   list) {
         if (event->target_msc <= msc) {
             present_wnmd_event_notify(xwl_present_window->window,
@@ -363,7 +363,7 @@ xwl_present_queue_vblank(WindowPtr present_window,
     event->xwl_present_window = xwl_present_window;
     event->target_msc = msc;
 
-    xorg_list_append(&event->list, &xwl_present_window->event_list);
+    xorg_list_append(&event->list, &xwl_present_window->wait_list);
 
     /* If there's a pending frame callback, use that */
     if (xwl_window && xwl_window->frame_callback &&
@@ -395,14 +395,14 @@ xwl_present_abort_vblank(WindowPtr present_window,
     if (!xwl_present_window)
         return;
 
-    xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list) {
+    xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->wait_list, list) {
         if (event->event_id == event_id) {
             xwl_present_free_event(event);
             return;
         }
     }
 
-    xorg_list_for_each_entry(event, &xwl_present_window->release_queue, list) {
+    xorg_list_for_each_entry(event, &xwl_present_window->release_list, list) {
         if (event->event_id == event_id) {
             event->abort = TRUE;
             return;
@@ -477,7 +477,7 @@ xwl_present_flip(WindowPtr present_window,
         xorg_list_init(&event->list);
         xwl_present_window->sync_flip = event;
     } else {
-        xorg_list_add(&event->list, &xwl_present_window->release_queue);
+        xorg_list_add(&event->list, &xwl_present_window->release_list);
     }
 
     xwl_pixmap_set_buffer_release_cb(pixmap, xwl_present_buffer_release, event);
diff --git a/hw/xwayland/xwayland-present.h b/hw/xwayland/xwayland-present.h
index 89d8db6d2..35b579469 100644
--- a/hw/xwayland/xwayland-present.h
+++ b/hw/xwayland/xwayland-present.h
@@ -45,8 +45,8 @@ struct xwl_present_window {
 
     struct wl_callback *sync_callback;
 
-    struct xorg_list event_list;
-    struct xorg_list release_queue;
+    struct xorg_list wait_list;
+    struct xorg_list release_list;
 };
 
 struct xwl_present_event {
commit 0db326e5ca3dd244dda502c8261801c04ff792ab
Author: Roman Gilg <subdiff at gmail.com>
Date:   Wed Jul 8 10:24:41 2020 +0200

    xwayland: Remove unused xwl_screen entry
    
    In xwl_present_window an xwl_screen entry was declared but never actually used.
    
    Signed-off-by: Roman Gilg <subdiff at gmail.com>

diff --git a/hw/xwayland/xwayland-present.h b/hw/xwayland/xwayland-present.h
index 5a7cb3607..89d8db6d2 100644
--- a/hw/xwayland/xwayland-present.h
+++ b/hw/xwayland/xwayland-present.h
@@ -34,7 +34,6 @@
 
 #ifdef GLAMOR_HAS_GBM
 struct xwl_present_window {
-    struct xwl_screen *xwl_screen;
     struct xwl_present_event *sync_flip;
     WindowPtr window;
     struct xorg_list frame_callback_list;


More information about the xorg-commit mailing list