2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
5 Desc: vesa gfx Hidd for standalone i386 AROS
9 #define __OOP_NOATTRBASES__
11 #include <proto/exec.h>
12 #include <proto/graphics.h>
13 #include <proto/oop.h>
14 #include <exec/types.h>
15 #include <exec/lists.h>
16 #include <graphics/driver.h>
17 #include <graphics/gfxbase.h>
18 #include <hidd/graphics.h>
20 #include <utility/utility.h>
21 #include <aros/symbolsets.h>
24 #include "vesagfxclass.h"
26 #include LC_LIBDEFS_FILE
28 #include <aros/debug.h>
31 * The following two functions are candidates for inclusion into oop.library.
32 * For slightly other implementation see incomplete Android-hosted graphics driver.
34 static void FreeAttrBases(const STRPTR
*iftable
, OOP_AttrBase
*bases
, ULONG num
)
38 for (i
= 0; i
< num
; i
++)
41 OOP_ReleaseAttrBase(iftable
[i
]);
45 static BOOL
GetAttrBases(const STRPTR
*iftable
, OOP_AttrBase
*bases
, ULONG num
)
49 for (i
= 0; i
< num
; i
++)
51 bases
[i
] = OOP_ObtainAttrBase(iftable
[i
]);
54 FreeAttrBases(iftable
, bases
, i
);
62 /* These must stay in the same order as attrBases[] entries assignment in vesagfxclass.h */
63 static const STRPTR interfaces
[ATTRBASES_NUM
] =
73 static int PCVesa_Init(LIBBASETYPEPTR LIBBASE
)
75 struct VesaGfx_staticdata
*xsd
= &LIBBASE
->vsd
;
76 struct GfxBase
*GfxBase
;
81 * Open graphics.library ourselves because we will close it
82 * after adding the driver.
83 * Autoinit code would close it only upon driver expunge.
85 GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 41);
88 if (initVesaGfxHW(&xsd
->data
))
90 if (GetAttrBases(interfaces
, xsd
->attrBases
, ATTRBASES_NUM
))
92 xsd
->basebm
= OOP_FindClass(CLID_Hidd_BitMap
);
93 D(bug("[VESA] BitMap class @ 0x%p\n", xsd
->basebm
));
95 InitSemaphore(&xsd
->framebufferlock
);
96 InitSemaphore(&xsd
->HW_acc
);
98 D(bug("[VESA] Init: Everything OK, installing driver\n"));
101 * It is unknown (and no way to know) what hardware part this driver uses.
102 * In order to avoid conflicts with disk-based native-mode hardware
103 * drivers it needs to be removed from the system when some other driver
105 * This is done by graphics.library if DDRV_BootMode is set to TRUE.
107 err
= AddDisplayDriver(xsd
->vesagfxclass
, NULL
, DDRV_BootMode
, TRUE
, TAG_DONE
);
109 D(bug("[VESA] AddDisplayDriver() result: %u\n", err
));
112 /* expunge protection */
113 LIBBASE
->library
.lib_OpenCnt
= 1;
118 CloseLibrary(&GfxBase
->LibNode
);
122 D(bug("[VESA] Failed to open graphics.library!\n"));
127 ADD2INITLIB(PCVesa_Init
, 0)