diff options
author | Brian Paul <[email protected]> | 2004-09-10 19:19:24 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-09-10 19:19:24 +0000 |
commit | 0cabfa68c37041028d634a7697daf6de9fc10c72 (patch) | |
tree | 232b3987a199700620ab560063a18217e72367ea /src/mesa/drivers/ggi/display | |
parent | e14c225597c83994e62c58285cb4a03b5c007ef8 (diff) |
assorted updates (bug #1025977)
Diffstat (limited to 'src/mesa/drivers/ggi/display')
-rw-r--r-- | src/mesa/drivers/ggi/display/fbdev_mode.c | 23 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/display/fbdev_visual.c | 73 |
2 files changed, 55 insertions, 41 deletions
diff --git a/src/mesa/drivers/ggi/display/fbdev_mode.c b/src/mesa/drivers/ggi/display/fbdev_mode.c index 6fb952d55c6..eee80eb4b77 100644 --- a/src/mesa/drivers/ggi/display/fbdev_mode.c +++ b/src/mesa/drivers/ggi/display/fbdev_mode.c @@ -50,15 +50,13 @@ int GGIMesa_fbdev_getapi(ggi_visual *vis, int num, char *apiname, char *arguments) { - struct fbdev_priv_mesa *priv = GGIMESA_PRIVATE(vis); + struct fbdev_priv_mesa *priv = GGIMESA_PRIV(vis); - strcpy(arguments, ""); + arguments = '\0'; - switch(num) - { - case 0: - if (priv->oldpriv->have_accel) - { + switch(num) { + case 0: + if (priv->oldpriv->have_accel) { strcpy(apiname, priv->oldpriv->accel); return 0; } @@ -70,17 +68,16 @@ int GGIMesa_fbdev_getapi(ggi_visual *vis, int num, char *apiname, char *argument static int do_setmode(ggi_visual *vis) { - struct fbdev_priv_mesa *priv = GGIMESA_PRIVATE(vis); + struct fbdev_priv_mesa *priv = GGIMESA_PRIV(vis); int err, id; - char libname[256], libargs[256]; + char libname[GGI_API_MAXLEN], libargs[GGI_API_MAXLEN]; ggi_graphtype gt; _ggiZapMode(vis, ~GGI_DL_OPDISPLAY); priv->have_accel = 0; for (id = 1; GGIMesa_fbdev_getapi(vis, id, libname, libargs) == 0; id++) { - if (_ggiOpenDL(vis, libname, libargs, NULL) == 0) - { + if (_ggiOpenDL(vis, libname, libargs, NULL) == 0) { fprintf(stderr, "display-fbdev-mesa: Error opening the " "%s (%s) library.\n", libname, libargs); return GGI_EFATAL; @@ -92,9 +89,7 @@ static int do_setmode(ggi_visual *vis) if (priv->oldpriv->accel && _ggiOpenDL(vis, priv->accel, NULL, NULL) != 0) { priv->have_accel = 1; - } - else - { + } else { priv->have_accel = 0; } vis->accelactive = 0; diff --git a/src/mesa/drivers/ggi/display/fbdev_visual.c b/src/mesa/drivers/ggi/display/fbdev_visual.c index 0176614ffba..79c16ec7963 100644 --- a/src/mesa/drivers/ggi/display/fbdev_visual.c +++ b/src/mesa/drivers/ggi/display/fbdev_visual.c @@ -76,51 +76,47 @@ char *conffile = confstub; static int changed(ggi_visual_t vis, int whatchanged) { - switch (whatchanged) - { - case GGI_CHG_APILIST: - { - char api[256]; - char args[256]; - int i; - const char *fname; - ggi_dlhandle *lib; + switch (whatchanged) { + case GGI_CHG_APILIST: { + char api[GGI_API_MAXLEN], args[GGI_API_MAXLEN]; + int i; + const char *fname; + ggi_dlhandle *lib; - for (i = 0; ggiGetAPI(vis, i, api, args) == 0; i++) - { - strcat(api, "-mesa"); - fname = ggMatchConfig(_configHandle, api, NULL); - if (fname == NULL) - { - /* No special implementation for this sublib */ - continue; - } - - lib = ggiExtensionLoadDL(vis, fname, args, NULL, GGI_SYMNAME_PREFIX); + for (i = 0; ggiGetAPI(vis, i, api, args) == 0; i++) { + strcat(api, "-mesa"); + fname = ggMatchConfig(_configHandle, api, NULL); + if (fname == NULL) { + /* No special implementation for this sublib */ + continue; } + + lib = ggiExtensionLoadDL(vis, fname, args, NULL, GGI_SYMNAME_PREFIX); } - break; + } + break; } return 0; } -int GGIdlinit(ggi_visual *vis, const char *args, void *argptr) + +static int GGIopen(ggi_visual *vis, struct ggi_dlhandle *dlh, + const char *args, void *argptr, uint32 *dlret) { struct fbdev_priv_mesa *priv; int err; ggifunc_getapi *oldgetapi; - GGIMESA_PRIVATE(vis) = priv = malloc(sizeof(struct fbdev_priv_mesa)); + GGIMESA_PRIV(vis) = priv = malloc(sizeof(struct fbdev_priv_mesa)); if (priv == NULL) { fprintf(stderr, "Failed to allocate fbdev private data\n"); - return GGI_DL_ERROR; + return GGI_ENOMEM; } priv->oldpriv = LIBGGI_PRIVATE(vis); /* Hook back */ err = ggLoadConfig(conffile, &_configHandle); - if (err != GGI_OK) - { + if (err != GGI_OK) { GGIMESADPRINT_CORE("display-fbdev: Couldn't open %s\n", conffile); return err; } @@ -139,12 +135,35 @@ int GGIdlinit(ggi_visual *vis, const char *args, void *argptr) vis->opdisplay->getapi = oldgetapi; } + *dlret = GGI_DL_EXTENSION; return 0; } -int GGIdlcleanup(ggi_visual *vis) + +static int GGIclose(ggi_visual *vis, struct ggi_dlhandle *dlh) { return 0; } + +int MesaGGIdl_fbdev_mesa(int func, void **funcptr) +{ + switch (func) { + case GGIFUNC_open: + *funcptr = GGIopen; + return 0; + case GGIFUNC_exit: + *funcptr = NULL; + return 0; + case GGIFUNC_close: + *funcptr = GGIclose; + return 0; + default: + *funcptr = NULL; + } + + return GGI_ENOTFOUND; +} + + #include <ggi/internal/ggidlinit.h> |