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