Commit 0b86c0c3 authored by Olivier Fourdan's avatar Olivier Fourdan

xwayland: Add a flag for n-buffers in EGL backend

Using multiple window buffers crashes with EGLStream, which does not
need it anyway as this is handled through EGL directly.

Add a flag to the EGL backend to indicate whether it would benefit from
multiple buffers and use this in the get_buffer() function.

Thanks to Adam Jackson <ajax@redhat.com> for pointing out that issue
with EGLStream.

v2: Fix logical test (Adam Jackson <ajax@redhat.com>)
Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent ae84f14f
Pipeline #204395 passed with stages
in 4 minutes and 17 seconds
......@@ -1117,5 +1117,6 @@ xwl_glamor_init_gbm(struct xwl_screen *xwl_screen)
xwl_screen->gbm_backend.get_wl_buffer_for_pixmap = xwl_glamor_gbm_get_wl_buffer_for_pixmap;
xwl_screen->gbm_backend.is_available = TRUE;
xwl_screen->gbm_backend.backend_flags = XWL_EGL_BACKEND_HAS_PRESENT_FLIP |
XWL_EGL_BACKEND_NEEDS_BUFFER_FLUSH;
XWL_EGL_BACKEND_NEEDS_BUFFER_FLUSH |
XWL_EGL_BACKEND_NEEDS_N_BUFFERING;
}
......@@ -196,6 +196,17 @@ xwl_glamor_needs_buffer_flush(struct xwl_screen *xwl_screen)
XWL_EGL_BACKEND_NEEDS_BUFFER_FLUSH);
}
Bool
xwl_glamor_needs_n_buffering(struct xwl_screen *xwl_screen)
{
/* wl_shm benefits from n-buffering */
if (!xwl_screen->glamor || !xwl_screen->egl_backend)
return TRUE;
return (xwl_screen->egl_backend->backend_flags &
XWL_EGL_BACKEND_NEEDS_N_BUFFERING);
}
void
xwl_glamor_init_backends(struct xwl_screen *xwl_screen, Bool use_eglstream)
{
......
......@@ -36,6 +36,7 @@ typedef enum _xwl_egl_backend_flags {
XWL_EGL_BACKEND_NO_FLAG = 0,
XWL_EGL_BACKEND_HAS_PRESENT_FLIP = (1 << 0),
XWL_EGL_BACKEND_NEEDS_BUFFER_FLUSH = (1 << 1),
XWL_EGL_BACKEND_NEEDS_N_BUFFERING = (1 << 2),
} xwl_egl_backend_flags;
struct xwl_egl_backend {
......@@ -120,6 +121,7 @@ Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window);
void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
Bool xwl_glamor_has_present_flip(struct xwl_screen *xwl_screen);
Bool xwl_glamor_needs_buffer_flush(struct xwl_screen *xwl_screen);
Bool xwl_glamor_needs_n_buffering(struct xwl_screen *xwl_screen);
#ifdef XV
......
......@@ -279,6 +279,11 @@ xwl_window_buffers_get_pixmap(struct xwl_window *xwl_window,
window_pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
#ifdef XWL_HAS_GLAMOR
if (!xwl_glamor_needs_n_buffering(xwl_screen))
return window_pixmap;
#endif /* XWL_HAS_GLAMOR */
xwl_window_buffer = xwl_window_buffer_get_available(xwl_window);
if (!xwl_window_buffer)
return window_pixmap;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment