revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / gallium / gallium_init.c
blob355fb508406e9bd96e1a03db1f234e7d011cfa4a
1 /*
2 Copyright © 2010-2018, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/symbolsets.h>
7 #include <proto/exec.h>
8 #include <proto/oop.h>
10 #include <hidd/gfx.h>
12 #include LC_LIBDEFS_FILE
14 CONST_STRPTR softpipe_str = "softpipe";
16 static int Init(LIBBASETYPEPTR LIBBASE)
18 InitSemaphore(&LIBBASE->driversemaphore);
20 LIBBASE->basegallium = OOP_FindClass(CLID_Hidd_Gallium);
21 if (!LIBBASE->basegallium)
22 return FALSE;
24 LIBBASE->gfxAttrBase = OOP_ObtainAttrBase((STRPTR)IID_Hidd_Gfx);
25 if (!LIBBASE->gfxAttrBase)
26 return FALSE;
28 LIBBASE->bmAttrBase = OOP_ObtainAttrBase((STRPTR)IID_Hidd_BitMap);
29 if (!LIBBASE->bmAttrBase)
30 return FALSE;
32 LIBBASE->galliumAttrBase = OOP_ObtainAttrBase((STRPTR)IID_Hidd_Gallium);
33 if (!LIBBASE->galliumAttrBase)
34 return FALSE;
36 LIBBASE->fallback = (char *)softpipe_str;
37 LIBBASE->fallbackmodule = NULL;
39 /* Cache method IDs that we use */
40 LIBBASE->galliumMId_UpdateRect =
41 OOP_GetMethodID(IID_Hidd_BitMap, moHidd_BitMap_UpdateRect);
42 LIBBASE->galliumMId_DisplayResource =
43 OOP_GetMethodID(IID_Hidd_Gallium, moHidd_Gallium_DisplayResource);
45 return TRUE;
48 static int Expunge(LIBBASETYPEPTR LIBBASE)
50 if (LIBBASE->driver)
51 OOP_DisposeObject(LIBBASE->driver);
53 if (LIBBASE->galliumAttrBase)
54 OOP_ReleaseAttrBase((STRPTR)IID_Hidd_Gallium);
56 if (LIBBASE->bmAttrBase)
57 OOP_ReleaseAttrBase((STRPTR)IID_Hidd_BitMap);
59 if (LIBBASE->gfxAttrBase)
60 OOP_ReleaseAttrBase((STRPTR)IID_Hidd_Gfx);
62 if (LIBBASE->drivermodule)
63 CloseLibrary(LIBBASE->drivermodule);
65 return TRUE;
68 ADD2INITLIB(Init, 0);
69 ADD2EXPUNGELIB(Expunge, 0);
71 ADD2LIBS((STRPTR)"gallium.hidd", 0, static struct Library *, GalliumHiddBase);