atiload.c revision e35d4d8e
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 depth-specific entry points */ 47 switch (pATI->bitsPerPixel) 48 { 49 case 8: 50 case 16: 51 case 24: 52 case 32: 53 fbPtr = xf86LoadSubModule(pScreenInfo, "fb"); 54 break; 55 56 default: 57 return NULL; 58 } 59 if (!fbPtr) 60 return NULL; 61 62 /* Load ramdac module if needed */ 63 if ((pATI->Cursor > ATI_CURSOR_SOFTWARE) && 64 !xf86LoadSubModule(pScreenInfo, "ramdac")) 65 return NULL; 66 67#ifdef USE_EXA 68 /* Load EXA if needed */ 69 if (pATI->useEXA && pATI->OptionAccel) 70 { 71 XF86ModReqInfo req; 72 int errmaj, errmin; 73 74 memset(&req, 0, sizeof(XF86ModReqInfo)); 75 req.majorversion = 2; 76 req.minorversion = 0; 77 if (!LoadSubModule(pScreenInfo->module, "exa", NULL, NULL, NULL, &req, 78 &errmaj, &errmin)) 79 { 80 LoaderErrorMsg(NULL, "exa", errmaj, errmin); 81 return NULL; 82 } 83 } 84#endif 85#ifdef USE_XAA 86 /* Load XAA if needed */ 87 if (!pATI->useEXA && pATI->OptionAccel && 88 !xf86LoadSubModule(pScreenInfo, "xaa")) { 89 xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, 90 "Falling back to shadowfb\n"); 91 pATI->OptionAccel = 0; 92 pATI->OptionShadowFB = 1; 93 } 94#endif 95 96 /* Load shadow frame buffer code if needed */ 97 if (pATI->OptionShadowFB && 98 !xf86LoadSubModule(pScreenInfo, "shadowfb")) 99 return NULL; 100 101 return fbPtr; 102} 103