xwayland: Separate Xwayland pixmap code
Move Xwayland generic pixmap code to a separate source file and header. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
		
							parent
							
								
									89e32d00f6
								
							
						
					
					
						commit
						d780bdc2fd
					
				| 
						 | 
					@ -14,6 +14,8 @@ Xwayland_SOURCES =				\
 | 
				
			||||||
	xwayland-input.c			\
 | 
						xwayland-input.c			\
 | 
				
			||||||
	xwayland-cursor.c			\
 | 
						xwayland-cursor.c			\
 | 
				
			||||||
	xwayland-glamor.h			\
 | 
						xwayland-glamor.h			\
 | 
				
			||||||
 | 
						xwayland-pixmap.c			\
 | 
				
			||||||
 | 
						xwayland-pixmap.h			\
 | 
				
			||||||
	xwayland-shm.c				\
 | 
						xwayland-shm.c				\
 | 
				
			||||||
	xwayland-shm.h				\
 | 
						xwayland-shm.h				\
 | 
				
			||||||
	xwayland-types.h			\
 | 
						xwayland-types.h			\
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,8 @@ srcs = [
 | 
				
			||||||
    'xwayland-input.c',
 | 
					    'xwayland-input.c',
 | 
				
			||||||
    'xwayland-cursor.c',
 | 
					    'xwayland-cursor.c',
 | 
				
			||||||
    'xwayland-glamor.h',
 | 
					    'xwayland-glamor.h',
 | 
				
			||||||
 | 
					    'xwayland-pixmap.c',
 | 
				
			||||||
 | 
					    'xwayland-pixmap.h',
 | 
				
			||||||
    'xwayland-shm.c',
 | 
					    'xwayland-shm.c',
 | 
				
			||||||
    'xwayland-shm.h',
 | 
					    'xwayland-shm.h',
 | 
				
			||||||
    'xwayland-types.h',
 | 
					    'xwayland-types.h',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,6 +42,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "xwayland.h"
 | 
					#include "xwayland.h"
 | 
				
			||||||
#include "xwayland-glamor.h"
 | 
					#include "xwayland-glamor.h"
 | 
				
			||||||
 | 
					#include "xwayland-pixmap.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "wayland-eglstream-client-protocol.h"
 | 
					#include "wayland-eglstream-client-protocol.h"
 | 
				
			||||||
#include "wayland-eglstream-controller-client-protocol.h"
 | 
					#include "wayland-eglstream-controller-client-protocol.h"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,6 +48,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "xwayland.h"
 | 
					#include "xwayland.h"
 | 
				
			||||||
#include "xwayland-glamor.h"
 | 
					#include "xwayland-glamor.h"
 | 
				
			||||||
 | 
					#include "xwayland-pixmap.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
 | 
					#include "linux-dmabuf-unstable-v1-client-protocol.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,123 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Copyright © 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.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <xwayland-config.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <X11/X.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "os.h"
 | 
				
			||||||
 | 
					#include "privates.h"
 | 
				
			||||||
 | 
					#include "dix.h"
 | 
				
			||||||
 | 
					#include "fb.h"
 | 
				
			||||||
 | 
					#include "pixmapstr.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "xwayland-types.h"
 | 
				
			||||||
 | 
					#include "xwayland-pixmap.h"
 | 
				
			||||||
 | 
					#include "xwayland-window-buffers.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static DevPrivateKeyRec xwl_pixmap_private_key;
 | 
				
			||||||
 | 
					static DevPrivateKeyRec xwl_pixmap_cb_private_key;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct xwl_pixmap_buffer_release_callback {
 | 
				
			||||||
 | 
					    xwl_pixmap_cb callback;
 | 
				
			||||||
 | 
					    void *data;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key, xwl_pixmap);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct xwl_pixmap *
 | 
				
			||||||
 | 
					xwl_pixmap_get(PixmapPtr pixmap)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return dixLookupPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Bool
 | 
				
			||||||
 | 
					xwl_pixmap_set_buffer_release_cb(PixmapPtr pixmap,
 | 
				
			||||||
 | 
					                                 xwl_pixmap_cb func, void *data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    struct xwl_pixmap_buffer_release_callback *xwl_pixmap_buffer_release_callback;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xwl_pixmap_buffer_release_callback = dixLookupPrivate(&pixmap->devPrivates,
 | 
				
			||||||
 | 
					                                                          &xwl_pixmap_cb_private_key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (xwl_pixmap_buffer_release_callback == NULL) {
 | 
				
			||||||
 | 
					        xwl_pixmap_buffer_release_callback =
 | 
				
			||||||
 | 
					            calloc(1, sizeof (struct xwl_pixmap_buffer_release_callback));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (xwl_pixmap_buffer_release_callback == NULL) {
 | 
				
			||||||
 | 
					            ErrorF("Failed to allocate pixmap callback data\n");
 | 
				
			||||||
 | 
					            return FALSE;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_cb_private_key,
 | 
				
			||||||
 | 
					                      xwl_pixmap_buffer_release_callback);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xwl_pixmap_buffer_release_callback->callback = func;
 | 
				
			||||||
 | 
					    xwl_pixmap_buffer_release_callback->data = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return TRUE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					xwl_pixmap_del_buffer_release_cb(PixmapPtr pixmap)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    struct xwl_pixmap_buffer_release_callback *xwl_pixmap_buffer_release_callback;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xwl_pixmap_buffer_release_callback = dixLookupPrivate(&pixmap->devPrivates,
 | 
				
			||||||
 | 
					                                                          &xwl_pixmap_cb_private_key);
 | 
				
			||||||
 | 
					    if (xwl_pixmap_buffer_release_callback) {
 | 
				
			||||||
 | 
					        dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_cb_private_key, NULL);
 | 
				
			||||||
 | 
					        free(xwl_pixmap_buffer_release_callback);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    PixmapPtr pixmap = data;
 | 
				
			||||||
 | 
					    struct xwl_pixmap_buffer_release_callback *xwl_pixmap_buffer_release_callback;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xwl_pixmap_buffer_release_callback = dixLookupPrivate(&pixmap->devPrivates,
 | 
				
			||||||
 | 
					                                                          &xwl_pixmap_cb_private_key);
 | 
				
			||||||
 | 
					    if (xwl_pixmap_buffer_release_callback)
 | 
				
			||||||
 | 
					        (*xwl_pixmap_buffer_release_callback->callback)
 | 
				
			||||||
 | 
					            (pixmap, xwl_pixmap_buffer_release_callback->data);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Bool
 | 
				
			||||||
 | 
					xwl_pixmap_init(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0))
 | 
				
			||||||
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!dixRegisterPrivateKey(&xwl_pixmap_cb_private_key, PRIVATE_PIXMAP, 0))
 | 
				
			||||||
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return TRUE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,47 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Copyright © 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_PIXMAP_H
 | 
				
			||||||
 | 
					#define XWAYLAND_PIXMAP_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <xwayland-config.h>
 | 
				
			||||||
 | 
					#include <wayland-client.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "pixmapstr.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* This is an opaque structure implemented in the different backends */
 | 
				
			||||||
 | 
					struct xwl_pixmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef void (*xwl_pixmap_cb) (PixmapPtr pixmap, void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap);
 | 
				
			||||||
 | 
					struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap);
 | 
				
			||||||
 | 
					Bool xwl_pixmap_set_buffer_release_cb(PixmapPtr pixmap,
 | 
				
			||||||
 | 
					                                      xwl_pixmap_cb func, void *data);
 | 
				
			||||||
 | 
					void xwl_pixmap_del_buffer_release_cb(PixmapPtr pixmap);
 | 
				
			||||||
 | 
					void xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer);
 | 
				
			||||||
 | 
					Bool xwl_pixmap_init(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* XWAYLAND_PIXMAP_H */
 | 
				
			||||||
| 
						 | 
					@ -32,6 +32,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "xwayland.h"
 | 
					#include "xwayland.h"
 | 
				
			||||||
#include "xwayland-window.h"
 | 
					#include "xwayland-window.h"
 | 
				
			||||||
 | 
					#include "xwayland-pixmap.h"
 | 
				
			||||||
#include "glamor.h"
 | 
					#include "glamor.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,6 +26,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <xwayland-config.h>
 | 
					#include <xwayland-config.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "os.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <sys/mman.h>
 | 
					#include <sys/mman.h>
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
| 
						 | 
					@ -39,6 +41,7 @@
 | 
				
			||||||
#include "pixmapstr.h"
 | 
					#include "pixmapstr.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "xwayland.h"
 | 
					#include "xwayland.h"
 | 
				
			||||||
 | 
					#include "xwayland-pixmap.h"
 | 
				
			||||||
#include "xwayland-shm.h"
 | 
					#include "xwayland-shm.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct xwl_pixmap {
 | 
					struct xwl_pixmap {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,6 +29,7 @@
 | 
				
			||||||
#include "gcstruct.h"
 | 
					#include "gcstruct.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "xwayland-window.h"
 | 
					#include "xwayland-window.h"
 | 
				
			||||||
 | 
					#include "xwayland-pixmap.h"
 | 
				
			||||||
#include "xwayland-window-buffers.h"
 | 
					#include "xwayland-window-buffers.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BUFFER_TIMEOUT 1 * 1000 /* ms */
 | 
					#define BUFFER_TIMEOUT 1 * 1000 /* ms */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,9 +38,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "xwayland.h"
 | 
					#include "xwayland.h"
 | 
				
			||||||
#include "xwayland-glamor.h"
 | 
					#include "xwayland-glamor.h"
 | 
				
			||||||
 | 
					#include "xwayland-pixmap.h"
 | 
				
			||||||
#include "xwayland-shm.h"
 | 
					#include "xwayland-shm.h"
 | 
				
			||||||
#include "xwayland-window.h"
 | 
					 | 
				
			||||||
#include "xwayland-window-buffers.h"
 | 
					#include "xwayland-window-buffers.h"
 | 
				
			||||||
 | 
					#include "xwayland-window.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef XF86VIDMODE
 | 
					#ifdef XF86VIDMODE
 | 
				
			||||||
#include <X11/extensions/xf86vmproto.h>
 | 
					#include <X11/extensions/xf86vmproto.h>
 | 
				
			||||||
| 
						 | 
					@ -171,8 +172,6 @@ ddxProcessArgument(int argc, char *argv[], int i)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static DevPrivateKeyRec xwl_client_private_key;
 | 
					static DevPrivateKeyRec xwl_client_private_key;
 | 
				
			||||||
static DevPrivateKeyRec xwl_screen_private_key;
 | 
					static DevPrivateKeyRec xwl_screen_private_key;
 | 
				
			||||||
static DevPrivateKeyRec xwl_pixmap_private_key;
 | 
					 | 
				
			||||||
static DevPrivateKeyRec xwl_pixmap_cb_private_key;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct xwl_client *
 | 
					struct xwl_client *
 | 
				
			||||||
xwl_client_get(ClientPtr client)
 | 
					xwl_client_get(ClientPtr client)
 | 
				
			||||||
| 
						 | 
					@ -242,64 +241,6 @@ xwl_property_callback(CallbackListPtr *pcbl, void *closure,
 | 
				
			||||||
        xwl_window_update_property(xwl_window, rec);
 | 
					        xwl_window_update_property(xwl_window, rec);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct xwl_pixmap_buffer_release_cb {
 | 
					 | 
				
			||||||
    xwl_pixmap_cb callback;
 | 
					 | 
				
			||||||
    void *data;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Bool
 | 
					 | 
				
			||||||
xwl_pixmap_set_buffer_release_cb(PixmapPtr pixmap,
 | 
					 | 
				
			||||||
                                 xwl_pixmap_cb func, void *data)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    struct xwl_pixmap_buffer_release_cb *xwl_pixmap_buffer_release_cb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xwl_pixmap_buffer_release_cb = dixLookupPrivate(&pixmap->devPrivates,
 | 
					 | 
				
			||||||
                                                    &xwl_pixmap_cb_private_key);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (xwl_pixmap_buffer_release_cb == NULL) {
 | 
					 | 
				
			||||||
        xwl_pixmap_buffer_release_cb =
 | 
					 | 
				
			||||||
            calloc(1, sizeof (struct xwl_pixmap_buffer_release_cb));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (xwl_pixmap_buffer_release_cb == NULL) {
 | 
					 | 
				
			||||||
            ErrorF("Failed to allocate pixmap callback data\n");
 | 
					 | 
				
			||||||
            return FALSE;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_cb_private_key,
 | 
					 | 
				
			||||||
                      xwl_pixmap_buffer_release_cb);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xwl_pixmap_buffer_release_cb->callback = func;
 | 
					 | 
				
			||||||
    xwl_pixmap_buffer_release_cb->data = data;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return TRUE;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
xwl_pixmap_del_buffer_release_cb(PixmapPtr pixmap)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    struct xwl_pixmap_buffer_release_cb *xwl_pixmap_buffer_release_cb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xwl_pixmap_buffer_release_cb = dixLookupPrivate(&pixmap->devPrivates,
 | 
					 | 
				
			||||||
                                                    &xwl_pixmap_cb_private_key);
 | 
					 | 
				
			||||||
    if (xwl_pixmap_buffer_release_cb) {
 | 
					 | 
				
			||||||
        dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_cb_private_key, NULL);
 | 
					 | 
				
			||||||
        free(xwl_pixmap_buffer_release_cb);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    PixmapPtr pixmap = data;
 | 
					 | 
				
			||||||
    struct xwl_pixmap_buffer_release_cb *xwl_pixmap_buffer_release_cb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xwl_pixmap_buffer_release_cb = dixLookupPrivate(&pixmap->devPrivates,
 | 
					 | 
				
			||||||
                                                    &xwl_pixmap_cb_private_key);
 | 
					 | 
				
			||||||
    if (xwl_pixmap_buffer_release_cb)
 | 
					 | 
				
			||||||
        (*xwl_pixmap_buffer_release_cb->callback)
 | 
					 | 
				
			||||||
            (pixmap, xwl_pixmap_buffer_release_cb->data);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static Bool
 | 
					static Bool
 | 
				
			||||||
xwl_close_screen(ScreenPtr screen)
 | 
					xwl_close_screen(ScreenPtr screen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -422,18 +363,6 @@ xwl_cursor_confined_to(DeviceIntPtr device,
 | 
				
			||||||
    xwl_seat_confine_pointer(xwl_seat, xwl_window);
 | 
					    xwl_seat_confine_pointer(xwl_seat, xwl_window);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key, xwl_pixmap);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct xwl_pixmap *
 | 
					 | 
				
			||||||
xwl_pixmap_get(PixmapPtr pixmap)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    return dixLookupPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen)
 | 
					xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -679,9 +608,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
 | 
					    if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
    if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0))
 | 
					    if (!xwl_pixmap_init())
 | 
				
			||||||
        return FALSE;
 | 
					 | 
				
			||||||
    if (!dixRegisterPrivateKey(&xwl_pixmap_cb_private_key, PRIVATE_PIXMAP, 0))
 | 
					 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
    if (!xwl_window_init())
 | 
					    if (!xwl_window_init())
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,8 +59,6 @@ struct xwl_format {
 | 
				
			||||||
    uint64_t *modifiers;
 | 
					    uint64_t *modifiers;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef void (*xwl_pixmap_cb) (PixmapPtr pixmap, void *data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct xwl_screen {
 | 
					struct xwl_screen {
 | 
				
			||||||
    int width;
 | 
					    int width;
 | 
				
			||||||
    int height;
 | 
					    int height;
 | 
				
			||||||
| 
						 | 
					@ -386,13 +384,6 @@ void xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen,
 | 
				
			||||||
RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
 | 
					RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
 | 
				
			||||||
                       float VRefresh, Bool Reduced, Bool Interlaced);
 | 
					                       float VRefresh, Bool Reduced, Bool Interlaced);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap);
 | 
					 | 
				
			||||||
struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap);
 | 
					 | 
				
			||||||
Bool xwl_pixmap_set_buffer_release_cb(PixmapPtr pixmap,
 | 
					 | 
				
			||||||
                                      xwl_pixmap_cb func, void *data);
 | 
					 | 
				
			||||||
void xwl_pixmap_del_buffer_release_cb(PixmapPtr pixmap);
 | 
					 | 
				
			||||||
void xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef XWL_HAS_GLAMOR
 | 
					#ifdef XWL_HAS_GLAMOR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef GLAMOR_HAS_GBM
 | 
					#ifdef GLAMOR_HAS_GBM
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue