xwayland/window-buffers: Do not always set syncpnts
The function xwl_window_swap_pixmap() can be called from two places, either from xwl_window_attach_buffer() or from damage_report(). When called from xwl_window_attach_buffer(), the new buffer is attached and the surface committed. However, when called from damage_report(), a new buffer might not be attached before the surface is committed. That's fine with implicit synchronization, but if we use explicit synchronization, committing a surface without a new buffer attached but with a release timeline point set is a protocol error: | If at surface commit time there is a pending release timeline point | set but no pending buffer attached, a no_buffer error is raised. To avoid such an issue, add a new parameter to xwl_window_swap_pixmap() to hint whether it should set the synchronization points, and have the synchronization points set only from xwl_window_attach_buffer(). v2: Rename param to handle_sync (Michel) Suggested-by: Michel Dänzer <mdaenzer@redhat.com> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
This commit is contained in:
parent
256cef8b20
commit
aab01c7391
|
@ -350,7 +350,7 @@ xwl_window_realloc_pixmap(struct xwl_window *xwl_window)
|
|||
}
|
||||
|
||||
PixmapPtr
|
||||
xwl_window_swap_pixmap(struct xwl_window *xwl_window)
|
||||
xwl_window_swap_pixmap(struct xwl_window *xwl_window, Bool handle_sync)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
|
||||
WindowPtr surface_window = xwl_window->surface_window;
|
||||
|
@ -409,7 +409,7 @@ xwl_window_swap_pixmap(struct xwl_window *xwl_window)
|
|||
xwl_window_buffer->refcnt++;
|
||||
|
||||
#ifdef XWL_HAS_GLAMOR
|
||||
if (!xwl_glamor_supports_implicit_sync(xwl_screen)) {
|
||||
if (handle_sync && !xwl_glamor_supports_implicit_sync(xwl_screen)) {
|
||||
if (xwl_screen->explicit_sync && xwl_glamor_gbm_set_syncpts(xwl_window, window_pixmap)) {
|
||||
implicit_sync = FALSE;
|
||||
/* wait until the release fence is available before re-using this buffer */
|
||||
|
|
|
@ -36,6 +36,6 @@ void xwl_window_buffer_release(struct xwl_window_buffer *xwl_window_buffer);
|
|||
void xwl_window_buffers_init(struct xwl_window *xwl_window);
|
||||
void xwl_window_buffers_dispose(struct xwl_window *xwl_window);
|
||||
void xwl_window_realloc_pixmap(struct xwl_window *xwl_window);
|
||||
PixmapPtr xwl_window_swap_pixmap(struct xwl_window *xwl_window);
|
||||
PixmapPtr xwl_window_swap_pixmap(struct xwl_window *xwl_window, Bool handle_sync);
|
||||
|
||||
#endif /* XWAYLAND_WINDOW_BUFFERS_H */
|
||||
|
|
|
@ -318,7 +318,7 @@ damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data)
|
|||
|
||||
window_pixmap = xwl_screen->screen->GetWindowPixmap(xwl_window->surface_window);
|
||||
if (xwl_is_client_pixmap(window_pixmap))
|
||||
xwl_screen->screen->DestroyPixmap(xwl_window_swap_pixmap(xwl_window));
|
||||
xwl_screen->screen->DestroyPixmap(xwl_window_swap_pixmap(xwl_window, FALSE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1955,7 +1955,7 @@ xwl_window_attach_buffer(struct xwl_window *xwl_window)
|
|||
PixmapPtr pixmap;
|
||||
int i;
|
||||
|
||||
pixmap = xwl_window_swap_pixmap(xwl_window);
|
||||
pixmap = xwl_window_swap_pixmap(xwl_window, TRUE);
|
||||
buffer = xwl_pixmap_get_wl_buffer(pixmap);
|
||||
|
||||
if (!buffer) {
|
||||
|
|
Loading…
Reference in New Issue