2 Copyright © 2010-2015, The AROS Development Team. All rights reserved.
6 #include "nouveau_intern.h"
7 #include "drm_aros_config.h"
10 #include <proto/exec.h>
11 #include <aros/symbolsets.h>
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
20 struct CardData
* globalcarddataptr
;
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
},
41 if (!OOP_ObtainAttrBases(attrbases
))
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
;
77 static VOID
Nouveau_Exit(LIBBASETYPEPTR LIBBASE
)
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
);