hw/Xwayland: add xwl_glamor_mode_flags enum

This replaces int glamor parameter with a new enum to be more clean
and prepare for more glamor options.
No functional change.

Signed-off-by: Konstantin <ria.freelander@gmail.com>
This commit is contained in:
Konstantin 2023-10-30 14:23:43 +03:00 committed by Olivier Fourdan
parent 4fc1500f74
commit 8fd24a121a
5 changed files with 23 additions and 4 deletions

View File

@ -962,6 +962,11 @@ xwl_glamor_eglstream_init_egl(struct xwl_screen *xwl_screen)
}; };
int n; int n;
if (!(xwl_screen->glamor & XWL_GLAMOR_GL)) {
ErrorF("glamor: eglstream backend requires desktop OpenGL\n");
goto error;
}
xwl_screen->egl_display = glamor_egl_get_display( xwl_screen->egl_display = glamor_egl_get_display(
EGL_PLATFORM_DEVICE_EXT, xwl_eglstream->egl_device); EGL_PLATFORM_DEVICE_EXT, xwl_eglstream->egl_device);
if (!xwl_screen->egl_display) if (!xwl_screen->egl_display)

View File

@ -1072,6 +1072,9 @@ xwl_glamor_try_big_gl_api(struct xwl_screen *xwl_screen)
}; };
int gl_version; int gl_version;
if (!(xwl_screen->glamor & XWL_GLAMOR_GL))
return FALSE;
eglBindAPI(EGL_OPENGL_API); eglBindAPI(EGL_OPENGL_API);
xwl_screen->egl_context = xwl_screen->egl_context =
@ -1112,6 +1115,9 @@ xwl_glamor_try_gles_api(struct xwl_screen *xwl_screen)
EGL_NONE, EGL_NONE,
}; };
if (!(xwl_screen->glamor & XWL_GLAMOR_GL))
return FALSE;
eglBindAPI(EGL_OPENGL_ES_API); eglBindAPI(EGL_OPENGL_ES_API);
xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display, xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display,

View File

@ -41,6 +41,11 @@ typedef enum _xwl_egl_backend_flags {
XWL_EGL_BACKEND_NEEDS_N_BUFFERING = (1 << 1), XWL_EGL_BACKEND_NEEDS_N_BUFFERING = (1 << 1),
} xwl_egl_backend_flags; } xwl_egl_backend_flags;
typedef enum _xwl_glamor_mode_flags{
XWL_GLAMOR_NONE = 0,
XWL_GLAMOR_GL = (1 << 0),
} xwl_glamor_mode_flags;
struct xwl_egl_backend { struct xwl_egl_backend {
/* Set by the backend if available */ /* Set by the backend if available */
Bool is_available; Bool is_available;

View File

@ -54,6 +54,9 @@
#ifdef XWL_HAS_EI #ifdef XWL_HAS_EI
#include "xwayland-xtest.h" #include "xwayland-xtest.h"
#endif #endif
#ifdef XWL_HAS_GLAMOR
#include "xwayland-glamor.h"
#endif
#ifdef MITSHM #ifdef MITSHM
#include "shmint.h" #include "shmint.h"
@ -757,7 +760,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
#endif #endif
#ifdef XWL_HAS_GLAMOR #ifdef XWL_HAS_GLAMOR
xwl_screen->glamor = 1; xwl_screen->glamor = XWL_GLAMOR_GL;
#endif #endif
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
@ -778,7 +781,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
defaultScreenSaverInterval = 0; defaultScreenSaverInterval = 0;
} }
else if (strcmp(argv[i], "-shm") == 0) { else if (strcmp(argv[i], "-shm") == 0) {
xwl_screen->glamor = 0; xwl_screen->glamor = XWL_GLAMOR_NONE;
} }
else if (strcmp(argv[i], "-eglstream") == 0) { else if (strcmp(argv[i], "-eglstream") == 0) {
#ifdef XWL_HAS_EGLSTREAM #ifdef XWL_HAS_EGLSTREAM
@ -961,7 +964,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
if (xwl_screen->egl_backend == NULL || !xwl_glamor_init(xwl_screen)) { if (xwl_screen->egl_backend == NULL || !xwl_glamor_init(xwl_screen)) {
ErrorF("Failed to initialize glamor, falling back to sw\n"); ErrorF("Failed to initialize glamor, falling back to sw\n");
xwl_screen->glamor = 0; xwl_screen->glamor = XWL_GLAMOR_NONE;
} }
} }
#ifdef GLAMOR_HAS_GBM #ifdef GLAMOR_HAS_GBM

View File

@ -60,7 +60,7 @@ struct xwl_screen {
enum RootClipMode root_clip_mode; enum RootClipMode root_clip_mode;
int rootless; int rootless;
int glamor; xwl_glamor_mode_flags glamor;
int present; int present;
int force_xrandr_emulation; int force_xrandr_emulation;
int fullscreen; int fullscreen;