glamor: Lift the GLX EGL backend from Xwayland

This code is almost entirely ddx-agnostic already, and I'd like to use
it from the other EGL glamor consumers. Which, right now that's just
Xorg, but soon it'll be Xephyr too.
This commit is contained in:
Adam Jackson 2020-08-26 18:22:22 -04:00 committed by Konstantin
parent 3caf7aa88d
commit 58b88ba0b1
5 changed files with 17 additions and 17 deletions

View File

@ -30,21 +30,18 @@
* can do, which often does not include things like multisample visuals.
*/
#include <xwayland-config.h>
#include <dix-config.h>
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
// #include <EGL/egl.h>
#include <epoxy/egl.h>
#include "glxserver.h"
#include "glxutil.h"
#include "compint.h"
#include <X11/extensions/composite.h>
#include "glamor_context.h"
#include "glamor_priv.h"
#include "glamor.h"
#include "xwayland-screen.h"
/* Can't get these from <GL/glx.h> since it pulls in client headers */
#define GLX_RGBA_BIT 0x00000001
#define GLX_WINDOW_BIT 0x00000001
@ -364,12 +361,16 @@ static __GLXscreen *
egl_screen_probe(ScreenPtr pScreen)
{
struct egl_screen *screen;
struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
glamor_screen_private *glamor_screen;
__GLXscreen *base;
if (enableIndirectGLX)
return NULL; /* not implemented */
glamor_screen = glamor_get_screen_private(pScreen);
if (!glamor_screen)
return NULL;
if (!(screen = calloc(1, sizeof *screen)))
return NULL;
@ -378,7 +379,7 @@ egl_screen_probe(ScreenPtr pScreen)
base->createDrawable = egl_create_glx_drawable;
/* base.swapInterval = NULL; */
screen->display = xwl_screen->glamor_ctx->display;
screen->display = glamor_screen->ctx.display;
__glXInitExtensionEnableBits(screen->base.glx_enable_bits);
__glXEnableExtension(base->glx_enable_bits, "GLX_ARB_context_flush_control");
@ -402,8 +403,8 @@ egl_screen_probe(ScreenPtr pScreen)
return NULL;
}
if (!screen->base.glvnd && xwl_screen->glvnd_vendor)
screen->base.glvnd = strdup(xwl_screen->glvnd_vendor);
if (!screen->base.glvnd && glamor_screen->glvnd_vendor)
screen->base.glvnd = strdup(glamor_screen->glvnd_vendor);
if (!screen->base.glvnd)
screen->base.glvnd = strdup("mesa");

View File

@ -27,11 +27,11 @@
#ifndef XWAYLAND_GLX_H
#define XWAYLAND_GLX_H
#include <xwayland-config.h>
#include <dix-config.h>
#ifdef GLXEXT
#include "glx_extinit.h"
extern __GLXprovider glamor_provider;
extern _X_EXPORT __GLXprovider glamor_provider;
#endif
#endif /* XWAYLAND_GLX_H */

View File

@ -33,6 +33,9 @@ srcs_glamor = [
'glamor_sync.c',
]
if build_glx
srcs_glamor += 'glamor_glx_provider.c'
endif
if build_xv
srcs_glamor += 'glamor_xv.c'
endif
@ -41,7 +44,7 @@ epoxy_dep = dependency('epoxy')
glamor = static_library('glamor',
srcs_glamor,
include_directories: inc,
include_directories: [inc, glx_inc],
dependencies: [
common_dep,
epoxy_dep,

View File

@ -7,7 +7,6 @@ srcs = [
'xwayland-drm-lease.h',
'xwayland-drm-lease.c',
'xwayland-glamor.h',
'xwayland-glx.h',
'xwayland-pixmap.c',
'xwayland-pixmap.h',
'xwayland-present.h',
@ -105,9 +104,6 @@ xwayland_glamor = []
eglstream_srcs = []
if build_glamor
srcs += 'xwayland-glamor.c'
if build_glx
srcs += 'xwayland-glx.c'
endif
if gbm_dep.found()
srcs += [
'xwayland-glamor-gbm.c',

View File

@ -33,6 +33,7 @@
#include <glamor.h>
#include <glamor_context.h>
#include <glamor_glx_provider.h>
#ifdef GLXEXT
#include "glx_extinit.h"
#endif
@ -42,7 +43,6 @@
#include <drm_fourcc.h>
#include "xwayland-glamor.h"
#include "xwayland-glx.h"
#include "xwayland-screen.h"
#include "xwayland-window.h"
#include "xwayland-window-buffers.h"