]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/libdri2.git/blob - test/dri2util.h
Fixes dependencies on GL/glx.h and GL/glxext.h files (v2)
[glsdk/libdri2.git] / test / dri2util.h
1 /*
2  * Copyright © 2011 Texas Instruments, 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  *   Rob Clark (rob@ti.com)
31  */
33 #ifndef _DRI2TEST_H_
34 #define _DRI2TEST_H_
36 #include <sys/types.h>
37 #include <sys/stat.h>
38 #include <fcntl.h>
39 #include <stdlib.h>
40 #include <string.h>
41 #include <stdio.h>
42 #include <xf86drm.h>
43 #include <X11/Xlib.h>
44 #include <X11/Xmd.h>
45 #include <X11/extensions/dri2proto.h>
46 #include "X11/extensions/dri2.h"
48 #define MSG(fmt, ...) \
49                 do { fprintf(stderr, fmt "\n", ##__VA_ARGS__); } while (0)
50 #define ERROR_MSG(fmt, ...) \
51                 do { fprintf(stderr, "ERROR: " fmt "\n", ##__VA_ARGS__); } while (0)
53 static inline void print_hex(int len, const unsigned char *val)
54 {
55         char buf[33];
56         int i, j;
57         for (i = 0; i < len; i += j) {
58                 for (j = 0; (j < 16) && ((i + j) < len); ++j)
59                         sprintf(&buf[j * 2], "%02x", val[i + j]);
60                 fprintf(stderr, "\t%s\n", buf);
61         }
62 }
65 typedef struct {
66         DRI2Buffer *dri2buf;
67         void *hdl;
68 } Buffer;
70 typedef struct {
71         void   (*setup)(int fd);
72         void * (*init)(DRI2Buffer *dri2buf);
73         char * (*prep)(void *hdl);
74         void   (*fini)(void *hdl);
75 } Backend;
77 int dri2_connect(Display *dpy, char **driver);
78 Backend * get_backend(const char *driver);
80 #endif /* _DRI2TEST_H_ */