summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2019-12-16 17:23:30 +0100
committerOlivier Fourdan <ofourdan@redhat.com>2019-12-20 16:19:01 +0100
commit3a59650ba74e9d97473fa39269fdb74ad7e1cd43 (patch)
tree85ec24859f21d742365dda8bcfb74d813ea0d65f
parent177c8a230232d114cdbe1650bd22a396d182f5f8 (diff)
xwayland: Move GLAMOR declarations to their own header
Currently, `xwayland.h` contains all the declarations, which is a bit awkward and hard to follow. Move the GLAMOR relevant declarations to their own header file. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
-rw-r--r--hw/xwayland/Makefile.am1
-rw-r--r--hw/xwayland/meson.build1
-rw-r--r--hw/xwayland/xwayland-glamor-eglstream.c11
-rw-r--r--hw/xwayland/xwayland-glamor-gbm.c8
-rw-r--r--hw/xwayland/xwayland-glamor-xv.c6
-rw-r--r--hw/xwayland/xwayland-glamor.c7
-rw-r--r--hw/xwayland/xwayland-glamor.h134
-rw-r--r--hw/xwayland/xwayland.c2
-rw-r--r--hw/xwayland/xwayland.h97
9 files changed, 164 insertions, 103 deletions
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index c3a159e7a..7decc8f06 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -13,6 +13,7 @@ Xwayland_SOURCES = \
xwayland.c \
xwayland-input.c \
xwayland-cursor.c \
+ xwayland-glamor.h \
xwayland-shm.c \
xwayland-shm.h \
xwayland-types.h \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 61337b0e1..d4a408cb4 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -2,6 +2,7 @@ srcs = [
'xwayland.c',
'xwayland-input.c',
'xwayland-cursor.c',
+ 'xwayland-glamor.h',
'xwayland-shm.c',
'xwayland-shm.h',
'xwayland-types.h',
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
index ed10355ed..b9d3bc45d 100644
--- a/hw/xwayland/xwayland-glamor-eglstream.c
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
@@ -27,10 +27,7 @@
*
*/
-#include "xwayland.h"
-
-#include "wayland-eglstream-client-protocol.h"
-#include "wayland-eglstream-controller-client-protocol.h"
+#include <xwayland-config.h>
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
@@ -43,6 +40,12 @@
#include <epoxy/egl.h>
+#include "xwayland.h"
+#include "xwayland-glamor.h"
+
+#include "wayland-eglstream-client-protocol.h"
+#include "wayland-eglstream-controller-client-protocol.h"
+
struct xwl_eglstream_pending_stream {
PixmapPtr pixmap;
WindowPtr window;
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 9b7d6e286..e4718da52 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -28,9 +28,10 @@
*
*/
-#include "xwayland.h"
+#include <xwayland-config.h>
#include <fcntl.h>
+#include <errno.h>
#include <sys/stat.h>
#include <xf86drm.h>
#include <drm_fourcc.h>
@@ -45,6 +46,11 @@
#include <dri3.h>
#include "drm-client-protocol.h"
+#include "xwayland.h"
+#include "xwayland-glamor.h"
+
+#include "linux-dmabuf-unstable-v1-client-protocol.h"
+
struct xwl_gbm_private {
char *device_name;
struct gbm_device *gbm;
diff --git a/hw/xwayland/xwayland-glamor-xv.c b/hw/xwayland/xwayland-glamor-xv.c
index 8e0f8da94..fe6849cc3 100644
--- a/hw/xwayland/xwayland-glamor-xv.c
+++ b/hw/xwayland/xwayland-glamor-xv.c
@@ -30,11 +30,15 @@
* implementations
*/
-#include "xwayland.h"
+#include <xwayland-config.h>
+
#include "glamor_priv.h"
#include <X11/extensions/Xv.h>
+#include "xwayland.h"
+#include "xwayland-glamor.h"
+
#define NUM_FORMATS 3
#define NUM_PORTS 16
#define ADAPTOR_NAME "glamor textured video"
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index bf7f0ffb4..e1ac22348 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -23,7 +23,9 @@
* SOFTWARE.
*/
-#include "xwayland.h"
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
@@ -35,6 +37,9 @@
#include "glx_extinit.h"
#endif
+#include "xwayland.h"
+#include "xwayland-glamor.h"
+
static void
glamor_egl_make_current(struct glamor_context *glamor_ctx)
{
diff --git a/hw/xwayland/xwayland-glamor.h b/hw/xwayland/xwayland-glamor.h
new file mode 100644
index 000000000..78e0d6ddd
--- /dev/null
+++ b/hw/xwayland/xwayland-glamor.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright © 2011-2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_GLAMOR_H
+#define XWAYLAND_GLAMOR_H
+
+#include <xwayland-config.h>
+
+#include "xwayland-types.h"
+
+struct xwl_egl_backend {
+ /* Set by the backend if available */
+ Bool is_available;
+
+ /* Called once for each interface in the global registry. Backends
+ * should use this to bind to any wayland interfaces they need.
+ */
+ Bool (*init_wl_registry)(struct xwl_screen *xwl_screen,
+ struct wl_registry *wl_registry,
+ uint32_t id, const char *name,
+ uint32_t version);
+
+ /* Check that the required Wayland interfaces are available.
+ */
+ Bool (*has_wl_interfaces)(struct xwl_screen *xwl_screen);
+
+ /* Called before glamor has been initialized. Backends should setup a
+ * valid, glamor compatible EGL context in this hook.
+ */
+ Bool (*init_egl)(struct xwl_screen *xwl_screen);
+
+ /* Called after glamor has been initialized, and after all of the
+ * common Xwayland DDX hooks have been connected. Backends should use
+ * this to setup any required wraps around X server callbacks like
+ * CreatePixmap.
+ */
+ Bool (*init_screen)(struct xwl_screen *xwl_screen);
+
+ /* Called by Xwayland to retrieve a pointer to a valid wl_buffer for
+ * the given window/pixmap combo so that damage to the pixmap may be
+ * displayed on-screen. Backends should use this to create a new
+ * wl_buffer for a currently buffer-less pixmap, or simply return the
+ * pixmap they've prepared beforehand.
+ */
+ struct wl_buffer *(*get_wl_buffer_for_pixmap)(PixmapPtr pixmap,
+ Bool *created);
+
+ /* Called by Xwayland to perform any pre-wl_surface damage routines
+ * that are required by the backend. If your backend is poorly
+ * designed and lacks the ability to render directly to a surface,
+ * you should implement blitting from the glamor pixmap to the wayland
+ * pixmap here. Otherwise, this callback is optional.
+ */
+ void (*post_damage)(struct xwl_window *xwl_window,
+ PixmapPtr pixmap, RegionPtr region);
+
+ /* Called by Xwayland to confirm with the egl backend that the given
+ * pixmap is completely setup and ready for display on-screen. This
+ * callback is optional.
+ */
+ Bool (*allow_commits)(struct xwl_window *xwl_window);
+};
+
+#ifdef XWL_HAS_GLAMOR
+
+void xwl_glamor_init_backends(struct xwl_screen *xwl_screen,
+ Bool use_eglstream);
+void xwl_glamor_select_backend(struct xwl_screen *xwl_screen,
+ Bool use_eglstream);
+Bool xwl_glamor_init(struct xwl_screen *xwl_screen);
+
+Bool xwl_screen_set_drm_interface(struct xwl_screen *xwl_screen,
+ uint32_t id, uint32_t version);
+Bool xwl_screen_set_dmabuf_interface(struct xwl_screen *xwl_screen,
+ uint32_t id, uint32_t version);
+struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
+ Bool *created);
+void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
+ struct wl_registry *registry,
+ uint32_t id, const char *interface,
+ uint32_t version);
+Bool xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen,
+ struct xwl_egl_backend *xwl_egl_backend);
+void xwl_glamor_post_damage(struct xwl_window *xwl_window,
+ PixmapPtr pixmap, RegionPtr region);
+Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window);
+void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
+
+#ifdef XV
+/* glamor Xv Adaptor */
+Bool xwl_glamor_xv_init(ScreenPtr pScreen);
+#endif /* XV */
+
+#endif /* XWL_HAS_GLAMOR */
+
+#ifdef GLAMOR_HAS_GBM
+void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen);
+#else
+static inline void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen)
+{
+}
+#endif
+
+#ifdef XWL_HAS_EGLSTREAM
+void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen);
+#else
+static inline void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen)
+{
+}
+#endif
+
+#endif /* XWAYLAND_GLAMOR_H */
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 726be02de..764511d4e 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -23,6 +23,7 @@
* SOFTWARE.
*/
+
#include <stdio.h>
#include <X11/Xatom.h>
@@ -37,6 +38,7 @@
#include <propertyst.h>
#include "xwayland.h"
+#include "xwayland-glamor.h"
#include "xwayland-shm.h"
#include "xwayland-window-buffers.h"
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index f4cdc5be0..8db682a8f 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -51,6 +51,7 @@
#include "viewporter-client-protocol.h"
#include "xwayland-types.h"
+#include "xwayland-glamor.h"
struct xwl_format {
uint32_t format;
@@ -60,59 +61,6 @@ struct xwl_format {
typedef void (*xwl_pixmap_cb) (PixmapPtr pixmap, void *data);
-struct xwl_egl_backend {
- /* Set by the backend if available */
- Bool is_available;
-
- /* Called once for each interface in the global registry. Backends
- * should use this to bind to any wayland interfaces they need.
- */
- Bool (*init_wl_registry)(struct xwl_screen *xwl_screen,
- struct wl_registry *wl_registry,
- uint32_t id, const char *name,
- uint32_t version);
-
- /* Check that the required Wayland interfaces are available.
- */
- Bool (*has_wl_interfaces)(struct xwl_screen *xwl_screen);
-
- /* Called before glamor has been initialized. Backends should setup a
- * valid, glamor compatible EGL context in this hook.
- */
- Bool (*init_egl)(struct xwl_screen *xwl_screen);
-
- /* Called after glamor has been initialized, and after all of the
- * common Xwayland DDX hooks have been connected. Backends should use
- * this to setup any required wraps around X server callbacks like
- * CreatePixmap.
- */
- Bool (*init_screen)(struct xwl_screen *xwl_screen);
-
- /* Called by Xwayland to retrieve a pointer to a valid wl_buffer for
- * the given window/pixmap combo so that damage to the pixmap may be
- * displayed on-screen. Backends should use this to create a new
- * wl_buffer for a currently buffer-less pixmap, or simply return the
- * pixmap they've prepared beforehand.
- */
- struct wl_buffer *(*get_wl_buffer_for_pixmap)(PixmapPtr pixmap,
- Bool *created);
-
- /* Called by Xwayland to perform any pre-wl_surface damage routines
- * that are required by the backend. If your backend is poorly
- * designed and lacks the ability to render directly to a surface,
- * you should implement blitting from the glamor pixmap to the wayland
- * pixmap here. Otherwise, this callback is optional.
- */
- void (*post_damage)(struct xwl_window *xwl_window,
- PixmapPtr pixmap, RegionPtr region);
-
- /* Called by Xwayland to confirm with the egl backend that the given
- * pixmap is completely setup and ready for display on-screen. This
- * callback is optional.
- */
- Bool (*allow_commits)(struct xwl_window *xwl_window);
-};
-
struct xwl_screen {
int width;
int height;
@@ -472,28 +420,6 @@ void xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer);
struct xwl_window *xwl_window_from_window(WindowPtr window);
#ifdef XWL_HAS_GLAMOR
-void xwl_glamor_init_backends(struct xwl_screen *xwl_screen,
- Bool use_eglstream);
-void xwl_glamor_select_backend(struct xwl_screen *xwl_screen,
- Bool use_eglstream);
-Bool xwl_glamor_init(struct xwl_screen *xwl_screen);
-
-Bool xwl_screen_set_drm_interface(struct xwl_screen *xwl_screen,
- uint32_t id, uint32_t version);
-Bool xwl_screen_set_dmabuf_interface(struct xwl_screen *xwl_screen,
- uint32_t id, uint32_t version);
-struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
- Bool *created);
-void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
- struct wl_registry *registry,
- uint32_t id, const char *interface,
- uint32_t version);
-Bool xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen,
- struct xwl_egl_backend *xwl_egl_backend);
-void xwl_glamor_post_damage(struct xwl_window *xwl_window,
- PixmapPtr pixmap, RegionPtr region);
-Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window);
-void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
#ifdef GLAMOR_HAS_GBM
void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window);
@@ -502,11 +428,6 @@ void xwl_present_cleanup(WindowPtr window);
void xwl_present_unrealize_window(WindowPtr window);
#endif /* GLAMOR_HAS_GBM */
-#ifdef XV
-/* glamor Xv Adaptor */
-Bool xwl_glamor_xv_init(ScreenPtr pScreen);
-#endif /* XV */
-
#endif /* XWL_HAS_GLAMOR */
void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
@@ -517,22 +438,6 @@ void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
void xwlVidModeExtensionInit(void);
#endif
-#ifdef GLAMOR_HAS_GBM
-void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen);
-#else
-static inline void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen)
-{
-}
-#endif
-
-#ifdef XWL_HAS_EGLSTREAM
-void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen);
-#else
-static inline void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen)
-{
-}
-#endif
-
#ifdef GLXEXT
#include "glx_extinit.h"
extern __GLXprovider glamor_provider;