1428d7b3dSmrg/*
2428d7b3dSmrg * Copyright © 2007,2008 Red Hat, Inc.
3428d7b3dSmrg *
4428d7b3dSmrg * Permission is hereby granted, free of charge, to any person obtaining a
5428d7b3dSmrg * copy of this software and associated documentation files (the "Soft-
6428d7b3dSmrg * ware"), to deal in the Software without restriction, including without
7428d7b3dSmrg * limitation the rights to use, copy, modify, merge, publish, distribute,
8428d7b3dSmrg * and/or sell copies of the Software, and to permit persons to whom the
9428d7b3dSmrg * Software is furnished to do so, provided that the above copyright
10428d7b3dSmrg * notice(s) and this permission notice appear in all copies of the Soft-
11428d7b3dSmrg * ware and that both the above copyright notice(s) and this permission
12428d7b3dSmrg * notice appear in supporting documentation.
13428d7b3dSmrg *
14428d7b3dSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15428d7b3dSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
16428d7b3dSmrg * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
17428d7b3dSmrg * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
18428d7b3dSmrg * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
19428d7b3dSmrg * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20428d7b3dSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21428d7b3dSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
22428d7b3dSmrg * MANCE OF THIS SOFTWARE.
23428d7b3dSmrg *
24428d7b3dSmrg * Except as contained in this notice, the name of a copyright holder shall
25428d7b3dSmrg * not be used in advertising or otherwise to promote the sale, use or
26428d7b3dSmrg * other dealings in this Software without prior written authorization of
27428d7b3dSmrg * the copyright holder.
28428d7b3dSmrg *
29428d7b3dSmrg * Authors:
30428d7b3dSmrg *   Kristian Høgsberg (krh@redhat.com)
31428d7b3dSmrg */
32428d7b3dSmrg
33428d7b3dSmrg#ifndef _DRI2_H_
34428d7b3dSmrg#define _DRI2_H_
35428d7b3dSmrg
36428d7b3dSmrg#include <stdint.h>
37428d7b3dSmrg
38428d7b3dSmrg#include <X11/extensions/Xfixes.h>
39428d7b3dSmrg#include <X11/extensions/dri2tokens.h>
40428d7b3dSmrg
41428d7b3dSmrgtypedef struct
42428d7b3dSmrg{
43428d7b3dSmrg   unsigned int attachment;
44428d7b3dSmrg   unsigned int name;
45428d7b3dSmrg   unsigned int pitch;
46428d7b3dSmrg   unsigned int cpp;
47428d7b3dSmrg   unsigned int flags;
48428d7b3dSmrg} DRI2Buffer;
49428d7b3dSmrg
50428d7b3dSmrgextern Bool
51428d7b3dSmrgDRI2QueryExtension(Display * display, int *eventBase, int *errorBase);
52428d7b3dSmrg
53428d7b3dSmrgextern Bool
54428d7b3dSmrgDRI2QueryVersion(Display * display, int *major, int *minor);
55428d7b3dSmrg
56428d7b3dSmrgextern Bool
57428d7b3dSmrgDRI2Connect(Display * display, XID window,
58428d7b3dSmrg            char **driverName, char **deviceName);
59428d7b3dSmrg
60428d7b3dSmrgextern Bool
61428d7b3dSmrgDRI2Authenticate(Display * display, XID window, unsigned int magic);
62428d7b3dSmrg
63428d7b3dSmrgextern void
64428d7b3dSmrgDRI2CreateDrawable(Display * display, XID drawable);
65428d7b3dSmrg
66428d7b3dSmrgextern void
67428d7b3dSmrgDRI2DestroyDrawable(Display * display, XID handle);
68428d7b3dSmrg
69428d7b3dSmrgextern DRI2Buffer*
70428d7b3dSmrgDRI2GetBuffers(Display * dpy, XID drawable,
71428d7b3dSmrg               int *width, int *height,
72428d7b3dSmrg               unsigned int *attachments, int count,
73428d7b3dSmrg               int *outCount);
74428d7b3dSmrg
75428d7b3dSmrg/**
76428d7b3dSmrg * \note
77428d7b3dSmrg * This function is only supported with DRI2 version 1.1 or later.
78428d7b3dSmrg */
79428d7b3dSmrgextern DRI2Buffer*
80428d7b3dSmrgDRI2GetBuffersWithFormat(Display * dpy, XID drawable,
81428d7b3dSmrg                         int *width, int *height,
82428d7b3dSmrg                         unsigned int *attachments,
83428d7b3dSmrg                         int count, int *outCount);
84428d7b3dSmrg
85428d7b3dSmrgextern void
86428d7b3dSmrgDRI2CopyRegion(Display * dpy, XID drawable,
87428d7b3dSmrg               XserverRegion region,
88428d7b3dSmrg               uint32_t dest, uint32_t src);
89428d7b3dSmrg
90428d7b3dSmrgextern uint64_t
91428d7b3dSmrgDRI2SwapBuffers(Display *dpy, XID drawable,
92428d7b3dSmrg		uint64_t target_msc, uint64_t divisor, uint64_t remainder);
93428d7b3dSmrg
94428d7b3dSmrgextern Bool
95428d7b3dSmrgDRI2GetMSC(Display *dpy, XID drawable, uint64_t *ust, uint64_t *msc, uint64_t *sbc);
96428d7b3dSmrg
97428d7b3dSmrgextern Bool
98428d7b3dSmrgDRI2WaitMSC(Display *dpy, XID drawable, uint64_t target_msc, uint64_t divisor,
99428d7b3dSmrg	    uint64_t remainder, uint64_t *ust, uint64_t *msc, uint64_t *sbc);
100428d7b3dSmrg
101428d7b3dSmrgextern Bool
102428d7b3dSmrgDRI2WaitSBC(Display *dpy, XID drawable, uint64_t target_sbc, uint64_t *ust,
103428d7b3dSmrg	    uint64_t *msc, uint64_t *sbc);
104428d7b3dSmrg
105428d7b3dSmrgextern void
106428d7b3dSmrgDRI2SwapInterval(Display *dpy, XID drawable, int interval);
107428d7b3dSmrg
108428d7b3dSmrg#endif
109