revert between 56095 -> 55830 in arch
[AROS.git] / workbench / hidds / nouveau / nouveau_init.c
blobb3c8dc76af5dd2bb3c50f722305fac276cb5ca6f
1 /*
2 Copyright © 2010-2019, 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;
15 struct SignalSemaphore globalLock;
17 /* This pointer is necessary to limit the number of changes function signatures
18 of xf86-video-nouveau codes. Without, carddata needs to be passed to each
19 function, since in original codes the data it represents is taken from global
20 array */
21 struct CardData * globalcarddataptr;
22 /* GLOBALS END */
24 static ULONG Nouveau_Init(LIBBASETYPEPTR LIBBASE)
26 struct OOP_ABDescr attrbases[] =
28 { IID_Hidd, &LIBBASE->sd.hiddAttrBase },
29 { IID_Hidd_BitMap, &LIBBASE->sd.bitMapAttrBase },
30 { IID_Hidd_PixFmt, &LIBBASE->sd.pixFmtAttrBase },
31 { IID_Hidd_Sync, &LIBBASE->sd.syncAttrBase },
32 { IID_Hidd_Gfx, &LIBBASE->sd.gfxAttrBase },
33 { IID_Hidd_Gfx_Nouveau, &LIBBASE->sd.gfxNouveauAttrBase },
34 { IID_Hidd_PlanarBM, &LIBBASE->sd.planarAttrBase },
35 { IID_Hidd_I2C_Nouveau, &LIBBASE->sd.i2cNouveauAttrBase },
36 { IID_Hidd_Gallium, &LIBBASE->sd.galliumAttrBase },
37 { IID_Hidd_GC, &LIBBASE->sd.gcAttrBase },
38 { IID_Hidd_Compositor, &LIBBASE->sd.compositorAttrBase },
39 { IID_Hidd_BitMap_Nouveau, &LIBBASE->sd.bitMapNouveauAttrBase },
40 { NULL, NULL }
43 InitSemaphore(&globalLock);
45 if (!OOP_ObtainAttrBases(attrbases))
46 return FALSE;
48 LIBBASE->sd.basegc = OOP_FindClass(CLID_Hidd_GC);
49 LIBBASE->sd.basebm = OOP_FindClass(CLID_Hidd_BitMap);
50 LIBBASE->sd.basegallium = OOP_FindClass(CLID_Hidd_Gallium);
51 LIBBASE->sd.basei2c = OOP_FindClass(CLID_Hidd_I2C);
53 LIBBASE->sd.mid_CopyMemBox16 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_CopyMemBox16);
54 LIBBASE->sd.mid_CopyMemBox32 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_CopyMemBox32);
55 LIBBASE->sd.mid_PutMem32Image16 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_PutMem32Image16);
56 LIBBASE->sd.mid_GetMem32Image16 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_GetMem32Image16);
57 LIBBASE->sd.mid_PutMemTemplate16= OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_PutMemTemplate16);
58 LIBBASE->sd.mid_PutMemTemplate32= OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_PutMemTemplate32);
59 LIBBASE->sd.mid_PutMemPattern16 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_PutMemPattern16);
60 LIBBASE->sd.mid_PutMemPattern32 = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_PutMemPattern32);
61 LIBBASE->sd.mid_ConvertPixels = OOP_GetMethodID((STRPTR)IID_Hidd_BitMap, moHidd_BitMap_ConvertPixels);
62 LIBBASE->sd.mid_GetPixFmt = OOP_GetMethodID((STRPTR)IID_Hidd_Gfx, moHidd_Gfx_GetPixFmt);
64 LIBBASE->sd.mid_BitMapPositionChanged =
65 OOP_GetMethodID((STRPTR)IID_Hidd_Compositor, moHidd_Compositor_BitMapPositionChanged);
66 LIBBASE->sd.mid_BitMapRectChanged =
67 OOP_GetMethodID((STRPTR)IID_Hidd_Compositor, moHidd_Compositor_BitMapRectChanged);
68 LIBBASE->sd.mid_ValidateBitMapPositionChange =
69 OOP_GetMethodID((STRPTR)IID_Hidd_Compositor, moHidd_Compositor_ValidateBitMapPositionChange);
73 InitSemaphore(&LIBBASE->sd.multibitmapsemaphore);
75 NouveauMemPool = CreatePool(MEMF_PUBLIC | MEMF_CLEAR | MEMF_SEM_PROTECTED, 32 * 1024, 16 * 1024);
77 globalcarddataptr = &LIBBASE->sd.carddata;
79 return TRUE;
82 static VOID Nouveau_Exit(LIBBASETYPEPTR LIBBASE)
84 if (NouveauMemPool)
86 DeletePool(NouveauMemPool);
87 NouveauMemPool = NULL;
91 APTR HIDDNouveauAlloc(ULONG size)
93 return AllocVecPooled(NouveauMemPool, size);
96 VOID HIDDNouveauFree(APTR memory)
98 FreeVecPooled(NouveauMemPool, memory);
101 ADD2INITLIB(Nouveau_Init, 0);
102 ADD2EXPUNGELIB(Nouveau_Exit, 0);
104 ADD2LIBS((STRPTR)"gallium.hidd", 7, static struct Library *, GalliumHiddBase);
105 ADD2LIBS((STRPTR)"pci.hidd", 0, static struct Library *, PciHiddBase);