atiload.c revision 32b578d3
1/*
2 * Copyright 2000 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of Marc Aurele La France not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission.  Marc Aurele La France makes no representations
11 * about the suitability of this software for any purpose.  It is provided
12 * "as-is" without express or implied warranty.
13 *
14 * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO
16 * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
21 */
22
23#ifdef HAVE_CONFIG_H
24#include "config.h"
25#endif
26
27#include "ati.h"
28#include "aticursor.h"
29#include "atiload.h"
30#include "atistruct.h"
31
32/*
33 * ATILoadModules --
34 *
35 * This function loads other modules required for a screen.
36 */
37pointer
38ATILoadModules
39(
40    ScrnInfoPtr pScreenInfo,
41    ATIPtr      pATI
42)
43{
44    pointer fbPtr = NULL;
45
46    /* Load shadow frame buffer code if needed */
47    if (pATI->OptionShadowFB &&
48        !xf86LoadSubModule(pScreenInfo, "shadowfb"))
49        return NULL;
50
51    /* Load depth-specific entry points */
52    switch (pATI->bitsPerPixel)
53    {
54        case 8:
55        case 16:
56        case 24:
57        case 32:
58            fbPtr = xf86LoadSubModule(pScreenInfo, "fb");
59            break;
60
61        default:
62            return NULL;
63    }
64    if (!fbPtr)
65        return NULL;
66
67    /* Load ramdac module if needed */
68    if ((pATI->Cursor > ATI_CURSOR_SOFTWARE) &&
69        !xf86LoadSubModule(pScreenInfo, "ramdac"))
70        return NULL;
71
72#ifdef USE_EXA
73    /* Load EXA if needed */
74    if (pATI->useEXA && pATI->OptionAccel)
75    {
76        XF86ModReqInfo req;
77        int errmaj, errmin;
78
79        memset(&req, 0, sizeof(XF86ModReqInfo));
80        req.majorversion = 2;
81        req.minorversion = 0;
82        if (!LoadSubModule(pScreenInfo->module, "exa", NULL, NULL, NULL, &req,
83            &errmaj, &errmin))
84        {
85            LoaderErrorMsg(NULL, "exa", errmaj, errmin);
86            return NULL;
87        }
88    }
89#endif
90#ifdef USE_XAA
91    /* Load XAA if needed */
92    if (!pATI->useEXA && pATI->OptionAccel &&
93        !xf86LoadSubModule(pScreenInfo, "xaa"))
94        return NULL;
95#endif
96
97    return fbPtr;
98}
99