Imported Upstream version 1.15.1
[deb_xorg-server.git] / dri3 / dri3_priv.h
1 /*
2 * Copyright © 2013 Keith Packard
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23 #ifndef _DRI3PRIV_H_
24 #define _DRI3PRIV_H_
25
26 #include <X11/X.h>
27 #include "scrnintstr.h"
28 #include "misc.h"
29 #include "list.h"
30 #include "windowstr.h"
31 #include "dixstruct.h"
32 #include <randrstr.h>
33 #include "dri3.h"
34
35 extern int dri3_request;
36
37 extern DevPrivateKeyRec dri3_screen_private_key;
38
39 typedef struct dri3_screen_priv {
40 CloseScreenProcPtr CloseScreen;
41 ConfigNotifyProcPtr ConfigNotify;
42 DestroyWindowProcPtr DestroyWindow;
43
44 dri3_screen_info_ptr info;
45 } dri3_screen_priv_rec, *dri3_screen_priv_ptr;
46
47 #define wrap(priv,real,mem,func) {\
48 priv->mem = real->mem; \
49 real->mem = func; \
50 }
51
52 #define unwrap(priv,real,mem) {\
53 real->mem = priv->mem; \
54 }
55
56 static inline dri3_screen_priv_ptr
57 dri3_screen_priv(ScreenPtr screen)
58 {
59 return (dri3_screen_priv_ptr)dixLookupPrivate(&(screen)->devPrivates, &dri3_screen_private_key);
60 }
61
62 int
63 proc_dri3_dispatch(ClientPtr client);
64
65 int
66 sproc_dri3_dispatch(ClientPtr client);
67
68 /* DDX interface */
69
70 int
71 dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd);
72
73 int
74 dri3_pixmap_from_fd(PixmapPtr *ppixmap, ScreenPtr screen, int fd,
75 CARD16 width, CARD16 height, CARD16 stride, CARD8 depth, CARD8 bpp);
76
77 int
78 dri3_fd_from_pixmap(int *pfd, PixmapPtr pixmap, CARD16 *stride, CARD32 *size);
79
80 #endif /* _DRI3PRIV_H_ */