Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
[mesa.git] / src / driclient / src / test.c
1 #include <assert.h>
2 #include <stdio.h>
3 #include "driclient.h"
4
5 int main(int argc, char **argv)
6 {
7 Display *dpy;
8 Window root, window;
9
10 dri_screen_t *screen;
11 dri_drawable_t *dri_drawable;
12 dri_context_t *context;
13
14 dpy = XOpenDisplay(NULL);
15 root = XDefaultRootWindow(dpy);
16 window = XCreateSimpleWindow(dpy, root, 0, 0, 100, 100, 0, 0, 0);
17
18 XSelectInput(dpy, window, 0);
19 XMapWindow(dpy, window);
20 XSync(dpy, 0);
21
22 assert(driCreateScreen(dpy, 0, &screen, NULL) == 0);
23 assert(driCreateDrawable(screen, window, &dri_drawable) == 0);
24 assert(driCreateContext(screen, XDefaultVisual(dpy, 0), &context) == 0);
25 assert(driUpdateDrawableInfo(dri_drawable) == 0);
26
27 DRI_VALIDATE_DRAWABLE_INFO(screen, dri_drawable);
28
29 assert(drmGetLock(screen->fd, context->drm_context, 0) == 0);
30 assert(drmUnlock(screen->fd, context->drm_context) == 0);
31
32 assert(driDestroyContext(context) == 0);
33 assert(driDestroyDrawable(dri_drawable) == 0);
34 assert(driDestroyScreen(screen) == 0);
35
36 XDestroyWindow(dpy, window);
37 XCloseDisplay(dpy);
38
39 return 0;
40 }
41