1/*
2 * Copyright © 2007,2008 Red Hat, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Soft-
6 * ware"), to deal in the Software without restriction, including without
7 * limitation the rights to use, copy, modify, merge, publish, distribute,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, provided that the above copyright
10 * notice(s) and this permission notice appear in all copies of the Soft-
11 * ware and that both the above copyright notice(s) and this permission
12 * notice appear in supporting documentation.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
16 * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
17 * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
18 * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
19 * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
22 * MANCE OF THIS SOFTWARE.
23 *
24 * Except as contained in this notice, the name of a copyright holder shall
25 * not be used in advertising or otherwise to promote the sale, use or
26 * other dealings in this Software without prior written authorization of
27 * the copyright holder.
28 *
29 * Authors:
30 *   Kristian Høgsberg (krh@redhat.com)
31 */
32
33#ifndef _DRI2_H_
34#define _DRI2_H_
35
36#include <stdint.h>
37
38#include <X11/extensions/Xfixes.h>
39#include <X11/extensions/dri2tokens.h>
40
41typedef struct
42{
43   unsigned int attachment;
44   unsigned int name;
45   unsigned int pitch;
46   unsigned int cpp;
47   unsigned int flags;
48} DRI2Buffer;
49
50extern Bool
51DRI2QueryExtension(Display * display, int *eventBase, int *errorBase);
52
53extern Bool
54DRI2QueryVersion(Display * display, int *major, int *minor);
55
56extern Bool
57DRI2Connect(Display * display, XID window,
58            char **driverName, char **deviceName);
59
60extern Bool
61DRI2Authenticate(Display * display, XID window, unsigned int magic);
62
63extern void
64DRI2CreateDrawable(Display * display, XID drawable);
65
66extern void
67DRI2DestroyDrawable(Display * display, XID handle);
68
69extern DRI2Buffer*
70DRI2GetBuffers(Display * dpy, XID drawable,
71               int *width, int *height,
72               unsigned int *attachments, int count,
73               int *outCount);
74
75/**
76 * \note
77 * This function is only supported with DRI2 version 1.1 or later.
78 */
79extern DRI2Buffer*
80DRI2GetBuffersWithFormat(Display * dpy, XID drawable,
81                         int *width, int *height,
82                         unsigned int *attachments,
83                         int count, int *outCount);
84
85extern void
86DRI2CopyRegion(Display * dpy, XID drawable,
87               XserverRegion region,
88               uint32_t dest, uint32_t src);
89
90extern uint64_t
91DRI2SwapBuffers(Display *dpy, XID drawable,
92		uint64_t target_msc, uint64_t divisor, uint64_t remainder);
93
94extern Bool
95DRI2GetMSC(Display *dpy, XID drawable, uint64_t *ust, uint64_t *msc, uint64_t *sbc);
96
97extern Bool
98DRI2WaitMSC(Display *dpy, XID drawable, uint64_t target_msc, uint64_t divisor,
99	    uint64_t remainder, uint64_t *ust, uint64_t *msc, uint64_t *sbc);
100
101extern Bool
102DRI2WaitSBC(Display *dpy, XID drawable, uint64_t target_sbc, uint64_t *ust,
103	    uint64_t *msc, uint64_t *sbc);
104
105extern void
106DRI2SwapInterval(Display *dpy, XID drawable, int interval);
107
108#endif
109