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>
This commit is contained in:
parent
177c8a2302
commit
3a59650ba7
|
@ -13,6 +13,7 @@ Xwayland_SOURCES = \
|
||||||
xwayland.c \
|
xwayland.c \
|
||||||
xwayland-input.c \
|
xwayland-input.c \
|
||||||
xwayland-cursor.c \
|
xwayland-cursor.c \
|
||||||
|
xwayland-glamor.h \
|
||||||
xwayland-shm.c \
|
xwayland-shm.c \
|
||||||
xwayland-shm.h \
|
xwayland-shm.h \
|
||||||
xwayland-types.h \
|
xwayland-types.h \
|
||||||
|
|
|
@ -2,6 +2,7 @@ srcs = [
|
||||||
'xwayland.c',
|
'xwayland.c',
|
||||||
'xwayland-input.c',
|
'xwayland-input.c',
|
||||||
'xwayland-cursor.c',
|
'xwayland-cursor.c',
|
||||||
|
'xwayland-glamor.h',
|
||||||
'xwayland-shm.c',
|
'xwayland-shm.c',
|
||||||
'xwayland-shm.h',
|
'xwayland-shm.h',
|
||||||
'xwayland-types.h',
|
'xwayland-types.h',
|
||||||
|
|
|
@ -27,10 +27,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xwayland.h"
|
#include <xwayland-config.h>
|
||||||
|
|
||||||
#include "wayland-eglstream-client-protocol.h"
|
|
||||||
#include "wayland-eglstream-controller-client-protocol.h"
|
|
||||||
|
|
||||||
#define MESA_EGL_NO_X11_HEADERS
|
#define MESA_EGL_NO_X11_HEADERS
|
||||||
#define EGL_NO_X11
|
#define EGL_NO_X11
|
||||||
|
@ -43,6 +40,12 @@
|
||||||
|
|
||||||
#include <epoxy/egl.h>
|
#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 {
|
struct xwl_eglstream_pending_stream {
|
||||||
PixmapPtr pixmap;
|
PixmapPtr pixmap;
|
||||||
WindowPtr window;
|
WindowPtr window;
|
||||||
|
|
|
@ -28,9 +28,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xwayland.h"
|
#include <xwayland-config.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
#include <drm_fourcc.h>
|
#include <drm_fourcc.h>
|
||||||
|
@ -45,6 +46,11 @@
|
||||||
#include <dri3.h>
|
#include <dri3.h>
|
||||||
#include "drm-client-protocol.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 {
|
struct xwl_gbm_private {
|
||||||
char *device_name;
|
char *device_name;
|
||||||
struct gbm_device *gbm;
|
struct gbm_device *gbm;
|
||||||
|
|
|
@ -30,11 +30,15 @@
|
||||||
* implementations
|
* implementations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xwayland.h"
|
#include <xwayland-config.h>
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
#include <X11/extensions/Xv.h>
|
#include <X11/extensions/Xv.h>
|
||||||
|
|
||||||
|
#include "xwayland.h"
|
||||||
|
#include "xwayland-glamor.h"
|
||||||
|
|
||||||
#define NUM_FORMATS 3
|
#define NUM_FORMATS 3
|
||||||
#define NUM_PORTS 16
|
#define NUM_PORTS 16
|
||||||
#define ADAPTOR_NAME "glamor textured video"
|
#define ADAPTOR_NAME "glamor textured video"
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xwayland.h"
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
#include <dix-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MESA_EGL_NO_X11_HEADERS
|
#define MESA_EGL_NO_X11_HEADERS
|
||||||
#define EGL_NO_X11
|
#define EGL_NO_X11
|
||||||
|
@ -35,6 +37,9 @@
|
||||||
#include "glx_extinit.h"
|
#include "glx_extinit.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "xwayland.h"
|
||||||
|
#include "xwayland-glamor.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
glamor_egl_make_current(struct glamor_context *glamor_ctx)
|
glamor_egl_make_current(struct glamor_context *glamor_ctx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 */
|
|
@ -23,6 +23,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
#include <propertyst.h>
|
#include <propertyst.h>
|
||||||
|
|
||||||
#include "xwayland.h"
|
#include "xwayland.h"
|
||||||
|
#include "xwayland-glamor.h"
|
||||||
#include "xwayland-shm.h"
|
#include "xwayland-shm.h"
|
||||||
#include "xwayland-window-buffers.h"
|
#include "xwayland-window-buffers.h"
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include "viewporter-client-protocol.h"
|
#include "viewporter-client-protocol.h"
|
||||||
|
|
||||||
#include "xwayland-types.h"
|
#include "xwayland-types.h"
|
||||||
|
#include "xwayland-glamor.h"
|
||||||
|
|
||||||
struct xwl_format {
|
struct xwl_format {
|
||||||
uint32_t format;
|
uint32_t format;
|
||||||
|
@ -60,59 +61,6 @@ struct xwl_format {
|
||||||
|
|
||||||
typedef void (*xwl_pixmap_cb) (PixmapPtr pixmap, void *data);
|
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 {
|
struct xwl_screen {
|
||||||
int width;
|
int width;
|
||||||
int height;
|
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);
|
struct xwl_window *xwl_window_from_window(WindowPtr window);
|
||||||
|
|
||||||
#ifdef XWL_HAS_GLAMOR
|
#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
|
#ifdef GLAMOR_HAS_GBM
|
||||||
void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window);
|
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);
|
void xwl_present_unrealize_window(WindowPtr window);
|
||||||
#endif /* GLAMOR_HAS_GBM */
|
#endif /* GLAMOR_HAS_GBM */
|
||||||
|
|
||||||
#ifdef XV
|
|
||||||
/* glamor Xv Adaptor */
|
|
||||||
Bool xwl_glamor_xv_init(ScreenPtr pScreen);
|
|
||||||
#endif /* XV */
|
|
||||||
|
|
||||||
#endif /* XWL_HAS_GLAMOR */
|
#endif /* XWL_HAS_GLAMOR */
|
||||||
|
|
||||||
void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
|
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);
|
void xwlVidModeExtensionInit(void);
|
||||||
#endif
|
#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
|
#ifdef GLXEXT
|
||||||
#include "glx_extinit.h"
|
#include "glx_extinit.h"
|
||||||
extern __GLXprovider glamor_provider;
|
extern __GLXprovider glamor_provider;
|
||||||
|
|
Loading…
Reference in New Issue