f0c1771c77823b481a26f6d279b33af68e0f08df
1 /******************************************************************************
3 display-fbdev-mesa: visual handling
5 Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
7 Permission is hereby granted, free of charge, to any person obtaining a
8 copy of this software and associated documentation files (the "Software"),
9 to deal in the Software without restriction, including without limitation
10 the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 and/or sell copies of the Software, and to permit persons to whom the
12 Software is furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 ******************************************************************************
27 #include <ggi/internal/ggi-dl.h>
28 #include <ggi/mesa/ggimesa_int.h>
29 #include <ggi/mesa/display_fbdev.h>
30 #include <ggi/mesa/debug.h>
47 #ifdef HAVE_LINUX_KDEV_T_H
48 #include <linux/kdev_t.h>
50 #include <linux/tty.h>
52 #define MAX_DEV_LEN 63
53 #define DEFAULT_FBNUM 0
55 static char accel_prefix
[] = "tgt-fbdev-";
56 #define PREFIX_LEN (sizeof(accel_prefix))
63 static accel_info accel_strings
[] = {
64 { 0, "kgicon-generic",}, /* no accel - check for KGIcon */
65 { 0, NULL
}, /* Atari Blitter */
68 #define NUM_ACCELS (sizeof(accel_strings)/sizeof(accel_info))
72 static int GGIopen(ggi_visual
*vis
, struct ggi_dlhandle
*dlh
,
73 const char *args
, void *argptr
, uint32
*dlret
)
76 struct fbdev_priv_mesa
*priv
;
77 ggifunc_getapi
*oldgetapi
;
80 priv
->oldpriv
= LIBGGI_PRIVATE(vis
); /* Hook back */
82 GGIMESA_PRIV(vis
) = priv
= malloc(sizeof(struct fbdev_priv_mesa
));
84 fprintf(stderr
, "GGIMesa: Failed to allocate fbdev private data\n");
88 oldgetapi
= vis
->opdisplay
->getapi
;
89 vis
->opdisplay
->getapi
= GGIMesa_fbdev_getapi
;
90 changed(vis
, GGI_CHG_APILIST
);
92 /* If the accel sublibs didn't sucessfuly hook a driver,
93 * back up and keep looking */
94 if ((LIBGGI_MESAEXT(vis
)->update_state
== NULL
) ||
95 (LIBGGI_MESAEXT(vis
)->setup_driver
== NULL
))
97 vis
->opdisplay
->getapi
= oldgetapi
;
100 *dlret
= GGI_DL_EXTENSION
;
105 static int GGIclose(ggi_visual
*vis
, struct ggi_dlhandle
*dlh
)
107 struct fbdev_priv_mesa
*priv
= GGIMESA_PRIV(vis
);
110 LIBGGI_PRIVATE(vis
) = priv
->oldpriv
;
118 int MesaGGIdl_fbdev_mesa(int func
, void **funcptr
)
134 return GGI_ENOTFOUND
;
138 #include <ggi/internal/ggidlinit.h>