diff options
author | Thomas Hellstrom | 2007-01-30 05:56:51 -0600 |
---|---|---|
committer | Thomas Hellstrom | 2007-01-30 07:54:12 -0600 |
commit | c01fe2cdd4a86f37c1a9bce344b41b6432dbe427 (patch) | |
tree | 2bb4a3894119c0841cd82902c55b41205b1f39e6 /tests/ttmtest | |
parent | 9bbdc0fb10101586fb2bbddeb700e3241a993b1f (diff) | |
download | external-libgbm-c01fe2cdd4a86f37c1a9bce344b41b6432dbe427.tar.gz external-libgbm-c01fe2cdd4a86f37c1a9bce344b41b6432dbe427.tar.xz external-libgbm-c01fe2cdd4a86f37c1a9bce344b41b6432dbe427.zip |
Add the ttmtest test utility.
Diffstat (limited to 'tests/ttmtest')
-rw-r--r-- | tests/ttmtest/AUTHORS | 1 | ||||
-rw-r--r-- | tests/ttmtest/ChangeLog | 23 | ||||
-rw-r--r-- | tests/ttmtest/Makefile.am | 1 | ||||
-rw-r--r-- | tests/ttmtest/NEWS | 0 | ||||
-rw-r--r-- | tests/ttmtest/README | 0 | ||||
-rw-r--r-- | tests/ttmtest/configure.ac | 33 | ||||
-rwxr-xr-x | tests/ttmtest/reconf | 2 | ||||
-rw-r--r-- | tests/ttmtest/src/Makefile.am | 8 | ||||
-rw-r--r-- | tests/ttmtest/src/ttmtest.c | 195 | ||||
-rw-r--r-- | tests/ttmtest/src/xf86dri.c | 603 | ||||
-rw-r--r-- | tests/ttmtest/src/xf86dri.h | 116 | ||||
-rw-r--r-- | tests/ttmtest/src/xf86dristr.h | 390 |
12 files changed, 1372 insertions, 0 deletions
diff --git a/tests/ttmtest/AUTHORS b/tests/ttmtest/AUTHORS new file mode 100644 index 00000000..fa4a089d --- /dev/null +++ b/tests/ttmtest/AUTHORS | |||
@@ -0,0 +1 @@ | |||
Thomas Hellström <thomas-at-tungstengraphics.com> and others. | |||
diff --git a/tests/ttmtest/ChangeLog b/tests/ttmtest/ChangeLog new file mode 100644 index 00000000..4588c8db --- /dev/null +++ b/tests/ttmtest/ChangeLog | |||
@@ -0,0 +1,23 @@ | |||
1 | 2006-01-24 Thomas Hellström <thomas-at-tungstengraphics.com> | ||
2 | |||
3 | * configure.ac: | ||
4 | * src/ttmtest.c: | ||
5 | |||
6 | Fixed include path. | ||
7 | |||
8 | 2006-01-24 Thomas Hellström <thomas-at-tungstengraphics.com> | ||
9 | |||
10 | * AUTHORS: | ||
11 | * Makefile.am: | ||
12 | * configure.ac: | ||
13 | * reconf: | ||
14 | * src/Makefile.am: | ||
15 | * src/ttmtest.c: (fastrdtsc), (time_diff), (releaseContext), | ||
16 | (testAGP), (main): | ||
17 | * src/xf86dri.c: (uniDRIDestroyContext), (uniDRICreateDrawable), | ||
18 | (uniDRIDestroyDrawable), (uniDRIGetDrawableInfo): | ||
19 | * src/xf86dri.h: | ||
20 | * src/xf86dristr.h: | ||
21 | |||
22 | Initial import of the ttmtest utility. | ||
23 | \ No newline at end of file | ||
diff --git a/tests/ttmtest/Makefile.am b/tests/ttmtest/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/tests/ttmtest/Makefile.am | |||
@@ -0,0 +1 @@ | |||
SUBDIRS = src | |||
diff --git a/tests/ttmtest/NEWS b/tests/ttmtest/NEWS new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/ttmtest/NEWS | |||
diff --git a/tests/ttmtest/README b/tests/ttmtest/README new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/ttmtest/README | |||
diff --git a/tests/ttmtest/configure.ac b/tests/ttmtest/configure.ac new file mode 100644 index 00000000..c41e91ac --- /dev/null +++ b/tests/ttmtest/configure.ac | |||
@@ -0,0 +1,33 @@ | |||
1 | AC_INIT | ||
2 | AC_PROG_CC | ||
3 | AC_PATH_X | ||
4 | if test "x$no_x" != "xyes"; then | ||
5 | savecpp="$CPPFLAGS" | ||
6 | CPPFLAGS="$CPPFLAGS -I$x_includes" | ||
7 | AC_CHECK_HEADER($x_includes/X11/Xlib.h,,\ | ||
8 | [AC_MSG_ERROR(Could not find X installation.)]) | ||
9 | CPPFLAGS="$savecpp" | ||
10 | MDRIINC="-I$x_includes" | ||
11 | LIBS="-L$x_libraries $LIBS" | ||
12 | else | ||
13 | AC_MSG_ERROR(Could not find X installation. Aborting.) | ||
14 | fi | ||
15 | AC_ARG_WITH(libdrm, | ||
16 | AC_HELP_STRING([--with-libdrm=DIR], | ||
17 | [Installation prefix of libdrm [[default=/usr]]]), | ||
18 | [libdrmpref="$withval"], | ||
19 | [libdrmpref="/usr"]) | ||
20 | savecpp="$CPPFLAGS" | ||
21 | MDRIINC="-I$libdrmpref/include -I$libdrmpref/include/drm -I$x_includes" | ||
22 | CPPFLAGS="$CPPFLAGS $MDRIINC" | ||
23 | AC_CHECK_HEADER(xf86drm.h,,\ | ||
24 | [AC_MSG_ERROR(Could not find libdrm installation. Use --with-libdrm=<libdrm_installation_prefix>)]) | ||
25 | AC_CHECK_HEADER(drm.h,,\ | ||
26 | [AC_MSG_ERROR(Could not find libdrm installation. Use --with-libdrm=<libdrm_installation_prefix>)]) | ||
27 | CPPFLAGS="$savecpp" | ||
28 | LIBS="-L$libdrmpref/lib64 -L$libdrmpref/lib $LIBS" | ||
29 | AC_SUBST(MDRIINC) | ||
30 | AC_SYS_LARGEFILE | ||
31 | AM_INIT_AUTOMAKE(minidri,0.1.0) | ||
32 | AM_CONFIG_HEADER(config.h) | ||
33 | AC_OUTPUT([Makefile src/Makefile]) | ||
diff --git a/tests/ttmtest/reconf b/tests/ttmtest/reconf new file mode 100755 index 00000000..e64d00ac --- /dev/null +++ b/tests/ttmtest/reconf | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | autoreconf -v --install || exit 1 \ No newline at end of file | ||
diff --git a/tests/ttmtest/src/Makefile.am b/tests/ttmtest/src/Makefile.am new file mode 100644 index 00000000..b7ee8291 --- /dev/null +++ b/tests/ttmtest/src/Makefile.am | |||
@@ -0,0 +1,8 @@ | |||
1 | INCLUDES = @MDRIINC@ | ||
2 | bin_PROGRAMS = ttmtest | ||
3 | ttmtest_SOURCES = \ | ||
4 | ttmtest.c \ | ||
5 | xf86dri.c \ | ||
6 | xf86dri.h \ | ||
7 | xf86dristr.h | ||
8 | ttmtest_LDADD = -ldrm -lXext -lX11 | ||
diff --git a/tests/ttmtest/src/ttmtest.c b/tests/ttmtest/src/ttmtest.c new file mode 100644 index 00000000..14a7af0b --- /dev/null +++ b/tests/ttmtest/src/ttmtest.c | |||
@@ -0,0 +1,195 @@ | |||
1 | |||
2 | #ifdef HAVE_CONFIG_H | ||
3 | #include "config.h" | ||
4 | #endif | ||
5 | |||
6 | #include <X11/Xlib.h> | ||
7 | #include <X11/Xutil.h> | ||
8 | #include <drm/drm.h> | ||
9 | #include "xf86dri.h" | ||
10 | #include "xf86drm.h" | ||
11 | #include "stdio.h" | ||
12 | #include "sys/types.h" | ||
13 | #include <unistd.h> | ||
14 | #include <string.h> | ||
15 | #include "sys/mman.h" | ||
16 | |||
17 | typedef struct | ||
18 | { | ||
19 | enum | ||
20 | { | ||
21 | haveNothing, | ||
22 | haveDisplay, | ||
23 | haveConnection, | ||
24 | haveDriverName, | ||
25 | haveDeviceInfo, | ||
26 | haveDRM, | ||
27 | haveContext | ||
28 | } | ||
29 | state; | ||
30 | |||
31 | Display *display; | ||
32 | int screen; | ||
33 | drm_handle_t sAreaOffset; | ||
34 | char *curBusID; | ||
35 | char *driverName; | ||
36 | int drmFD; | ||
37 | XVisualInfo visualInfo; | ||
38 | XID id; | ||
39 | drm_context_t hwContext; | ||
40 | void *driPriv; | ||
41 | int driPrivSize; | ||
42 | int fbSize; | ||
43 | int fbOrigin; | ||
44 | int fbStride; | ||
45 | drm_handle_t fbHandle; | ||
46 | int ddxDriverMajor; | ||
47 | int ddxDriverMinor; | ||
48 | int ddxDriverPatch; | ||
49 | } TinyDRIContext; | ||
50 | |||
51 | #ifndef __x86_64__ | ||
52 | static unsigned | ||
53 | fastrdtsc(void) | ||
54 | { | ||
55 | unsigned eax; | ||
56 | __asm__ volatile ("\t" | ||
57 | "pushl %%ebx\n\t" | ||
58 | "cpuid\n\t" ".byte 0x0f, 0x31\n\t" "popl %%ebx\n":"=a" (eax) | ||
59 | :"0"(0) | ||
60 | :"ecx", "edx", "cc"); | ||
61 | |||
62 | return eax; | ||
63 | } | ||
64 | #else | ||
65 | static unsigned | ||
66 | fastrdtsc(void) | ||
67 | { | ||
68 | unsigned eax; | ||
69 | __asm__ volatile ("\t" | ||
70 | "cpuid\n\t" ".byte 0x0f, 0x31\n\t" :"=a" (eax) | ||
71 | :"0"(0) | ||
72 | :"ecx", "edx", "ebx", "cc"); | ||
73 | |||
74 | return eax; | ||
75 | } | ||
76 | #endif | ||
77 | |||
78 | static unsigned | ||
79 | time_diff(unsigned t, unsigned t2) | ||
80 | { | ||
81 | return ((t < t2) ? t2 - t : 0xFFFFFFFFU - (t - t2 - 1)); | ||
82 | } | ||
83 | |||
84 | static int | ||
85 | releaseContext(TinyDRIContext * ctx) | ||
86 | { | ||
87 | switch (ctx->state) { | ||
88 | case haveContext: | ||
89 | uniDRIDestroyContext(ctx->display, ctx->screen, ctx->id); | ||
90 | case haveDRM: | ||
91 | drmClose(ctx->drmFD); | ||
92 | case haveDeviceInfo: | ||
93 | XFree(ctx->driPriv); | ||
94 | case haveDriverName: | ||
95 | XFree(ctx->driverName); | ||
96 | case haveConnection: | ||
97 | XFree(ctx->curBusID); | ||
98 | uniDRICloseConnection(ctx->display, ctx->screen); | ||
99 | case haveDisplay: | ||
100 | XCloseDisplay(ctx->display); | ||
101 | default: | ||
102 | break; | ||
103 | } | ||
104 | return -1; | ||
105 | } | ||
106 | |||
107 | static void | ||
108 | testAGP(TinyDRIContext * ctx) | ||
109 | { | ||
110 | } | ||
111 | |||
112 | int | ||
113 | main() | ||
114 | { | ||
115 | int ret, screen, isCapable; | ||
116 | char *displayName = ":0"; | ||
117 | TinyDRIContext ctx; | ||
118 | unsigned magic; | ||
119 | |||
120 | ctx.screen = 0; | ||
121 | ctx.state = haveNothing; | ||
122 | ctx.display = XOpenDisplay(displayName); | ||
123 | if (!ctx.display) { | ||
124 | fprintf(stderr, "Could not open display\n"); | ||
125 | return releaseContext(&ctx); | ||
126 | } | ||
127 | ctx.state = haveDisplay; | ||
128 | |||
129 | ret = | ||
130 | uniDRIQueryDirectRenderingCapable(ctx.display, ctx.screen, | ||
131 | &isCapable); | ||
132 | if (!ret || !isCapable) { | ||
133 | fprintf(stderr, "No DRI on this display:sceen\n"); | ||
134 | return releaseContext(&ctx); | ||
135 | } | ||
136 | |||
137 | if (!uniDRIOpenConnection(ctx.display, ctx.screen, &ctx.sAreaOffset, | ||
138 | &ctx.curBusID)) { | ||
139 | fprintf(stderr, "Could not open DRI connection.\n"); | ||
140 | return releaseContext(&ctx); | ||
141 | } | ||
142 | ctx.state = haveConnection; | ||
143 | |||
144 | if (!uniDRIGetClientDriverName(ctx.display, ctx.screen, | ||
145 | &ctx.ddxDriverMajor, &ctx.ddxDriverMinor, | ||
146 | &ctx.ddxDriverPatch, &ctx.driverName)) { | ||
147 | fprintf(stderr, "Could not get DRI driver name.\n"); | ||
148 | return releaseContext(&ctx); | ||
149 | } | ||
150 | ctx.state = haveDriverName; | ||
151 | |||
152 | if (!uniDRIGetDeviceInfo(ctx.display, ctx.screen, | ||
153 | &ctx.fbHandle, &ctx.fbOrigin, &ctx.fbSize, | ||
154 | &ctx.fbStride, &ctx.driPrivSize, &ctx.driPriv)) { | ||
155 | fprintf(stderr, "Could not get DRI device info.\n"); | ||
156 | return releaseContext(&ctx); | ||
157 | } | ||
158 | ctx.state = haveDriverName; | ||
159 | |||
160 | if ((ctx.drmFD = drmOpen(NULL, ctx.curBusID)) < 0) { | ||
161 | perror("DRM Device could not be opened"); | ||
162 | return releaseContext(&ctx); | ||
163 | } | ||
164 | ctx.state = haveDRM; | ||
165 | |||
166 | drmGetMagic(ctx.drmFD, &magic); | ||
167 | if (!uniDRIAuthConnection(ctx.display, ctx.screen, magic)) { | ||
168 | fprintf(stderr, "Could not get X server to authenticate us.\n"); | ||
169 | return releaseContext(&ctx); | ||
170 | } | ||
171 | |||
172 | ret = XMatchVisualInfo(ctx.display, ctx.screen, 24, TrueColor, | ||
173 | &ctx.visualInfo); | ||
174 | if (!ret) { | ||
175 | ret = XMatchVisualInfo(ctx.display, ctx.screen, 16, TrueColor, | ||
176 | &ctx.visualInfo); | ||
177 | if (!ret) { | ||
178 | fprintf(stderr, "Could not find a matching visual.\n"); | ||
179 | return releaseContext(&ctx); | ||
180 | } | ||
181 | } | ||
182 | |||
183 | if (!uniDRICreateContext(ctx.display, ctx.screen, ctx.visualInfo.visual, | ||
184 | &ctx.id, &ctx.hwContext)) { | ||
185 | fprintf(stderr, "Could not create DRI context.\n"); | ||
186 | return releaseContext(&ctx); | ||
187 | } | ||
188 | ctx.state = haveContext; | ||
189 | |||
190 | testAGP(&ctx); | ||
191 | |||
192 | releaseContext(&ctx); | ||
193 | printf("Terminating normally\n"); | ||
194 | return 0; | ||
195 | } | ||
diff --git a/tests/ttmtest/src/xf86dri.c b/tests/ttmtest/src/xf86dri.c new file mode 100644 index 00000000..ad92504e --- /dev/null +++ b/tests/ttmtest/src/xf86dri.c | |||
@@ -0,0 +1,603 @@ | |||
1 | /* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */ | ||
2 | /************************************************************************** | ||
3 | |||
4 | Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. | ||
5 | Copyright 2000 VA Linux Systems, Inc. | ||
6 | All Rights Reserved. | ||
7 | |||
8 | Permission is hereby granted, free of charge, to any person obtaining a | ||
9 | copy of this software and associated documentation files (the | ||
10 | "Software"), to deal in the Software without restriction, including | ||
11 | without limitation the rights to use, copy, modify, merge, publish, | ||
12 | distribute, sub license, and/or sell copies of the Software, and to | ||
13 | permit persons to whom the Software is furnished to do so, subject to | ||
14 | the following conditions: | ||
15 | |||
16 | The above copyright notice and this permission notice (including the | ||
17 | next paragraph) shall be included in all copies or substantial portions | ||
18 | of the Software. | ||
19 | |||
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
21 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
23 | IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
24 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
25 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
26 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
27 | |||
28 | **************************************************************************/ | ||
29 | |||
30 | /* | ||
31 | * Authors: | ||
32 | * Kevin E. Martin <martin@valinux.com> | ||
33 | * Jens Owen <jens@tungstengraphics.com> | ||
34 | * Rickard E. (Rik) Faith <faith@valinux.com> | ||
35 | * | ||
36 | */ | ||
37 | |||
38 | /* THIS IS NOT AN X CONSORTIUM STANDARD */ | ||
39 | |||
40 | #ifdef HAVE_CONFIG_H | ||
41 | #include "config.h" | ||
42 | #endif | ||
43 | |||
44 | #define NEED_REPLIES | ||
45 | #include <X11/Xlibint.h> | ||
46 | #include <X11/extensions/Xext.h> | ||
47 | #include <X11/extensions/extutil.h> | ||
48 | #include "xf86dristr.h" | ||
49 | |||
50 | static XExtensionInfo _xf86dri_info_data; | ||
51 | static XExtensionInfo *xf86dri_info = &_xf86dri_info_data; | ||
52 | static char xf86dri_extension_name[] = XF86DRINAME; | ||
53 | |||
54 | #define uniDRICheckExtension(dpy,i,val) \ | ||
55 | XextCheckExtension (dpy, i, xf86dri_extension_name, val) | ||
56 | |||
57 | /***************************************************************************** | ||
58 | * * | ||
59 | * private utility routines * | ||
60 | * * | ||
61 | *****************************************************************************/ | ||
62 | |||
63 | static int close_display(Display * dpy, XExtCodes * extCodes); | ||
64 | static /* const */ XExtensionHooks xf86dri_extension_hooks = { | ||
65 | NULL, /* create_gc */ | ||
66 | NULL, /* copy_gc */ | ||
67 | NULL, /* flush_gc */ | ||
68 | NULL, /* free_gc */ | ||
69 | NULL, /* create_font */ | ||
70 | NULL, /* free_font */ | ||
71 | close_display, /* close_display */ | ||
72 | NULL, /* wire_to_event */ | ||
73 | NULL, /* event_to_wire */ | ||
74 | NULL, /* error */ | ||
75 | NULL, /* error_string */ | ||
76 | }; | ||
77 | |||
78 | static | ||
79 | XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info, | ||
80 | xf86dri_extension_name, &xf86dri_extension_hooks, 0, NULL) | ||
81 | |||
82 | static XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info) | ||
83 | |||
84 | /***************************************************************************** | ||
85 | * * | ||
86 | * public XFree86-DRI Extension routines * | ||
87 | * * | ||
88 | *****************************************************************************/ | ||
89 | #if 0 | ||
90 | #include <stdio.h> | ||
91 | #define TRACE(msg) fprintf(stderr,"uniDRI%s\n", msg); | ||
92 | #else | ||
93 | #define TRACE(msg) | ||
94 | #endif | ||
95 | Bool uniDRIQueryExtension(dpy, event_basep, error_basep) | ||
96 | Display *dpy; | ||
97 | int *event_basep, *error_basep; | ||
98 | { | ||
99 | XExtDisplayInfo *info = find_display(dpy); | ||
100 | |||
101 | TRACE("QueryExtension..."); | ||
102 | if (XextHasExtension(info)) { | ||
103 | *event_basep = info->codes->first_event; | ||
104 | *error_basep = info->codes->first_error; | ||
105 | TRACE("QueryExtension... return True"); | ||
106 | return True; | ||
107 | } else { | ||
108 | TRACE("QueryExtension... return False"); | ||
109 | return False; | ||
110 | } | ||
111 | } | ||
112 | |||
113 | Bool | ||
114 | uniDRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion) | ||
115 | Display *dpy; | ||
116 | int *majorVersion; | ||
117 | int *minorVersion; | ||
118 | int *patchVersion; | ||
119 | { | ||
120 | XExtDisplayInfo *info = find_display(dpy); | ||
121 | xXF86DRIQueryVersionReply rep; | ||
122 | xXF86DRIQueryVersionReq *req; | ||
123 | |||
124 | TRACE("QueryVersion..."); | ||
125 | uniDRICheckExtension(dpy, info, False); | ||
126 | |||
127 | LockDisplay(dpy); | ||
128 | GetReq(XF86DRIQueryVersion, req); | ||
129 | req->reqType = info->codes->major_opcode; | ||
130 | req->driReqType = X_XF86DRIQueryVersion; | ||
131 | if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { | ||
132 | UnlockDisplay(dpy); | ||
133 | SyncHandle(); | ||
134 | TRACE("QueryVersion... return False"); | ||
135 | return False; | ||
136 | } | ||
137 | *majorVersion = rep.majorVersion; | ||
138 | *minorVersion = rep.minorVersion; | ||
139 | *patchVersion = rep.patchVersion; | ||
140 | UnlockDisplay(dpy); | ||
141 | SyncHandle(); | ||
142 | TRACE("QueryVersion... return True"); | ||
143 | return True; | ||
144 | } | ||
145 | |||
146 | Bool | ||
147 | uniDRIQueryDirectRenderingCapable(dpy, screen, isCapable) | ||
148 | Display *dpy; | ||
149 | int screen; | ||
150 | Bool *isCapable; | ||
151 | { | ||
152 | XExtDisplayInfo *info = find_display(dpy); | ||
153 | xXF86DRIQueryDirectRenderingCapableReply rep; | ||
154 | xXF86DRIQueryDirectRenderingCapableReq *req; | ||
155 | |||
156 | TRACE("QueryDirectRenderingCapable..."); | ||
157 | uniDRICheckExtension(dpy, info, False); | ||
158 | |||
159 | LockDisplay(dpy); | ||
160 | GetReq(XF86DRIQueryDirectRenderingCapable, req); | ||
161 | req->reqType = info->codes->major_opcode; | ||
162 | req->driReqType = X_XF86DRIQueryDirectRenderingCapable; | ||
163 | req->screen = screen; | ||
164 | if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { | ||
165 | UnlockDisplay(dpy); | ||
166 | SyncHandle(); | ||
167 | TRACE("QueryDirectRenderingCapable... return False"); | ||
168 | return False; | ||
169 | } | ||
170 | *isCapable = rep.isCapable; | ||
171 | UnlockDisplay(dpy); | ||
172 | SyncHandle(); | ||
173 | TRACE("QueryDirectRenderingCapable... return True"); | ||
174 | return True; | ||
175 | } | ||
176 | |||
177 | Bool | ||
178 | uniDRIOpenConnection(dpy, screen, hSAREA, busIdString) | ||
179 | Display *dpy; | ||
180 | int screen; | ||
181 | drm_handle_t *hSAREA; | ||
182 | char **busIdString; | ||
183 | { | ||
184 | XExtDisplayInfo *info = find_display(dpy); | ||
185 | xXF86DRIOpenConnectionReply rep; | ||
186 | xXF86DRIOpenConnectionReq *req; | ||
187 | |||
188 | TRACE("OpenConnection..."); | ||
189 | uniDRICheckExtension(dpy, info, False); | ||
190 | |||
191 | LockDisplay(dpy); | ||
192 | GetReq(XF86DRIOpenConnection, req); | ||
193 | req->reqType = info->codes->major_opcode; | ||
194 | req->driReqType = X_XF86DRIOpenConnection; | ||
195 | req->screen = screen; | ||
196 | if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { | ||
197 | UnlockDisplay(dpy); | ||
198 | SyncHandle(); | ||
199 | TRACE("OpenConnection... return False"); | ||
200 | return False; | ||
201 | } | ||
202 | |||
203 | *hSAREA = rep.hSAREALow; | ||
204 | #ifdef LONG64 | ||
205 | if (sizeof(drm_handle_t) == 8) { | ||
206 | *hSAREA |= ((unsigned long)rep.hSAREAHigh) << 32; | ||
207 | } | ||
208 | #endif | ||
209 | if (rep.length) { | ||
210 | if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) { | ||
211 | _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3)); | ||
212 | UnlockDisplay(dpy); | ||
213 | SyncHandle(); | ||
214 | TRACE("OpenConnection... return False"); | ||
215 | return False; | ||
216 | } | ||
217 | _XReadPad(dpy, *busIdString, rep.busIdStringLength); | ||
218 | } else { | ||
219 | *busIdString = NULL; | ||
220 | } | ||
221 | UnlockDisplay(dpy); | ||
222 | SyncHandle(); | ||
223 | TRACE("OpenConnection... return True"); | ||
224 | return True; | ||
225 | } | ||
226 | |||
227 | Bool | ||
228 | uniDRIAuthConnection(dpy, screen, magic) | ||
229 | Display *dpy; | ||
230 | int screen; | ||
231 | drm_magic_t magic; | ||
232 | { | ||
233 | XExtDisplayInfo *info = find_display(dpy); | ||
234 | xXF86DRIAuthConnectionReq *req; | ||
235 | xXF86DRIAuthConnectionReply rep; | ||
236 | |||
237 | TRACE("AuthConnection..."); | ||
238 | uniDRICheckExtension(dpy, info, False); | ||
239 | |||
240 | LockDisplay(dpy); | ||
241 | GetReq(XF86DRIAuthConnection, req); | ||
242 | req->reqType = info->codes->major_opcode; | ||
243 | req->driReqType = X_XF86DRIAuthConnection; | ||
244 | req->screen = screen; | ||
245 | req->magic = magic; | ||
246 | rep.authenticated = 0; | ||
247 | if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) { | ||
248 | UnlockDisplay(dpy); | ||
249 | SyncHandle(); | ||
250 | TRACE("AuthConnection... return False"); | ||
251 | return False; | ||
252 | } | ||
253 | UnlockDisplay(dpy); | ||
254 | SyncHandle(); | ||
255 | TRACE("AuthConnection... return True"); | ||
256 | return True; | ||
257 | } | ||
258 | |||
259 | Bool | ||
260 | uniDRICloseConnection(dpy, screen) | ||
261 | Display *dpy; | ||
262 | int screen; | ||
263 | { | ||
264 | XExtDisplayInfo *info = find_display(dpy); | ||
265 | xXF86DRICloseConnectionReq *req; | ||
266 | |||
267 | TRACE("CloseConnection..."); | ||
268 | |||
269 | uniDRICheckExtension(dpy, info, False); | ||
270 | |||
271 | LockDisplay(dpy); | ||
272 | GetReq(XF86DRICloseConnection, req); | ||
273 | req->reqType = info->codes->major_opcode; | ||
274 | req->driReqType = X_XF86DRICloseConnection; | ||
275 | req->screen = screen; | ||
276 | UnlockDisplay(dpy); | ||
277 | SyncHandle(); | ||
278 | TRACE("CloseConnection... return True"); | ||
279 | return True; | ||
280 | } | ||
281 | |||
282 | Bool | ||
283 | uniDRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion, | ||
284 | ddxDriverMinorVersion, ddxDriverPatchVersion, clientDriverName) | ||
285 | Display *dpy; | ||
286 | int screen; | ||
287 | int *ddxDriverMajorVersion; | ||
288 | int *ddxDriverMinorVersion; | ||
289 | int *ddxDriverPatchVersion; | ||
290 | char **clientDriverName; | ||
291 | { | ||
292 | XExtDisplayInfo *info = find_display(dpy); | ||
293 | xXF86DRIGetClientDriverNameReply rep; | ||
294 | xXF86DRIGetClientDriverNameReq *req; | ||
295 | |||
296 | TRACE("GetClientDriverName..."); | ||
297 | uniDRICheckExtension(dpy, info, False); | ||
298 | |||
299 | LockDisplay(dpy); | ||
300 | GetReq(XF86DRIGetClientDriverName, req); | ||
301 | req->reqType = info->codes->major_opcode; | ||
302 | req->driReqType = X_XF86DRIGetClientDriverName; | ||
303 | req->screen = screen; | ||
304 | if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { | ||
305 | UnlockDisplay(dpy); | ||
306 | SyncHandle(); | ||
307 | TRACE("GetClientDriverName... return False"); | ||
308 | return False; | ||
309 | } | ||
310 | |||
311 | *ddxDriverMajorVersion = rep.ddxDriverMajorVersion; | ||
312 | *ddxDriverMinorVersion = rep.ddxDriverMinorVersion; | ||
313 | *ddxDriverPatchVersion = rep.ddxDriverPatchVersion; | ||
314 | |||
315 | if (rep.length) { | ||
316 | if (!(*clientDriverName = | ||
317 | (char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) { | ||
318 | _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3)); | ||
319 | UnlockDisplay(dpy); | ||
320 | SyncHandle(); | ||
321 | TRACE("GetClientDriverName... return False"); | ||
322 | return False; | ||
323 | } | ||
324 | _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength); | ||
325 | } else { | ||
326 | *clientDriverName = NULL; | ||
327 | } | ||
328 | UnlockDisplay(dpy); | ||
329 | SyncHandle(); | ||
330 | TRACE("GetClientDriverName... return True"); | ||
331 | return True; | ||
332 | } | ||
333 | |||
334 | Bool | ||
335 | uniDRICreateContextWithConfig(dpy, screen, configID, context, hHWContext) | ||
336 | Display *dpy; | ||
337 | int screen; | ||
338 | int configID; | ||
339 | XID *context; | ||
340 | drm_context_t *hHWContext; | ||
341 | { | ||
342 | XExtDisplayInfo *info = find_display(dpy); | ||
343 | xXF86DRICreateContextReply rep; | ||
344 | xXF86DRICreateContextReq *req; | ||
345 | |||
346 | TRACE("CreateContext..."); | ||
347 | uniDRICheckExtension(dpy, info, False); | ||
348 | |||
349 | LockDisplay(dpy); | ||
350 | GetReq(XF86DRICreateContext, req); | ||
351 | req->reqType = info->codes->major_opcode; | ||
352 | req->driReqType = X_XF86DRICreateContext; | ||
353 | req->visual = configID; | ||
354 | req->screen = screen; | ||
355 | *context = XAllocID(dpy); | ||
356 | req->context = *context; | ||
357 | if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { | ||
358 | UnlockDisplay(dpy); | ||
359 | SyncHandle(); | ||
360 | TRACE("CreateContext... return False"); | ||
361 | return False; | ||
362 | } | ||
363 | *hHWContext = rep.hHWContext; | ||
364 | UnlockDisplay(dpy); | ||
365 | SyncHandle(); | ||
366 | TRACE("CreateContext... return True"); | ||
367 | return True; | ||
368 | } | ||
369 | |||
370 | Bool | ||
371 | uniDRICreateContext(dpy, screen, visual, context, hHWContext) | ||
372 | Display *dpy; | ||
373 | int screen; | ||
374 | Visual *visual; | ||
375 | XID *context; | ||
376 | drm_context_t *hHWContext; | ||
377 | { | ||
378 | return uniDRICreateContextWithConfig(dpy, screen, visual->visualid, | ||
379 | context, hHWContext); | ||
380 | } | ||
381 | |||
382 | Bool | ||
383 | uniDRIDestroyContext(Display * ndpy, int screen, XID context) | ||
384 | { | ||
385 | Display *const dpy = (Display *) ndpy; | ||
386 | XExtDisplayInfo *info = find_display(dpy); | ||
387 | xXF86DRIDestroyContextReq *req; | ||
388 | |||
389 | TRACE("DestroyContext..."); | ||
390 | uniDRICheckExtension(dpy, info, False); | ||
391 | |||
392 | LockDisplay(dpy); | ||
393 | GetReq(XF86DRIDestroyContext, req); | ||
394 | req->reqType = info->codes->major_opcode; | ||
395 | req->driReqType = X_XF86DRIDestroyContext; | ||
396 | req->screen = screen; | ||
397 | req->context = context; | ||
398 | UnlockDisplay(dpy); | ||
399 | SyncHandle(); | ||
400 | TRACE("DestroyContext... return True"); | ||
401 | return True; | ||
402 | } | ||
403 | |||
404 | Bool | ||
405 | uniDRICreateDrawable(Display * ndpy, int screen, | ||
406 | Drawable drawable, drm_drawable_t * hHWDrawable) | ||
407 | { | ||
408 | Display *const dpy = (Display *) ndpy; | ||
409 | XExtDisplayInfo *info = find_display(dpy); | ||
410 | xXF86DRICreateDrawableReply rep; | ||
411 | xXF86DRICreateDrawableReq *req; | ||
412 | |||
413 | TRACE("CreateDrawable..."); | ||
414 | uniDRICheckExtension(dpy, info, False); | ||
415 | |||
416 | LockDisplay(dpy); | ||
417 | GetReq(XF86DRICreateDrawable, req); | ||
418 | req->reqType = info->codes->major_opcode; | ||
419 | req->driReqType = X_XF86DRICreateDrawable; | ||
420 | req->screen = screen; | ||
421 | req->drawable = drawable; | ||
422 | if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { | ||
423 | UnlockDisplay(dpy); | ||
424 | SyncHandle(); | ||
425 | TRACE("CreateDrawable... return False"); | ||
426 | return False; | ||
427 | } | ||
428 | *hHWDrawable = rep.hHWDrawable; | ||
429 | UnlockDisplay(dpy); | ||
430 | SyncHandle(); | ||
431 | TRACE("CreateDrawable... return True"); | ||
432 | return True; | ||
433 | } | ||
434 | |||
435 | Bool | ||
436 | uniDRIDestroyDrawable(Display * ndpy, int screen, Drawable drawable) | ||
437 | { | ||
438 | Display *const dpy = (Display *) ndpy; | ||
439 | XExtDisplayInfo *info = find_display(dpy); | ||
440 | xXF86DRIDestroyDrawableReq *req; | ||
441 | |||
442 | TRACE("DestroyDrawable..."); | ||
443 | uniDRICheckExtension(dpy, info, False); | ||
444 | |||
445 | LockDisplay(dpy); | ||
446 | GetReq(XF86DRIDestroyDrawable, req); | ||
447 | req->reqType = info->codes->major_opcode; | ||
448 | req->driReqType = X_XF86DRIDestroyDrawable; | ||
449 | req->screen = screen; | ||
450 | req->drawable = drawable; | ||
451 | UnlockDisplay(dpy); | ||
452 | SyncHandle(); | ||
453 | TRACE("DestroyDrawable... return True"); | ||
454 | return True; | ||
455 | } | ||
456 | |||
457 | Bool | ||
458 | uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, | ||
459 | unsigned int *index, unsigned int *stamp, | ||
460 | int *X, int *Y, int *W, int *H, | ||
461 | int *numClipRects, drm_clip_rect_t ** pClipRects, | ||
462 | int *backX, int *backY, | ||
463 | int *numBackClipRects, drm_clip_rect_t ** pBackClipRects) | ||
464 | { | ||
465 | XExtDisplayInfo *info = find_display(dpy); | ||
466 | xXF86DRIGetDrawableInfoReply rep; | ||
467 | xXF86DRIGetDrawableInfoReq *req; | ||
468 | int total_rects; | ||
469 | |||
470 | TRACE("GetDrawableInfo..."); | ||
471 | uniDRICheckExtension(dpy, info, False); | ||
472 | |||
473 | LockDisplay(dpy); | ||
474 | GetReq(XF86DRIGetDrawableInfo, req); | ||
475 | req->reqType = info->codes->major_opcode; | ||
476 | req->driReqType = X_XF86DRIGetDrawableInfo; | ||
477 | req->screen = screen; | ||
478 | req->drawable = drawable; | ||
479 | |||
480 | if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) { | ||
481 | UnlockDisplay(dpy); | ||
482 | SyncHandle(); | ||
483 | TRACE("GetDrawableInfo... return False"); | ||
484 | return False; | ||
485 | } | ||
486 | *index = rep.drawableTableIndex; | ||
487 | *stamp = rep.drawableTableStamp; | ||
488 | *X = (int)rep.drawableX; | ||
489 | *Y = (int)rep.drawableY; | ||
490 | *W = (int)rep.drawableWidth; | ||
491 | *H = (int)rep.drawableHeight; | ||
492 | *numClipRects = rep.numClipRects; | ||
493 | total_rects = *numClipRects; | ||
494 | |||
495 | *backX = rep.backX; | ||
496 | *backY = rep.backY; | ||
497 | *numBackClipRects = rep.numBackClipRects; | ||
498 | total_rects += *numBackClipRects; | ||
499 | |||
500 | #if 0 | ||
501 | /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks | ||
502 | * backwards compatibility (Because of the >> 2 shift) but the fix | ||
503 | * enables multi-threaded apps to work. | ||
504 | */ | ||
505 | if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) - | ||
506 | SIZEOF(xGenericReply) + | ||
507 | total_rects * sizeof(drm_clip_rect_t)) + | ||
508 | 3) & ~3) >> 2)) { | ||
509 | _XEatData(dpy, rep.length); | ||
510 | UnlockDisplay(dpy); | ||
511 | SyncHandle(); | ||
512 | TRACE("GetDrawableInfo... return False"); | ||
513 | return False; | ||
514 | } | ||
515 | #endif | ||
516 | |||
517 | if (*numClipRects) { | ||
518 | int len = sizeof(drm_clip_rect_t) * (*numClipRects); | ||
519 | |||
520 | *pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1); | ||
521 | if (*pClipRects) | ||
522 | _XRead(dpy, (char *)*pClipRects, len); | ||
523 | } else { | ||
524 | *pClipRects = NULL; | ||
525 | } | ||
526 | |||
527 | if (*numBackClipRects) { | ||
528 | int len = sizeof(drm_clip_rect_t) * (*numBackClipRects); | ||
529 | |||
530 | *pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1); | ||
531 | if (*pBackClipRects) | ||
532 | _XRead(dpy, (char *)*pBackClipRects, len); | ||
533 | } else { | ||
534 | *pBackClipRects = NULL; | ||
535 | } | ||
536 | |||
537 | UnlockDisplay(dpy); | ||
538 | SyncHandle(); | ||
539 | TRACE("GetDrawableInfo... return True"); | ||
540 | return True; | ||
541 | } | ||
542 | |||
543 | Bool | ||
544 | uniDRIGetDeviceInfo(dpy, screen, hFrameBuffer, | ||
545 | fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate) | ||
546 | Display *dpy; | ||
547 | int screen; | ||
548 | drm_handle_t *hFrameBuffer; | ||
549 | int *fbOrigin; | ||
550 | int *fbSize; | ||
551 | int *fbStride; | ||
552 | int *devPrivateSize; | ||
553 | void **pDevPrivate; | ||
554 | { | ||
555 | XExtDisplayInfo *info = find_display(dpy); | ||
556 | xXF86DRIGetDeviceInfoReply rep; | ||
557 | xXF86DRIGetDeviceInfoReq *req; | ||
558 | |||
559 | TRACE("GetDeviceInfo..."); | ||
560 | uniDRICheckExtension(dpy, info, False); | ||
561 | |||
562 | LockDisplay(dpy); | ||
563 | GetReq(XF86DRIGetDeviceInfo, req); | ||
564 | req->reqType = info->codes->major_opcode; | ||
565 | req->driReqType = X_XF86DRIGetDeviceInfo; | ||
566 | req->screen = screen; | ||
567 | if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { | ||
568 | UnlockDisplay(dpy); | ||
569 | SyncHandle(); | ||
570 | TRACE("GetDeviceInfo... return False"); | ||
571 | return False; | ||
572 | } | ||
573 | |||
574 | *hFrameBuffer = rep.hFrameBufferLow; | ||
575 | #ifdef LONG64 | ||
576 | if (sizeof(drm_handle_t) == 8) { | ||
577 | *hFrameBuffer |= ((unsigned long)rep.hFrameBufferHigh) << 32; | ||
578 | } | ||
579 | #endif | ||
580 | |||
581 | *fbOrigin = rep.framebufferOrigin; | ||
582 | *fbSize = rep.framebufferSize; | ||
583 | *fbStride = rep.framebufferStride; | ||
584 | *devPrivateSize = rep.devPrivateSize; | ||
585 | |||
586 | if (rep.length) { | ||
587 | if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) { | ||
588 | _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3)); | ||
589 | UnlockDisplay(dpy); | ||
590 | SyncHandle(); | ||
591 | TRACE("GetDeviceInfo... return False"); | ||
592 | return False; | ||
593 | } | ||
594 | _XRead(dpy, (char *)*pDevPrivate, rep.devPrivateSize); | ||
595 | } else { | ||
596 | *pDevPrivate = NULL; | ||
597 | } | ||
598 | |||
599 | UnlockDisplay(dpy); | ||
600 | SyncHandle(); | ||
601 | TRACE("GetDeviceInfo... return True"); | ||
602 | return True; | ||
603 | } | ||
diff --git a/tests/ttmtest/src/xf86dri.h b/tests/ttmtest/src/xf86dri.h new file mode 100644 index 00000000..8fb78968 --- /dev/null +++ b/tests/ttmtest/src/xf86dri.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.8 2002/10/30 12:51:25 alanh Exp $ */ | ||
2 | /************************************************************************** | ||
3 | |||
4 | Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. | ||
5 | Copyright 2000 VA Linux Systems, Inc. | ||
6 | All Rights Reserved. | ||
7 | |||
8 | Permission is hereby granted, free of charge, to any person obtaining a | ||
9 | copy of this software and associated documentation files (the | ||
10 | "Software"), to deal in the Software without restriction, including | ||
11 | without limitation the rights to use, copy, modify, merge, publish, | ||
12 | distribute, sub license, and/or sell copies of the Software, and to | ||
13 | permit persons to whom the Software is furnished to do so, subject to | ||
14 | the following conditions: | ||
15 | |||
16 | The above copyright notice and this permission notice (including the | ||
17 | next paragraph) shall be included in all copies or substantial portions | ||
18 | of the Software. | ||
19 | |||
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
21 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
23 | IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
24 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
25 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
26 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
27 | |||
28 | **************************************************************************/ | ||
29 | |||
30 | /** | ||
31 | * \file xf86dri.h | ||
32 | * Protocol numbers and function prototypes for DRI X protocol. | ||
33 | * | ||
34 | * \author Kevin E. Martin <martin@valinux.com> | ||
35 | * \author Jens Owen <jens@tungstengraphics.com> | ||
36 | * \author Rickard E. (Rik) Faith <faith@valinux.com> | ||
37 | */ | ||
38 | |||
39 | #ifndef _XF86DRI_H_ | ||
40 | #define _XF86DRI_H_ | ||
41 | |||
42 | #include <X11/Xfuncproto.h> | ||
43 | #include <drm/drm.h> | ||
44 | |||
45 | #define X_XF86DRIQueryVersion 0 | ||
46 | #define X_XF86DRIQueryDirectRenderingCapable 1 | ||
47 | #define X_XF86DRIOpenConnection 2 | ||
48 | #define X_XF86DRICloseConnection 3 | ||
49 | #define X_XF86DRIGetClientDriverName 4 | ||
50 | #define X_XF86DRICreateContext 5 | ||
51 | #define X_XF86DRIDestroyContext 6 | ||
52 | #define X_XF86DRICreateDrawable 7 | ||
53 | #define X_XF86DRIDestroyDrawable 8 | ||
54 | #define X_XF86DRIGetDrawableInfo 9 | ||
55 | #define X_XF86DRIGetDeviceInfo 10 | ||
56 | #define X_XF86DRIAuthConnection 11 | ||
57 | #define X_XF86DRIOpenFullScreen 12 /* Deprecated */ | ||
58 | #define X_XF86DRICloseFullScreen 13 /* Deprecated */ | ||
59 | |||
60 | #define XF86DRINumberEvents 0 | ||
61 | |||
62 | #define XF86DRIClientNotLocal 0 | ||
63 | #define XF86DRIOperationNotSupported 1 | ||
64 | #define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1) | ||
65 | |||
66 | #ifndef _XF86DRI_SERVER_ | ||
67 | |||
68 | _XFUNCPROTOBEGIN | ||
69 | Bool uniDRIQueryExtension(Display * dpy, int *event_base, | ||
70 | int *error_base); | ||
71 | |||
72 | Bool uniDRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion, | ||
73 | int *patchVersion); | ||
74 | |||
75 | Bool uniDRIQueryDirectRenderingCapable(Display * dpy, int screen, | ||
76 | Bool * isCapable); | ||
77 | |||
78 | Bool uniDRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, | ||
79 | char **busIDString); | ||
80 | |||
81 | Bool uniDRIAuthConnection(Display * dpy, int screen, drm_magic_t magic); | ||
82 | |||
83 | Bool uniDRICloseConnection(Display * dpy, int screen); | ||
84 | |||
85 | Bool uniDRIGetClientDriverName(Display * dpy, int screen, | ||
86 | int *ddxDriverMajorVersion, int *ddxDriverMinorVersion, | ||
87 | int *ddxDriverPatchVersion, char **clientDriverName); | ||
88 | |||
89 | Bool uniDRICreateContext(Display * dpy, int screen, Visual * visual, | ||
90 | XID * ptr_to_returned_context_id, drm_context_t * hHWContext); | ||
91 | |||
92 | Bool uniDRICreateContextWithConfig(Display * dpy, int screen, int configID, | ||
93 | XID * ptr_to_returned_context_id, drm_context_t * hHWContext); | ||
94 | |||
95 | extern Bool uniDRIDestroyContext(Display * dpy, int screen, XID context_id); | ||
96 | |||
97 | extern Bool uniDRICreateDrawable(Display * dpy, int screen, | ||
98 | Drawable drawable, drm_drawable_t * hHWDrawable); | ||
99 | |||
100 | extern Bool uniDRIDestroyDrawable(Display * dpy, int screen, | ||
101 | Drawable drawable); | ||
102 | |||
103 | Bool uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, | ||
104 | unsigned int *index, unsigned int *stamp, | ||
105 | int *X, int *Y, int *W, int *H, | ||
106 | int *numClipRects, drm_clip_rect_t ** pClipRects, | ||
107 | int *backX, int *backY, | ||
108 | int *numBackClipRects, drm_clip_rect_t ** pBackClipRects); | ||
109 | |||
110 | Bool uniDRIGetDeviceInfo(Display * dpy, int screen, | ||
111 | drm_handle_t * hFrameBuffer, int *fbOrigin, int *fbSize, | ||
112 | int *fbStride, int *devPrivateSize, void **pDevPrivate); | ||
113 | |||
114 | _XFUNCPROTOEND | ||
115 | #endif /* _XF86DRI_SERVER_ */ | ||
116 | #endif /* _XF86DRI_H_ */ | ||
diff --git a/tests/ttmtest/src/xf86dristr.h b/tests/ttmtest/src/xf86dristr.h new file mode 100644 index 00000000..3b43438e --- /dev/null +++ b/tests/ttmtest/src/xf86dristr.h | |||
@@ -0,0 +1,390 @@ | |||
1 | /* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.10 2002/10/30 12:51:25 alanh Exp $ */ | ||
2 | /************************************************************************** | ||
3 | |||
4 | Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. | ||
5 | Copyright 2000 VA Linux Systems, Inc. | ||
6 | All Rights Reserved. | ||
7 | |||
8 | Permission is hereby granted, free of charge, to any person obtaining a | ||
9 | copy of this software and associated documentation files (the | ||
10 | "Software"), to deal in the Software without restriction, including | ||
11 | without limitation the rights to use, copy, modify, merge, publish, | ||
12 | distribute, sub license, and/or sell copies of the Software, and to | ||
13 | permit persons to whom the Software is furnished to do so, subject to | ||
14 | the following conditions: | ||
15 | |||
16 | The above copyright notice and this permission notice (including the | ||
17 | next paragraph) shall be included in all copies or substantial portions | ||
18 | of the Software. | ||
19 | |||
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
21 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
23 | IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
24 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
25 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
26 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
27 | |||
28 | **************************************************************************/ | ||
29 | |||
30 | /* | ||
31 | * Authors: | ||
32 | * Kevin E. Martin <martin@valinux.com> | ||
33 | * Jens Owen <jens@tungstengraphics.com> | ||
34 | * Rickard E. (Rik) Fiath <faith@valinux.com> | ||
35 | * | ||
36 | */ | ||
37 | |||
38 | #ifndef _XF86DRISTR_H_ | ||
39 | #define _XF86DRISTR_H_ | ||
40 | |||
41 | #include "xf86dri.h" | ||
42 | |||
43 | #define XF86DRINAME "XFree86-DRI" | ||
44 | |||
45 | /* The DRI version number. This was originally set to be the same of the | ||
46 | * XFree86 version number. However, this version is really indepedent of | ||
47 | * the XFree86 version. | ||
48 | * | ||
49 | * Version History: | ||
50 | * 4.0.0: Original | ||
51 | * 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02 | ||
52 | * 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02 | ||
53 | */ | ||
54 | #define XF86DRI_MAJOR_VERSION 4 | ||
55 | #define XF86DRI_MINOR_VERSION 1 | ||
56 | #define XF86DRI_PATCH_VERSION 0 | ||
57 | |||
58 | typedef struct _XF86DRIQueryVersion | ||
59 | { | ||
60 | CARD8 reqType; /* always DRIReqCode */ | ||
61 | CARD8 driReqType; /* always X_DRIQueryVersion */ | ||
62 | CARD16 length B16; | ||
63 | } xXF86DRIQueryVersionReq; | ||
64 | |||
65 | #define sz_xXF86DRIQueryVersionReq 4 | ||
66 | |||
67 | typedef struct | ||
68 | { | ||
69 | BYTE type; /* X_Reply */ | ||
70 | BOOL pad1; | ||
71 | CARD16 sequenceNumber B16; | ||
72 | CARD32 length B32; | ||
73 | CARD16 majorVersion B16; /* major version of DRI protocol */ | ||
74 | CARD16 minorVersion B16; /* minor version of DRI protocol */ | ||
75 | CARD32 patchVersion B32; /* patch version of DRI protocol */ | ||
76 | CARD32 pad3 B32; | ||
77 | CARD32 pad4 B32; | ||
78 | CARD32 pad5 B32; | ||
79 | CARD32 pad6 B32; | ||
80 | } xXF86DRIQueryVersionReply; | ||
81 | |||
82 | #define sz_xXF86DRIQueryVersionReply 32 | ||
83 | |||
84 | typedef struct _XF86DRIQueryDirectRenderingCapable | ||
85 | { | ||
86 | CARD8 reqType; /* always DRIReqCode */ | ||
87 | CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ | ||
88 | CARD16 length B16; | ||
89 | CARD32 screen B32; | ||
90 | } xXF86DRIQueryDirectRenderingCapableReq; | ||
91 | |||
92 | #define sz_xXF86DRIQueryDirectRenderingCapableReq 8 | ||
93 | |||
94 | typedef struct | ||
95 | { | ||
96 | BYTE type; /* X_Reply */ | ||
97 | BOOL pad1; | ||
98 | CARD16 sequenceNumber B16; | ||
99 | CARD32 length B32; | ||
100 | BOOL isCapable; | ||
101 | BOOL pad2; | ||
102 | BOOL pad3; | ||
103 | BOOL pad4; | ||
104 | CARD32 pad5 B32; | ||
105 | CARD32 pad6 B32; | ||
106 | CARD32 pad7 B32; | ||
107 | CARD32 pad8 B32; | ||
108 | CARD32 pad9 B32; | ||
109 | } xXF86DRIQueryDirectRenderingCapableReply; | ||
110 | |||
111 | #define sz_xXF86DRIQueryDirectRenderingCapableReply 32 | ||
112 | |||
113 | typedef struct _XF86DRIOpenConnection | ||
114 | { | ||
115 | CARD8 reqType; /* always DRIReqCode */ | ||
116 | CARD8 driReqType; /* always X_DRIOpenConnection */ | ||
117 | CARD16 length B16; | ||
118 | CARD32 screen B32; | ||
119 | } xXF86DRIOpenConnectionReq; | ||
120 | |||
121 | #define sz_xXF86DRIOpenConnectionReq 8 | ||
122 | |||
123 | typedef struct | ||
124 | { | ||
125 | BYTE type; /* X_Reply */ | ||
126 | BOOL pad1; | ||
127 | CARD16 sequenceNumber B16; | ||
128 | CARD32 length B32; | ||
129 | CARD32 hSAREALow B32; | ||
130 | CARD32 hSAREAHigh B32; | ||
131 | CARD32 busIdStringLength B32; | ||
132 | CARD32 pad6 B32; | ||
133 | CARD32 pad7 B32; | ||
134 | CARD32 pad8 B32; | ||
135 | } xXF86DRIOpenConnectionReply; | ||
136 | |||
137 | #define sz_xXF86DRIOpenConnectionReply 32 | ||
138 | |||
139 | typedef struct _XF86DRIAuthConnection | ||
140 | { | ||
141 | CARD8 reqType; /* always DRIReqCode */ | ||
142 | CARD8 driReqType; /* always X_DRICloseConnection */ | ||
143 | CARD16 length B16; | ||
144 | CARD32 screen B32; | ||
145 | CARD32 magic B32; | ||
146 | } xXF86DRIAuthConnectionReq; | ||
147 | |||
148 | #define sz_xXF86DRIAuthConnectionReq 12 | ||
149 | |||
150 | typedef struct | ||
151 | { | ||
152 | BYTE type; | ||
153 | BOOL pad1; | ||
154 | CARD16 sequenceNumber B16; | ||
155 | CARD32 length B32; | ||
156 | CARD32 authenticated B32; | ||
157 | CARD32 pad2 B32; | ||
158 | CARD32 pad3 B32; | ||
159 | CARD32 pad4 B32; | ||
160 | CARD32 pad5 B32; | ||
161 | CARD32 pad6 B32; | ||
162 | } xXF86DRIAuthConnectionReply; | ||
163 | |||
164 | #define zx_xXF86DRIAuthConnectionReply 32 | ||
165 | |||
166 | typedef struct _XF86DRICloseConnection | ||
167 | { | ||
168 | CARD8 reqType; /* always DRIReqCode */ | ||
169 | CARD8 driReqType; /* always X_DRICloseConnection */ | ||
170 | CARD16 length B16; | ||
171 | CARD32 screen B32; | ||
172 | } xXF86DRICloseConnectionReq; | ||
173 | |||
174 | #define sz_xXF86DRICloseConnectionReq 8 | ||
175 | |||
176 | typedef struct _XF86DRIGetClientDriverName | ||
177 | { | ||
178 | CARD8 reqType; /* always DRIReqCode */ | ||
179 | CARD8 driReqType; /* always X_DRIGetClientDriverName */ | ||
180 | CARD16 length B16; | ||
181 | CARD32 screen B32; | ||
182 | } xXF86DRIGetClientDriverNameReq; | ||
183 | |||
184 | #define sz_xXF86DRIGetClientDriverNameReq 8 | ||
185 | |||
186 | typedef struct | ||
187 | { | ||
188 | BYTE type; /* X_Reply */ | ||
189 | BOOL pad1; | ||
190 | CARD16 sequenceNumber B16; | ||
191 | CARD32 length B32; | ||
192 | CARD32 ddxDriverMajorVersion B32; | ||
193 | CARD32 ddxDriverMinorVersion B32; | ||
194 | CARD32 ddxDriverPatchVersion B32; | ||
195 | CARD32 clientDriverNameLength B32; | ||
196 | CARD32 pad5 B32; | ||
197 | CARD32 pad6 B32; | ||
198 | } xXF86DRIGetClientDriverNameReply; | ||
199 | |||
200 | #define sz_xXF86DRIGetClientDriverNameReply 32 | ||
201 | |||
202 | typedef struct _XF86DRICreateContext | ||
203 | { | ||
204 | CARD8 reqType; /* always DRIReqCode */ | ||
205 | CARD8 driReqType; /* always X_DRICreateContext */ | ||
206 | CARD16 length B16; | ||
207 | CARD32 screen B32; | ||
208 | CARD32 visual B32; | ||
209 | CARD32 context B32; | ||
210 | } xXF86DRICreateContextReq; | ||
211 | |||
212 | #define sz_xXF86DRICreateContextReq 16 | ||
213 | |||
214 | typedef struct | ||
215 | { | ||
216 | BYTE type; /* X_Reply */ | ||
217 | BOOL pad1; | ||
218 | CARD16 sequenceNumber B16; | ||
219 | CARD32 length B32; | ||
220 | CARD32 hHWContext B32; | ||
221 | CARD32 pad2 B32; | ||
222 | CARD32 pad3 B32; | ||
223 | CARD32 pad4 B32; | ||
224 | CARD32 pad5 B32; | ||
225 | CARD32 pad6 B32; | ||
226 | } xXF86DRICreateContextReply; | ||
227 | |||
228 | #define sz_xXF86DRICreateContextReply 32 | ||
229 | |||
230 | typedef struct _XF86DRIDestroyContext | ||
231 | { | ||
232 | CARD8 reqType; /* always DRIReqCode */ | ||
233 | CARD8 driReqType; /* always X_DRIDestroyContext */ | ||
234 | CARD16 length B16; | ||
235 | CARD32 screen B32; | ||
236 | CARD32 context B32; | ||
237 | } xXF86DRIDestroyContextReq; | ||
238 | |||
239 | #define sz_xXF86DRIDestroyContextReq 12 | ||
240 | |||
241 | typedef struct _XF86DRICreateDrawable | ||
242 | { | ||
243 | CARD8 reqType; /* always DRIReqCode */ | ||
244 | CARD8 driReqType; /* always X_DRICreateDrawable */ | ||
245 | CARD16 length B16; | ||
246 | CARD32 screen B32; | ||
247 | CARD32 drawable B32; | ||
248 | } xXF86DRICreateDrawableReq; | ||
249 | |||
250 | #define sz_xXF86DRICreateDrawableReq 12 | ||
251 | |||
252 | typedef struct | ||
253 | { | ||
254 | BYTE type; /* X_Reply */ | ||
255 | BOOL pad1; | ||
256 | CARD16 sequenceNumber B16; | ||
257 | CARD32 length B32; | ||
258 | CARD32 hHWDrawable B32; | ||
259 | CARD32 pad2 B32; | ||
260 | CARD32 pad3 B32; | ||
261 | CARD32 pad4 B32; | ||
262 | CARD32 pad5 B32; | ||
263 | CARD32 pad6 B32; | ||
264 | } xXF86DRICreateDrawableReply; | ||
265 | |||
266 | #define sz_xXF86DRICreateDrawableReply 32 | ||
267 | |||
268 | typedef struct _XF86DRIDestroyDrawable | ||
269 | { | ||
270 | CARD8 reqType; /* always DRIReqCode */ | ||
271 | CARD8 driReqType; /* always X_DRIDestroyDrawable */ | ||
272 | CARD16 length B16; | ||
273 | CARD32 screen B32; | ||
274 | CARD32 drawable B32; | ||
275 | } xXF86DRIDestroyDrawableReq; | ||
276 | |||
277 | #define sz_xXF86DRIDestroyDrawableReq 12 | ||
278 | |||
279 | typedef struct _XF86DRIGetDrawableInfo | ||
280 | { | ||
281 | CARD8 reqType; /* always DRIReqCode */ | ||
282 | CARD8 driReqType; /* always X_DRIGetDrawableInfo */ | ||
283 | CARD16 length B16; | ||
284 | CARD32 screen B32; | ||
285 | CARD32 drawable B32; | ||
286 | } xXF86DRIGetDrawableInfoReq; | ||
287 | |||
288 | #define sz_xXF86DRIGetDrawableInfoReq 12 | ||
289 | |||
290 | typedef struct | ||
291 | { | ||
292 | BYTE type; /* X_Reply */ | ||
293 | BOOL pad1; | ||
294 | CARD16 sequenceNumber B16; | ||
295 | CARD32 length B32; | ||
296 | CARD32 drawableTableIndex B32; | ||
297 | CARD32 drawableTableStamp B32; | ||
298 | INT16 drawableX B16; | ||
299 | INT16 drawableY B16; | ||
300 | INT16 drawableWidth B16; | ||
301 | INT16 drawableHeight B16; | ||
302 | CARD32 numClipRects B32; | ||
303 | INT16 backX B16; | ||
304 | INT16 backY B16; | ||
305 | CARD32 numBackClipRects B32; | ||
306 | } xXF86DRIGetDrawableInfoReply; | ||
307 | |||
308 | #define sz_xXF86DRIGetDrawableInfoReply 36 | ||
309 | |||
310 | typedef struct _XF86DRIGetDeviceInfo | ||
311 | { | ||
312 | CARD8 reqType; /* always DRIReqCode */ | ||
313 | CARD8 driReqType; /* always X_DRIGetDeviceInfo */ | ||
314 | CARD16 length B16; | ||
315 | CARD32 screen B32; | ||
316 | } xXF86DRIGetDeviceInfoReq; | ||
317 | |||
318 | #define sz_xXF86DRIGetDeviceInfoReq 8 | ||
319 | |||
320 | typedef struct | ||
321 | { | ||
322 | BYTE type; /* X_Reply */ | ||
323 | BOOL pad1; | ||
324 | CARD16 sequenceNumber B16; | ||
325 | CARD32 length B32; | ||
326 | CARD32 hFrameBufferLow B32; | ||
327 | CARD32 hFrameBufferHigh B32; | ||
328 | CARD32 framebufferOrigin B32; | ||
329 | CARD32 framebufferSize B32; | ||
330 | CARD32 framebufferStride B32; | ||
331 | CARD32 devPrivateSize B32; | ||
332 | } xXF86DRIGetDeviceInfoReply; | ||
333 | |||
334 | #define sz_xXF86DRIGetDeviceInfoReply 32 | ||
335 | |||
336 | typedef struct _XF86DRIOpenFullScreen | ||
337 | { | ||
338 | CARD8 reqType; /* always DRIReqCode */ | ||
339 | CARD8 driReqType; /* always X_DRIOpenFullScreen */ | ||
340 | CARD16 length B16; | ||
341 | CARD32 screen B32; | ||
342 | CARD32 drawable B32; | ||
343 | } xXF86DRIOpenFullScreenReq; | ||
344 | |||
345 | #define sz_xXF86DRIOpenFullScreenReq 12 | ||
346 | |||
347 | typedef struct | ||
348 | { | ||
349 | BYTE type; | ||
350 | BOOL pad1; | ||
351 | CARD16 sequenceNumber B16; | ||
352 | CARD32 length B32; | ||
353 | CARD32 isFullScreen B32; | ||
354 | CARD32 pad2 B32; | ||
355 | CARD32 pad3 B32; | ||
356 | CARD32 pad4 B32; | ||
357 | CARD32 pad5 B32; | ||
358 | CARD32 pad6 B32; | ||
359 | } xXF86DRIOpenFullScreenReply; | ||
360 | |||
361 | #define sz_xXF86DRIOpenFullScreenReply 32 | ||
362 | |||
363 | typedef struct _XF86DRICloseFullScreen | ||
364 | { | ||
365 | CARD8 reqType; /* always DRIReqCode */ | ||
366 | CARD8 driReqType; /* always X_DRICloseFullScreen */ | ||
367 | CARD16 length B16; | ||
368 | CARD32 screen B32; | ||
369 | CARD32 drawable B32; | ||
370 | } xXF86DRICloseFullScreenReq; | ||
371 | |||
372 | #define sz_xXF86DRICloseFullScreenReq 12 | ||
373 | |||
374 | typedef struct | ||
375 | { | ||
376 | BYTE type; | ||
377 | BOOL pad1; | ||
378 | CARD16 sequenceNumber B16; | ||
379 | CARD32 length B32; | ||
380 | CARD32 pad2 B32; | ||
381 | CARD32 pad3 B32; | ||
382 | CARD32 pad4 B32; | ||
383 | CARD32 pad5 B32; | ||
384 | CARD32 pad6 B32; | ||
385 | CARD32 pad7 B32; | ||
386 | } xXF86DRICloseFullScreenReply; | ||
387 | |||
388 | #define sz_xXF86DRICloseFullScreenReply 32 | ||
389 | |||
390 | #endif /* _XF86DRISTR_H_ */ | ||