xserver: Branch 'server-1.20-branch' - 4 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jul 20 13:46:26 UTC 2020
hw/xwayland/xwayland-present.c | 51 +++++++++++++++++------------------------
present/present_screen.c | 8 ++----
2 files changed, 25 insertions(+), 34 deletions(-)
New commits:
commit 22c0808ac88f917541fe40ab30e85364adac82bc
Author: Michel Dänzer <mdaenzer at redhat.com>
Date: Fri Jun 19 18:10:18 2020 +0200
xwayland: Free all remaining events in xwl_present_cleanup
At the end of xwl_present_cleanup, these events aren't reachable
anymore, so if we don't free them first, they're leaked.
(cherry picked from commit 64565ea344fef0171497952ef75f019cb420fe3b)
v2:
* Simpler backport, no need to keep a reference to the pixmap on the
1.20 branch.
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 492e4a876..2cec63f59 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -114,6 +114,12 @@ xwl_present_reset_timer(struct xwl_present_window *xwl_present_window)
static void
xwl_present_free_event(struct xwl_present_event *event)
{
+ if (!event)
+ return;
+
+ if (event->buffer)
+ wl_buffer_set_user_data(event->buffer, NULL);
+
xorg_list_del(&event->list);
free(event);
}
@@ -138,21 +144,10 @@ xwl_present_cleanup(WindowPtr window)
xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list)
xwl_present_free_event(event);
- /* Clear remaining buffer releases and inform Present about free ressources */
- event = xwl_present_window->sync_flip;
- xwl_present_window->sync_flip = NULL;
- if (event) {
- if (event->buffer_released) {
- xwl_present_free_event(event);
- } else {
- event->pending = FALSE;
- event->abort = TRUE;
- }
- }
- xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->release_queue, list) {
- xorg_list_del(&event->list);
- event->abort = TRUE;
- }
+ xwl_present_free_event(xwl_present_window->sync_flip);
+
+ xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->release_queue, list)
+ xwl_present_free_event(event);
/* Clear timer */
xwl_present_free_timer(xwl_present_window);
@@ -353,6 +348,7 @@ xwl_present_queue_vblank(WindowPtr present_window,
return BadAlloc;
event->event_id = event_id;
+ event->buffer = NULL;
event->xwl_present_window = xwl_present_window;
event->target_msc = msc;
commit 37779d7f4028e94c8383a937eab57a6ffb15c38b
Author: Michel Dänzer <mdaenzer at redhat.com>
Date: Fri Jun 19 18:14:35 2020 +0200
xwayland: Always use xwl_present_free_event for freeing Present events
Minor cleanup, and will make the next change simpler. No functional
change intended.
Reviewed-by: Dave Airlie <airlied at redhat.com>
(cherry picked from commit 1beffba699e2cc3f23039d2177c025bc127966de)
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 5ba7dce08..492e4a876 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -111,6 +111,13 @@ xwl_present_reset_timer(struct xwl_present_window *xwl_present_window)
}
}
+static void
+xwl_present_free_event(struct xwl_present_event *event)
+{
+ xorg_list_del(&event->list);
+ free(event);
+}
+
void
xwl_present_cleanup(WindowPtr window)
{
@@ -128,17 +135,15 @@ xwl_present_cleanup(WindowPtr window)
}
/* Clear remaining events */
- xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list) {
- xorg_list_del(&event->list);
- free(event);
- }
+ xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list)
+ xwl_present_free_event(event);
/* Clear remaining buffer releases and inform Present about free ressources */
event = xwl_present_window->sync_flip;
xwl_present_window->sync_flip = NULL;
if (event) {
if (event->buffer_released) {
- free(event);
+ xwl_present_free_event(event);
} else {
event->pending = FALSE;
event->abort = TRUE;
@@ -160,13 +165,6 @@ xwl_present_cleanup(WindowPtr window)
free(xwl_present_window);
}
-static void
-xwl_present_free_event(struct xwl_present_event *event)
-{
- xorg_list_del(&event->list);
- free(event);
-}
-
static void
xwl_present_buffer_release(void *data, struct wl_buffer *buffer)
{
@@ -216,7 +214,7 @@ xwl_present_msc_bump(struct xwl_present_window *xwl_present_window)
/* 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);
- free(event);
+ xwl_present_free_event(event);
} else {
xorg_list_add(&event->list, &xwl_present_window->release_queue);
}
@@ -392,8 +390,7 @@ xwl_present_abort_vblank(WindowPtr present_window,
xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list) {
if (event->event_id == event_id) {
- xorg_list_del(&event->list);
- free(event);
+ xwl_present_free_event(event);
return;
}
}
commit ba52e5eb0e3b30aa63a8b51e8899eca88d9e0a30
Author: Michel Dänzer <mdaenzer at redhat.com>
Date: Thu Jun 25 18:11:31 2020 +0200
present/wnmd: Free flip_queue entries in present_wnmd_clear_window_flip
When present_wnmd_clear_window_flip is done, present_destroy_window
frees struct present_window_priv, and the events in the flip queue
become unreachable. So if we don't free them first, they're leaked.
Also drop the call to present_wnmd_set_abort_flip, which just sets a
flag in struct present_window_priv and thus can't have any observable
effect after present_destroy_window.
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1042
Reviewed-by: Dave Airlie <airlied at redhat.com>
(cherry picked from commit 1bdedc8dbb9d035b85444c2558a137470ff52113)
diff --git a/present/present_screen.c b/present/present_screen.c
index c435f55f4..bfd30b8ba 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -115,9 +115,9 @@ present_wnmd_clear_window_flip(WindowPtr window)
present_window_priv_ptr window_priv = present_window_priv(window);
present_vblank_ptr vblank, tmp;
- if (window_priv->flip_pending) {
- present_wnmd_set_abort_flip(window);
- window_priv->flip_pending->window = NULL;
+ 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) {
commit b3310ed5036b098509e40b3642c2265132445e6a
Author: Michel Dänzer <mdaenzer at redhat.com>
Date: Thu Jun 25 18:09:27 2020 +0200
present/wnmd: Keep pixmap pointer in present_wnmd_clear_window_flip
The comment was incorrect: Any reference held by the window (see
present_wnmd_execute) is in addition to the one in struct present_vblank
(see present_vblank_create). So if we don't drop the latter, the pixmap
will be leaked.
Reviewed-by: Dave Airlie <airlied at redhat.com>
(cherry picked from commit bc9dd1c71c3722284ffaa7183f4119151b25a44f)
diff --git a/present/present_screen.c b/present/present_screen.c
index c7e37c5fd..c435f55f4 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -122,8 +122,6 @@ present_wnmd_clear_window_flip(WindowPtr window)
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);
- /* The pixmap will be destroyed by freeing the window resources. */
- vblank->pixmap = NULL;
present_vblank_destroy(vblank);
}
More information about the xorg-commit
mailing list