From 792359057bd54548555674d2d309c0cfeebac12d Mon Sep 17 00:00:00 2001 From: Olivier Fourdan <ofourdan@redhat.com> Date: Mon, 11 Jun 2018 09:13:30 +0200 Subject: [PATCH] xwayland: simplify xwl_glamor_pixmap_get_wl_buffer() When retrieving the Wayland buffer from a pixmap, if the buffer already exists, the GBM backend will return that existing buffer. However, as seen with the Present issues, if the call had previously passed a wrong size, that buffer will remain at the wrong size for as long as the buffer exists, which is error prone. Considering that the width/height passed to get_wl_buffer() is always the actual pixmap drawable size, and considering that the EGLStream backend makes no use of the size either, there is really no point in passing the width/height around. Simplify the xwl_glamor_pixmap_get_wl_buffer() and EGL backends API by removing the pixmap size, and use the drawable size instead. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> --- hw/xwayland/xwayland-glamor-eglstream.c | 2 -- hw/xwayland/xwayland-glamor-gbm.c | 4 ++-- hw/xwayland/xwayland-glamor.c | 6 +----- hw/xwayland/xwayland-present.c | 5 +---- hw/xwayland/xwayland.c | 2 -- hw/xwayland/xwayland.h | 4 ---- 6 files changed, 4 insertions(+), 19 deletions(-) diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c index 43f34eed12..9950be94d2 100644 --- a/hw/xwayland/xwayland-glamor-eglstream.c +++ b/hw/xwayland/xwayland-glamor-eglstream.c @@ -308,8 +308,6 @@ xwl_glamor_eglstream_destroy_pixmap(PixmapPtr pixmap) static struct wl_buffer * xwl_glamor_eglstream_get_wl_buffer_for_pixmap(PixmapPtr pixmap, - unsigned short width, - unsigned short height, Bool *created) { /* XXX created? */ diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index bb29cc28ec..42d758e932 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -230,13 +230,13 @@ xwl_glamor_gbm_destroy_pixmap(PixmapPtr pixmap) static struct wl_buffer * xwl_glamor_gbm_get_wl_buffer_for_pixmap(PixmapPtr pixmap, - unsigned short width, - unsigned short height, Bool *created) { struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); + unsigned short width = pixmap->drawable.width; + unsigned short height = pixmap->drawable.height; int prime_fd; int num_planes; uint32_t strides[4]; diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index 2f64d05002..61418e7078 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -100,17 +100,13 @@ xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen, struct wl_buffer * xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap, - unsigned short width, - unsigned short height, Bool *created) { struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); if (xwl_screen->egl_backend->get_wl_buffer_for_pixmap) return xwl_screen->egl_backend->get_wl_buffer_for_pixmap(pixmap, - width, - height, - created); + created); return NULL; } diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c index 29014a3005..81e0eb9ce6 100644 --- a/hw/xwayland/xwayland-present.c +++ b/hw/xwayland/xwayland-present.c @@ -456,10 +456,7 @@ xwl_present_flip(WindowPtr present_window, xwl_window->present_window = present_window; - buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap, - pixmap->drawable.width, - pixmap->drawable.height, - &buffer_created); + buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap, &buffer_created); event->event_id = event_id; event->xwl_present_window = xwl_present_window; diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 7ea01ab868..96b4db18c5 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -678,8 +678,6 @@ xwl_window_post_damage(struct xwl_window *xwl_window) #ifdef XWL_HAS_GLAMOR if (xwl_screen->glamor) buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap, - pixmap->drawable.width, - pixmap->drawable.height, NULL); else #endif diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h index 0fa5cb5884..dc01c747cc 100644 --- a/hw/xwayland/xwayland.h +++ b/hw/xwayland/xwayland.h @@ -96,8 +96,6 @@ struct xwl_egl_backend { * pixmap they've prepared beforehand. */ struct wl_buffer *(*get_wl_buffer_for_pixmap)(PixmapPtr pixmap, - unsigned short width, - unsigned short height, Bool *created); /* Called by Xwayland to perform any pre-wl_surface damage routines @@ -439,8 +437,6 @@ Bool xwl_screen_set_drm_interface(struct xwl_screen *xwl_screen, Bool xwl_screen_set_dmabuf_interface(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version); struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap, - unsigned short width, - unsigned short height, Bool *created); void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen, struct wl_registry *registry, -- GitLab