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>
This commit is contained in:
parent
bdadaa25f5
commit
792359057b
|
@ -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? */
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user