Hint added.
[AROS.git] / workbench / hidds / nouveau / nouveau_init.c
blobd612f7b7a0bdd70a1b566782f7f37b07479bd944
1 /*
2 Copyright © 2010-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "nouveau_intern.h"
7 #include "drm_aros_config.h"
9 #include <proto/oop.h>
10 #include <proto/exec.h>
11 #include <aros/symbolsets.h>
13 /* GLOBALS */
14 APTR NouveauMemPool;
16 /* This pointer is necessary to limit the number of changes function signatures
17 of xf86-video-nouveau codes. Without, carddata needs to be passed to each
18 function, since in original codes the data it represents is taken from global
19 array */
20 struct CardData * globalcarddataptr;
21 /* GLOBALS END */
23 static ULONG Nouveau_Init(LIBBASETYPEPTR LIBBASE)
25 struct OOP_ABDescr attrbases[] =
27 { IID_Hidd_BitMap, &LIBBASE->sd.bitMapAttrBase },
28 { IID_Hidd_PixFmt, &LIBBASE->sd.pixFmtAttrBase },
29 { IID_Hidd_Sync, &LIBBASE->sd.syncAttrBase },
30 { IID_Hidd_Gfx, &LIBBASE->sd.gfxAttrBase },
31 { IID_Hidd_Gfx_Nouveau, &LIBBASE->sd.gfxNouveauAttrBase },
32 { IID_Hidd_PlanarBM, &LIBBASE->sd.planarAttrBase },
33 { IID_Hidd_I2C_Nouveau, &LIBBASE->sd.i2cNouveauAttrBase },
34 { IID_Hidd_Gallium, &LIBBASE->sd.galliumAttrBase },
35 { IID_Hidd_GC, &LIBBASE->sd.gcAttrBase },
36 { IID_Hidd_Compositor, &LIBBASE->sd.compositorAttrBase },
37 { IID_Hidd_BitMap_Nouveau, &LIBBASE->sd.bitMapNouveauAttrBase },
38 { NULL, NULL }
41 if (!OOP_ObtainAttrBases(attrbases))
42 return FALSE;
44 LIBBASE->sd.basegc = OOP_FindClass(CLID_Hidd_GC);
45 LIBBASE->sd.basebm = OOP_FindClass(CLID_Hidd_BitMap);
46 LIBBASE->sd.basegallium = OOP_FindClass(CLID_Hidd_Gallium);
48 LIBBASE->sd.mid_CopyMemBox16 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_CopyMemBox16);
49 LIBBASE->sd.mid_CopyMemBox32 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_CopyMemBox32);
50 LIBBASE->sd.mid_PutMem32Image16 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_PutMem32Image16);
51 LIBBASE->sd.mid_GetMem32Image16 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_GetMem32Image16);
52 LIBBASE->sd.mid_PutMemTemplate16= OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_PutMemTemplate16);
53 LIBBASE->sd.mid_PutMemTemplate32= OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_PutMemTemplate32);
54 LIBBASE->sd.mid_PutMemPattern16 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_PutMemPattern16);
55 LIBBASE->sd.mid_PutMemPattern32 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_PutMemPattern32);
56 LIBBASE->sd.mid_ConvertPixels = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_ConvertPixels);
57 LIBBASE->sd.mid_GetPixFmt = OOP_GetMethodID((STRPTR)IID_Hidd_Gfx, moHidd_Gfx_GetPixFmt);
59 LIBBASE->sd.mid_BitMapPositionChanged =
60 OOP_GetMethodID((STRPTR)IID_Hidd_Compositor, moHidd_Compositor_BitMapPositionChanged);
61 LIBBASE->sd.mid_BitMapRectChanged =
62 OOP_GetMethodID((STRPTR)IID_Hidd_Compositor, moHidd_Compositor_BitMapRectChanged);
63 LIBBASE->sd.mid_ValidateBitMapPositionChange =
64 OOP_GetMethodID((STRPTR)IID_Hidd_Compositor, moHidd_Compositor_ValidateBitMapPositionChange);
68 InitSemaphore(&LIBBASE->sd.multibitmapsemaphore);
70 NouveauMemPool = CreatePool(MEMF_PUBLIC | MEMF_CLEAR | MEMF_SEM_PROTECTED, 32 * 1024, 16 * 1024);
72 globalcarddataptr = &LIBBASE->sd.carddata;
74 return TRUE;
77 static VOID Nouveau_Exit(LIBBASETYPEPTR LIBBASE)
79 if (NouveauMemPool)
81 DeletePool(NouveauMemPool);
82 NouveauMemPool = NULL;
86 APTR HIDDNouveauAlloc(ULONG size)
88 return AllocVecPooled(NouveauMemPool, size);
91 VOID HIDDNouveauFree(APTR memory)
93 FreeVecPooled(NouveauMemPool, memory);
96 ADD2INITLIB(Nouveau_Init, 0);
97 ADD2EXPUNGELIB(Nouveau_Exit, 0);
99 ADD2LIBS((STRPTR)"gallium.hidd", 7, static struct Library *, GalliumHiddBase);
100 ADD2LIBS((STRPTR)"pci.hidd", 0, static struct Library *, PciHiddBase);