2 Copyright © 2010-2013, 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
.mid_CopyMemBox16
= OOP_GetMethodID((STRPTR
)IID_Hidd_BitMap
, moHidd_BitMap_CopyMemBox16
);
45 LIBBASE
->sd
.mid_CopyMemBox32
= OOP_GetMethodID((STRPTR
)IID_Hidd_BitMap
, moHidd_BitMap_CopyMemBox32
);
46 LIBBASE
->sd
.mid_PutMem32Image16
= OOP_GetMethodID((STRPTR
)IID_Hidd_BitMap
, moHidd_BitMap_PutMem32Image16
);
47 LIBBASE
->sd
.mid_GetMem32Image16
= OOP_GetMethodID((STRPTR
)IID_Hidd_BitMap
, moHidd_BitMap_GetMem32Image16
);
48 LIBBASE
->sd
.mid_PutMemTemplate16
= OOP_GetMethodID((STRPTR
)IID_Hidd_BitMap
, moHidd_BitMap_PutMemTemplate16
);
49 LIBBASE
->sd
.mid_PutMemTemplate32
= OOP_GetMethodID((STRPTR
)IID_Hidd_BitMap
, moHidd_BitMap_PutMemTemplate32
);
50 LIBBASE
->sd
.mid_PutMemPattern16
= OOP_GetMethodID((STRPTR
)IID_Hidd_BitMap
, moHidd_BitMap_PutMemPattern16
);
51 LIBBASE
->sd
.mid_PutMemPattern32
= OOP_GetMethodID((STRPTR
)IID_Hidd_BitMap
, moHidd_BitMap_PutMemPattern32
);
52 LIBBASE
->sd
.mid_ConvertPixels
= OOP_GetMethodID((STRPTR
)IID_Hidd_BitMap
, moHidd_BitMap_ConvertPixels
);
53 LIBBASE
->sd
.mid_GetPixFmt
= OOP_GetMethodID((STRPTR
)IID_Hidd_Gfx
, moHidd_Gfx_GetPixFmt
);
55 LIBBASE
->sd
.mid_BitMapPositionChanged
=
56 OOP_GetMethodID((STRPTR
)IID_Hidd_Compositor
, moHidd_Compositor_BitMapPositionChanged
);
57 LIBBASE
->sd
.mid_BitMapRectChanged
=
58 OOP_GetMethodID((STRPTR
)IID_Hidd_Compositor
, moHidd_Compositor_BitMapRectChanged
);
59 LIBBASE
->sd
.mid_ValidateBitMapPositionChange
=
60 OOP_GetMethodID((STRPTR
)IID_Hidd_Compositor
, moHidd_Compositor_ValidateBitMapPositionChange
);
64 InitSemaphore(&LIBBASE
->sd
.multibitmapsemaphore
);
66 NouveauMemPool
= CreatePool(MEMF_PUBLIC
| MEMF_CLEAR
| MEMF_SEM_PROTECTED
, 32 * 1024, 16 * 1024);
68 globalcarddataptr
= &LIBBASE
->sd
.carddata
;
73 static VOID
Nouveau_Exit(LIBBASETYPEPTR LIBBASE
)
77 DeletePool(NouveauMemPool
);
78 NouveauMemPool
= NULL
;
82 APTR
HIDDNouveauAlloc(ULONG size
)
84 return AllocVecPooled(NouveauMemPool
, size
);
87 VOID
HIDDNouveauFree(APTR memory
)
89 FreeVecPooled(NouveauMemPool
, memory
);
92 ADD2INITLIB(Nouveau_Init
, 0);
93 ADD2EXPUNGELIB(Nouveau_Exit
, 0);
95 ADD2LIBS((STRPTR
)"gallium.hidd", 7, static struct Library
*, GalliumHiddBase
);
96 ADD2LIBS((STRPTR
)"pci.hidd", 0, static struct Library
*, PciHiddBase
);