From 9eb0b4f731e21952f93e168900f10bf07e261107 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 25 Jun 2020 17:49:27 +0200 Subject: xwayland: Remove xwl_present_event::buffer_released in favor of ::pixmap No need for the separate boolean. Reviewed-by: Olivier Fourdan --- hw/xwayland/xwayland-present.c | 29 ++++++++++++++++------------- hw/xwayland/xwayland-present.h | 1 - 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c index 06f7f54ed..4db068109 100644 --- a/hw/xwayland/xwayland-present.c +++ b/hw/xwayland/xwayland-present.c @@ -118,18 +118,23 @@ xwl_present_reset_timer(struct xwl_present_window *xwl_present_window) } static void -xwl_present_free_event(struct xwl_present_event *event) +xwl_present_release_pixmap(struct xwl_present_event *event) { - if (!event) + if (!event->pixmap) return; - if (event->pixmap) { - if (!event->buffer_released) - xwl_pixmap_del_buffer_release_cb(event->pixmap); + xwl_pixmap_del_buffer_release_cb(event->pixmap); + dixDestroyPixmap(event->pixmap, event->pixmap->drawable.id); + event->pixmap = NULL; +} - dixDestroyPixmap(event->pixmap, event->pixmap->drawable.id); - } +static void +xwl_present_free_event(struct xwl_present_event *event) +{ + if (!event) + return; + xwl_present_release_pixmap(event); xorg_list_del(&event->list); free(event); } @@ -178,8 +183,7 @@ xwl_present_buffer_release(PixmapPtr pixmap, void *data) if (!event) return; - xwl_pixmap_del_buffer_release_cb(pixmap); - event->buffer_released = TRUE; + xwl_present_release_pixmap(event); if (event->abort) { if (!event->pending) @@ -212,7 +216,7 @@ xwl_present_msc_bump(struct xwl_present_window *xwl_present_window) present_wnmd_event_notify(xwl_present_window->window, event->event_id, xwl_present_window->ust, msc); - if (event->buffer_released) { + 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); @@ -281,7 +285,7 @@ xwl_present_sync_callback(void *data, if (event->abort) { /* Event might have been aborted */ - if (event->buffer_released) + if (!event->pixmap) /* Buffer was already released, cleanup now */ xwl_present_free_event(event); return; @@ -292,7 +296,7 @@ xwl_present_sync_callback(void *data, xwl_present_window->ust, xwl_present_window->msc); - if (event->buffer_released) { + 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, @@ -468,7 +472,6 @@ xwl_present_flip(WindowPtr present_window, event->target_msc = target_msc; event->pending = TRUE; event->abort = FALSE; - event->buffer_released = FALSE; if (sync_flip) { xorg_list_init(&event->list); diff --git a/hw/xwayland/xwayland-present.h b/hw/xwayland/xwayland-present.h index a3de1a523..5a7cb3607 100644 --- a/hw/xwayland/xwayland-present.h +++ b/hw/xwayland/xwayland-present.h @@ -56,7 +56,6 @@ struct xwl_present_event { Bool abort; Bool pending; - Bool buffer_released; struct xwl_present_window *xwl_present_window; PixmapPtr pixmap; -- cgit v1.2.3