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