summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/ggi/display/fbdev_visual.c
diff options
context:
space:
mode:
authorJon Taylor <taylorj@ggi-project.org>1999-08-21 05:57:17 +0000
committerJon Taylor <taylorj@ggi-project.org>1999-08-21 05:57:17 +0000
commit95dcb43951b5d3c99514d1f2a50ea797217d328d (patch)
treefc9785a78f2febf89bbd867532da8606793cc344 /src/mesa/drivers/ggi/display/fbdev_visual.c
parent212ce73b08acf36354b61e03be311323c88063c4 (diff)
*** empty log message ***
Diffstat (limited to 'src/mesa/drivers/ggi/display/fbdev_visual.c')
-rw-r--r--src/mesa/drivers/ggi/display/fbdev_visual.c157
1 files changed, 157 insertions, 0 deletions
diff --git a/src/mesa/drivers/ggi/display/fbdev_visual.c b/src/mesa/drivers/ggi/display/fbdev_visual.c
new file mode 100644
index 0000000000..30ad340226
--- /dev/null
+++ b/src/mesa/drivers/ggi/display/fbdev_visual.c
@@ -0,0 +1,157 @@
+/* $Id: fbdev_visual.c,v 1.1 1999/08/21 05:57:59 jtaylor Exp $
+******************************************************************************
+
+ display-fbdev-mesa: visual handling
+
+ Copyright (C) 1998 Andrew Apted [andrew@ggi-project.org]
+ Copyright (C) 1999 Marcus Sundberg [marcus@ggi-project.org]
+ Copyright (C) 1999 Creative Labs
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************
+*/
+
+#include <ggi/internal/ggi-dl.h>
+#include <ggi/mesa/ggimesa_int.h>
+#include <ggi/mesa/display/fbdev.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#ifdef HAVE_SYS_VT_H
+#include <sys/vt.h>
+#else
+#include <linux/vt.h>
+#endif
+#ifdef HAVE_LINUX_KDEV_T_H
+#include <linux/kdev_t.h>
+#endif
+#include <linux/tty.h>
+
+#define MAX_DEV_LEN 63
+#define DEFAULT_FBNUM 0
+
+static char accel_prefix[] = "tgt-fbdev-";
+#define PREFIX_LEN (sizeof(accel_prefix))
+
+typedef struct {
+ int async;
+ char *str;
+} accel_info;
+
+static accel_info accel_strings[] = {
+ { 0, "kgicon-generic",}, /* no accel - check for KGIcon */
+ { 0, NULL }, /* Atari Blitter */
+};
+
+#define NUM_ACCELS (sizeof(accel_strings)/sizeof(accel_info))
+
+/* FIXME: These should really be defined in the make system */
+#define CONF_FILE "/usr/local/etc/ggi/mesa/targets/fbdev.conf"
+void *_configHandle;
+char confstub[512] = CONF_FILE;
+char *conffile = confstub;
+
+static int changed(ggi_visual_t vis, int whatchanged)
+{
+ gl_ggiDEBUG("Entered ggimesa_fbdev_changed\n");
+ switch (whatchanged)
+ {
+ case GGI_CHG_APILIST:
+ {
+ char api[256];
+ char args[256];
+ int i;
+ const char *fname;
+ ggi_dlhandle *lib;
+
+ for (i = 0; ggiGetAPI(vis, i, api, args) == 0; i++)
+ {
+ strcat(api, "-mesa");
+ gl_ggiDEBUG("ggimesa_fbdev_changed: api=%s, i=%d\n", api, i);
+ fname = ggMatchConfig(_configHandle, api, NULL);
+ if (fname == NULL)
+ {
+ /* No special implementation for this sublib */
+ continue;
+ }
+
+ lib = ggiExtensionLoadDL(vis, fname, args, NULL);
+ }
+ }
+ break;
+ }
+ gl_ggiDEBUG("Leaving ggimesa_fbdev_changed\n");
+ return 0;
+}
+
+int GGIdlinit(ggi_visual *vis, const char *args, void *argptr)
+{
+ fbdev_hook_mesa *priv;
+ char libname[256], libargs[256];
+ int id, err;
+ ggifunc_getapi *oldgetapi;
+
+ gl_ggiDEBUG("display-fbdev-mesa: GGIdlinit start\n");
+
+ GGIMESA_PRIVATE(vis) = priv = malloc(sizeof(fbdev_hook_mesa));
+ if (priv == NULL) {
+ fprintf(stderr, "Failed to allocate fbdev_hook!\n");
+ return GGI_DL_ERROR;
+ }
+
+ priv->oldpriv = LIBGGI_PRIVATE(vis); // Hook back
+
+ err = ggLoadConfig(conffile, &_configHandle);
+ if (err != GGI_OK)
+ {
+ gl_ggiPrint("display-fbdev: Couldn't open %s\n", conffile);
+ return err;
+ }
+
+ LIBGGI_MESAEXT(vis)->update_state = NULL;
+ LIBGGI_MESAEXT(vis)->setup_driver = NULL;
+
+ oldgetapi = vis->opdisplay->getapi;
+ vis->opdisplay->getapi = GGIMesa_fbdev_getapi;
+ changed(vis, GGI_CHG_APILIST);
+ /* If the accel sublibs didn't sucessfuly hook a driver,
+ * back up and keep looking */
+ if ((LIBGGI_MESAEXT(vis)->update_state == NULL) ||
+ (LIBGGI_MESAEXT(vis)->setup_driver == NULL))
+ {
+ vis->opdisplay->getapi = oldgetapi;
+ }
+
+ gl_ggiDEBUG("display-fbdev-mesa: GGIdlinit done\n");
+ return 0;
+}
+
+int GGIdlcleanup(ggi_visual *vis)
+{
+ return 0;
+}
+
+#include <ggi/internal/ggidlinit.h>