diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2020-09-14 14:35:22 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2020-09-22 17:59:42 +0200 |
commit | 0b86c0c36241989d7e9662d007c5297fe22ae8b5 (patch) | |
tree | b16822e92974294c9fc0caec4341251f81a4465d | |
parent | ae84f14fb554e5ad54c51c2e6d52ab4a68bf7a0a (diff) |
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: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | hw/xwayland/xwayland-glamor-gbm.c | 3 | ||||
-rw-r--r-- | hw/xwayland/xwayland-glamor.c | 11 | ||||
-rw-r--r-- | hw/xwayland/xwayland-glamor.h | 2 | ||||
-rw-r--r-- | hw/xwayland/xwayland-window-buffers.c | 5 |
4 files changed, 20 insertions, 1 deletions
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index 0a76b60a2..802e0f65d 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -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; } diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index 3c439f304..9dc7b9b92 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -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) { diff --git a/hw/xwayland/xwayland-glamor.h b/hw/xwayland/xwayland-glamor.h index 07b08a828..029b5dbd1 100644 --- a/hw/xwayland/xwayland-glamor.h +++ b/hw/xwayland/xwayland-glamor.h @@ -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 diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c index d1ae8774f..7336a7fbe 100644 --- a/hw/xwayland/xwayland-window-buffers.c +++ b/hw/xwayland/xwayland-window-buffers.c @@ -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; |