diff options
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/ggi/default/genkgi.conf.in | 4 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/default/genkgi.h | 47 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/default/genkgi_mode.c | 45 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/default/genkgi_visual.c | 34 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/display/fbdev_mode.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/display/fbdev_visual.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h | 6 |
7 files changed, 114 insertions, 36 deletions
diff --git a/src/mesa/drivers/ggi/default/genkgi.conf.in b/src/mesa/drivers/ggi/default/genkgi.conf.in index 8b3a25431b6..02acad2a191 100644 --- a/src/mesa/drivers/ggi/default/genkgi.conf.in +++ b/src/mesa/drivers/ggi/default/genkgi.conf.in @@ -1,4 +1,4 @@ # GGIMesa genkgi helper configuration -.root: @ggi_libdir@/ggi/mesa/default/ +.root: @ggi_libdir@/ggi/mesa/default -tgt-fbdev-kgicon-savage4-mesa kgi/savage4.so +tgt-fbdev-kgicon-d3dim-mesa d3dim.so diff --git a/src/mesa/drivers/ggi/default/genkgi.h b/src/mesa/drivers/ggi/default/genkgi.h index c5a725cad82..022189138f1 100644 --- a/src/mesa/drivers/ggi/default/genkgi.h +++ b/src/mesa/drivers/ggi/default/genkgi.h @@ -1,4 +1,4 @@ -/* $Id: genkgi.h,v 1.2 1999/08/21 22:36:52 jtaylor Exp $ +/* $Id: genkgi.h,v 1.3 1999/08/22 08:56:50 jtaylor Exp $ ****************************************************************************** GGIMesa - KGIcon specific overrides for fbcon-mesa @@ -26,18 +26,51 @@ ****************************************************************************** */ +#ifndef _GENKGI_MESA_H +#define _GENKGI_MESA_H + +#undef KGI_USE_PPBUFS + +#include <unistd.h> +#include <sys/mman.h> #include <ggi/internal/ggi-dl.h> #include <ggi/mesa/display_fbdev.h> +#include <kgi/kgi.h> -//ggifunc_setmode GGIMesa_genkgi_setmode; -ggifunc_getapi GGIMesa_genkgi_getapi; +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif -typedef struct genkgi_hook_mesa +/* FIXME: LibGGI needs to export its genkgi.h */ +struct genkgi_priv +{ + ggi_gc *mapped_gc; + unsigned int gc_size; + ggifunc_drawline *drawline; + ggifunc_drawbox *drawbox; + ggifunc_fillscreen *fillscreen; + int fd_gc; + int close_gc; + int fd_kgicommand; + uint8 *mapped_kgicommand; + uint8 *kgicommand_ptr; + unsigned int kgicommand_buffersize; +}; + +#define GENKGI_PRIV(vis) ((struct genkgi_priv *)FBDEV_PRIV(vis)->accelpriv) + +extern ggifunc_getapi GGIMesa_genkgi_getapi; +extern ggifunc_flush GGIMesa_genkgi_flush; + +struct genkgi_priv_mesa { char accel[100]; int have_accel; - void *accelpriv; -} genkgi_hook_mesa; + void *accelpriv; /* Private data of subdrivers */ + struct genkgi_priv *oldpriv; /* LibGGI's private data */ +}; + +#define GENKGI_PRIV_MESA(vis) ((struct genkgi_priv_mesa *)FBDEV_PRIV_MESA(vis)->accelpriv) -#define GENKGI_PRIVATE(vis) ((genkgi_hook_mesa *)FBDEV_PRIV_MESA(vis)->accelpriv) +#endif /* _GENKHI_MESA_H */ diff --git a/src/mesa/drivers/ggi/default/genkgi_mode.c b/src/mesa/drivers/ggi/default/genkgi_mode.c index 67e0145f705..b11b6414996 100644 --- a/src/mesa/drivers/ggi/default/genkgi_mode.c +++ b/src/mesa/drivers/ggi/default/genkgi_mode.c @@ -1,4 +1,4 @@ -/* $Id: genkgi_mode.c,v 1.2 1999/08/21 22:36:52 jtaylor Exp $ +/* $Id: genkgi_mode.c,v 1.3 1999/08/22 08:56:50 jtaylor Exp $ ****************************************************************************** display-fbdev-kgicon-generic-mesa @@ -41,7 +41,7 @@ int GGIMesa_genkgi_getapi(ggi_visual *vis, int num, char *apiname, char *arguments) { - genkgi_hook_mesa *priv = GENKGI_PRIVATE(vis); + struct genkgi_priv_mesa *priv = GENKGI_PRIV_MESA(vis); gl_ggiDEBUG("Entered mesa_genkgi_getapi, num=%d\n", num); @@ -59,3 +59,44 @@ int GGIMesa_genkgi_getapi(ggi_visual *vis, int num, char *apiname, char *argumen } return -1; } + +int GGIMesa_genkgi_flush(ggi_visual *vis, int x, int y, int w, int h, int tryflag) +{ + struct genkgi_priv_mesa *priv = GENKGI_PRIV_MESA(vis); + int junkval; // There must be a better way to do this + + priv->oldpriv->kgicommand_ptr += getpagesize(); + (kgiu32)(priv->oldpriv->kgicommand_ptr) &= 0xfffff000; + junkval = *((int *)(priv->oldpriv->kgicommand_ptr)); + + /* Check if we are now in the last page, and reset the + * FIFO if so. We can't use the last page to send + * more commands, since there's no page after it that + * we can touch to fault in the last page's commands. + * + * FIXME: This will be replaced with a flush-and-reset handler + * on the end-of-buffer pagefault at some point.... + * + */ + if ((priv->oldpriv->kgicommand_ptr - priv->oldpriv->mapped_kgicommand) + >= (priv->oldpriv->kgicommand_buffersize - getpagesize())) + { + gl_ggiDEBUG("Hit end of FIFO, attempting remap"); + munmap(priv->oldpriv->mapped_kgicommand, priv->oldpriv->kgicommand_buffersize); + gl_ggiDEBUG("Passed munmap"); + if ((priv->oldpriv->mapped_kgicommand = + mmap(NULL, + priv->oldpriv->kgicommand_buffersize, + PROT_READ | PROT_WRITE, + MAP_SHARED, + priv->oldpriv->fd_kgicommand, + 0)) == MAP_FAILED) + { + ggiPanic("Failed to remap kgicommand!"); + } + gl_ggiDEBUG("Passed mmap"); + priv->oldpriv->kgicommand_ptr = priv->oldpriv->mapped_kgicommand; + gl_ggiDEBUG("Passed kgicommand_ptr reset"); + } + return 0; +} diff --git a/src/mesa/drivers/ggi/default/genkgi_visual.c b/src/mesa/drivers/ggi/default/genkgi_visual.c index a1de5ff7c38..1ed038a0c78 100644 --- a/src/mesa/drivers/ggi/default/genkgi_visual.c +++ b/src/mesa/drivers/ggi/default/genkgi_visual.c @@ -1,4 +1,4 @@ -/* $Id: genkgi_visual.c,v 1.3 1999/08/21 22:46:13 jtaylor Exp $ +/* $Id: genkgi_visual.c,v 1.4 1999/08/22 08:56:50 jtaylor Exp $ ****************************************************************************** genkgi_visual.c: visual handling for the generic KGI helper @@ -70,7 +70,7 @@ typedef struct { static accel_info accel_strings[] = { - { 0, "savage4" }, /* S3 Savage4 */ + { 0, "d3dim" }, /* Direct3D Immedaite Mode */ }; #define NUM_ACCELS (sizeof(accel_strings)/sizeof(accel_info)) @@ -115,7 +115,7 @@ static int changed(ggi_visual_t vis, int whatchanged) int GGIdlinit(ggi_visual *vis, const char *args, void *argptr) { - genkgi_hook_mesa *priv; + struct genkgi_priv_mesa *priv; char libname[256], libargs[256]; int id, err; struct stat junk; @@ -123,13 +123,15 @@ int GGIdlinit(ggi_visual *vis, const char *args, void *argptr) gl_ggiDEBUG("display-fbdev-kgicon-mesa: GGIdlinit start\n"); - GENKGI_PRIVATE(vis) = priv = malloc(sizeof(genkgi_hook_mesa)); + GENKGI_PRIV_MESA(vis) = priv = malloc(sizeof(struct genkgi_priv_mesa)); if (priv == NULL) { - fprintf(stderr, "Failed to allocate genkgi_hook!\n"); + fprintf(stderr, "Failed to allocate genkgi private data\n"); return GGI_DL_ERROR; } + priv->oldpriv = GENKGI_PRIV(vis); +#if 0 err = ggLoadConfig(conffile, &_configHandle); if (err != GGI_OK) { @@ -137,24 +139,22 @@ int GGIdlinit(ggi_visual *vis, const char *args, void *argptr) return err; } - /* Hack city here. We need to probe the KGI driver properly to discover - * the acceleration type. + /* Hack city here. We need to probe the KGI driver properly for + * suggest-strings to discover the acceleration type(s). */ priv->have_accel = 0; -#if 0 - if (stat("/proc/savage4", &junk) == 0) +#if 1 + if (stat("/proc/gfx0", &junk) == 0) { - sprintf(priv->accel, "%s%s", accel_prefix, "savage4"); + sprintf(priv->accel, "%s%s", accel_prefix, "d3dim"); priv->have_accel = 1; gl_ggiDEBUG("display-fbdev-kgicon-mesa: Using accel: \"%s\"\n", priv->accel); } -#endif /* Mode management */ - vis->opdisplay->getapi = GGIMesa_genkgi_getapi; - + vis->opdisplay->getapi = GGIMesa_genkgi_getapi; ggiIndicateChange(vis, GGI_CHG_APILIST); - +#endif /* Give the accel sublibs a chance to set up a driver */ if (priv->have_accel == 1) @@ -168,7 +168,11 @@ int GGIdlinit(ggi_visual *vis, const char *args, void *argptr) (LIBGGI_MESAEXT(vis)->setup_driver == NULL)) vis->opdisplay->getapi = oldgetapi; } - +#endif + + LIBGGI_MESAEXT(vis)->update_state = genkgi_update_state; + LIBGGI_MESAEXT(vis)->setup_driver = genkgi_setup_driver; + gl_ggiDEBUG("display-fbdev-kgicon-mesa: GGIdlinit finished\n"); return 0; diff --git a/src/mesa/drivers/ggi/display/fbdev_mode.c b/src/mesa/drivers/ggi/display/fbdev_mode.c index 478ad83801c..6815e5f198e 100644 --- a/src/mesa/drivers/ggi/display/fbdev_mode.c +++ b/src/mesa/drivers/ggi/display/fbdev_mode.c @@ -1,4 +1,4 @@ -/* $Id: fbdev_mode.c,v 1.2 1999/08/21 22:46:13 jtaylor Exp $ +/* $Id: fbdev_mode.c,v 1.3 1999/08/22 08:56:50 jtaylor Exp $ ****************************************************************************** display-fbdev-mesa @@ -50,7 +50,7 @@ int GGIMesa_fbdev_getapi(ggi_visual *vis, int num, char *apiname, char *arguments) { - fbdev_hook_mesa *priv = GGIMESA_PRIVATE(vis); + struct fbdev_priv_mesa *priv = GGIMESA_PRIVATE(vis); strcpy(arguments, ""); @@ -70,7 +70,7 @@ int GGIMesa_fbdev_getapi(ggi_visual *vis, int num, char *apiname, char *argument static int do_setmode(ggi_visual *vis) { - fbdev_hook_mesa *priv = GGIMESA_PRIVATE(vis); + struct fbdev_priv_mesa *priv = GGIMESA_PRIVATE(vis); int err, id; char libname[256], libargs[256]; ggi_graphtype gt; diff --git a/src/mesa/drivers/ggi/display/fbdev_visual.c b/src/mesa/drivers/ggi/display/fbdev_visual.c index 60af90412af..13ac848e7cc 100644 --- a/src/mesa/drivers/ggi/display/fbdev_visual.c +++ b/src/mesa/drivers/ggi/display/fbdev_visual.c @@ -1,4 +1,4 @@ -/* $Id: fbdev_visual.c,v 1.2 1999/08/21 22:46:13 jtaylor Exp $ +/* $Id: fbdev_visual.c,v 1.3 1999/08/22 08:56:50 jtaylor Exp $ ****************************************************************************** display-fbdev-mesa: visual handling @@ -107,16 +107,16 @@ static int changed(ggi_visual_t vis, int whatchanged) int GGIdlinit(ggi_visual *vis, const char *args, void *argptr) { - fbdev_hook_mesa *priv; + struct fbdev_priv_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)); + GGIMESA_PRIVATE(vis) = priv = malloc(sizeof(struct fbdev_priv_mesa)); if (priv == NULL) { - fprintf(stderr, "Failed to allocate fbdev_hook!\n"); + fprintf(stderr, "Failed to allocate fbdev private data\n"); return GGI_DL_ERROR; } diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h b/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h index eee65339782..72d294bb6fc 100644 --- a/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h +++ b/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h @@ -7,14 +7,14 @@ ggifunc_setmode GGIMesa_fbdev_setmode; ggifunc_getapi GGIMesa_fbdev_getapi; -#define FBDEV_PRIV_MESA(vis) ((fbdev_hook_mesa *)(FBDEV_PRIV(vis)->accelpriv)) +#define FBDEV_PRIV_MESA(vis) ((struct fbdev_priv_mesa *)(FBDEV_PRIV(vis)->accelpriv)) -typedef struct fbdev_hook_mesa +struct fbdev_priv_mesa { char *accel; int have_accel; void *accelpriv; fbdev_hook *oldpriv; // Hooks back to the LibGGI fbdev target's private data -} fbdev_hook_mesa; +}; #endif /* _GGIMESA_DISPLAY_FBDEV_H */ |