Also, fold glamor_context.h into glamor.h, and use the standard Xnest trick so we can include server headers in glamor_glx.c.
Signed-off-by: Adam Jackson <a...@redhat.com> --- glamor/Makefile.am | 1 - glamor/glamor.c | 6 ++++++ glamor/glamor.h | 21 ++++++++++++++++++- glamor/glamor_context.h | 49 ------------------------------------------- glamor/glamor_glx.c | 5 ++++- glamor/glamor_priv.h | 1 - hw/xwayland/xwayland-glamor.c | 1 - 7 files changed, 30 insertions(+), 54 deletions(-) delete mode 100644 glamor/glamor_context.h diff --git a/glamor/Makefile.am b/glamor/Makefile.am index b5395259d..5f57c628c 100644 --- a/glamor/Makefile.am +++ b/glamor/Makefile.am @@ -6,7 +6,6 @@ AM_CFLAGS = $(CWARNFLAGS) $(DIX_CFLAGS) $(GLAMOR_CFLAGS) libglamor_la_SOURCES = \ glamor.c \ - glamor_context.h \ glamor_copy.c \ glamor_core.c \ glamor_dash.c \ diff --git a/glamor/glamor.c b/glamor/glamor.c index 9fd110ed2..2f15aa222 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -53,6 +53,12 @@ glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv) dixSetPrivate(&screen->devPrivates, &glamor_screen_private_key, priv); } +struct glamor_context * +glamor_get_screen_context(ScreenPtr screen) +{ + return (struct glamor_context *)&(glamor_get_screen_private(screen)->ctx); +} + /** * glamor_get_drawable_pixmap() returns a backing pixmap for a given drawable. * diff --git a/glamor/glamor.h b/glamor/glamor.h index 5b15a46e5..790f51eab 100644 --- a/glamor/glamor.h +++ b/glamor/glamor.h @@ -39,7 +39,22 @@ #include <xf86xv.h> #endif -struct glamor_context; +struct glamor_context { + /** Either an EGLDisplay or an Xlib Display */ + void *display; + + /** Either a GLXContext or an EGLContext. */ + void *ctx; + + /** The EGLSurface we should MakeCurrent to */ + void *drawable; + + /** The GLXDrawable we should MakeCurrent to */ + uint32_t drawable_xid; + + void (*make_current)(struct glamor_context *glamor_ctx); +}; + struct gbm_bo; struct gbm_device; @@ -331,6 +346,8 @@ extern _X_EXPORT Bool extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx); +extern _X_EXPORT Bool glamor_glx_screen_init(struct glamor_context *glamor_ctx); + extern _X_EXPORT int glamor_create_gc(GCPtr gc); extern _X_EXPORT void glamor_validate_gc(GCPtr gc, unsigned long changes, @@ -351,4 +368,6 @@ extern _X_EXPORT XF86VideoAdaptorPtr glamor_xv_init(ScreenPtr pScreen, int num_texture_ports); #endif +extern struct glamor_context *glamor_get_screen_context(ScreenPtr screen); + #endif /* GLAMOR_H */ diff --git a/glamor/glamor_context.h b/glamor/glamor_context.h deleted file mode 100644 index 47b87e620..000000000 --- a/glamor/glamor_context.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright © 2013 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -/** - * @file glamor_context.h - * - * This is the struct of state required for context switching in - * glamor. It has to use types that don't require including either - * server headers or Xlib headers, since it will be included by both - * the server and the GLX (xlib) code. - */ - -struct glamor_context { - /** Either an EGLDisplay or an Xlib Display */ - void *display; - - /** Either a GLXContext or an EGLContext. */ - void *ctx; - - /** The EGLSurface we should MakeCurrent to */ - void *drawable; - - /** The GLXDrawable we should MakeCurrent to */ - uint32_t drawable_xid; - - void (*make_current)(struct glamor_context *glamor_ctx); -}; - -Bool glamor_glx_screen_init(struct glamor_context *glamor_ctx); diff --git a/glamor/glamor_glx.c b/glamor/glamor_glx.c index 7107c7c17..091af5213 100644 --- a/glamor/glamor_glx.c +++ b/glamor/glamor_glx.c @@ -21,8 +21,11 @@ * IN THE SOFTWARE. */ +#include <dix-config.h> +#define GC XlibGC #include <epoxy/glx.h> -#include "glamor_context.h" +#undef GC +#include "glamor.h" /** * @file glamor_glx.c diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index 631f3d167..2a4ee80a1 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -50,7 +50,6 @@ #include "glyphstr.h" #include "glamor_debug.h" -#include "glamor_context.h" #include "glamor_program.h" #include <list.h> diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index 8ffb40d6f..31659fb8e 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -34,7 +34,6 @@ #include <glamor_egl.h> #include <glamor.h> -#include <glamor_context.h> #include <dri3.h> #include "drm-client-protocol.h" -- 2.14.3 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel