From e422335ee7e950236c478eeefa1fc5cde90fd3aa Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 2 May 2009 20:01:56 +0100 Subject: Move authentication to a common file --- gdri-cmdq-submission.c | 54 +------------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) (limited to 'gdri-cmdq-submission.c') diff --git a/gdri-cmdq-submission.c b/gdri-cmdq-submission.c index 40dfcc9..a78093b 100644 --- a/gdri-cmdq-submission.c +++ b/gdri-cmdq-submission.c @@ -23,14 +23,7 @@ #include #include -#include -#include -#include -#include -#include -#include #include -#include #include #include @@ -39,54 +32,9 @@ #include "dri2.h" #include "glamo-regs.h" +#include "utils.h" -#define RING_LOCALS int __count = 0; -#define OUT_REG(reg, val) cmds[__count++] = (reg); cmds[__count++] = (val); - - -static int do_drm_authentication(Display *dpy) -{ - int scrnum; - Window root; - char *driver; - char *device; - int fd; - drm_magic_t magic; - - /* Get default screen, root window and default visual */ - scrnum = DefaultScreen(dpy); - root = RootWindow(dpy, scrnum); - - /* Get device name */ - if ( !DRI2Connect(dpy, root, &driver, &device) ) { - fprintf(stderr, "DRI2Connect failed\n"); - return -1; - } - - /* Open DRM device */ - fd = open(device, O_RDWR); - if ( fd < 0 ) { - fprintf(stderr, "Couldn't open '%s': %s\n", - device, strerror(errno)); - return -1; - } - - /* Get an authentication token */ - if ( drmGetMagic(fd, &magic) ) { - fprintf(stderr, "drmGetMagic failed\n"); - return -1; - } - - /* Authenticate */ - if ( DRI2Authenticate(dpy, root, magic) == False ) { - fprintf(stderr, "DRI2Authenticate failed\n"); - return -1; - } - - return fd; -} - int main() { Display *dpy; -- cgit v1.2.3