[PATCH xserver 4/5] xwayland: Move egl_backends init to glamor
Olivier Fourdan
ofourdan at redhat.com
Fri Jun 1 14:31:41 UTC 2018
Move EGL backends initialization and choice to its own function in
xwayland-glamor.c
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
hw/xwayland/xwayland-glamor.c | 17 +++++++++++++++++
hw/xwayland/xwayland.c | 16 ++--------------
hw/xwayland/xwayland.h | 2 ++
3 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index 8e858394a..eb8ebf032 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -162,6 +162,23 @@ glamor_egl_fd_name_from_pixmap(ScreenPtr screen,
return 0;
}
+void
+xwl_glamor_init_backends(struct xwl_screen *xwl_screen, Bool use_eglstreams)
+{
+#ifdef XWL_HAS_EGLSTREAM
+ if (use_eglstreams) {
+ if (!xwl_glamor_init_eglstream(xwl_screen)) {
+ ErrorF("xwayland glamor: failed to setup eglstream backend\n");
+ use_eglstreams = FALSE;
+ }
+ }
+#endif
+ if (!use_eglstreams && !xwl_glamor_init_gbm(xwl_screen)) {
+ ErrorF("xwayland glamor: failed to setup GBM backend, falling back to sw accel\n");
+ xwl_screen->glamor = 0;
+ }
+}
+
Bool
xwl_glamor_init(struct xwl_screen *xwl_screen)
{
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index a08d58451..0584b53e6 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -992,20 +992,8 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
}
#ifdef XWL_HAS_GLAMOR
- if (xwl_screen->glamor) {
-#ifdef XWL_HAS_EGLSTREAM
- if (use_eglstreams) {
- if (!xwl_glamor_init_eglstream(xwl_screen)) {
- ErrorF("xwayland glamor: failed to setup eglstream backend\n");
- use_eglstreams = FALSE;
- }
- }
-#endif
- if (!use_eglstreams && !xwl_glamor_init_gbm(xwl_screen)) {
- ErrorF("xwayland glamor: failed to setup GBM backend, falling back to sw accel\n");
- xwl_screen->glamor = 0;
- }
- }
+ if (xwl_screen->glamor)
+ xwl_glamor_init_backends(xwl_screen, use_eglstreams);
#endif
/* In rootless mode, we don't have any screen storage, and the only
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 674be3d49..40918e87b 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -423,6 +423,8 @@ Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap);
struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap);
#ifdef XWL_HAS_GLAMOR
+void xwl_glamor_init_backends(struct xwl_screen *xwl_screen,
+ Bool use_eglstreams);
Bool xwl_glamor_init(struct xwl_screen *xwl_screen);
Bool xwl_screen_set_drm_interface(struct xwl_screen *xwl_screen,
--
2.17.0
More information about the xorg-devel
mailing list