1 | /*
|
---|
2 | * Copyright © 2007 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 ([email protected])
|
---|
31 | */
|
---|
32 |
|
---|
33 | #ifndef _DRI2_H_
|
---|
34 | #define _DRI2_H_
|
---|
35 |
|
---|
36 | #include <X11/extensions/dri2tokens.h>
|
---|
37 |
|
---|
38 | /* Version 1 structure (for ABI compatibility) */
|
---|
39 | typedef struct {
|
---|
40 | unsigned int attachment;
|
---|
41 | unsigned int name;
|
---|
42 | unsigned int pitch;
|
---|
43 | unsigned int cpp;
|
---|
44 | unsigned int flags;
|
---|
45 | void *driverPrivate;
|
---|
46 | } DRI2BufferRec, *DRI2BufferPtr;
|
---|
47 |
|
---|
48 | /* Version 2 structure (with format at the end) */
|
---|
49 | typedef struct {
|
---|
50 | unsigned int attachment;
|
---|
51 | unsigned int name;
|
---|
52 | unsigned int pitch;
|
---|
53 | unsigned int cpp;
|
---|
54 | unsigned int flags;
|
---|
55 | void *driverPrivate;
|
---|
56 | unsigned int format;
|
---|
57 | } DRI2Buffer2Rec, *DRI2Buffer2Ptr;
|
---|
58 |
|
---|
59 | typedef DRI2BufferPtr (*DRI2CreateBuffersProcPtr)(DrawablePtr pDraw,
|
---|
60 | unsigned int *attachments,
|
---|
61 | int count);
|
---|
62 | typedef void (*DRI2DestroyBuffersProcPtr)(DrawablePtr pDraw,
|
---|
63 | DRI2BufferPtr buffers,
|
---|
64 | int count);
|
---|
65 | typedef void (*DRI2CopyRegionProcPtr)(DrawablePtr pDraw,
|
---|
66 | RegionPtr pRegion,
|
---|
67 | DRI2BufferPtr pDestBuffer,
|
---|
68 | DRI2BufferPtr pSrcBuffer);
|
---|
69 |
|
---|
70 | typedef void (*DRI2WaitProcPtr)(WindowPtr pWin,
|
---|
71 | unsigned int sequence);
|
---|
72 |
|
---|
73 | typedef DRI2Buffer2Ptr (*DRI2CreateBufferProcPtr)(DrawablePtr pDraw,
|
---|
74 | unsigned int attachment,
|
---|
75 | unsigned int format);
|
---|
76 | typedef void (*DRI2DestroyBufferProcPtr)(DrawablePtr pDraw,
|
---|
77 | DRI2Buffer2Ptr buffer);
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Version of the DRI2InfoRec structure defined in this header
|
---|
81 | */
|
---|
82 | #define DRI2INFOREC_VERSION 2
|
---|
83 |
|
---|
84 | typedef struct {
|
---|
85 | unsigned int version; /**< Version of this struct */
|
---|
86 | int fd;
|
---|
87 | const char *driverName;
|
---|
88 | const char *deviceName;
|
---|
89 |
|
---|
90 | DRI2CreateBuffersProcPtr CreateBuffers;
|
---|
91 | DRI2DestroyBuffersProcPtr DestroyBuffers;
|
---|
92 | DRI2CopyRegionProcPtr CopyRegion;
|
---|
93 | DRI2WaitProcPtr Wait;
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * \name Fields added in version 2 of the structure.
|
---|
97 | */
|
---|
98 | /*@{*/
|
---|
99 | DRI2CreateBufferProcPtr CreateBuffer;
|
---|
100 | DRI2DestroyBufferProcPtr DestroyBuffer;
|
---|
101 | /*@}*/
|
---|
102 |
|
---|
103 | } DRI2InfoRec, *DRI2InfoPtr;
|
---|
104 |
|
---|
105 | Bool DRI2ScreenInit(ScreenPtr pScreen,
|
---|
106 | DRI2InfoPtr info);
|
---|
107 |
|
---|
108 | void DRI2CloseScreen(ScreenPtr pScreen);
|
---|
109 |
|
---|
110 | Bool DRI2Connect(ScreenPtr pScreen,
|
---|
111 | unsigned int driverType,
|
---|
112 | int *fd,
|
---|
113 | const char **driverName,
|
---|
114 | const char **deviceName);
|
---|
115 |
|
---|
116 | Bool DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic);
|
---|
117 |
|
---|
118 | int DRI2CreateDrawable(DrawablePtr pDraw);
|
---|
119 |
|
---|
120 | void DRI2DestroyDrawable(DrawablePtr pDraw);
|
---|
121 |
|
---|
122 | DRI2Buffer2Ptr *DRI2GetBuffers(DrawablePtr pDraw,
|
---|
123 | int *width,
|
---|
124 | int *height,
|
---|
125 | unsigned int *attachments,
|
---|
126 | int count,
|
---|
127 | int *out_count);
|
---|
128 |
|
---|
129 | int DRI2CopyRegion(DrawablePtr pDraw,
|
---|
130 | RegionPtr pRegion,
|
---|
131 | unsigned int dest,
|
---|
132 | unsigned int src);
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * Determine the major and minor version of the DRI2 extension.
|
---|
136 | *
|
---|
137 | * Provides a mechanism to other modules (e.g., 2D drivers) to determine the
|
---|
138 | * version of the DRI2 extension. While it is possible to peek directly at
|
---|
139 | * the \c XF86ModuleData from a layered module, such a module will fail to
|
---|
140 | * load (due to an unresolved symbol) if the DRI2 extension is not loaded.
|
---|
141 | *
|
---|
142 | * \param major Location to store the major verion of the DRI2 extension
|
---|
143 | * \param minor Location to store the minor verion of the DRI2 extension
|
---|
144 | *
|
---|
145 | * \note
|
---|
146 | * This interface was added some time after the initial release of the DRI2
|
---|
147 | * module. Layered modules that wish to use this interface must first test
|
---|
148 | * its existance by calling \c xf86LoaderCheckSymbol.
|
---|
149 | */
|
---|
150 | extern _X_EXPORT void DRI2Version(int *major, int *minor);
|
---|
151 |
|
---|
152 | extern _X_EXPORT DRI2Buffer2Ptr *DRI2GetBuffersWithFormat(DrawablePtr pDraw,
|
---|
153 | int *width, int *height, unsigned int *attachments, int count,
|
---|
154 | int *out_count);
|
---|
155 |
|
---|
156 | #endif
|
---|