2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 Desc: gfx Hidd for linux framebuffer
10 * A newstyle startup code for resident display drivers.
12 * Now it's the job of the driver to add ifself to the system.
13 * The driver does not have to be a library anymore, it can be
14 * plain executable which is started from DEVS:Monitors.
16 * The job of driver startup code is to create all necessary
17 * classes (driver class and bitmap class) and create as many
18 * driver objects as possible. Every object needs to be given
19 * to AddDisplayDriverA() in order to become functional.
21 * When the transition completes, kludges from bootmenu and
22 * dosboot will be removed. Noone will care about library
26 #include <aros/debug.h>
27 #include <aros/symbolsets.h>
28 #include <graphics/gfxbase.h>
29 #include <proto/exec.h>
30 #include <proto/graphics.h>
31 #include <proto/oop.h>
32 #include <hidd/unixio.h>
34 #include LC_LIBDEFS_FILE
36 /* Prevent redefinition of struct timeval */
37 #define timeval sys_timeval
39 /* avoid conflicts between our __unused define and the ones that might come in
47 #define LSD(cl) (&LIBBASE->lsd)
49 static int LinuxFB_Startup(LIBBASETYPEPTR LIBBASE
)
52 struct GfxBase
*GfxBase
;
54 struct TagItem gfx_attrs
[] =
56 {aHidd_LinuxFB_File
, 0},
60 D(bug("[LinuxFB] LinuxFB_Startup()\n"));
62 GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 41);
63 D(bug("[LinuxFB_Startup] GfxBase 0x%p\n", GfxBase
));
67 /* TODO: In future we will support more framebuffers */
68 gfx_attrs
[0].ti_Data
= Hidd_UnixIO_OpenFile(LIBBASE
->lsd
.unixio
, "/dev/fb0", O_RDWR
, 0, NULL
);
69 if (gfx_attrs
[0].ti_Data
== -1)
71 CloseLibrary(&GfxBase
->LibNode
);
76 * In future we will be able to call this several times in a loop.
77 * This will allow us to create several displays.
79 err
= AddDisplayDriverA(LIBBASE
->lsd
.gfxclass
, gfx_attrs
, NULL
);
81 D(bug("[LinuxFB_Startup] AddDisplayDriver() result: %u\n", err
));
86 /* We use ourselves, and noone else */
87 LIBBASE
->library
.lib_OpenCnt
= 1;
90 CloseLibrary(&GfxBase
->LibNode
);
95 static int LinuxFB_Test(LIBBASETYPEPTR LIBBASE
)
97 OOP_Class
*x11
= OOP_FindClass("hidd.gfx.x11");
99 D(bug("[LinuxFB_Test] X11 class 0x%p\n", x11
));
100 return x11
? FALSE
: TRUE
;
103 /* This routine must be called AFTER everything all other initialization was run */
104 ADD2INITLIB(LinuxFB_Startup
, 10);
106 ADD2INITLIB(LinuxFB_Test
, -10);