1706f2543Smrg/**************************************************************************
2706f2543Smrg
3706f2543SmrgCopyright 1999 Precision Insight, Inc., Cedar Park, Texas.
4706f2543SmrgAll Rights Reserved.
5706f2543Smrg
6706f2543SmrgPermission is hereby granted, free of charge, to any person obtaining a
7706f2543Smrgcopy of this software and associated documentation files (the
8706f2543Smrg"Software"), to deal in the Software without restriction, including
9706f2543Smrgwithout limitation the rights to use, copy, modify, merge, publish,
10706f2543Smrgdistribute, sub license, and/or sell copies of the Software, and to
11706f2543Smrgpermit persons to whom the Software is furnished to do so, subject to
12706f2543Smrgthe following conditions:
13706f2543Smrg
14706f2543SmrgThe above copyright notice and this permission notice (including the
15706f2543Smrgnext paragraph) shall be included in all copies or substantial portions
16706f2543Smrgof the Software.
17706f2543Smrg
18706f2543SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19706f2543SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20706f2543SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21706f2543SmrgIN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
22706f2543SmrgANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23706f2543SmrgTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24706f2543SmrgSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25706f2543Smrg
26706f2543Smrg**************************************************************************/
27706f2543Smrg
28706f2543Smrg/*
29706f2543Smrg * Authors:
30706f2543Smrg *   Kevin E. Martin <kevin@precisioninsight.com>
31706f2543Smrg *   Rickard E. Faith <faith@precisioninsight.com>
32706f2543Smrg *
33706f2543Smrg */
34706f2543Smrg
35706f2543Smrg#ifdef HAVE_XORG_CONFIG_H
36706f2543Smrg#include <xorg-config.h>
37706f2543Smrg#endif
38706f2543Smrg
39706f2543Smrg#include "xf86Module.h"
40706f2543Smrg#include "globals.h"
41706f2543Smrg
42706f2543Smrg#include "xf86drm.h"
43706f2543Smrgstatic MODULESETUPPROTO(driSetup);
44706f2543Smrg
45706f2543SmrgdrmServerInfo DRIDRMServerInfo;
46706f2543Smrg
47706f2543Smrgstatic XF86ModuleVersionInfo VersRec =
48706f2543Smrg{
49706f2543Smrg        "dri",
50706f2543Smrg        MODULEVENDORSTRING,
51706f2543Smrg        MODINFOSTRING1,
52706f2543Smrg        MODINFOSTRING2,
53706f2543Smrg        XORG_VERSION_CURRENT,
54706f2543Smrg        1, 0, 0,
55706f2543Smrg        ABI_CLASS_EXTENSION,
56706f2543Smrg        ABI_EXTENSION_VERSION,
57706f2543Smrg        MOD_CLASS_NONE,
58706f2543Smrg        {0,0,0,0}
59706f2543Smrg};
60706f2543Smrg
61706f2543Smrgextern void XFree86DRIExtensionInit(INITARGS);
62706f2543Smrg#define _XF86DRI_SERVER_
63706f2543Smrg#include <X11/dri/xf86driproto.h>
64706f2543Smrg
65706f2543Smrgstatic ExtensionModule XF86DRIExt =
66706f2543Smrg{
67706f2543Smrg    XFree86DRIExtensionInit,
68706f2543Smrg    XF86DRINAME,
69706f2543Smrg    &noXFree86DRIExtension,
70706f2543Smrg    NULL,
71706f2543Smrg    NULL
72706f2543Smrg};
73706f2543Smrg
74706f2543Smrg_X_EXPORT XF86ModuleData driModuleData = { &VersRec, driSetup, NULL };
75706f2543Smrg
76706f2543Smrgstatic pointer
77706f2543SmrgdriSetup(pointer module, pointer opts, int *errmaj, int *errmin)
78706f2543Smrg{
79706f2543Smrg    static Bool setupDone = FALSE;
80706f2543Smrg
81706f2543Smrg    if (!setupDone) {
82706f2543Smrg	setupDone = TRUE;
83706f2543Smrg	LoadExtension(&XF86DRIExt, FALSE);
84706f2543Smrg    } else {
85706f2543Smrg	if (errmaj) *errmaj = LDR_ONCEONLY;
86706f2543Smrg    }
87706f2543Smrg
88706f2543Smrg    drmSetServerInfo(&DRIDRMServerInfo);
89706f2543Smrg
90706f2543Smrg    /* Need a non-NULL return value to indicate success */
91706f2543Smrg    return (pointer)1;
92706f2543Smrg}
93706f2543Smrg
94