summaryrefslogtreecommitdiff
path: root/src/driclient/src/test.c
diff options
context:
space:
mode:
authorYounes Manton <younes.m@gmail.com>2008-07-22 22:26:26 -0400
committerYounes Manton <younes.m@gmail.com>2008-07-22 22:41:31 -0400
commit0c25ac52425e6d6eb037b99ab90f41b47e3f4491 (patch)
tree67c8739b48a6210e51858189b0583552cee65f2c /src/driclient/src/test.c
parent90bd0e338d315c426c2d0255331610055023739e (diff)
g3dvl: Add Nouveau winsys, libdriclient.
Nouveau winsys is based on Mesa's Nouveau winsys and soft-links to most of it. The 'nouveau_context' and 'nouveau_screen' code contains most of the changes, 'nouveau_winsys_pipe', 'nouveau_swapbuffers' and 'nouveau_lock' contain some minor changes. The driclient library contains the DRI userland stuff, most of which was based on Mesa's DRI code.
Diffstat (limited to 'src/driclient/src/test.c')
-rw-r--r--src/driclient/src/test.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/driclient/src/test.c b/src/driclient/src/test.c
new file mode 100644
index 0000000000..15f75d928b
--- /dev/null
+++ b/src/driclient/src/test.c
@@ -0,0 +1,41 @@
+#include <assert.h>
+#include <stdio.h>
+#include "driclient.h"
+
+int main(int argc, char **argv)
+{
+ Display *dpy;
+ Window root, window;
+
+ dri_screen_t *screen;
+ dri_drawable_t *dri_drawable;
+ dri_context_t *context;
+
+ dpy = XOpenDisplay(NULL);
+ root = XDefaultRootWindow(dpy);
+ window = XCreateSimpleWindow(dpy, root, 0, 0, 100, 100, 0, 0, 0);
+
+ XSelectInput(dpy, window, 0);
+ XMapWindow(dpy, window);
+ XSync(dpy, 0);
+
+ assert(driCreateScreen(dpy, 0, &screen, NULL) == 0);
+ assert(driCreateDrawable(screen, window, &dri_drawable) == 0);
+ assert(driCreateContext(screen, XDefaultVisual(dpy, 0), &context) == 0);
+ assert(driUpdateDrawableInfo(dri_drawable) == 0);
+
+ DRI_VALIDATE_DRAWABLE_INFO(screen, dri_drawable);
+
+ assert(drmGetLock(screen->fd, context->drm_context, 0) == 0);
+ assert(drmUnlock(screen->fd, context->drm_context) == 0);
+
+ assert(driDestroyContext(context) == 0);
+ assert(driDestroyDrawable(dri_drawable) == 0);
+ assert(driDestroyScreen(screen) == 0);
+
+ XDestroyWindow(dpy, window);
+ XCloseDisplay(dpy);
+
+ return 0;
+}
+