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>
(cherry picked from commit 792359057b
)
This commit is contained in:
parent
79ebd7f689
commit
c641d10ef0
|
@ -308,8 +308,6 @@ xwl_glamor_eglstream_destroy_pixmap(PixmapPtr pixmap)
|
||||||
|
|
||||||
static struct wl_buffer *
|
static struct wl_buffer *
|
||||||
xwl_glamor_eglstream_get_wl_buffer_for_pixmap(PixmapPtr pixmap,
|
xwl_glamor_eglstream_get_wl_buffer_for_pixmap(PixmapPtr pixmap,
|
||||||
unsigned short width,
|
|
||||||
unsigned short height,
|
|
||||||
Bool *created)
|
Bool *created)
|
||||||
{
|
{
|
||||||
/* XXX created? */
|
/* XXX created? */
|
||||||
|
|
|
@ -230,13 +230,13 @@ xwl_glamor_gbm_destroy_pixmap(PixmapPtr pixmap)
|
||||||
|
|
||||||
static struct wl_buffer *
|
static struct wl_buffer *
|
||||||
xwl_glamor_gbm_get_wl_buffer_for_pixmap(PixmapPtr pixmap,
|
xwl_glamor_gbm_get_wl_buffer_for_pixmap(PixmapPtr pixmap,
|
||||||
unsigned short width,
|
|
||||||
unsigned short height,
|
|
||||||
Bool *created)
|
Bool *created)
|
||||||
{
|
{
|
||||||
struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
|
struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
|
||||||
struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
|
struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
|
||||||
struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
|
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 prime_fd;
|
||||||
int num_planes;
|
int num_planes;
|
||||||
uint32_t strides[4];
|
uint32_t strides[4];
|
||||||
|
|
|
@ -100,17 +100,13 @@ xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen,
|
||||||
|
|
||||||
struct wl_buffer *
|
struct wl_buffer *
|
||||||
xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
|
xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
|
||||||
unsigned short width,
|
|
||||||
unsigned short height,
|
|
||||||
Bool *created)
|
Bool *created)
|
||||||
{
|
{
|
||||||
struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
|
struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
|
||||||
|
|
||||||
if (xwl_screen->egl_backend->get_wl_buffer_for_pixmap)
|
if (xwl_screen->egl_backend->get_wl_buffer_for_pixmap)
|
||||||
return xwl_screen->egl_backend->get_wl_buffer_for_pixmap(pixmap,
|
return xwl_screen->egl_backend->get_wl_buffer_for_pixmap(pixmap,
|
||||||
width,
|
created);
|
||||||
height,
|
|
||||||
created);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,10 +456,7 @@ xwl_present_flip(WindowPtr present_window,
|
||||||
|
|
||||||
xwl_window->present_window = present_window;
|
xwl_window->present_window = present_window;
|
||||||
|
|
||||||
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap,
|
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap, &buffer_created);
|
||||||
pixmap->drawable.width,
|
|
||||||
pixmap->drawable.height,
|
|
||||||
&buffer_created);
|
|
||||||
|
|
||||||
event->event_id = event_id;
|
event->event_id = event_id;
|
||||||
event->xwl_present_window = xwl_present_window;
|
event->xwl_present_window = xwl_present_window;
|
||||||
|
|
|
@ -678,8 +678,6 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
|
||||||
#ifdef XWL_HAS_GLAMOR
|
#ifdef XWL_HAS_GLAMOR
|
||||||
if (xwl_screen->glamor)
|
if (xwl_screen->glamor)
|
||||||
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap,
|
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap,
|
||||||
pixmap->drawable.width,
|
|
||||||
pixmap->drawable.height,
|
|
||||||
NULL);
|
NULL);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -96,8 +96,6 @@ struct xwl_egl_backend {
|
||||||
* pixmap they've prepared beforehand.
|
* pixmap they've prepared beforehand.
|
||||||
*/
|
*/
|
||||||
struct wl_buffer *(*get_wl_buffer_for_pixmap)(PixmapPtr pixmap,
|
struct wl_buffer *(*get_wl_buffer_for_pixmap)(PixmapPtr pixmap,
|
||||||
unsigned short width,
|
|
||||||
unsigned short height,
|
|
||||||
Bool *created);
|
Bool *created);
|
||||||
|
|
||||||
/* Called by Xwayland to perform any pre-wl_surface damage routines
|
/* 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,
|
Bool xwl_screen_set_dmabuf_interface(struct xwl_screen *xwl_screen,
|
||||||
uint32_t id, uint32_t version);
|
uint32_t id, uint32_t version);
|
||||||
struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
|
struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
|
||||||
unsigned short width,
|
|
||||||
unsigned short height,
|
|
||||||
Bool *created);
|
Bool *created);
|
||||||
void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
|
void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
|
||||||
struct wl_registry *registry,
|
struct wl_registry *registry,
|
||||||
|
|
Loading…
Reference in New Issue