summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/ggi/default
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/ggi/default')
-rw-r--r--src/mesa/drivers/ggi/default/.gitignore1
-rw-r--r--src/mesa/drivers/ggi/default/genkgi.conf.in4
-rw-r--r--src/mesa/drivers/ggi/default/genkgi.h76
-rw-r--r--src/mesa/drivers/ggi/default/genkgi_mode.c97
-rw-r--r--src/mesa/drivers/ggi/default/genkgi_visual.c190
-rw-r--r--src/mesa/drivers/ggi/default/linear.c409
-rw-r--r--src/mesa/drivers/ggi/default/linear_15.c36
-rw-r--r--src/mesa/drivers/ggi/default/linear_16.c36
-rw-r--r--src/mesa/drivers/ggi/default/linear_24.c36
-rw-r--r--src/mesa/drivers/ggi/default/linear_32.c36
-rw-r--r--src/mesa/drivers/ggi/default/linear_8.c36
-rw-r--r--src/mesa/drivers/ggi/default/stubs.c512
12 files changed, 0 insertions, 1469 deletions
diff --git a/src/mesa/drivers/ggi/default/.gitignore b/src/mesa/drivers/ggi/default/.gitignore
deleted file mode 100644
index c8a526b14d7..00000000000
--- a/src/mesa/drivers/ggi/default/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-genkgi.conf
diff --git a/src/mesa/drivers/ggi/default/genkgi.conf.in b/src/mesa/drivers/ggi/default/genkgi.conf.in
deleted file mode 100644
index 02acad2a191..00000000000
--- a/src/mesa/drivers/ggi/default/genkgi.conf.in
+++ /dev/null
@@ -1,4 +0,0 @@
-# GGIMesa genkgi helper configuration
-.root: @ggi_libdir@/ggi/mesa/default
-
-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
deleted file mode 100644
index 6d0963416f9..00000000000
--- a/src/mesa/drivers/ggi/default/genkgi.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-******************************************************************************
-
- GGIMesa - KGIcon specific overrides for fbcon-mesa
- API header
-
- Copyright (C) 1999 Jon Taylor [[email protected]]
-
- 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.
-
-******************************************************************************
-*/
-
-#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>
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-/* 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; /* 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)
-
-#endif /* _GENKHI_MESA_H */
diff --git a/src/mesa/drivers/ggi/default/genkgi_mode.c b/src/mesa/drivers/ggi/default/genkgi_mode.c
deleted file mode 100644
index f81d6a45bd6..00000000000
--- a/src/mesa/drivers/ggi/default/genkgi_mode.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-******************************************************************************
-
- display-fbdev-kgicon-generic-mesa
-
- Copyright (C) 1999 Jon Taylor [[email protected]]
-
- 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-#include "genkgi.h"
-
-int GGIMesa_genkgi_getapi(ggi_visual *vis, int num, char *apiname, char *arguments)
-{
- struct genkgi_priv_mesa *priv = GENKGI_PRIV_MESA(vis);
-
- GGIMESADPRINT_CORE("Entered mesa_genkgi_getapi, num=%d\n", num);
-
- strcpy(arguments, "");
-
- switch(num)
- {
- case 0:
- if (priv->have_accel)
- {
- strcpy(apiname, priv->accel);
- return 0;
- }
- break;
- }
- 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;
-
- 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()))
- {
- munmap(priv->oldpriv->mapped_kgicommand, priv->oldpriv->kgicommand_buffersize);
- 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!");
- }
- priv->oldpriv->kgicommand_ptr = priv->oldpriv->mapped_kgicommand;
- }
- return 0;
-}
diff --git a/src/mesa/drivers/ggi/default/genkgi_visual.c b/src/mesa/drivers/ggi/default/genkgi_visual.c
deleted file mode 100644
index d7838cae6e0..00000000000
--- a/src/mesa/drivers/ggi/default/genkgi_visual.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
-******************************************************************************
-
- genkgi_visual.c: visual handling for the generic KGI helper
-
- Copyright (C) 1999 Jon Taylor [[email protected]]
-
- 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 <ggi/mesa/debug.h>
-#include "genkgi.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 DEFAULT_FBNUM 0
-
-static char accel_prefix[] = "tgt-fbdev-kgicon-";
-#define PREFIX_LEN (sizeof(accel_prefix))
-
-typedef struct {
- int async;
- char *str;
-} accel_info;
-
-static accel_info accel_strings[] =
-{
- { 0, "d3dim" }, /* Direct3D Immediate Mode */
-};
-
-#define NUM_ACCELS (sizeof(accel_strings)/sizeof(accel_info))
-
-/* FIXME: These should be defined in the makefile system */
-#define CONF_FILE "/usr/local/etc/ggi/mesa/targets/genkgi.conf"
-void *_configHandle;
-char confstub[512] = CONF_FILE;
-char *conffile = confstub;
-
-static int changed(ggi_visual_t vis, int whatchanged)
-{
- GGIMESADPRINT_CORE("Entered ggimesa_genkgi_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");
- GGIMESADPRINT_CORE("ggimesa_genkgi_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;
- }
- return 0;
-}
-
-static int GGIdlinit(ggi_visual *vis, struct ggi_dlhandle *dlh,
- const char *args, void *argptr, uint32 *dlret)
-{
- struct genkgi_priv_mesa *priv;
- char libname[256], libargs[256];
- int id, err;
- struct stat junk;
- ggifunc_getapi *oldgetapi;
-
- GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: GGIdlinit start\n");
-
- GENKGI_PRIV_MESA(vis) = priv = malloc(sizeof(struct genkgi_priv_mesa));
- if (priv == NULL)
- {
- 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)
- {
- gl_ggiPrint("display-fbdev-kgicon-mesa: Couldn't open %s\n", conffile);
- return err;
- }
-
- /* 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 (stat("/proc/gfx0", &junk) == 0)
- {
- sprintf(priv->accel, "%s%s", accel_prefix, "d3dim");
- priv->have_accel = 1;
- GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: Using accel: \"%s\"\n", priv->accel);
- }
-
- /* Mode management */
- vis->opdisplay->getapi = GGIMesa_genkgi_getapi;
- ggiIndicateChange(vis, GGI_CHG_APILIST);
-
- /* Give the accel sublibs a chance to set up a driver */
- if (priv->have_accel == 1)
- {
- oldgetapi = vis->opdisplay->getapi;
- vis->opdisplay->getapi = GGIMesa_genkgi_getapi;
- changed(vis, GGI_CHG_APILIST);
- /* If the accel sublibs didn't produce, back up
- * and keep looking */
- if ((LIBGGI_MESAEXT(vis)->update_state == NULL) ||
- (LIBGGI_MESAEXT(vis)->setup_driver == NULL))
- vis->opdisplay->getapi = oldgetapi;
- }
-
- LIBGGI_MESAEXT(vis)->update_state = genkgi_update_state;
- LIBGGI_MESAEXT(vis)->setup_driver = genkgi_setup_driver;
-#endif
- GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: GGIdlinit finished\n");
-
- *dlret = GGI_DL_OPDRAW;
- return 0;
-}
-
-int MesaGGIdl_fbdev(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- case GGIFUNC_close:
- *funcptr = NULL;
- return 0;
- default:
- *funcptr = NULL;
- }
- return GGI_ENOTFOUND;
-}
-
-#include <ggi/internal/ggidlinit.h>
diff --git a/src/mesa/drivers/ggi/default/linear.c b/src/mesa/drivers/ggi/default/linear.c
deleted file mode 100644
index 9d29761ad5b..00000000000
--- a/src/mesa/drivers/ggi/default/linear.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-#include "swrast/swrast.h"
-
-#define RMASK ((1<<R)-1)
-#define GMASK ((1<<G)-1)
-#define BMASK ((1<<B)-1)
-
-#define RS (8-R)
-#define GS (8-G)
-#define BS (8-B)
-
-#define PACK(color) (((color[RCOMP]>>RS) << (G+B)) | \
- ((color[GCOMP]>>GS) << B) | \
- ((color[BCOMP]>>BS)))
-
-#define FLIP(coord) (LIBGGI_VIRTY(ggi_ctx->ggi_visual) - (coord) - 1)
-
-
-/**********************************************************************/
-/***** Write spans of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = *ci;
- fb++;
- ci++;
- }
- } else {
- while (n--) *fb++ = *ci++;
- }
-}
-
-void GGIwrite_ci8_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLubyte ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = *ci;
- fb++;
- ci++;
- }
- } else {
- while (n--) *fb++ = *ci++;
- }
-}
-
-
-void GGIwrite_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan rgba[][4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = PACK(rgba[0]);
- fb++;
- rgba++;
- }
- } else {
- while (n--) {
- *fb++ = PACK(rgba[0]);
- rgba++;
- }
- }
-}
-
-void GGIwrite_rgb_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan rgba[][3], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = PACK(rgba[0]);
- fb++;
- rgba++;
- }
- } else {
- while (n--) {
- *fb++ = PACK(rgba[0]);
- rgba++;
- }
- }
-}
-
-
-void GGIwrite_mono_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--){
- if (*mask++)
- *fb = PACK(color);
- ++fb;
- }
- } else {
- while (n--)
- *fb++ = PACK(color);
-
- /* Alternatively we could write a potentialy faster HLine
- ggiSetGCForeground(ggi_ctx->ggi_visual, color);
- ggiDrawHLine(ggi_ctx->ggi_visual,x,FLIP(y),n);
- */
- }
-}
-
-void GGIwrite_mono_ci_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask){
- while (n--){
- if (*mask++)
- *fb = ci;
- ++fb;
- }
- } else {
- while (n--)
- *fb++ = ci;
-
- /* Alternatively we could write a potentialy faster HLine
- ggiSetGCForeground(ggi_ctx->ggi_visual, ci);
- ggiDrawHLine(ggi_ctx->ggi_visual, x, FLIP(y), n);
- */
- }
-}
-
-
-/**********************************************************************/
-/***** Read spans of pixels *****/
-/**********************************************************************/
-
-
-void GGIread_ci32_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLuint ci[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- while (n--)
- *ci++ = (GLuint)*fb++;
-}
-
-void GGIread_rgba_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLchan rgba[][4])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE color;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- while (n--) {
- color = *fb++;
- rgba[0][RCOMP] = (GLubyte) (color>>(G+B))<<RS;
- rgba[0][GCOMP] = (GLubyte) ((color>>B)& ((1<<G)-1))<<GS;
- rgba[0][BCOMP] = (GLubyte) (color & ((1<<B)-1))<<BS;
- rgba[0][ACOMP] = 0;
- rgba++;
- }
-}
-
-/**********************************************************************/
-/***** Write arrays of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = *ci;
- }
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIwrite_mono_ci_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = ci;
- }
- x++;
- y++;
- }
-}
-
-void GGIwrite_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan rgba[][4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = PACK(rgba[0]);
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-void GGIwrite_mono_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan rgba[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = PACK(rgba);
- }
-
- x++;
- y++;
- }
-}
-
-/**********************************************************************/
-/***** Read arrays of pixels *****/
-/**********************************************************************/
-
-void GGIread_ci32_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *src = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *ci = *src;
- }
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIread_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
- FB_TYPE color;
-
- while (n--) {
- if (*mask++) {
- FB_TYPE *src = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- color = *src;
-
- rgba[0][RCOMP] = (GLubyte)(color>>(G+B))<<RS;
- rgba[0][GCOMP] = (GLubyte)((color>>B)& ((1<<G)-1))<<GS;
- rgba[0][BCOMP] = (GLubyte) (color & ((1<<B)-1))<<BS;
- rgba[0][ACOMP] = 0;
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-void GGIset_buffer(GLcontext *ctx, GLframebuffer *buffer, GLenum mode)
-{
-}
-
-int GGIsetup_driver(ggi_mesa_context_t ggi_ctx)
-{
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ggi_ctx->gl_ctx);
-
- GGIMESADPRINT_LIBS("linear_%d: GGIsetup_driver\n", sizeof(FB_TYPE)*8);
-
- swdd->WriteRGBASpan = GGIwrite_rgba_span;
- swdd->WriteRGBSpan = GGIwrite_rgb_span;
- swdd->WriteMonoRGBASpan = GGIwrite_mono_rgba_span;
- swdd->WriteRGBAPixels = GGIwrite_rgba_pixels;
- swdd->WriteMonoRGBAPixels = GGIwrite_mono_rgba_pixels;
-
- swdd->WriteCI32Span = GGIwrite_ci32_span;
- swdd->WriteCI8Span = GGIwrite_ci8_span;
- swdd->WriteMonoCISpan = GGIwrite_mono_ci_span;
- swdd->WriteCI32Pixels = GGIwrite_ci32_pixels;
- swdd->WriteMonoCIPixels = GGIwrite_mono_ci_pixels;
-
- swdd->ReadCI32Span = GGIread_ci32_span;
- swdd->ReadRGBASpan = GGIread_rgba_span;
- swdd->ReadCI32Pixels = GGIread_ci32_pixels;
- swdd->ReadRGBAPixels = GGIread_rgba_pixels;
-
- swdd->SetBuffer = GGIset_buffer;
-
- return 0;
-}
-
-static int GGIopen(ggi_visual_t vis,struct ggi_dlhandle *dlh,
- const char *args,void *argptr, uint32 *dlret)
-{
- GGIMESADPRINT_CORE("linear_%d: GGIOpen\n", sizeof(FB_TYPE)*8);
- LIBGGI_MESAEXT(vis)->setup_driver = GGIsetup_driver;
-
- *dlret = GGI_DL_OPDRAW;
- return 0;
-}
-
-int DLOPENFUNC(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- case GGIFUNC_close:
- *funcptr = NULL;
- return 0;
- default:
- *funcptr = NULL;
- }
- return GGI_ENOTFOUND;
-}
-
diff --git a/src/mesa/drivers/ggi/default/linear_15.c b/src/mesa/drivers/ggi/default/linear_15.c
deleted file mode 100644
index ead7cc58475..00000000000
--- a/src/mesa/drivers/ggi/default/linear_15.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 5
-#define G 5
-#define B 5
-
-#define FB_TYPE uint16
-#define FB_BITS 15
-#define DLOPENFUNC MesaGGIdl_linear_15
-
-#include "linear.c"
-
diff --git a/src/mesa/drivers/ggi/default/linear_16.c b/src/mesa/drivers/ggi/default/linear_16.c
deleted file mode 100644
index 6028699bbc9..00000000000
--- a/src/mesa/drivers/ggi/default/linear_16.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 5
-#define G 6
-#define B 5
-
-#define FB_TYPE uint16
-#define FB_BITS 16
-#define DLOPENFUNC MesaGGIdl_linear_16
-
-#include "linear.c"
-
diff --git a/src/mesa/drivers/ggi/default/linear_24.c b/src/mesa/drivers/ggi/default/linear_24.c
deleted file mode 100644
index 7a2236f1241..00000000000
--- a/src/mesa/drivers/ggi/default/linear_24.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 8
-#define G 8
-#define B 8
-
-#define FB_TYPE uint32
-#define FB_BITS 24
-#define DLOPENFUNC MesaGGIdl_linear_24
-
-#include "linear.c"
-
diff --git a/src/mesa/drivers/ggi/default/linear_32.c b/src/mesa/drivers/ggi/default/linear_32.c
deleted file mode 100644
index 7cbf945f359..00000000000
--- a/src/mesa/drivers/ggi/default/linear_32.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 8
-#define G 8
-#define B 8
-
-#define FB_TYPE uint32
-#define FB_BITS 32
-#define DLOPENFUNC MesaGGIdl_linear_32
-
-#include "linear.c"
-
diff --git a/src/mesa/drivers/ggi/default/linear_8.c b/src/mesa/drivers/ggi/default/linear_8.c
deleted file mode 100644
index 9c7b5d712f0..00000000000
--- a/src/mesa/drivers/ggi/default/linear_8.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 3
-#define G 3
-#define B 2
-
-#define FB_TYPE uint8
-#define FB_BITS 8
-#define DLOPENFUNC MesaGGIdl_linear_8
-
-#include "linear.c"
-
diff --git a/src/mesa/drivers/ggi/default/stubs.c b/src/mesa/drivers/ggi/default/stubs.c
deleted file mode 100644
index 62722972b2a..00000000000
--- a/src/mesa/drivers/ggi/default/stubs.c
+++ /dev/null
@@ -1,512 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <stdio.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-
-#include "swrast/swrast.h"
-//#include "swrast_setup/swrast_setup.h"
-//#include "swrast/s_context.h"
-//#include "swrast/s_depth.h"
-//#include "swrast/s_triangle.h"
-
-#define FLIP(coord) (LIBGGI_MODE(ggi_ctx->ggi_visual)->visible.y-(coord)-1)
-
-/**********************************************************************/
-/***** Write spans of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLuint ci[],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, *ci);
- x++;
- ci++;
- }
- }
- else
- {
- while (n--)
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, *ci++);
- }
-}
-
-void GGIwrite_ci8_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte ci[],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, *ci);
- x++;
- ci++;
- }
- }
- else
- {
- while (n--)
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, *ci++);
- }
-}
-
-void GGIwrite_mono_ci_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, ci);
- x++;
- }
- }
- else
- {
- while (n--)
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, ci);
- }
-}
-
-void GGIwrite_mono_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan rgba[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- y = FLIP(y);
-
- rgb.r = (uint16)(rgba[RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
-
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, col);
- x++;
- }
- }
- else
- {
- ggiDrawHLine(ggi_ctx->ggi_visual, x, y, n);
- }
-}
-
-void GGIwrite_rgba_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
- y = FLIP(y);
-
- if (mask)
- {
- while (n--) {
- if (*mask++)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, col);
- }
- x++;
- rgba++;
- }
- }
- else
- {
- while (n--)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, col);
- rgba++;
- }
- }
-}
-
-void GGIwrite_rgb_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgba[][3],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
- y = FLIP(y);
-
- if (mask)
- {
- while (n--) {
- if (*mask++)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, col);
- }
- x++;
- rgba++;
- }
- }
- else
- {
- while (n--)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, col);
- rgba++;
- }
- }
-}
-
-
-
-/**********************************************************************/
-/***** Read spans of pixels *****/
-/**********************************************************************/
-
-
-void GGIread_ci32_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLuint ci[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- while (n--)
- ggiGetPixel(ggi_ctx->ggi_visual, x++, y, ci++);
-}
-
-void GGIread_rgba_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- y = FLIP(y);
-
- while (n--)
- {
- ggiGetPixel(ggi_ctx->ggi_visual, x++, y, &col);
- ggiUnmapPixel(ggi_ctx->ggi_visual, col, &rgb);
- rgba[0][RCOMP] = (GLubyte) (rgb.r >> SHIFT);
- rgba[0][GCOMP] = (GLubyte) (rgb.g >> SHIFT);
- rgba[0][BCOMP] = (GLubyte) (rgb.b >> SHIFT);
- rgba[0][ACOMP] = 0;
- rgba++;
- }
-}
-
-/**********************************************************************/
-/***** Write arrays of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint ci[], const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), *ci);
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIwrite_mono_ci_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), ci);
- x++;
- y++;
- }
-}
-
-void GGIwrite_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_pixel col;
- ggi_color rgb;
- while (n--) {
- if (*mask++) {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), col);
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-void GGIwrite_mono_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan rgba[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- rgb.r = (uint16)(rgba[RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
-
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), col);
- x++;
- y++;
- }
-}
-
-/**********************************************************************/
-/***** Read arrays of pixels *****/
-/**********************************************************************/
-
-void GGIread_ci32_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- while (n--) {
- if (*mask++)
- ggiGetPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), ci);
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIread_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- while (n--)
- {
- if (*mask++)
- {
- ggiGetPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), &col);
- ggiUnmapPixel(ggi_ctx->ggi_visual, col, &rgb);
- rgba[0][RCOMP] = rgb.r >> SHIFT;
- rgba[0][GCOMP] = rgb.g >> SHIFT;
- rgba[0][BCOMP] = rgb.b >> SHIFT;
- rgba[0][ACOMP] = 0;
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-int GGIextend_visual(ggi_visual_t vis)
-{
- return 0;
-}
-
-//static swrast_tri_func ggimesa_stubs_get_triangle_func(GLcontext *ctx);
-
-int GGIsetup_driver(ggi_mesa_context_t ggi_ctx)
-{
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ggi_ctx->gl_ctx);
-
- GGIMESADPRINT_CORE("stubs: setup_driver\n");
-
- swdd->WriteRGBASpan = GGIwrite_rgba_span;
- swdd->WriteRGBSpan = GGIwrite_rgb_span;
- swdd->WriteMonoRGBASpan = GGIwrite_mono_rgba_span;
- swdd->WriteRGBAPixels = GGIwrite_rgba_pixels;
- swdd->WriteMonoRGBAPixels = GGIwrite_mono_rgba_pixels;
-
- swdd->WriteCI32Span = GGIwrite_ci32_span;
- swdd->WriteCI8Span = GGIwrite_ci8_span;
- swdd->WriteMonoCISpan = GGIwrite_mono_ci_span;
- swdd->WriteCI32Pixels = GGIwrite_ci32_pixels;
- swdd->WriteMonoCIPixels = GGIwrite_mono_ci_pixels;
-
- swdd->ReadCI32Span = GGIread_ci32_span;
- swdd->ReadRGBASpan = GGIread_rgba_span;
- swdd->ReadCI32Pixels = GGIread_ci32_pixels;
- swdd->ReadRGBAPixels = GGIread_rgba_pixels;
-
- return 0;
-}
-
-void GGIupdate_state(ggi_mesa_context_t *ctx)
-{
- //ctx->Driver.TriangleFunc = _swsetup_Triangle;
-}
-
-/*
-void GGItriangle_flat(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2)
-{
-//#define INTERP_Z 1
-#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-
-#define SETUP_CODE \
- ggi_color color; \
- color.r = v0->color[0]; \
- color.g = v0->color[1]; \
- color.b = v0->color[2]; \
- color.a = v0->color[3]; \
- ggiSetGCForeground(VIS, ggiMapColor(VIS, &color));
-
-#define INNER_LOOP(LEFT,RIGHT,Y) \
- ggiDrawHLine(VIS,LEFT,FLIP(Y),RIGHT-LEFT);
-
-#include "swrast/s_tritemp.h"
-}
-
-
-static void GGItriangle_flat_depth(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2)
-{
-#define INTERP_Z 1
-#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-
-#define SETUP_CODE \
- ggi_color color; \
- color.r = v0->color[0]; \
- color.g = v0->color[1]; \
- color.b = v0->color[2]; \
- color.a = v0->color[3]; \
- ggiSetGCForeground(VIS, ggiMapColor(VIS, &color));
-
-#define INNER_LOOP(LEFT,RIGHT,Y) \
- { \
- GLint i,xx=LEFT,yy=FLIP(Y),n=RIGHT-LEFT,length=0; \
- GLint startx=xx; \
- for (i=0;i<n;i++){ \
- GLdepth z=FixedToDepth(ffz); \
- if (z<zRow[i]) \
- { \
- zRow[i]=z; \
- length++; \
- } \
- else \
- { \
- if (length) \
- { \
- ggiDrawHLine(VIS,startx,yy,length); \
- length=0; \
- } \
- startx=xx+i+1; \
- } \
- ffz+=fdzdx; \
- } \
- if (length) ggiDrawHLine(VIS,startx,yy,length); \
- }
-
-#include "swrast/s_tritemp.h"
-}
-
-
-static swrast_tri_func ggimesa_stubs_get_triangle_func(GLcontext *ctx)
-{
- if (ctx->Stencil._Enabled) return NULL;
- if (ctx->Polygon.SmoothFlag) return NULL;
- if (ctx->Polygon.StippleFlag) return NULL;
- if (ctx->Texture._ReallyEnabled) return NULL;
- if (ctx->Light.ShadeModel==GL_SMOOTH) return NULL;
- if (ctx->Depth.Test && ctx->Depth.Func != GL_LESS) return NULL;
-
- if (ctx->Depth.Test)
- return GGItriangle_flat_depth;
-
- return GGItriangle_flat;
-}
-*/
-static int GGIopen(ggi_visual_t vis, struct ggi_dlhandle *dlh,
- const char *args, void *argptr, uint32 *dlret)
-{
- LIBGGI_MESAEXT(vis)->update_state = GGIupdate_state;
- LIBGGI_MESAEXT(vis)->setup_driver = GGIsetup_driver;
-
- *dlret = GGI_DL_OPDRAW;
- return 0;
-}
-
-int MesaGGIdl_stubs(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- case GGIFUNC_close:
- *funcptr = NULL;
- return 0;
- default:
- *funcptr = NULL;
- }
- return GGI_ENOTFOUND;
-}