summaryrefslogtreecommitdiff
path: root/hw/xgl
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xgl')
-rw-r--r--hw/xgl/Makefile.am35
-rw-r--r--hw/xgl/glx/Makefile.am16
-rw-r--r--hw/xgl/glx/xglx.c894
-rw-r--r--hw/xgl/xgl.h1413
-rw-r--r--hw/xgl/xglarea.c323
-rw-r--r--hw/xgl/xglbstore.c125
-rw-r--r--hw/xgl/xglcmap.c319
-rw-r--r--hw/xgl/xglcomp.c265
-rw-r--r--hw/xgl/xglcopy.c143
-rw-r--r--hw/xgl/xglfill.c753
-rw-r--r--hw/xgl/xglgc.c588
-rw-r--r--hw/xgl/xglgeometry.c723
-rw-r--r--hw/xgl/xglget.c85
-rw-r--r--hw/xgl/xglglx.c3580
-rw-r--r--hw/xgl/xglglyph.c1169
-rw-r--r--hw/xgl/xglhash.c118
-rw-r--r--hw/xgl/xglinput.c263
-rw-r--r--hw/xgl/xgloffscreen.c293
-rw-r--r--hw/xgl/xgloutput.c65
-rw-r--r--hw/xgl/xglparse.c179
-rw-r--r--hw/xgl/xglpict.c504
-rw-r--r--hw/xgl/xglpixmap.c601
-rw-r--r--hw/xgl/xglscreen.c448
-rw-r--r--hw/xgl/xglshm.c122
-rw-r--r--hw/xgl/xglsolid.c162
-rw-r--r--hw/xgl/xglsync.c389
-rw-r--r--hw/xgl/xgltile.c268
-rw-r--r--hw/xgl/xgltrap.c484
-rw-r--r--hw/xgl/xglwindow.c283
29 files changed, 0 insertions, 14610 deletions
diff --git a/hw/xgl/Makefile.am b/hw/xgl/Makefile.am
deleted file mode 100644
index eb92a9994..000000000
--- a/hw/xgl/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-SUBDIRS = . $(XGLX_DIRS)
-
-INCLUDES = \
- @XGL_INCS@ \
- @XSERVER_CFLAGS@ \
- @XGLSERVER_CFLAGS@
-
-noinst_LIBRARIES = libxgl.a
-
-libxgl_a_SOURCES = \
- xglinput.c \
- xgloutput.c \
- xglcmap.c \
- xglparse.c \
- xglscreen.c \
- xglarea.c \
- xgloffscreen.c \
- xglgeometry.c \
- xglpixmap.c \
- xglsync.c \
- xglsolid.c \
- xgltile.c \
- xglcopy.c \
- xglfill.c \
- xglwindow.c \
- xglbstore.c \
- xglget.c \
- xglgc.c \
- xglshm.c \
- xglcomp.c \
- xglpict.c \
- xglglyph.c \
- xgltrap.c \
- xglhash.c \
- xglglx.c
diff --git a/hw/xgl/glx/Makefile.am b/hw/xgl/glx/Makefile.am
deleted file mode 100644
index 2ab66d8f6..000000000
--- a/hw/xgl/glx/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-INCLUDES = \
- @XGL_INCS@ \
- @XSERVER_CFLAGS@ \
- @XGLXSERVER_CFLAGS@
-
-bin_PROGRAMS = Xglx
-
-Xglx_SOURCES = xglx.c
-
-Xglx_LDADD = \
- @XGL_LIBS@ \
- @XSERVER_LIBS@ \
- @XGLXSERVER_LIBS@
-
-Xglx_DEPENDENCIES = @XGL_LIBS@
-
diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c
deleted file mode 100644
index 15dfa8b3d..000000000
--- a/hw/xgl/glx/xglx.c
+++ /dev/null
@@ -1,894 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <glitz-glx.h>
-
-#include "xgl.h"
-#include "inputstr.h"
-#include "cursorstr.h"
-#include "mipointer.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <math.h>
-
-#define XGLX_DEFAULT_SCREEN_WIDTH 800
-#define XGLX_DEFAULT_SCREEN_HEIGHT 600
-
-typedef struct _xglxScreen {
- Window win;
- Colormap colormap;
- CloseScreenProcPtr CloseScreen;
-} xglxScreenRec, *xglxScreenPtr;
-
-int xglxScreenGeneration = -1;
-int xglxScreenPrivateIndex;
-
-#define XGLX_GET_SCREEN_PRIV(pScreen) \
- ((xglxScreenPtr) (pScreen)->devPrivates[xglxScreenPrivateIndex].ptr)
-
-#define XGLX_SET_SCREEN_PRIV(pScreen, v) \
- ((pScreen)->devPrivates[xglxScreenPrivateIndex].ptr = (pointer) v)
-
-#define XGLX_SCREEN_PRIV(pScreen) \
- xglxScreenPtr pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen)
-
-typedef struct _xglxCursor {
- Cursor cursor;
-} xglxCursorRec, *xglxCursorPtr;
-
-#define XGLX_GET_CURSOR_PRIV(pCursor, pScreen) \
- ((xglxCursorPtr) (pCursor)->devPriv[(pScreen)->myNum])
-
-#define XGLX_SET_CURSOR_PRIV(pCursor, pScreen, v) \
- ((pCursor)->devPriv[(pScreen)->myNum] = (pointer) v)
-
-#define XGLX_CURSOR_PRIV(pCursor, pScreen) \
- xglxCursorPtr pCursorPriv = XGLX_GET_CURSOR_PRIV (pCursor, pScreen)
-
-char *xDisplayName = NULL;
-Display *xdisplay = NULL;
-int xscreen;
-glitz_format_t *xglxCurrentFormat;
-CARD32 lastEventTime = 0;
-ScreenPtr currentScreen = NULL;
-Bool softCursor = FALSE;
-xglScreenInfoRec xglScreenInfo = {
- NULL, 0, 0, 0, 0, FALSE,
- DEFAULT_GEOMETRY_DATA_TYPE,
- DEFAULT_GEOMETRY_USAGE,
- FALSE,
- XGL_DEFAULT_PBO_MASK,
- FALSE
-};
-
-static Bool
-xglxAllocatePrivates (ScreenPtr pScreen)
-{
- xglxScreenPtr pScreenPriv;
-
- if (xglxScreenGeneration != serverGeneration)
- {
- xglxScreenPrivateIndex = AllocateScreenPrivateIndex ();
- if (xglxScreenPrivateIndex < 0)
- return FALSE;
-
- xglxScreenGeneration = serverGeneration;
- }
-
- pScreenPriv = xalloc (sizeof (xglxScreenRec));
- if (!pScreenPriv)
- return FALSE;
-
- XGLX_SET_SCREEN_PRIV (pScreen, pScreenPriv);
-
- return TRUE;
-}
-
-static void
-xglxConstrainCursor (ScreenPtr pScreen,
- BoxPtr pBox)
-{
-}
-
-static void
-xglxCursorLimits (ScreenPtr pScreen,
- CursorPtr pCursor,
- BoxPtr pHotBox,
- BoxPtr pTopLeftBox)
-{
- *pTopLeftBox = *pHotBox;
-}
-
-static Bool
-xglxDisplayCursor (ScreenPtr pScreen,
- CursorPtr pCursor)
-{
- XGLX_SCREEN_PRIV (pScreen);
- XGLX_CURSOR_PRIV (pCursor, pScreen);
-
- XDefineCursor (xdisplay, pScreenPriv->win, pCursorPriv->cursor);
-
- return TRUE;
-}
-
-#ifdef ARGB_CURSOR
-
-static Bool
-xglxARGBCursorSupport (void);
-
-static Cursor
-xglxCreateARGBCursor (ScreenPtr pScreen,
- CursorPtr pCursor);
-
-#endif
-
-static Bool
-xglxRealizeCursor (ScreenPtr pScreen,
- CursorPtr pCursor)
-{
- xglxCursorPtr pCursorPriv;
- XImage *ximage;
- Pixmap source, mask;
- XColor fgColor, bgColor;
- GC xgc;
- unsigned long valuemask;
- XGCValues values;
-
- XGLX_SCREEN_PRIV (pScreen);
-
- valuemask = GCForeground | GCBackground;
-
- values.foreground = 1L;
- values.background = 0L;
-
- pCursorPriv = xalloc (sizeof (xglxCursorRec));
- if (!pCursorPriv)
- return FALSE;
-
- XGLX_SET_CURSOR_PRIV (pCursor, pScreen, pCursorPriv);
-
-#ifdef ARGB_CURSOR
- if (pCursor->bits->argb)
- {
- pCursorPriv->cursor = xglxCreateARGBCursor (pScreen, pCursor);
- if (pCursorPriv->cursor)
- return TRUE;
- }
-#endif
-
- source = XCreatePixmap (xdisplay,
- pScreenPriv->win,
- pCursor->bits->width,
- pCursor->bits->height,
- 1);
-
- mask = XCreatePixmap (xdisplay,
- pScreenPriv->win,
- pCursor->bits->width,
- pCursor->bits->height,
- 1);
-
- xgc = XCreateGC (xdisplay, source, valuemask, &values);
-
- ximage = XCreateImage (xdisplay,
- DefaultVisual (xdisplay, xscreen),
- 1, XYBitmap, 0,
- (char *) pCursor->bits->source,
- pCursor->bits->width,
- pCursor->bits->height,
- BitmapPad (xdisplay), 0);
-
- XPutImage (xdisplay, source, xgc, ximage,
- 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
- XFree (ximage);
-
- ximage = XCreateImage (xdisplay,
- DefaultVisual (xdisplay, xscreen),
- 1, XYBitmap, 0,
- (char *) pCursor->bits->mask,
- pCursor->bits->width,
- pCursor->bits->height,
- BitmapPad (xdisplay), 0);
-
- XPutImage (xdisplay, mask, xgc, ximage,
- 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
- XFree (ximage);
- XFreeGC (xdisplay, xgc);
-
- fgColor.red = pCursor->foreRed;
- fgColor.green = pCursor->foreGreen;
- fgColor.blue = pCursor->foreBlue;
-
- bgColor.red = pCursor->backRed;
- bgColor.green = pCursor->backGreen;
- bgColor.blue = pCursor->backBlue;
-
- pCursorPriv->cursor =
- XCreatePixmapCursor (xdisplay, source, mask, &fgColor, &bgColor,
- pCursor->bits->xhot, pCursor->bits->yhot);
-
- XFreePixmap (xdisplay, mask);
- XFreePixmap (xdisplay, source);
-
- return TRUE;
-}
-
-static Bool
-xglxUnrealizeCursor (ScreenPtr pScreen,
- CursorPtr pCursor)
-{
- XGLX_CURSOR_PRIV (pCursor, pScreen);
-
- XFreeCursor (xdisplay, pCursorPriv->cursor);
- xfree (pCursorPriv);
-
- return TRUE;
-}
-
-static void
-xglxRecolorCursor (ScreenPtr pScreen,
- CursorPtr pCursor,
- Bool displayed)
-{
- XColor fgColor, bgColor;
-
- XGLX_CURSOR_PRIV (pCursor, pScreen);
-
- fgColor.red = pCursor->foreRed;
- fgColor.green = pCursor->foreGreen;
- fgColor.blue = pCursor->foreBlue;
-
- bgColor.red = pCursor->backRed;
- bgColor.green = pCursor->backGreen;
- bgColor.blue = pCursor->backBlue;
-
- XRecolorCursor (xdisplay, pCursorPriv->cursor, &fgColor, &bgColor);
-}
-
-static Bool
-xglxSetCursorPosition (ScreenPtr pScreen,
- int x,
- int y,
- Bool generateEvent)
-{
- XGLX_SCREEN_PRIV (pScreen);
-
- XWarpPointer (xdisplay, pScreenPriv->win, pScreenPriv->win,
- 0, 0, 0, 0, x, y);
-
- return TRUE;
-}
-
-static Bool
-xglxCloseScreen (int index,
- ScreenPtr pScreen)
-{
- glitz_drawable_t *drawable;
-
- XGLX_SCREEN_PRIV (pScreen);
-
- drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable;
- if (drawable)
- glitz_drawable_destroy (drawable);
-
- xglClearVisualTypes ();
-
- if (pScreenPriv->win)
- XDestroyWindow (xdisplay, pScreenPriv->win);
-
- if (pScreenPriv->colormap)
- XFreeColormap (xdisplay, pScreenPriv->colormap);
-
- XGL_SCREEN_UNWRAP (CloseScreen);
- xfree (pScreenPriv);
-
- return (*pScreen->CloseScreen) (index, pScreen);
-}
-
-static Bool
-xglxCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
-{
- return FALSE;
-}
-
-static void
-xglxCrossScreen (ScreenPtr pScreen, Bool entering)
-{
-}
-
-static void
-xglxWarpCursor (ScreenPtr pScreen, int x, int y)
-{
- miPointerWarpCursor (pScreen, x, y);
-}
-
-miPointerScreenFuncRec xglxPointerScreenFuncs = {
- xglxCursorOffScreen,
- xglxCrossScreen,
- xglxWarpCursor
-};
-
-static Bool
-xglxScreenInit (int index,
- ScreenPtr pScreen,
- int argc,
- char **argv)
-{
- XSetWindowAttributes xswa;
- XWMHints *wmHints;
- XSizeHints *normalHints;
- XClassHint *classHint;
- xglxScreenPtr pScreenPriv;
- Window root;
- XVisualInfo *vinfo;
- XEvent xevent;
- glitz_drawable_format_t *format;
- glitz_drawable_t *drawable;
-
- format = xglVisuals[0].format;
-
- if (!xglxAllocatePrivates (pScreen))
- return FALSE;
-
- currentScreen = pScreen;
-
- pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen);
-
- root = RootWindow (xdisplay, xscreen);
-
- vinfo = glitz_glx_get_visual_info_from_format (xdisplay, xscreen, format);
- if (!vinfo)
- {
- ErrorF ("[%d] no visual info from format\n", index);
- return FALSE;
- }
-
- pScreenPriv->colormap =
- XCreateColormap (xdisplay, root, vinfo->visual, AllocNone);
-
- if (xglScreenInfo.fullscreen)
- {
- xglScreenInfo.width = DisplayWidth (xdisplay, xscreen);
- xglScreenInfo.height = DisplayHeight (xdisplay, xscreen);
- xglScreenInfo.widthMm = DisplayWidthMM (xdisplay, xscreen);
- xglScreenInfo.heightMm = DisplayHeightMM (xdisplay, xscreen);
- }
- else if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
- {
- xglScreenInfo.width = XGLX_DEFAULT_SCREEN_WIDTH;
- xglScreenInfo.height = XGLX_DEFAULT_SCREEN_HEIGHT;
- }
-
- xswa.colormap = pScreenPriv->colormap;
-
- pScreenPriv->win =
- XCreateWindow (xdisplay, root, 0, 0,
- xglScreenInfo.width, xglScreenInfo.height, 0,
- vinfo->depth, InputOutput, vinfo->visual,
- CWColormap, &xswa);
-
- XFree (vinfo);
-
- normalHints = XAllocSizeHints ();
- normalHints->flags = PMinSize | PMaxSize | PSize;
- normalHints->min_width = xglScreenInfo.width;
- normalHints->min_height = xglScreenInfo.height;
- normalHints->max_width = xglScreenInfo.width;
- normalHints->max_height = xglScreenInfo.height;
-
- if (xglScreenInfo.fullscreen)
- {
- normalHints->x = 0;
- normalHints->y = 0;
- normalHints->flags |= PPosition;
- }
-
- classHint = XAllocClassHint ();
- classHint->res_name = "xglx";
- classHint->res_class = "Xglx";
-
- wmHints = XAllocWMHints ();
- wmHints->flags = InputHint;
- wmHints->input = TRUE;
-
- Xutf8SetWMProperties (xdisplay, pScreenPriv->win, "Xglx", "Xglx", 0, 0,
- normalHints, wmHints, classHint);
-
- XFree (wmHints);
- XFree (classHint);
- XFree (normalHints);
-
- drawable = glitz_glx_create_drawable_for_window (xdisplay, xscreen,
- format, pScreenPriv->win,
- xglScreenInfo.width,
- xglScreenInfo.height);
- if (!drawable)
- {
- ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
- return FALSE;
- }
-
- XSelectInput (xdisplay, pScreenPriv->win, ExposureMask);
- XMapWindow (xdisplay, pScreenPriv->win);
-
- if (xglScreenInfo.fullscreen)
- {
- XClientMessageEvent xev;
-
- memset (&xev, 0, sizeof (xev));
-
- xev.type = ClientMessage;
- xev.message_type = XInternAtom (xdisplay, "_NET_WM_STATE", FALSE);
- xev.display = xdisplay;
- xev.window = pScreenPriv->win;
- xev.format = 32;
- xev.data.l[0] = 1;
- xev.data.l[1] =
- XInternAtom (xdisplay, "_NET_WM_STATE_FULLSCREEN", FALSE);
-
- XSendEvent (xdisplay, root, FALSE, SubstructureRedirectMask,
- (XEvent *) &xev);
- }
-
- xglScreenInfo.drawable = drawable;
-
- if (!xglScreenInit (pScreen, &xglScreenInfo))
- return FALSE;
-
- XGL_SCREEN_WRAP (CloseScreen, xglxCloseScreen);
-
-#ifdef ARGB_CURSOR
- if (!xglxARGBCursorSupport ())
- softCursor = TRUE;
-#endif
-
- if (softCursor)
- {
- static char data = 0;
- XColor black, dummy;
- Pixmap bitmap;
- Cursor cursor;
-
- if (!XAllocNamedColor (xdisplay, pScreenPriv->colormap,
- "black", &black, &dummy))
- return FALSE;
-
- bitmap = XCreateBitmapFromData (xdisplay, pScreenPriv->win, &data,
- 1, 1);
- if (!bitmap)
- return FALSE;
-
- cursor = XCreatePixmapCursor (xdisplay, bitmap, bitmap, &black, &black,
- 0, 0);
- if (!cursor)
- return FALSE;
-
- XDefineCursor (xdisplay, pScreenPriv->win, cursor);
-
- XFreeCursor (xdisplay, cursor);
- XFreePixmap (xdisplay, bitmap);
- XFreeColors (xdisplay, pScreenPriv->colormap, &black.pixel, 1, 0);
-
- miDCInitialize (pScreen, &xglxPointerScreenFuncs);
- }
- else
- {
- pScreen->ConstrainCursor = xglxConstrainCursor;
- pScreen->CursorLimits = xglxCursorLimits;
- pScreen->DisplayCursor = xglxDisplayCursor;
- pScreen->RealizeCursor = xglxRealizeCursor;
- pScreen->UnrealizeCursor = xglxUnrealizeCursor;
- pScreen->RecolorCursor = xglxRecolorCursor;
- pScreen->SetCursorPosition = xglxSetCursorPosition;
- }
-
- if (!xglFinishScreenInit (pScreen))
- return FALSE;
-
- while (XNextEvent (xdisplay, &xevent))
- if (xevent.type == Expose)
- break;
-
- XSelectInput (xdisplay, pScreenPriv->win,
- ButtonPressMask | ButtonReleaseMask |
- KeyPressMask | KeyReleaseMask | EnterWindowMask |
- PointerMotionMask);
-
- return TRUE;
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
-{
- glitz_drawable_format_t *format, templ;
- int i;
- unsigned long mask;
- unsigned long extraMask[] = {
- GLITZ_FORMAT_PBUFFER_MASK |
- GLITZ_FORMAT_DOUBLEBUFFER_MASK,
- 0
- };
-
- xglSetPixmapFormats (pScreenInfo);
-
- if (!xdisplay)
- {
- xdisplay = XOpenDisplay (xDisplayName);
- if (!xdisplay)
- FatalError ("can't open display");
-
- xscreen = DefaultScreen (xdisplay);
- }
-
- templ.types.window = 1;
- templ.types.pbuffer = 1;
- templ.samples = 1;
- templ.doublebuffer = 1;
- templ.color.alpha_size = 8;
-
- mask =
- GLITZ_FORMAT_WINDOW_MASK |
- GLITZ_FORMAT_SAMPLES_MASK;
-
- for (i = 0; i < sizeof (extraMask) / sizeof (extraMask[0]); i++)
- {
- format = glitz_glx_find_drawable_format (xdisplay, xscreen,
- mask | extraMask[i],
- &templ, 0);
- if (format)
- break;
- }
-
- if (!format)
- FatalError ("no visual format found");
-
- xglSetVisualTypesAndMasks (pScreenInfo, format, (1 << TrueColor));
-
- xglInitVisuals (pScreenInfo);
-
- AddScreen (xglxScreenInit, argc, argv);
-}
-
-static void
-xglxBlockHandler (pointer blockData,
- OSTimePtr pTimeout,
- pointer pReadMask)
-{
- XGL_SCREEN_PRIV (currentScreen);
-
- if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
- FatalError (XGL_SW_FAILURE_STRING);
-
- glitz_surface_flush (pScreenPriv->surface);
- glitz_drawable_finish (pScreenPriv->drawable);
-
- XSync (xdisplay, FALSE);
-}
-
-static void
-xglxWakeupHandler (pointer blockData,
- int result,
- pointer pReadMask)
-{
- ScreenPtr pScreen = currentScreen;
- XEvent X;
- xEvent x;
-
- while (XPending (xdisplay)) {
- XNextEvent (xdisplay, &X);
-
- switch (X.type) {
- case KeyPress:
- x.u.u.type = KeyPress;
- x.u.u.detail = X.xkey.keycode;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
- mieqEnqueue (&x);
- break;
- case KeyRelease:
- x.u.u.type = KeyRelease;
- x.u.u.detail = X.xkey.keycode;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
- mieqEnqueue (&x);
- break;
- case ButtonPress:
- x.u.u.type = ButtonPress;
- x.u.u.detail = X.xbutton.button;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
- mieqEnqueue (&x);
- break;
- case ButtonRelease:
- x.u.u.type = ButtonRelease;
- x.u.u.detail = X.xbutton.button;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
- mieqEnqueue (&x);
- break;
- case MotionNotify:
- x.u.u.type = MotionNotify;
- x.u.keyButtonPointer.rootX = X.xmotion.x;
- x.u.keyButtonPointer.rootY = X.xmotion.y;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
- miPointerAbsoluteCursor (X.xmotion.x, X.xmotion.y, lastEventTime);
- mieqEnqueue (&x);
- break;
- case EnterNotify:
- if (X.xcrossing.detail != NotifyInferior) {
- if (pScreen) {
- NewCurrentScreen (pScreen, X.xcrossing.x, X.xcrossing.y);
- x.u.u.type = MotionNotify;
- x.u.keyButtonPointer.rootX = X.xcrossing.x;
- x.u.keyButtonPointer.rootY = X.xcrossing.y;
- x.u.keyButtonPointer.time = lastEventTime =
- GetTimeInMillis ();
- mieqEnqueue (&x);
- }
- }
- break;
- default:
- break;
- }
- }
-}
-
-static void
-xglxBell (int volume,
- DeviceIntPtr pDev,
- pointer ctrl,
- int cls)
-{
- XBell (xdisplay, volume);
-}
-
-static int
-xglxKeybdProc (DeviceIntPtr pDevice,
- int onoff)
-{
- Bool ret;
- DevicePtr pDev = (DevicePtr) pDevice;
-
- if (!pDev)
- return BadImplementation;
-
- switch (onoff) {
- case DEVICE_INIT: {
- XModifierKeymap *xmodMap;
- KeySym *xkeyMap;
- int minKeyCode, maxKeyCode, mapWidth, i, j;
- KeySymsRec xglxKeySyms;
- CARD8 xglxModMap[256];
- XKeyboardState values;
-
- if (pDev != LookupKeyboardDevice ())
- return !Success;
-
- xmodMap = XGetModifierMapping (xdisplay);
- XDisplayKeycodes (xdisplay, &minKeyCode, &maxKeyCode);
- xkeyMap = XGetKeyboardMapping (xdisplay,
- minKeyCode,
- maxKeyCode - minKeyCode + 1,
- &mapWidth);
-
- memset (xglxModMap, 0, 256);
-
- for (j = 0; j < 8; j++)
- {
- for (i = 0; i < xmodMap->max_keypermod; i++)
- {
- CARD8 keyCode;
-
- keyCode = xmodMap->modifiermap[j * xmodMap->max_keypermod + i];
- if (keyCode)
- xglxModMap[keyCode] |= 1 << j;
- }
- }
-
- XFreeModifiermap (xmodMap);
-
- xglxKeySyms.minKeyCode = minKeyCode;
- xglxKeySyms.maxKeyCode = maxKeyCode;
- xglxKeySyms.mapWidth = mapWidth;
- xglxKeySyms.map = xkeyMap;
-
- XGetKeyboardControl (xdisplay, &values);
-
- memmove (defaultKeyboardControl.autoRepeats,
- values.auto_repeats, sizeof (values.auto_repeats));
-
- ret = InitKeyboardDeviceStruct (pDev,
- &xglxKeySyms,
- xglxModMap,
- xglxBell,
- xglKbdCtrl);
-
- XFree (xkeyMap);
-
- if (!ret)
- return BadImplementation;
- } break;
- case DEVICE_ON:
- pDev->on = TRUE;
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- pDev->on = FALSE;
- break;
- }
-
- return Success;
-}
-
-Bool
-LegalModifier (unsigned int key,
- DevicePtr pDev)
-{
- return TRUE;
-}
-
-void
-ProcessInputEvents ()
-{
- mieqProcessInputEvents ();
- miPointerUpdate ();
-}
-
-void
-InitInput (int argc, char **argv)
-{
- DeviceIntPtr pKeyboard, pPointer;
-
- pPointer = AddInputDevice (xglMouseProc, TRUE);
- pKeyboard = AddInputDevice (xglxKeybdProc, TRUE);
-
- RegisterPointerDevice (pPointer);
- RegisterKeyboardDevice (pKeyboard);
-
- miRegisterPointerDevice (screenInfo.screens[0], pPointer);
- mieqInit (&pKeyboard->public, &pPointer->public);
-
- AddEnabledDevice (XConnectionNumber (xdisplay));
-
- RegisterBlockAndWakeupHandlers (xglxBlockHandler,
- xglxWakeupHandler,
- NULL);
-}
-
-void
-ddxUseMsg (void)
-{
- ErrorF ("\nXglx usage:\n");
- ErrorF ("-display string display name of the real server\n");
- ErrorF ("-softcursor force software cursor\n");
-
- xglUseMsg ();
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- if (!strcmp (argv[i], "-display"))
- {
- if (++i < argc) {
- xDisplayName = argv[i];
- return 2;
- }
- return 0;
- }
- else if (!strcmp (argv[i], "-softcursor"))
- {
- softCursor = TRUE;
- return 1;
- }
-
- return xglProcessArgument (&xglScreenInfo, argc, argv, i);
-}
-
-void
-AbortDDX (void)
-{
-}
-
-void
-ddxGiveUp ()
-{
- AbortDDX ();
-}
-
-void
-OsVendorInit (void)
-{
-}
-
-#ifdef ARGB_CURSOR
-
-#include <X11/extensions/Xrender.h>
-
-static Bool
-xglxARGBCursorSupport (void)
-{
- int renderMajor, renderMinor;
-
- if (!XRenderQueryVersion (xdisplay, &renderMajor, &renderMinor))
- renderMajor = renderMinor = -1;
-
- return (renderMajor > 0 || renderMinor > 4);
-}
-
-static Cursor
-xglxCreateARGBCursor (ScreenPtr pScreen,
- CursorPtr pCursor)
-{
- Pixmap xpixmap;
- GC xgc;
- XImage *ximage;
- XRenderPictFormat *xformat;
- Picture xpicture;
- Cursor cursor;
-
- XGLX_SCREEN_PRIV (pScreen);
-
- xpixmap = XCreatePixmap (xdisplay,
- pScreenPriv->win,
- pCursor->bits->width,
- pCursor->bits->height,
- 32);
-
- xgc = XCreateGC (xdisplay, xpixmap, 0, NULL);
-
- ximage = XCreateImage (xdisplay,
- DefaultVisual (xdisplay, xscreen),
- 32, ZPixmap, 0,
- (char *) pCursor->bits->argb,
- pCursor->bits->width,
- pCursor->bits->height,
- 32, pCursor->bits->width * 4);
-
- XPutImage (xdisplay, xpixmap, xgc, ximage,
- 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
- XFree (ximage);
- XFreeGC (xdisplay, xgc);
-
- xformat = XRenderFindStandardFormat (xdisplay, PictStandardARGB32);
- xpicture = XRenderCreatePicture (xdisplay, xpixmap, xformat, 0, 0);
-
- cursor = XRenderCreateCursor (xdisplay, xpicture,
- pCursor->bits->xhot,
- pCursor->bits->yhot);
-
- XRenderFreePicture (xdisplay, xpicture);
- XFreePixmap (xdisplay, xpixmap);
-
- return cursor;
-}
-
-#endif
diff --git a/hw/xgl/xgl.h b/hw/xgl/xgl.h
deleted file mode 100644
index b1094beff..000000000
--- a/hw/xgl/xgl.h
+++ /dev/null
@@ -1,1413 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef _XGL_H_
-#define _XGL_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/X.h>
-#define NEED_EVENTS
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include <glitz.h>
-
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "servermd.h"
-#include "mi.h"
-#include "dix.h"
-#include "damage.h"
-#include "gc.h"
-/* I'd like gc.h to provide this */
-typedef struct _GCFuncs *GCFuncsPtr;
-
-#ifdef RENDER
-#include "mipict.h"
-#endif
-
-extern WindowPtr *WindowTable;
-
-#define XGL_DEFAULT_PBO_MASK 0 /* don't use PBO as default */
-
-typedef struct _xglScreenInfo {
- glitz_drawable_t *drawable;
- unsigned int width;
- unsigned int height;
- unsigned int widthMm;
- unsigned int heightMm;
- Bool fullscreen;
- int geometryDataType;
- int geometryUsage;
- Bool yInverted;
- int pboMask;
- Bool lines;
-} xglScreenInfoRec, *xglScreenInfoPtr;
-
-typedef struct _xglPixelFormat {
- CARD8 depth, bitsPerRGB;
- glitz_pixel_masks_t masks;
-} xglPixelFormatRec, *xglPixelFormatPtr;
-
-typedef struct _xglVisual {
- glitz_drawable_format_t *format;
- xglPixelFormatPtr pPixel;
- unsigned long visuals;
-} xglVisualRec, *xglVisualPtr;
-
-typedef struct _xglPixmapFormat {
- glitz_format_t *format;
- xglPixelFormatPtr pPixel;
-} xglPixmapFormatRec, *xglPixmapFormatPtr;
-
-extern xglVisualPtr xglVisuals;
-extern int nxglVisuals;
-
-extern xglVisualPtr xglPbufferVisuals;
-extern int nxglPbufferVisuals;
-
-#define xglAreaAvailable 0
-#define xglAreaDivided 1
-#define xglAreaOccupied 2
-
-typedef struct _xglRootArea *xglRootAreaPtr;
-
-typedef struct _xglArea {
- int state;
- int level;
- int x, y;
- int width, height;
- struct _xglArea *pArea[4];
- xglRootAreaPtr pRoot;
- pointer closure;
- DevUnion devPrivate;
-} xglAreaRec, *xglAreaPtr;
-
-typedef struct _xglAreaFuncs {
- Bool (*Create) (xglAreaPtr pArea);
-
- Bool (*MoveIn) (xglAreaPtr pArea,
- pointer closure);
-
- void (*MoveOut) (xglAreaPtr pArea,
- pointer closure);
-
- int (*CompareScore) (xglAreaPtr pArea,
- pointer closure1,
- pointer closure2);
-
-} xglAreaFuncsRec, *xglAreaFuncsPtr;
-
-typedef struct _xglRootArea {
- int maxLevel;
- int width, height;
- xglAreaPtr pArea;
- xglAreaFuncsPtr funcs;
- int devPrivateSize;
- pointer closure;
-} xglRootAreaRec;
-
-typedef struct xglGeometry {
- glitz_buffer_t *buffer;
- pointer *data;
- Bool broken;
- glitz_fixed16_16_t xOff, yOff;
- int dataType;
- int usage;
- int size, endOffset;
- glitz_geometry_type_t type;
- glitz_geometry_format_t f;
- int first, width, count;
- glitz_multi_array_t *array;
-} xglGeometryRec, *xglGeometryPtr;
-
-#ifdef RENDER
-typedef struct _xglFBox {
- glitz_float_t x1, y1, x2, y2;
-} xglFBoxRec;
-
-typedef union _xglBox {
- BoxRec sBox;
- xglFBoxRec fBox;
-} xglBoxRec, *xglBoxPtr;
-
-typedef struct _xglRange {
- int first;
- unsigned int count;
-} xglRangeRec, *xglRangePtr;
-
-typedef struct _xglGlyphTexture {
- glitz_surface_t *mask;
- glitz_pixel_format_t pixel;
- glitz_geometry_format_t format;
- int geometryDataType;
-} xglGlyphTextureRec, *xglGlyphTexturePtr;
-
-typedef struct _xglGlyphArea {
- unsigned long serial;
- union {
- xglBoxRec box;
- xglRangeRec range;
- } u;
-} xglGlyphAreaRec, *xglGlyphAreaPtr;
-
-typedef struct _xglGlyphCache {
- ScreenPtr pScreen;
- int depth;
- xglRootAreaRec rootArea;
- union {
- xglGlyphTextureRec texture;
- xglGeometryRec geometry;
- } u;
-} xglGlyphCacheRec, *xglGlyphCachePtr;
-
-typedef struct _xglGlyph {
- xglAreaPtr pArea;
-} xglGlyphRec, *xglGlyphPtr;
-
-extern int xglGlyphPrivateIndex;
-
-#define XGL_GET_GLYPH_PRIV(pScreen, pGlyph) ((xglGlyphPtr) \
- (GetGlyphPrivatesForScreen (pGlyph, pScreen))[xglGlyphPrivateIndex].ptr)
-
-#define XGL_GLYPH_PRIV(pScreen, pGlyph) \
- xglGlyphPtr pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pGlyph)
-
-#endif
-
-#define XGL_MAX_OFFSCREEN_AREAS 8
-
-typedef struct _xglOffscreen {
- xglRootAreaRec rootArea;
- glitz_drawable_t *drawable;
- glitz_drawable_format_t *format;
- glitz_drawable_buffer_t buffer;
-} xglOffscreenRec, *xglOffscreenPtr;
-
-typedef struct _xglScreen {
- xglVisualPtr pVisual;
- xglPixmapFormatRec pixmapFormats[33];
- glitz_drawable_t *drawable;
- glitz_surface_t *surface;
- glitz_surface_t *solid;
- PixmapPtr pScreenPixmap;
- unsigned long features;
- xglOffscreenRec pOffscreen[XGL_MAX_OFFSCREEN_AREAS];
- int nOffscreen;
- int geometryUsage;
- int geometryDataType;
- Bool yInverted;
- int pboMask;
- Bool lines;
- xglGeometryRec scratchGeometry;
-
-#ifdef RENDER
- xglGlyphCacheRec glyphCache[33];
- PicturePtr pSolidAlpha;
- struct _trapInfo {
- PicturePtr pMask;
- glitz_surface_t *mask;
- glitz_geometry_format_t format;
- } trapInfo;
-#endif
-
- GetImageProcPtr GetImage;
- GetSpansProcPtr GetSpans;
- CreateWindowProcPtr CreateWindow;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- PaintWindowBackgroundProcPtr PaintWindowBackground;
- PaintWindowBorderProcPtr PaintWindowBorder;
- CopyWindowProcPtr CopyWindow;
- CreateGCProcPtr CreateGC;
- CloseScreenProcPtr CloseScreen;
- SetWindowPixmapProcPtr SetWindowPixmap;
- BitmapToRegionProcPtr BitmapToRegion;
-
-#ifdef RENDER
- CompositeProcPtr Composite;
- GlyphsProcPtr Glyphs;
- TrapezoidsProcPtr Trapezoids;
- AddTrapsProcPtr AddTraps;
- AddTrianglesProcPtr AddTriangles;
- ChangePictureProcPtr ChangePicture;
- ChangePictureTransformProcPtr ChangePictureTransform;
- ChangePictureFilterProcPtr ChangePictureFilter;
-
- RealizeGlyphProcPtr RealizeGlyph;
- UnrealizeGlyphProcPtr UnrealizeGlyph;
-#endif
-
- BSFuncRec BackingStoreFuncs;
-
-} xglScreenRec, *xglScreenPtr;
-
-extern int xglScreenPrivateIndex;
-
-#define XGL_GET_SCREEN_PRIV(pScreen) \
- ((xglScreenPtr) (pScreen)->devPrivates[xglScreenPrivateIndex].ptr)
-
-#define XGL_SET_SCREEN_PRIV(pScreen, v) \
- ((pScreen)->devPrivates[xglScreenPrivateIndex].ptr = (pointer) v)
-
-#define XGL_SCREEN_PRIV(pScreen) \
- xglScreenPtr pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen)
-
-#define XGL_SCREEN_WRAP(field, wrapper) \
- pScreenPriv->field = pScreen->field; \
- pScreen->field = wrapper
-
-#define XGL_SCREEN_UNWRAP(field) \
- pScreen->field = pScreenPriv->field
-
-#ifdef RENDER
-#define XGL_PICTURE_SCREEN_WRAP(field, wrapper) \
- pScreenPriv->field = pPictureScreen->field; \
- pPictureScreen->field = wrapper
-
-#define XGL_PICTURE_SCREEN_UNWRAP(field) \
- pPictureScreen->field = pScreenPriv->field
-#endif
-
-#define xglGCSoftwareDrawableFlag (1L << 0)
-#define xglGCReadOnlyDrawableFlag (1L << 1)
-#define xglGCBadFunctionFlag (1L << 2)
-#define xglGCPlaneMaskFlag (1L << 3)
-
-typedef struct _xglGC {
- glitz_color_t fg;
- glitz_color_t bg;
- glitz_operator_t op;
- unsigned long flags;
- GCFuncsPtr funcs;
- GCOpsPtr ops;
-} xglGCRec, *xglGCPtr;
-
-extern int xglGCPrivateIndex;
-
-#define XGL_GET_GC_PRIV(pGC) \
- ((xglGCPtr) (pGC)->devPrivates[xglGCPrivateIndex].ptr)
-
-#define XGL_GC_PRIV(pGC) \
- xglGCPtr pGCPriv = XGL_GET_GC_PRIV (pGC)
-
-#define XGL_GC_WRAP(field, wrapper) \
- pGCPriv->field = pGC->field; \
- pGC->field = wrapper
-
-#define XGL_GC_UNWRAP(field) \
- pGC->field = pGCPriv->field
-
-
-#define xglPCFillMask (1L << 0)
-#define xglPCFilterMask (1L << 1)
-#define xglPCTransformMask (1L << 2)
-#define xglPCComponentAlphaMask (1L << 3)
-#define xglPCDitherMask (1L << 4)
-
-#define xglPFFilterMask (1L << 8)
-
-#define xglPixmapTargetNo 0
-#define xglPixmapTargetOut 1
-#define xglPixmapTargetIn 2
-
-typedef struct _xglPixmap {
- xglPixelFormatPtr pPixel;
- glitz_format_t *format;
- glitz_surface_t *surface;
- glitz_buffer_t *buffer;
- int target;
- xglAreaPtr pArea;
- int score;
- Bool acceleratedTile;
- pointer bits;
- int stride;
- DamagePtr pDamage;
- BoxRec damageBox;
- BoxRec bitBox;
- Bool allBits;
- unsigned long pictureMask;
- xglGeometryPtr pGeometry;
- int lock;
-} xglPixmapRec, *xglPixmapPtr;
-
-extern int xglPixmapPrivateIndex;
-
-#define XGL_GET_PIXMAP_PRIV(pPixmap) \
- ((xglPixmapPtr) (pPixmap)->devPrivates[xglPixmapPrivateIndex].ptr)
-
-#define XGL_PIXMAP_PRIV(pPixmap) \
- xglPixmapPtr pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap)
-
-#define XGL_PICTURE_CHANGES(pictureMask) (pictureMask & 0x0000ffff)
-#define XGL_PICTURE_FAILURES(pictureMask) (pictureMask & 0xffff0000)
-
-typedef struct _xglWin {
- PixmapPtr pPixmap;
-} xglWinRec, *xglWinPtr;
-
-extern int xglWinPrivateIndex;
-
-#define XGL_GET_WINDOW_PRIV(pWin) \
- ((xglWinPtr) (pWin)->devPrivates[xglWinPrivateIndex].ptr)
-
-#define XGL_WINDOW_PRIV(pWin) \
- xglWinPtr pWinPriv = XGL_GET_WINDOW_PRIV (pWin)
-
-#define XGL_GET_WINDOW_PIXMAP(pWin) \
- (XGL_GET_WINDOW_PRIV((WindowPtr) (pWin))->pPixmap)
-
-
-#define XGL_GET_DRAWABLE_PIXMAP(pDrawable) \
- (((pDrawable)->type == DRAWABLE_WINDOW)? \
- XGL_GET_WINDOW_PIXMAP (pDrawable): \
- (PixmapPtr) (pDrawable))
-
-#define XGL_DRAWABLE_PIXMAP(pDrawable) \
- PixmapPtr pPixmap = XGL_GET_DRAWABLE_PIXMAP (pDrawable)
-
-#define XGL_GET_DRAWABLE_PIXMAP_PRIV(pDrawable) \
- XGL_GET_PIXMAP_PRIV (XGL_GET_DRAWABLE_PIXMAP (pDrawable))
-
-#define XGL_DRAWABLE_PIXMAP_PRIV(pDrawable) \
- xglPixmapPtr pPixmapPriv = XGL_GET_DRAWABLE_PIXMAP_PRIV (pDrawable)
-
-#ifdef COMPOSITE
-#define __XGL_OFF_X_WIN(pPix) (-(pPix)->screen_x)
-#define __XGL_OFF_Y_WIN(pPix) (-(pPix)->screen_y)
-#else
-#define __XGL_OFF_X_WIN(pPix) (0)
-#define __XGL_OFF_Y_WIN(pPix) (0)
-#endif
-
-#define XGL_GET_DRAWABLE(pDrawable, pSurface, xOff, yOff) \
- { \
- PixmapPtr _pPix; \
- if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
- _pPix = XGL_GET_WINDOW_PIXMAP (pDrawable); \
- (xOff) = __XGL_OFF_X_WIN (_pPix); \
- (yOff) = __XGL_OFF_Y_WIN (_pPix); \
- } else { \
- _pPix = (PixmapPtr) (pDrawable); \
- (yOff) = (xOff) = 0; \
- } \
- (pSurface) = XGL_GET_PIXMAP_PRIV (_pPix)->surface; \
- }
-
-#define XGL_DEFAULT_DPI 96
-
-#define XGL_SW_FAILURE_STRING "software fall-back failure"
-
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-
-#define POWER_OF_TWO(v) ((v & (v - 1)) == 0)
-
-#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
-
-#define FIXED_TO_FLOAT(f) (((glitz_float_t) (f)) / 65536)
-#define FLOAT_TO_FIXED(f) ((int) ((f) * 65536))
-
-#define BOX_NOTEMPTY(pBox) \
- (((pBox)->x2 - (pBox)->x1) > 0 && \
- ((pBox)->y2 - (pBox)->y1) > 0)
-
-#define XGL_MAX_PIXMAP_SCORE 32768
-#define XGL_MIN_PIXMAP_SCORE -32768
-
-#define XGL_INCREMENT_PIXMAP_SCORE(pPixmapPriv, incr) \
- { \
- (pPixmapPriv)->score += (incr); \
- if ((pPixmapPriv)->score > XGL_MAX_PIXMAP_SCORE) \
- (pPixmapPriv)->score = XGL_MAX_PIXMAP_SCORE; \
- }
-
-#define XGL_DECREMENT_PIXMAP_SCORE(pPixmapPriv, decr) \
- { \
- (pPixmapPriv)->score -= (decr); \
- if ((pPixmapPriv)->score < XGL_MIN_PIXMAP_SCORE) \
- (pPixmapPriv)->score = XGL_MIN_PIXMAP_SCORE; \
- }
-
-
-/* xglinput.c */
-
-int
-xglMouseProc (DeviceIntPtr pDevice,
- int onoff);
-
-int
-xglKeybdProc (DeviceIntPtr pDevice,
- int onoff);
-
-void
-xglBell (int volume,
- DeviceIntPtr pDev,
- pointer ctrl,
- int something);
-
-void
-xglKbdCtrl (DeviceIntPtr pDevice,
- KeybdCtrl *ctrl);
-
-void
-xglInitInput (int argc, char **argv);
-
-
-/* xgloutput.c */
-
-void
-xglSetPixmapFormats (ScreenInfo *pScreenInfo);
-
-
-/* xglcmap.c */
-
-void
-xglSetVisualTypesAndMasks (ScreenInfo *pScreenInfo,
- glitz_drawable_format_t *format,
- unsigned long visuals);
-
-void
-xglInitVisuals (ScreenInfo *pScreenInfo);
-
-void
-xglClearVisualTypes (void);
-
-void
-xglInitPixmapFormats (ScreenPtr pScreen);
-
-void
-xglPixelToColor (xglPixelFormatPtr pFormat,
- CARD32 pixel,
- glitz_color_t *color);
-
-
-/* xglparse.c */
-
-char *
-xglParseFindNext (char *cur,
- char *delim,
- char *save,
- char *last);
-
-void
-xglParseScreen (xglScreenInfoPtr pScreenInfo,
- char *arg);
-
-void
-xglUseMsg (void);
-
-int
-xglProcessArgument (xglScreenInfoPtr pScreenInfo,
- int argc,
- char **argv,
- int i);
-
-
-/* xglscreen.c */
-
-Bool
-xglScreenInit (ScreenPtr pScreen,
- xglScreenInfoPtr pScreenInfo);
-
-Bool
-xglFinishScreenInit (ScreenPtr pScreen);
-
-Bool
-xglCloseScreen (int index,
- ScreenPtr pScreen);
-
-void
-xglCreateSolidAlphaPicture (ScreenPtr pScreen);
-
-
-/* xglarea.c */
-
-Bool
-xglRootAreaInit (xglRootAreaPtr pRoot,
- int maxLevel,
- int width,
- int height,
- int devPrivateSize,
- xglAreaFuncsPtr funcs,
- pointer closure);
-
-void
-xglRootAreaFini (xglRootAreaPtr pRoot);
-
-void
-xglLeaveArea (xglAreaPtr pArea);
-
-void
-xglWithdrawArea (xglAreaPtr pArea);
-
-Bool
-xglFindArea (xglAreaPtr pArea,
- int width,
- int height,
- Bool kickOut,
- pointer closure);
-
-
-/* xgloffscreen.c */
-
-Bool
-xglInitOffscreen (ScreenPtr pScreen,
- xglScreenInfoPtr pScreenInfo);
-
-void
-xglFiniOffscreen (ScreenPtr pScreen);
-
-Bool
-xglFindOffscreenArea (ScreenPtr pScreen,
- PixmapPtr pPixmap);
-
-void
-xglLeaveOffscreenArea (PixmapPtr pPixmap);
-
-
-/* xglgeometry.c */
-
-#define GEOMETRY_DATA_TYPE_SHORT 0
-#define GEOMETRY_DATA_TYPE_FLOAT 1
-
-typedef struct _xglDataTypeInfo {
- glitz_data_type_t type;
- int size;
-} xglDataTypeInfoRec, *xglDataTypeInfoPtr;
-
-extern xglDataTypeInfoRec xglGeometryDataTypes[2];
-
-#define DEFAULT_GEOMETRY_DATA_TYPE GEOMETRY_DATA_TYPE_FLOAT
-
-#define GEOMETRY_USAGE_STREAM 0
-#define GEOMETRY_USAGE_STATIC 1
-#define GEOMETRY_USAGE_DYNAMIC 2
-#define GEOMETRY_USAGE_SYSMEM 3
-
-#define DEFAULT_GEOMETRY_USAGE GEOMETRY_USAGE_SYSMEM
-
-#define GEOMETRY_INIT(pScreen, pGeometry, _type, _usage, _size) \
- { \
- (pGeometry)->type = _type; \
- (pGeometry)->usage = _usage; \
- (pGeometry)->dataType = DEFAULT_GEOMETRY_DATA_TYPE; \
- (pGeometry)->usage = _usage; \
- (pGeometry)->size = 0; \
- (pGeometry)->endOffset = 0; \
- (pGeometry)->data = (pointer) 0; \
- (pGeometry)->buffer = NULL; \
- (pGeometry)->broken = FALSE; \
- (pGeometry)->xOff = 0; \
- (pGeometry)->yOff = 0; \
- (pGeometry)->array = NULL; \
- (pGeometry)->first = 0; \
- (pGeometry)->count = 0; \
- if (_type == GLITZ_GEOMETRY_TYPE_VERTEX) \
- { \
- (pGeometry)->width = 2; \
- (pGeometry)->f.vertex.type = \
- xglGeometryDataTypes[(pGeometry)->dataType].type; \
- (pGeometry)->f.vertex.bytes_per_vertex = (pGeometry)->width * \
- xglGeometryDataTypes[(pGeometry)->dataType].size; \
- (pGeometry)->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS; \
- (pGeometry)->f.vertex.attributes = 0; \
- (pGeometry)->f.vertex.src.type = GLITZ_DATA_TYPE_FLOAT; \
- (pGeometry)->f.vertex.src.size = GLITZ_COORDINATE_SIZE_X; \
- (pGeometry)->f.vertex.src.offset = 0; \
- (pGeometry)->f.vertex.mask.type = GLITZ_DATA_TYPE_FLOAT; \
- (pGeometry)->f.vertex.mask.size = GLITZ_COORDINATE_SIZE_X; \
- (pGeometry)->f.vertex.mask.offset = 0; \
- } \
- else \
- { \
- (pGeometry)->width = 0; \
- (pGeometry)->f.bitmap.scanline_order = \
- GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN; \
- (pGeometry)->f.bitmap.bytes_per_line = 0; \
- (pGeometry)->f.bitmap.pad = GLYPHPADBYTES; \
- } \
- if (_size) \
- xglGeometryResize (pScreen, pGeometry, _size); \
- }
-
-#define GEOMETRY_UNINIT(pGeometry) \
- { \
- if ((pGeometry)->array) \
- glitz_multi_array_destroy ((pGeometry)->array); \
- if ((pGeometry)->buffer) \
- glitz_buffer_destroy ((pGeometry)->buffer); \
- if ((pGeometry)->data) \
- xfree ((pGeometry)->data); \
- }
-
-#define GEOMETRY_SET_BUFFER(pGeometry, _buffer) \
- { \
- glitz_buffer_reference (_buffer); \
- if ((pGeometry)->buffer) \
- glitz_buffer_destroy ((pGeometry)->buffer); \
- (pGeometry)->buffer = _buffer; \
- }
-
-#define GEOMETRY_SET_MULTI_ARRAY(pGeometry, _array) \
- { \
- glitz_multi_array_reference (_array); \
- if ((pGeometry)->array) \
- glitz_multi_array_destroy ((pGeometry)->array); \
- (pGeometry)->array = _array; \
- }
-
-#define GEOMETRY_RESIZE(pScreen, pGeometry, size) \
- xglGeometryResize (pScreen, pGeometry, size)
-
-#define GEOMETRY_SET_TRANSLATE(pGeometry, _x, _y) \
- { \
- (pGeometry)->xOff = (_x) << 16; \
- (pGeometry)->yOff = (_y) << 16; \
- }
-
-#define GEOMETRY_TRANSLATE(pGeometry, tx, ty) \
- { \
- (pGeometry)->xOff += (tx) << 16; \
- (pGeometry)->yOff += (ty) << 16; \
- }
-
-#define GEOMETRY_TRANSLATE_FIXED(pGeometry, ftx, fty) \
- { \
- (pGeometry)->xOff += (ftx); \
- (pGeometry)->yOff += (fty); \
- }
-
-#define GEOMETRY_SET_VERTEX_PRIMITIVE(pGeometry, _primitive) \
- (pGeometry)->f.vertex.primitive = _primitive
-
-#define GEOMETRY_SET_VERTEX_DATA_TYPE(pGeometry, _type) \
- { \
- (pGeometry)->dataType = _type; \
- (pGeometry)->f.vertex.type = xglGeometryDataTypes[_type].type; \
- (pGeometry)->f.vertex.bytes_per_vertex = (pGeometry)->width * \
- xglGeometryDataTypes[_type].size; \
- }
-
-#define GEOMETRY_ADD_BOX(pScreen, pGeometry, pBox, nBox) \
- xglGeometryAddBox (pScreen, pGeometry, pBox, nBox, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_REGION_AT(pScreen, pGeometry, pRegion, offset) \
- xglGeometryAddBox (pScreen, pGeometry, \
- REGION_RECTS (pRegion), \
- REGION_NUM_RECTS (pRegion), \
- offset)
-
-#define GEOMETRY_ADD_REGION(pScreen, pGeometry, pRegion) \
- xglGeometryAddBox (pScreen, pGeometry, \
- REGION_RECTS (pRegion), \
- REGION_NUM_RECTS (pRegion), \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_SPAN(pScreen, pGeometry, ppt, pwidth, n) \
- xglGeometryAddSpan (pScreen, pGeometry, ppt, pwidth, n, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_LINE(pScreen, pGeometry, loop, mode, npt, ppt) \
- xglGeometryAddLine (pScreen, pGeometry, loop, mode, npt, ppt, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_SEGMENT(pScreen, pGeometry, nsegInit, pSegInit) \
- xglGeometryAddSegment (pScreen, pGeometry, nsegInit, pSegInit, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_FOR_GLYPH(pScreen, pGeometry, nGlyph, ppciInit, pglyphBase) \
- xglGeometryForGlyph (pScreen, pGeometry, nGlyph, ppciInit, pglyphBase);
-
-#define GEOMETRY_ADD_TRAPEZOID(pScreen, pGeometry, pTrap, nTrap) \
- xglGeometryAddTrapezoid (pScreen, pGeometry, pTrap, nTrap, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_TRAP(pScreen, pGeometry, pTrap, nTrap) \
- xglGeometryAddTrap (pScreen, pGeometry, pTrap, nTrap, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_GET_FORMAT(pGeometry, format) \
- xglGeometryGetFormat (pGeometry, format)
-
-#define GEOMETRY_ENABLE(pGeometry, surface) \
- xglSetGeometry (pGeometry, surface)
-
-#define GEOMETRY_DISABLE(surface) \
- glitz_set_geometry (surface, GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL)
-
-void
-xglGeometryResize (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int size);
-
-void
-xglGeometryAddBox (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- BoxPtr pBox,
- int nBox,
- int offset);
-
-void
-xglGeometryAddSpan (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- DDXPointPtr ppt,
- int *pwidth,
- int n,
- int offset);
-
-void
-xglGeometryAddLine (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int loop,
- int mode,
- int npt,
- DDXPointPtr ppt,
- int offset);
-
-void
-xglGeometryAddSegment (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int nsegInit,
- xSegment *pSegInit,
- int offset);
-
-void
-xglGeometryForGlyph (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- unsigned int nGlyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase);
-
-void
-xglGeometryAddTrapezoid (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- xTrapezoid *pTrap,
- int nTrap,
- int offset);
-
-void
-xglGeometryAddTrap (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- xTrap *pTrap,
- int nTrap,
- int offset);
-
-xglGeometryPtr
-xglGetScratchGeometryWithSize (ScreenPtr pScreen,
- int size);
-
-xglGeometryPtr
-xglGetScratchVertexGeometryWithType (ScreenPtr pScreen,
- int type,
- int count);
-
-xglGeometryPtr
-xglGetScratchVertexGeometry (ScreenPtr pScreen,
- int count);
-
-Bool
-xglSetGeometry (xglGeometryPtr pGeometry,
- glitz_surface_t *surface);
-
-
-/* xglpixmap.c */
-
-#define XGL_PIXMAP_USAGE_HINT_STREAM_DRAW 1
-#define XGL_PIXMAP_USAGE_HINT_STREAM_READ 2
-#define XGL_PIXMAP_USAGE_HINT_STREAM_COPY 3
-#define XGL_PIXMAP_USAGE_HINT_STATIC_DRAW 4
-#define XGL_PIXMAP_USAGE_HINT_STATIC_READ 5
-#define XGL_PIXMAP_USAGE_HINT_STATIC_COPY 6
-#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_DRAW 7
-#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_READ 8
-#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_COPY 9
-
-#define XGL_PIXMAP_USAGE_HINT_DEFAULT XGL_PIXMAP_USAGE_HINT_STREAM_DRAW
-
-PixmapPtr
-xglCreatePixmap (ScreenPtr pScreen,
- int width,
- int height,
- int depth);
-
-void
-xglFiniPixmap (PixmapPtr pPixmap);
-
-Bool
-xglDestroyPixmap (PixmapPtr pPixmap);
-
-Bool
-xglModifyPixmapHeader (PixmapPtr pPixmap,
- int width,
- int height,
- int depth,
- int bitsPerPixel,
- int devKind,
- pointer pPixData);
-
-RegionPtr
-xglPixmapToRegion (PixmapPtr pPixmap);
-
-xglGeometryPtr
-xglPixmapToGeometry (PixmapPtr pPixmap,
- int xOff,
- int yOff);
-
-Bool
-xglCreatePixmapSurface (PixmapPtr pPixmap);
-
-Bool
-xglAllocatePixmapBits (PixmapPtr pPixmap, int hint);
-
-Bool
-xglMapPixmapBits (PixmapPtr pPixmap);
-
-Bool
-xglUnmapPixmapBits (PixmapPtr pPixmap);
-
-
-/* xglsync.c */
-
-Bool
-xglSyncBits (DrawablePtr pDrawable,
- BoxPtr pExtents);
-
-void
-xglSyncDamageBoxBits (DrawablePtr pDrawable);
-
-Bool
-xglSyncSurface (DrawablePtr pDrawable);
-
-Bool
-xglPrepareTarget (DrawablePtr pDrawable);
-
-void
-xglAddSurfaceDamage (DrawablePtr pDrawable,
- RegionPtr pRegion);
-
-void
-xglAddCurrentSurfaceDamage (DrawablePtr pDrawable);
-
-void
-xglAddCurrentBitDamage (DrawablePtr pDrawable);
-
-
-/* xglsolid.c */
-
-Bool
-xglSolid (DrawablePtr pDrawable,
- glitz_operator_t op,
- glitz_color_t *color,
- xglGeometryPtr pGeometry,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox);
-
-Bool
-xglSolidGlyph (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nGlyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
-
-
-/* xgltile.c */
-
-xglGeometryPtr
-xglTiledBoxGeometry (PixmapPtr pTile,
- int tileX,
- int tileY,
- BoxPtr pBox,
- int nBox);
-
-Bool
-xglTile (DrawablePtr pDrawable,
- glitz_operator_t op,
- PixmapPtr pTile,
- int tileX,
- int tileY,
- xglGeometryPtr pGeometry,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox);
-
-
-/* xglcopy.c */
-
-Bool
-xglCopy (DrawablePtr pSrc,
- DrawablePtr pDst,
- int dx,
- int dy,
- BoxPtr pBox,
- int nBox);
-
-void
-xglCopyProc (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- BoxPtr pBox,
- int nBox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-
-/* xglfill.c */
-
-Bool
-xglFill (DrawablePtr pDrawable,
- GCPtr pGC,
- xglGeometryPtr pGeometry,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox);
-
-void
-xglFillSpan (DrawablePtr pDrawable,
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth);
-
-void
-xglFillRect (DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect);
-
-Bool
-xglFillLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
-
-Bool
-xglFillSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nsegInit,
- xSegment *pSegInit);
-
-Bool
-xglFillGlyph (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase);
-
-
-/* xglwindow.c */
-
-Bool
-xglCreateWindow (WindowPtr pWin);
-
-Bool
-xglChangeWindowAttributes (WindowPtr pWin,
- unsigned long mask);
-
-void
-xglCopyWindow (WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-
-void
-xglPaintWindowBackground (WindowPtr pWin,
- RegionPtr pRegion,
- int what);
-
-void
-xglPaintWindowBorder (WindowPtr pWin,
- RegionPtr pRegion,
- int what);
-
-
-/* xglbstore.c */
-
-void
-xglSaveAreas (PixmapPtr pPixmap,
- RegionPtr prgnSave,
- int xorg,
- int yorg,
- WindowPtr pWin);
-
-void
-xglRestoreAreas (PixmapPtr pPixmap,
- RegionPtr prgnRestore,
- int xorg,
- int yorg,
- WindowPtr pWin);
-
-
-/* xglget.c */
-
-void
-xglGetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d);
-
-void
-xglGetSpans (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart);
-
-
-/* xglgc.c */
-
-Bool
-xglCreateGC (GCPtr pGC);
-
-void
-xglValidateGC (GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable);
-
-void
-xglFillSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- int nspans,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted);
-
-void
-xglSetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *psrc,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted);
-
-void
-xglPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *bits);
-
-RegionPtr
-xglCopyArea (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcX,
- int srcY,
- int w,
- int h,
- int dstX,
- int dstY);
-
-RegionPtr
-xglCopyPlane (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcX,
- int srcY,
- int w,
- int h,
- int dstX,
- int dstY,
- unsigned long bitPlane);
-
-void
-xglPolyPoint (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit);
-
-void
-xglPolylines (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
-
-void
-xglPolySegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nsegInit,
- xSegment *pSegInit);
-
-void
-xglPolyArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *pArcs);
-
-void
-xglPolyFillRect (DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect);
-
-void
-xglPolyFillArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *pArcs);
-
-void
-xglImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
-
-void
-xglPolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
-void
-xglPushPixels (GCPtr pGC,
- PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w,
- int h,
- int x,
- int y);
-
-
-#ifdef MITSHM
-
-/* xglshm.c */
-
-void
-xglShmPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- unsigned int format,
- int w,
- int h,
- int sx,
- int sy,
- int sw,
- int sh,
- int dx,
- int dy,
- char *data);
-
-#endif
-
-
-#ifdef RENDER
-
-/* xglcomp.c */
-
-Bool
-xglComp (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height,
- xglGeometryPtr pGeometry,
- glitz_surface_t *mask);
-
-
-/* xglpict.c */
-
-void
-xglComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void
-xglAddTriangles (PicturePtr pDst,
- INT16 xOff,
- INT16 yOff,
- int ntri,
- xTriangle *tris);
-
-void
-xglChangePicture (PicturePtr pPicture,
- Mask mask);
-
-int
-xglChangePictureTransform (PicturePtr pPicture,
- PictTransform *transform);
-
-int
-xglChangePictureFilter (PicturePtr pPicture,
- int filter,
- xFixed *params,
- int nparams);
-
-void
-xglUpdatePicture (PicturePtr pPicture);
-
-Bool
-xglPictureInit (ScreenPtr pScreen);
-
-void
-xglPictureClipExtents (PicturePtr pPicture,
- BoxPtr extents);
-
-/* xglglyph.c */
-
-Bool
-xglRealizeGlyph (ScreenPtr pScreen,
- GlyphPtr pGlyph);
-
-void
-xglUnrealizeGlyph (ScreenPtr pScreen,
- GlyphPtr pGlyph);
-
-Bool
-xglInitGlyphCache (xglGlyphCachePtr pCache,
- ScreenPtr pScreen,
- PictFormatPtr format);
-
-void
-xglFiniGlyphCache (xglGlyphCachePtr pCache);
-
-void
-xglGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
-
-
-/* xgltrap.c */
-
-void
-xglTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nTrap,
- xTrapezoid *traps);
-
-void
-xglAddTraps (PicturePtr pDst,
- INT16 xOff,
- INT16 yOff,
- int nTrap,
- xTrap *traps);
-
-#endif
-
-#ifdef GLXEXT
-
-typedef struct _xglHashTable *xglHashTablePtr;
-
-xglHashTablePtr
-xglNewHashTable (void);
-
-void
-xglDeleteHashTable (xglHashTablePtr pTable);
-
-void *
-xglHashLookup (const xglHashTablePtr pTable,
- unsigned int key);
-
-void
-xglHashInsert (xglHashTablePtr pTable,
- unsigned int key,
- void *data);
-
-void
-xglHashRemove (xglHashTablePtr pTable,
- unsigned int key);
-
-unsigned int
-xglHashFirstEntry (xglHashTablePtr pTable);
-
-unsigned int
-xglHashNextEntry (const xglHashTablePtr pTable,
- unsigned int key);
-
-unsigned int
-xglHashFindFreeKeyBlock (xglHashTablePtr pTable,
- unsigned int numKeys);
-
-Bool
-xglInitVisualConfigs (ScreenPtr pScreen);
-
-#endif
-
-#endif /* _XGL_H_ */
diff --git a/hw/xgl/xglarea.c b/hw/xgl/xglarea.c
deleted file mode 100644
index 849f1a72e..000000000
--- a/hw/xgl/xglarea.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-static Bool
-xglAreaMoveIn (xglAreaPtr pArea,
- pointer closure)
-{
- pArea->closure = closure;
- pArea->state = xglAreaOccupied;
-
- return (*pArea->pRoot->funcs->MoveIn) (pArea, closure);
-}
-
-static void
-xglAreaMoveOut (xglAreaPtr pArea)
-{
- (*pArea->pRoot->funcs->MoveOut) (pArea, pArea->closure);
-
- pArea->closure = (pointer) 0;
- pArea->state = xglAreaAvailable;
-}
-
-static xglAreaPtr
-xglAreaCreate (xglRootAreaPtr pRoot,
- int level,
- int x,
- int y,
- int width,
- int height)
-{
- xglAreaPtr pArea;
- int n = 4;
-
- pArea = xalloc (sizeof (xglAreaRec) + pRoot->devPrivateSize);
- if (!pArea)
- return NULL;
-
- pArea->level = level;
- pArea->x = x;
- pArea->y = y;
- pArea->width = width;
- pArea->height = height;
- pArea->pRoot = pRoot;
- pArea->closure = (pointer) 0;
- pArea->state = xglAreaAvailable;
-
- while (n--)
- pArea->pArea[n] = NULL;
-
- if (pRoot->devPrivateSize)
- pArea->devPrivate.ptr = pArea + 1;
- else
- pArea->devPrivate.ptr = (pointer) 0;
-
- if (!(*pArea->pRoot->funcs->Create) (pArea))
- {
- free (pArea);
- return NULL;
- }
-
- return pArea;
-}
-
-static void
-xglAreaDestroy (xglAreaPtr pArea)
-{
- if (!pArea)
- return;
-
- if (pArea->state == xglAreaOccupied)
- {
- xglAreaMoveOut (pArea);
- }
- else
- {
- int n = 4;
-
- while (n--)
- xglAreaDestroy (pArea->pArea[n]);
- }
-
- xfree (pArea);
-}
-
-static xglAreaPtr
-xglAreaGetTopScoredSubArea (xglAreaPtr pArea)
-{
- if (!pArea)
- return NULL;
-
- switch (pArea->state) {
- case xglAreaOccupied:
- return pArea;
- case xglAreaAvailable:
- break;
- case xglAreaDivided: {
- xglAreaPtr tmp, top = NULL;
- int i;
-
- for (i = 0; i < 4; i++)
- {
- tmp = xglAreaGetTopScoredSubArea (pArea->pArea[i]);
- if (tmp && top)
- {
- if ((*pArea->pRoot->funcs->CompareScore) (tmp,
- tmp->closure,
- top->closure) > 0)
- top = tmp;
- }
- else if (tmp)
- {
- top = tmp;
- }
- }
- return top;
- }
- }
-
- return NULL;
-}
-
-static Bool
-xglAreaFind (xglAreaPtr pArea,
- int width,
- int height,
- Bool kickOut,
- pointer closure)
-{
- if (pArea->width < width || pArea->height < height)
- return FALSE;
-
- switch (pArea->state) {
- case xglAreaOccupied:
- if (kickOut)
- {
- if ((*pArea->pRoot->funcs->CompareScore) (pArea,
- pArea->closure,
- closure) >= 0)
- return FALSE;
-
- xglAreaMoveOut (pArea);
- } else
- return FALSE;
-
- /* fall-through */
- case xglAreaAvailable:
- {
- if (pArea->level == pArea->pRoot->maxLevel ||
- (pArea->width == width && pArea->height == height))
- {
- if (xglAreaMoveIn (pArea, closure))
- return TRUE;
- }
- else
- {
- int dx[4], dy[4], w[4], h[4], i;
-
- dx[0] = dx[2] = dy[0] = dy[1] = 0;
-
- w[0] = w[2] = dx[1] = dx[3] = width;
- h[0] = h[1] = dy[2] = dy[3] = height;
-
- w[1] = w[3] = pArea->width - width;
- h[2] = h[3] = pArea->height - height;
-
- for (i = 0; i < 2; i++)
- {
- if (w[i])
- pArea->pArea[i] =
- xglAreaCreate (pArea->pRoot,
- pArea->level + 1,
- pArea->x + dx[i],
- pArea->y + dy[i],
- w[i], h[i]);
- }
-
- for (; i < 4; i++)
- {
- if (w[i] && h[i])
- pArea->pArea[i] =
- xglAreaCreate (pArea->pRoot,
- pArea->level + 1,
- pArea->x + dx[i],
- pArea->y + dy[i],
- w[i], h[i]);
- }
-
- pArea->state = xglAreaDivided;
-
- if (xglAreaFind (pArea->pArea[0], width, height, kickOut, closure))
- return TRUE;
- }
- } break;
- case xglAreaDivided:
- {
- xglAreaPtr topArea;
- int i, rejected = FALSE;
-
- for (i = 0; i < 4; i++)
- {
- if (pArea->pArea[i])
- {
- if (pArea->pArea[i]->width >= width &&
- pArea->pArea[i]->height >= height)
- {
- if (xglFindArea (pArea->pArea[i], width, height, kickOut,
- closure))
- return TRUE;
-
- rejected = TRUE;
- }
- }
- }
-
- if (rejected)
- return FALSE;
-
- topArea = xglAreaGetTopScoredSubArea (pArea);
- if (topArea)
- {
- if (kickOut)
- {
- if ((*pArea->pRoot->funcs->CompareScore) (topArea,
- topArea->closure,
- closure) >= 0)
- return FALSE;
- } else
- return FALSE;
- }
-
- for (i = 0; i < 4; i++)
- {
- xglAreaDestroy (pArea->pArea[i]);
- pArea->pArea[i] = NULL;
- }
-
- pArea->closure = (pointer) 0;
- pArea->state = xglAreaAvailable;
- if (xglFindArea (pArea, width, height, TRUE, closure))
- return TRUE;
-
- } break;
- }
-
- return FALSE;
-}
-
-Bool
-xglRootAreaInit (xglRootAreaPtr pRoot,
- int maxLevel,
- int width,
- int height,
- int devPrivateSize,
- xglAreaFuncsPtr funcs,
- pointer closure)
-{
- pRoot->maxLevel = maxLevel;
- pRoot->funcs = funcs;
- pRoot->devPrivateSize = devPrivateSize;
- pRoot->closure = closure;
-
- pRoot->pArea = xglAreaCreate (pRoot, 0, 0, 0, width, height);
- if (!pRoot->pArea)
- return FALSE;
-
- return TRUE;
-}
-
-void
-xglRootAreaFini (xglRootAreaPtr pRoot)
-{
- xglAreaDestroy (pRoot->pArea);
-}
-
-void
-xglLeaveArea (xglAreaPtr pArea)
-{
- xglAreaMoveOut (pArea);
-}
-
-void
-xglWithdrawArea (xglAreaPtr pArea)
-{
- pArea->closure = NULL;
- pArea->state = xglAreaAvailable;
-}
-
-Bool
-xglFindArea (xglAreaPtr pArea,
- int width,
- int height,
- Bool kickOut,
- pointer closure)
-{
- if (width < 1 || height < 0)
- return FALSE;
-
- return xglAreaFind (pArea, width, height, kickOut, closure);
-}
diff --git a/hw/xgl/xglbstore.c b/hw/xgl/xglbstore.c
deleted file mode 100644
index 65b4bbf5c..000000000
--- a/hw/xgl/xglbstore.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-#define XGL_BSTORE_FALLBACK_PROLOGUE(pDrawable, func) \
- xglSyncDamageBoxBits (pDrawable); \
- XGL_SCREEN_UNWRAP (func)
-
-#define XGL_BSTORE_FALLBACK_EPILOGUE(pDrawable, func, xglfunc) \
- XGL_SCREEN_WRAP (func, xglfunc); \
- xglAddCurrentSurfaceDamage (pDrawable)
-
-/*
- * The follwong functions are not yet tested so we can assume that they
- * are both broken.
- */
-
-void
-xglSaveAreas (PixmapPtr pPixmap,
- RegionPtr prgnSave,
- int xorg,
- int yorg,
- WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- BoxRec box;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_PIXMAP_PRIV (pPixmap);
-
- box = *(REGION_EXTENTS (pScreen, prgnSave));
-
- pPixmapPriv->damageBox = box;
-
- if (xglCopy (&pWin->drawable,
- &pPixmap->drawable,
- xorg, yorg,
- REGION_RECTS (prgnSave),
- REGION_NUM_RECTS (prgnSave)))
- {
- xglAddCurrentBitDamage (&pPixmap->drawable);
- return;
- }
-
- box.x1 += xorg;
- box.y1 += yorg;
- box.x2 += xorg;
- box.y2 += yorg;
-
- if (!xglSyncBits (&pWin->drawable, &box))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_BSTORE_FALLBACK_PROLOGUE (&pPixmap->drawable,
- BackingStoreFuncs.RestoreAreas);
- (*pScreen->BackingStoreFuncs.SaveAreas) (pPixmap, prgnSave,
- xorg, yorg, pWin);
- XGL_BSTORE_FALLBACK_EPILOGUE (&pPixmap->drawable,
- BackingStoreFuncs.SaveAreas,
- xglSaveAreas);
-}
-
-void
-xglRestoreAreas (PixmapPtr pPixmap,
- RegionPtr prgnRestore,
- int xorg,
- int yorg,
- WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- BoxPtr pExt;
- BoxRec box;
-
- XGL_SCREEN_PRIV (pScreen);
-
- if (xglCopy (&pPixmap->drawable,
- &pWin->drawable,
- -xorg, -yorg,
- REGION_RECTS (prgnRestore),
- REGION_NUM_RECTS (prgnRestore)))
- {
- xglAddCurrentBitDamage (&pPixmap->drawable);
- return;
- }
-
- pExt = REGION_EXTENTS (pScreen, prgnRestore);
-
- box.x1 = pExt->x1 - xorg;
- box.y1 = pExt->y1 - yorg;
- box.x2 = pExt->x2 - xorg;
- box.y2 = pExt->y2 - yorg;
-
- if (!xglSyncBits (&pPixmap->drawable, &box))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_BSTORE_FALLBACK_PROLOGUE (&pWin->drawable,
- BackingStoreFuncs.RestoreAreas);
- (*pScreen->BackingStoreFuncs.RestoreAreas) (pPixmap, prgnRestore,
- xorg, yorg, pWin);
- XGL_BSTORE_FALLBACK_EPILOGUE (&pWin->drawable,
- BackingStoreFuncs.RestoreAreas,
- xglRestoreAreas);
-}
diff --git a/hw/xgl/xglcmap.c b/hw/xgl/xglcmap.c
deleted file mode 100644
index 251616549..000000000
--- a/hw/xgl/xglcmap.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "colormapst.h"
-#include "micmap.h"
-#include "fb.h"
-
-static xglPixelFormatRec xglPixelFormats[] = {
- {
- 8, 8,
- {
- 8,
- 0x000000ff,
- 0x00000000,
- 0x00000000,
- 0x00000000
- }
- }, {
- 15, 5,
- {
- 16,
- 0x00000000,
- 0x00007c00,
- 0x000003e0,
- 0x0000001f
- }
- }, {
- 16, 6,
- {
- 16,
- 0x00000000,
- 0x0000f800,
- 0x000007e0,
- 0x0000001f
- }
- }, {
- 24, 8,
- {
- 32,
- 0x00000000,
- 0x00ff0000,
- 0x0000ff00,
- 0x000000ff
- }
- }, {
- 32, 8,
- {
- 32,
- 0xff000000,
- 0x00ff0000,
- 0x0000ff00,
- 0x000000ff
- }
- }
-};
-
-#define NUM_XGL_PIXEL_FORMATS \
- (sizeof (xglPixelFormats) / sizeof (xglPixelFormats[0]))
-
-xglVisualPtr xglVisuals = NULL;
-int nxglVisuals = 0;
-
-xglVisualPtr xglPbufferVisuals = NULL;
-int nxglPbufferVisuals = 0;
-
-static xglPixelFormatPtr
-xglFindPixelFormat (glitz_drawable_format_t *format,
- int visuals)
-{
- glitz_color_format_t *color;
- int depth, i;
-
- color = &format->color;
-
- depth = color->red_size + color->green_size + color->blue_size;
-
- if (!visuals)
- depth += color->alpha_size;
-
- for (i = 0; i < NUM_XGL_PIXEL_FORMATS; i++)
- {
- if (xglPixelFormats[i].depth == depth)
- {
- xglPixelFormatPtr pPixel;
-
- pPixel = &xglPixelFormats[i];
- if (Ones (pPixel->masks.red_mask) == color->red_size &&
- Ones (pPixel->masks.green_mask) == color->green_size &&
- Ones (pPixel->masks.blue_mask) == color->blue_size)
- {
-
- if (visuals)
- return pPixel;
-
- if (Ones (pPixel->masks.alpha_mask) == color->alpha_size)
- return pPixel;
- }
- }
- }
-
- return NULL;
-}
-
-void
-xglSetVisualTypesAndMasks (ScreenInfo *pScreenInfo,
- glitz_drawable_format_t *format,
- unsigned long visuals)
-{
- xglPixelFormatPtr pPixelFormat;
-
- pPixelFormat = xglFindPixelFormat (format, visuals);
- if (pPixelFormat)
- {
- if (visuals && format->types.window)
- {
- xglVisuals = xrealloc (xglVisuals,
- (nxglVisuals + 1) * sizeof (xglVisualRec));
-
- if (xglVisuals)
- {
- xglVisuals[nxglVisuals].format = format;
- xglVisuals[nxglVisuals].pPixel = pPixelFormat;
- xglVisuals[nxglVisuals].visuals = visuals;
- nxglVisuals++;
- }
- }
-
- if (format->types.pbuffer)
- {
- xglPbufferVisuals =
- xrealloc (xglPbufferVisuals,
- (nxglPbufferVisuals + 1) * sizeof (xglVisualRec));
-
- if (xglPbufferVisuals)
- {
- xglPbufferVisuals[nxglPbufferVisuals].format = format;
- xglPbufferVisuals[nxglPbufferVisuals].pPixel = NULL;
- xglPbufferVisuals[nxglPbufferVisuals].visuals = 0;
- nxglPbufferVisuals++;
- }
- }
- }
-}
-
-void
-xglInitVisuals (ScreenInfo *pScreenInfo)
-{
- int i, j;
-
- for (i = 0; i < pScreenInfo->numPixmapFormats; i++)
- {
- unsigned long visuals;
- unsigned int bitsPerRGB;
- Pixel rm, gm, bm;
-
- visuals = 0;
- bitsPerRGB = 0;
- rm = gm = bm = 0;
-
- for (j = 0; j < nxglVisuals; j++)
- {
- if (pScreenInfo->formats[i].depth == xglVisuals[j].pPixel->depth)
- {
- visuals = xglVisuals[j].visuals;
- bitsPerRGB = xglVisuals[j].pPixel->bitsPerRGB;
-
- rm = xglVisuals[j].pPixel->masks.red_mask;
- gm = xglVisuals[j].pPixel->masks.green_mask;
- bm = xglVisuals[j].pPixel->masks.blue_mask;
-
- fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
- visuals, bitsPerRGB,
- rm, gm, bm);
- }
- }
-
- if (!visuals)
- {
- for (j = 0; j < NUM_XGL_PIXEL_FORMATS; j++)
- {
- if (pScreenInfo->formats[i].depth == xglPixelFormats[j].depth)
- {
- bitsPerRGB = xglPixelFormats[j].bitsPerRGB;
-
- rm = xglPixelFormats[j].masks.red_mask;
- gm = xglPixelFormats[j].masks.green_mask;
- bm = xglPixelFormats[j].masks.blue_mask;
- break;
- }
- }
-
- fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
- visuals, bitsPerRGB,
- rm, gm, bm);
- }
- }
-}
-
-void
-xglClearVisualTypes (void)
-{
- nxglVisuals = 0;
- nxglPbufferVisuals = 0;
-
- if (xglVisuals)
- xfree (xglVisuals);
-
- if (xglPbufferVisuals)
- xfree (xglPbufferVisuals);
-
- xglVisuals = NULL;
- xglPbufferVisuals = NULL;
-
- miClearVisualTypes ();
-}
-
-void
-xglInitPixmapFormats (ScreenPtr pScreen)
-{
- glitz_format_t *format, **best;
- int i, j;
-
- XGL_SCREEN_PRIV (pScreen);
-
- for (i = 0; i < 33; i++)
- {
- pScreenPriv->pixmapFormats[i].pPixel = NULL;
- pScreenPriv->pixmapFormats[i].format = NULL;
-
- for (j = 0; j < NUM_XGL_PIXEL_FORMATS; j++)
- {
- if (xglPixelFormats[j].depth == i)
- {
- int rs, gs, bs, as, k;
-
- pScreenPriv->pixmapFormats[i].pPixel = &xglPixelFormats[j];
- pScreenPriv->pixmapFormats[i].format = NULL;
- best = &pScreenPriv->pixmapFormats[i].format;
-
- rs = Ones (xglPixelFormats[j].masks.red_mask);
- gs = Ones (xglPixelFormats[j].masks.green_mask);
- bs = Ones (xglPixelFormats[j].masks.blue_mask);
- as = Ones (xglPixelFormats[j].masks.alpha_mask);
-
- k = 0;
- do {
- format = glitz_find_format (pScreenPriv->drawable,
- 0, NULL, k++);
- if (format && format->type == GLITZ_FORMAT_TYPE_COLOR)
- {
- /* find best matching sufficient format */
- if (format->color.red_size >= rs &&
- format->color.green_size >= gs &&
- format->color.blue_size >= bs &&
- format->color.alpha_size >= as)
- {
- if (*best)
- {
- if (((format->color.red_size - rs) +
- (format->color.green_size - gs) +
- (format->color.blue_size - bs)) <
- (((*best)->color.red_size - rs) +
- ((*best)->color.green_size - gs) +
- ((*best)->color.blue_size - bs)))
- *best = format;
- } else
- *best = format;
- }
- }
- } while (format);
- }
- }
- }
-}
-
-#define PIXEL_TO_COLOR(p, mask) \
- (((uint32_t) ((((uint64_t) (((uint32_t) (p)) & (mask))) * 0xffffffff) / \
- ((uint64_t) (mask)))))
-
-#define PIXEL_TO_RGB_COLOR(p, mask) \
- ((mask)? PIXEL_TO_COLOR (p, mask): 0)
-
-void
-xglPixelToColor (xglPixelFormatPtr pFormat,
- CARD32 pixel,
- glitz_color_t *color)
-{
- color->red = PIXEL_TO_RGB_COLOR (pixel, pFormat->masks.red_mask);
- color->green = PIXEL_TO_RGB_COLOR (pixel, pFormat->masks.green_mask);
- color->blue = PIXEL_TO_RGB_COLOR (pixel, pFormat->masks.blue_mask);
-
- if (pFormat->masks.alpha_mask)
- color->alpha = PIXEL_TO_COLOR (pixel, pFormat->masks.alpha_mask);
- else
- color->alpha = 0xffff;
-}
diff --git a/hw/xgl/xglcomp.c b/hw/xgl/xglcomp.c
deleted file mode 100644
index 3d153f34c..000000000
--- a/hw/xgl/xglcomp.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-#ifdef RENDER
-
-static glitz_operator_t xglOperators[] = {
- GLITZ_OPERATOR_CLEAR,
- GLITZ_OPERATOR_SRC,
- GLITZ_OPERATOR_DST,
- GLITZ_OPERATOR_OVER,
- GLITZ_OPERATOR_OVER_REVERSE,
- GLITZ_OPERATOR_IN,
- GLITZ_OPERATOR_IN_REVERSE,
- GLITZ_OPERATOR_OUT,
- GLITZ_OPERATOR_OUT_REVERSE,
- GLITZ_OPERATOR_ATOP,
- GLITZ_OPERATOR_ATOP_REVERSE,
- GLITZ_OPERATOR_XOR,
- GLITZ_OPERATOR_ADD
-};
-
-#define NUM_XGL_OPERATORS \
- (sizeof (xglOperators) / sizeof (xglOperators[0]))
-
-#define XGL_OPERATOR(op) (xglOperators[op])
-
-Bool
-xglComp (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height,
- xglGeometryPtr pGeometry,
- glitz_surface_t *mask)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- xglPixmapPtr pSrcPriv;
- glitz_surface_t *src, *dst;
- int dstXoff, dstYoff;
- RegionRec region;
- BoxPtr pBox;
- int nBox;
-
- if (pDst->alphaMap)
- return FALSE;
-
- if (op >= NUM_XGL_OPERATORS)
- return FALSE;
-
- if (pSrc->pDrawable->type != DRAWABLE_PIXMAP)
- return FALSE;
-
- if (pSrc->pDrawable->bitsPerPixel == 1)
- return FALSE;
-
- if (pMask)
- {
- if (pMask->pDrawable->type != DRAWABLE_PIXMAP)
- return FALSE;
-
- if (pSrc->pDrawable == pMask->pDrawable && pSrc != pMask)
- return FALSE;
- }
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask,
- xDst, yDst, width, height))
- return TRUE;
-
- pBox = REGION_RECTS (&region);
- nBox = REGION_NUM_RECTS (&region);
-
- if (!xglPrepareTarget (pDst->pDrawable))
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
-
- XGL_GET_DRAWABLE (pDst->pDrawable, dst, dstXoff, dstYoff);
-
- if (!xglSyncSurface (pSrc->pDrawable))
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
-
- pSrcPriv = XGL_GET_PIXMAP_PRIV ((PixmapPtr) pSrc->pDrawable);
- if (XGL_PICTURE_CHANGES (pSrcPriv->pictureMask))
- xglUpdatePicture (pSrc);
-
- src = pSrcPriv->surface;
-
- if (pMask)
- {
- xglPixmapPtr pMaskPriv;
-
- /* bitmap as mask */
- if (pMask->pDrawable->bitsPerPixel == 1)
- {
- if (pGeometry)
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
-
- pGeometry =
- xglPixmapToGeometry ((PixmapPtr) pMask->pDrawable,
- xDst - xMask,
- yDst - yMask);
- if (!pGeometry)
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
- }
- else
- {
- if (!xglSyncSurface (pMask->pDrawable))
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
-
- pMaskPriv = XGL_GET_PIXMAP_PRIV ((PixmapPtr) pMask->pDrawable);
- if (XGL_PICTURE_CHANGES (pMaskPriv->pictureMask))
- xglUpdatePicture (pMask);
-
- mask = pMaskPriv->surface;
- }
- }
-
- if (!pGeometry)
- {
- if (!pSrc->transform && pSrc->filter != PictFilterConvolution)
- {
- if (pSrc->repeat)
- {
- /* tile */
- if (!pSrcPriv->acceleratedTile)
- {
- pGeometry =
- xglTiledBoxGeometry ((PixmapPtr) pSrc->pDrawable,
- xSrc - xDst, ySrc - yDst,
- pBox, nBox);
- if (!pGeometry)
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
-
- pBox = REGION_EXTENTS (pScreen, &region);
- nBox = 1;
- }
- }
- else
- {
- /* copy */
- if (op == PictOpSrc && !mask)
- {
- if (xglCopy (pSrc->pDrawable,
- pDst->pDrawable,
- xSrc - xDst,
- ySrc - yDst,
- pBox,
- nBox))
- {
- REGION_UNINIT (pScreen, &region);
- return TRUE;
- }
- }
- }
- }
-
- if (nBox > 1)
- {
- pGeometry = xglGetScratchVertexGeometry (pScreen, 4 * nBox);
-
- GEOMETRY_ADD_BOX (pScreen, pGeometry, pBox, nBox);
-
- pBox = REGION_EXTENTS (pScreen, &region);
- }
-
- xSrc += pBox->x1 - xDst;
- ySrc += pBox->y1 - yDst;
-
- if (pMask)
- {
- xMask += pBox->x1 - xDst;
- yMask += pBox->y1 - yDst;
- }
-
- xDst = pBox->x1;
- yDst = pBox->y1;
-
- width = pBox->x2 - pBox->x1;
- height = pBox->y2 - pBox->y1;
- }
- else
- {
- glitz_surface_set_clip_region (dst,
- dstXoff, dstYoff,
- (glitz_box_t *) pBox, nBox);
- }
-
- if (pGeometry)
- {
- GEOMETRY_TRANSLATE (pGeometry, dstXoff, dstYoff);
-
- if (!GEOMETRY_ENABLE (pGeometry, dst))
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
- } else
- GEOMETRY_DISABLE (dst);
-
- glitz_composite (XGL_OPERATOR (op),
- src, mask, dst,
- xSrc, ySrc,
- xMask, yMask,
- xDst + dstXoff, yDst + dstYoff,
- width, height);
-
- glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
-
- REGION_UNINIT (pScreen, &region);
-
- if (glitz_surface_get_status (dst))
- return FALSE;
-
- return TRUE;
-}
-
-#endif
diff --git a/hw/xgl/xglcopy.c b/hw/xgl/xglcopy.c
deleted file mode 100644
index 83895d385..000000000
--- a/hw/xgl/xglcopy.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "fb.h"
-
-Bool
-xglCopy (DrawablePtr pSrc,
- DrawablePtr pDst,
- int dx,
- int dy,
- BoxPtr pBox,
- int nBox)
-{
- glitz_surface_t *src, *dst;
- int srcXoff, srcYoff;
- int dstXoff, dstYoff;
-
- XGL_SCREEN_PRIV (pDst->pScreen);
- XGL_DRAWABLE_PIXMAP_PRIV (pSrc);
-
- if (!nBox)
- return TRUE;
-
- if (!xglPrepareTarget (pDst))
- return FALSE;
-
- if (!xglSyncSurface (pSrc))
- return FALSE;
-
- XGL_GET_DRAWABLE (pSrc, src, srcXoff, srcYoff);
- XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff);
-
- /* blit to screen */
- if (dst == pScreenPriv->surface)
- XGL_INCREMENT_PIXMAP_SCORE (pPixmapPriv, 5000);
-
- glitz_surface_set_clip_region (dst,
- dstXoff, dstYoff,
- (glitz_box_t *) pBox, nBox);
-
- glitz_copy_area (src,
- dst,
- pDst->x + srcXoff + dx,
- pDst->y + srcYoff + dy,
- pDst->width,
- pDst->height,
- pDst->x + dstXoff,
- pDst->y + dstYoff);
-
- glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
-
- if (glitz_surface_get_status (dst))
- return FALSE;
-
- return TRUE;
-}
-
-void
-xglCopyProc (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- BoxPtr pBox,
- int nBox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- BoxPtr pSrcBox = (BoxPtr) closure;
-
- if (!xglCopy (pSrc, pDst, dx, dy, pBox, nBox))
- {
- RegionPtr pDamageRegion;
- glitz_surface_t *dst;
- int dstXoff, dstYoff;
- RegionRec region;
- BoxRec box;
-
- XGL_DRAWABLE_PIXMAP (pDst);
- XGL_PIXMAP_PRIV (pPixmap);
-
- XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff);
-
- pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
-
- if (!xglMapPixmapBits (pPixmap))
- FatalError (XGL_SW_FAILURE_STRING);
-
- if (!xglSyncBits (pSrc, pSrcBox))
- FatalError (XGL_SW_FAILURE_STRING);
-
- fbCopyNtoN (pSrc, pDst, pGC,
- pBox, nBox,
- dx, dy,
- reverse, upsidedown, bitplane,
- (void *) 0);
-
- pPixmapPriv->damageBox = miEmptyBox;
- if (!pPixmapPriv->format)
- return;
-
- while (nBox--)
- {
- box.x1 = pBox->x1 + dstXoff;
- box.y1 = pBox->y1 + dstYoff;
- box.x2 = pBox->x2 + dstXoff;
- box.y2 = pBox->y2 + dstYoff;
-
- REGION_INIT (pDst->pScreen, &region, &box, 1);
- REGION_UNION (pDst->pScreen,
- pDamageRegion, pDamageRegion, &region);
- REGION_UNINIT (pDst->pScreen, &region);
-
- pBox++;
- }
- } else
- xglAddCurrentBitDamage (pDst);
-}
diff --git a/hw/xgl/xglfill.c b/hw/xgl/xglfill.c
deleted file mode 100644
index 1bcf41daa..000000000
--- a/hw/xgl/xglfill.c
+++ /dev/null
@@ -1,753 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "gcstruct.h"
-#include "fb.h"
-
-Bool
-xglFill (DrawablePtr pDrawable,
- GCPtr pGC,
- xglGeometryPtr pGeometry,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox)
-{
- XGL_GC_PRIV (pGC);
-
- switch (pGC->fillStyle) {
- case FillSolid:
- if (xglSolid (pDrawable,
- pGCPriv->op, &pGCPriv->fg,
- pGeometry,
- x, y,
- width, height,
- pBox, nBox))
- return TRUE;
- break;
- case FillStippled:
- case FillOpaqueStippled:
- break;
- case FillTiled:
- if (xglTile (pDrawable,
- pGCPriv->op, pGC->tile.pixmap,
- -(pGC->patOrg.x + pDrawable->x),
- -(pGC->patOrg.y + pDrawable->y),
- pGeometry,
- x, y,
- width, height,
- pBox, nBox))
- return TRUE;
- break;
- }
-
- return FALSE;
-}
-
-static void
-xglFillBox (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox)
-{
- BoxRec box;
-
- if (!nBox)
- return;
-
- if (!xglFill (pDrawable, pGC, NULL, x, y, width, height, pBox, nBox))
- {
- RegionRec region;
- RegionPtr pDamageRegion;
- glitz_surface_t *surface;
- int xOff, yOff;
-
- XGL_DRAWABLE_PIXMAP (pDrawable);
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (!xglMapPixmapBits (pPixmap))
- FatalError (XGL_SW_FAILURE_STRING);
-
- switch (pGC->fillStyle) {
- case FillSolid:
- break;
- case FillStippled:
- case FillOpaqueStippled:
- if (!xglSyncBits (&pGC->stipple->drawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
- break;
- case FillTiled:
- if (!xglSyncBits (&pGC->tile.pixmap->drawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
- break;
- }
-
- pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
-
- XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
- pPixmapPriv->damageBox = miEmptyBox;
-
- while (nBox--)
- {
- fbFill (pDrawable, pGC,
- pBox->x1, pBox->y1,
- pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
-
- if (pPixmapPriv->format)
- {
- box.x1 = pBox->x1 + xOff;
- box.y1 = pBox->y1 + yOff;
- box.x2 = pBox->x2 + xOff;
- box.y2 = pBox->y2 + yOff;
-
- REGION_INIT (pDrawable->pScreen, &region, &box, 1);
- REGION_UNION (pDrawable->pScreen,
- pDamageRegion, pDamageRegion, &region);
- REGION_UNINIT (pDrawable->pScreen, &region);
- }
-
- pBox++;
- }
- } else
- xglAddCurrentBitDamage (pDrawable);
-}
-
-#define N_STACK_BOX 1024
-
-static BoxPtr
-xglMoreBoxes (BoxPtr stackBox,
- BoxPtr heapBox,
- int nBoxes)
-{
- Bool stack = !heapBox;
-
- heapBox = xrealloc (heapBox, sizeof (BoxRec) * nBoxes);
- if (!heapBox)
- return NULL;
-
- if (stack)
- memcpy (heapBox, stackBox, sizeof (BoxRec) * N_STACK_BOX);
-
- return heapBox;
-}
-
-#define ADD_BOX(pBox, nBox, stackBox, heapBox, size, box) \
- { \
- if ((nBox) == (size)) \
- { \
- (size) *= 2; \
- (heapBox) = xglMoreBoxes (stackBox, heapBox, size); \
- if (heapBox) \
- { \
- (pBox) = (heapBox) + (nBox); \
- *(pBox)++ = (box); \
- (nBox)++; \
- } \
- } \
- else \
- { \
- *(pBox)++ = (box); \
- (nBox)++; \
- } \
- }
-
-void
-xglFillRect (DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect)
-{
- RegionPtr pClip = pGC->pCompositeClip;
- BoxPtr pClipBox;
- BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
- BoxRec part, full;
- BoxPtr heapBox = NULL;
- BoxRec stackBox[N_STACK_BOX];
- int size = N_STACK_BOX;
- BoxPtr pBox = stackBox;
- int nClip, nBox = 0;
-
- while (nrect--)
- {
- full.x1 = prect->x + pDrawable->x;
- full.y1 = prect->y + pDrawable->y;
- full.x2 = full.x1 + (int) prect->width;
- full.y2 = full.y1 + (int) prect->height;
-
- prect++;
-
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
-
- if (full.x1 >= full.x2 || full.y1 >= full.y2)
- continue;
-
- nClip = REGION_NUM_RECTS (pClip);
- if (nClip == 1)
- {
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
- }
- else
- {
- pClipBox = REGION_RECTS (pClip);
- while (nClip--)
- {
- part = *pClipBox++;
-
- if (part.x1 < full.x1)
- part.x1 = full.x1;
- if (part.y1 < full.y1)
- part.y1 = full.y1;
- if (part.x2 > full.x2)
- part.x2 = full.x2;
- if (part.y2 > full.y2)
- part.y2 = full.y2;
-
- if (part.x1 < part.x2 && part.y1 < part.y2)
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
- }
- }
- }
-
- xglFillBox (pDrawable, pGC,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- (heapBox) ? heapBox : stackBox, nBox);
-
- if (heapBox)
- xfree (heapBox);
-}
-
-void
-xglFillSpan (DrawablePtr pDrawable,
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth)
-{
- RegionPtr pClip = pGC->pCompositeClip;
- BoxPtr pClipBox;
- BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
- BoxRec part, full;
- BoxPtr heapBox = NULL;
- BoxRec stackBox[N_STACK_BOX];
- int size = N_STACK_BOX;
- BoxPtr pBox = stackBox;
- int nClip, nBox = 0;
-
- while (n--)
- {
- full.x1 = ppt->x;
- full.y1 = ppt->y;
- full.x2 = full.x1 + *pwidth;
- full.y2 = full.y1 + 1;
-
- pwidth++;
- ppt++;
-
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
-
- if (full.x1 >= full.x2 || full.y1 >= full.y2)
- continue;
-
- nClip = REGION_NUM_RECTS (pClip);
- if (nClip == 1)
- {
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
- }
- else
- {
- pClipBox = REGION_RECTS (pClip);
- while (nClip--)
- {
- part = *pClipBox++;
-
- if (part.x1 < full.x1)
- part.x1 = full.x1;
- if (part.y1 < full.y1)
- part.y1 = full.y1;
- if (part.x2 > full.x2)
- part.x2 = full.x2;
- if (part.y2 > full.y2)
- part.y2 = full.y2;
-
- if (part.x1 < part.x2 && part.y1 < part.y2)
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
- }
- }
- }
-
- xglFillBox (pDrawable, pGC,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- (heapBox) ? heapBox : stackBox, nBox);
-
- if (heapBox)
- xfree (heapBox);
-}
-
-Bool
-xglFillLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
-{
- RegionPtr pClip = pGC->pCompositeClip;
- BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
- Bool coincidentEndpoints = FALSE;
- Bool horizontalAndVertical = TRUE;
- DDXPointPtr pptTmp;
- int nptTmp;
- DDXPointRec pt;
- xglGeometryPtr pGeometry;
-
- XGL_SCREEN_PRIV (pGC->pScreen);
-
- if (npt < 2)
- return TRUE;
-
- pt = *ppt;
-
- nptTmp = npt - 1;
- pptTmp = ppt + 1;
-
- if (mode == CoordModePrevious)
- {
- while (nptTmp--)
- {
- if (pptTmp->x && pptTmp->y)
- horizontalAndVertical = FALSE;
-
- pt.x += pptTmp->x;
- pt.y += pptTmp->y;
-
- pptTmp++;
- }
-
- if (pt.x == ppt->x && pt.y == ppt->y)
- coincidentEndpoints = TRUE;
- }
- else
- {
- while (nptTmp--)
- {
- if (pptTmp->x != pt.x && pptTmp->y != pt.y)
- {
- horizontalAndVertical = FALSE;
- break;
- }
-
- pt = *pptTmp++;
- }
-
- if (ppt[npt - 1].x == ppt->x && ppt[npt - 1].y == ppt->y)
- coincidentEndpoints = TRUE;
- }
-
- if (horizontalAndVertical)
- {
- BoxPtr pClipBox;
- BoxRec part, full;
- BoxPtr heapBox = NULL;
- BoxRec stackBox[N_STACK_BOX];
- int size = N_STACK_BOX;
- BoxPtr pBox = stackBox;
- int nClip, nBox = 0;
- int dx, dy;
-
- pt = *ppt;
-
- ppt++;
- npt--;
-
- while (npt--)
- {
- if (mode == CoordModePrevious)
- {
- dx = ppt->x;
- dy = ppt->y;
- }
- else
- {
- dx = ppt->x - pt.x;
- dy = ppt->y - pt.y;
- }
-
- if (dx)
- {
- if (dx > 0)
- {
- full.x1 = pt.x + pDrawable->x;
-
- if (npt || coincidentEndpoints)
- full.x2 = full.x1 + dx;
- else
- full.x2 = full.x1 + dx + 1;
- }
- else
- {
- full.x2 = pt.x + pDrawable->x + 1;
-
- if (npt || coincidentEndpoints)
- full.x1 = full.x2 + dx;
- else
- full.x1 = full.x2 + dx - 1;
- }
-
- full.y1 = pt.y + pDrawable->y;
- full.y2 = full.y1 + 1;
- }
- else
- {
- if (dy > 0)
- {
- full.y1 = pt.y + pDrawable->y;
-
- if (npt || coincidentEndpoints)
- full.y2 = full.y1 + dy;
- else
- full.y2 = full.y1 + dy + 1;
- }
- else
- {
- full.y2 = pt.y + pDrawable->y + 1;
-
- if (npt || coincidentEndpoints)
- full.y1 = full.y2 + dy;
- else
- full.y1 = full.y2 + dy - 1;
- }
-
- full.x1 = pt.x + pDrawable->x;
- full.x2 = full.x1 + 1;
- }
-
- pt.x += dx;
- pt.y += dy;
-
- ppt++;
-
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
-
- if (full.x1 >= full.x2 || full.y1 >= full.y2)
- continue;
-
- nClip = REGION_NUM_RECTS (pClip);
- if (nClip == 1)
- {
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
- }
- else
- {
- pClipBox = REGION_RECTS (pClip);
- while (nClip--)
- {
- part = *pClipBox++;
-
- if (part.x1 < full.x1)
- part.x1 = full.x1;
- if (part.y1 < full.y1)
- part.y1 = full.y1;
- if (part.x2 > full.x2)
- part.x2 = full.x2;
- if (part.y2 > full.y2)
- part.y2 = full.y2;
-
- if (part.x1 < part.x2 && part.y1 < part.y2)
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
- }
- }
- }
-
- xglFillBox (pDrawable, pGC,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- (heapBox) ? heapBox : stackBox, nBox);
-
- if (heapBox)
- xfree (heapBox);
-
- return TRUE;
- }
-
- if (!pScreenPriv->lines)
- return FALSE;
-
- if (coincidentEndpoints)
- npt--;
-
- pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, npt);
-
- GEOMETRY_ADD_LINE (pGC->pScreen, pGeometry,
- coincidentEndpoints, mode, npt, ppt);
-
- if (coincidentEndpoints)
- GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINE_LOOP);
- else
- GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINE_STRIP);
-
- /* Lines need a 0.5 translate */
- GEOMETRY_TRANSLATE_FIXED (pGeometry, 1 << 15, 1 << 15);
-
- GEOMETRY_TRANSLATE (pGeometry, pDrawable->x, pDrawable->y);
-
- pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip);
-
- if (xglFill (pDrawable, pGC, pGeometry,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- REGION_RECTS (pGC->pCompositeClip),
- REGION_NUM_RECTS (pGC->pCompositeClip)))
- return TRUE;
-
- return FALSE;
-}
-
-Bool
-xglFillSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nSegInit,
- xSegment *pSegInit)
-{
- RegionPtr pClip = pGC->pCompositeClip;
- BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
- Bool horizontalAndVertical = TRUE;
- xglGeometryPtr pGeometry;
- xSegment *pSeg;
- int nSeg;
-
- XGL_SCREEN_PRIV (pGC->pScreen);
-
- if (nSegInit < 1)
- return TRUE;
-
- pSeg = pSegInit;
- nSeg = nSegInit;
- while (nSeg--)
- {
- if (pSeg->x1 != pSeg->x2 && pSeg->y1 != pSeg->y2)
- horizontalAndVertical = FALSE;
-
- pSeg++;
- }
-
- if (horizontalAndVertical)
- {
- BoxPtr pClipBox;
- BoxRec part, full;
- BoxPtr heapBox = NULL;
- BoxRec stackBox[N_STACK_BOX];
- int size = N_STACK_BOX;
- BoxPtr pBox = stackBox;
- int nClip, nBox = 0;
-
- while (nSegInit--)
- {
- if (pSegInit->x1 != pSegInit->x2)
- {
- if (pSegInit->x1 < pSegInit->x2)
- {
- full.x1 = pSegInit->x1;
- full.x2 = pSegInit->x2;
- }
- else
- {
- full.x1 = pSegInit->x2;
- full.x2 = pSegInit->x1;
- }
-
- full.x1 += pDrawable->x;
- full.x2 += pDrawable->x + 1;
- full.y1 = pSegInit->y1 + pDrawable->y;
- full.y2 = full.y1 + 1;
- }
- else
- {
- if (pSegInit->y1 < pSegInit->y2)
- {
- full.y1 = pSegInit->y1;
- full.y2 = pSegInit->y2;
- }
- else
- {
- full.y1 = pSegInit->y2;
- full.y2 = pSegInit->y1;
- }
-
- full.y1 += pDrawable->y;
- full.y2 += pDrawable->y + 1;
- full.x1 = pSegInit->x1 + pDrawable->x;
- full.x2 = full.x1 + 1;
- }
-
- pSegInit++;
-
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
-
- if (full.x1 >= full.x2 || full.y1 >= full.y2)
- continue;
-
- nClip = REGION_NUM_RECTS (pClip);
- if (nClip == 1)
- {
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
- }
- else
- {
- pClipBox = REGION_RECTS (pClip);
- while (nClip--)
- {
- part = *pClipBox++;
-
- if (part.x1 < full.x1)
- part.x1 = full.x1;
- if (part.y1 < full.y1)
- part.y1 = full.y1;
- if (part.x2 > full.x2)
- part.x2 = full.x2;
- if (part.y2 > full.y2)
- part.y2 = full.y2;
-
- if (part.x1 < part.x2 && part.y1 < part.y2)
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
- }
- }
- }
-
- xglFillBox (pDrawable, pGC,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- (heapBox) ? heapBox : stackBox, nBox);
-
- if (heapBox)
- xfree (heapBox);
-
- return TRUE;
- }
-
- if (!pScreenPriv->lines)
- return FALSE;
-
- pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, 2 * nSegInit);
-
- GEOMETRY_ADD_SEGMENT (pGC->pScreen, pGeometry, nSegInit, pSegInit);
-
- /* Line segments need 0.5 translate */
- GEOMETRY_TRANSLATE_FIXED (pGeometry, 1 << 15, 1 << 15);
- GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINES);
-
- GEOMETRY_TRANSLATE (pGeometry, pDrawable->x, pDrawable->y);
-
- if (xglFill (pDrawable, pGC, pGeometry,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- REGION_RECTS (pGC->pCompositeClip),
- REGION_NUM_RECTS (pGC->pCompositeClip)))
- return TRUE;
-
- return FALSE;
-}
-
-Bool
-xglFillGlyph (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nGlyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- BoxPtr pExtent;
- xglGeometryRec geometry;
-
- if (nGlyph < 1)
- return TRUE;
-
- pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip);
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- GEOMETRY_INIT (pDrawable->pScreen, &geometry,
- GLITZ_GEOMETRY_TYPE_BITMAP,
- GEOMETRY_USAGE_SYSMEM, 0);
-
- GEOMETRY_FOR_GLYPH (pDrawable->pScreen,
- &geometry,
- nGlyph,
- ppci,
- pglyphBase);
-
- GEOMETRY_TRANSLATE (&geometry, x, y);
-
- if (xglFill (pDrawable, pGC, &geometry,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- REGION_RECTS (pGC->pCompositeClip),
- REGION_NUM_RECTS (pGC->pCompositeClip)))
- {
- GEOMETRY_UNINIT (&geometry);
- return TRUE;
- }
-
- GEOMETRY_UNINIT (&geometry);
- return FALSE;
-}
diff --git a/hw/xgl/xglgc.c b/hw/xgl/xglgc.c
deleted file mode 100644
index 5a85ead69..000000000
--- a/hw/xgl/xglgc.c
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "fb.h"
-#include "gcstruct.h"
-#include "migc.h"
-
-#define XGL_GC_OP_FALLBACK_PROLOGUE(pDrawable) \
- xglSyncDamageBoxBits (pDrawable); \
- XGL_GC_UNWRAP (funcs); \
- XGL_GC_UNWRAP (ops)
-
-#define XGL_GC_OP_FALLBACK_EPILOGUE(pDrawable) \
- XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs); \
- XGL_GC_WRAP (ops, (GCOps *) &xglGCOps); \
- xglAddCurrentSurfaceDamage (pDrawable)
-
-#define XGL_GC_FILL_OP_FALLBACK_PROLOGUE(pDrawable) \
- switch (pGC->fillStyle) { \
- case FillSolid: \
- break; \
- case FillStippled: \
- case FillOpaqueStippled: \
- if (!xglSyncBits (&pGC->stipple->drawable, NullBox)) \
- FatalError (XGL_SW_FAILURE_STRING); \
- break; \
- case FillTiled: \
- if (!xglSyncBits (&pGC->tile.pixmap->drawable, NullBox)) \
- FatalError (XGL_SW_FAILURE_STRING); \
- break; \
- } \
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable)
-
-static const GCFuncs xglGCFuncs = {
- xglValidateGC,
- miChangeGC,
- miCopyGC,
- miDestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip
-};
-
-static const GCOps xglGCOps = {
- xglFillSpans,
- xglSetSpans,
- xglPutImage,
- xglCopyArea,
- xglCopyPlane,
- xglPolyPoint,
- xglPolylines,
- xglPolySegment,
- miPolyRectangle,
- xglPolyArc,
- miFillPolygon,
- xglPolyFillRect,
- xglPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- xglImageGlyphBlt,
- xglPolyGlyphBlt,
- xglPushPixels
-#ifdef NEED_LINEHELPER
- , NULL
-#endif
-};
-
-void
-xglFillSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- int nspans,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted)
-{
- XGL_GC_PRIV (pGC);
-
- if (pGCPriv->flags || pGC->fillStyle == FillStippled)
- {
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->FillSpans) (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- }
- else
- {
- /* xglFillSpan handles fall-back */
- xglFillSpan (pDrawable, pGC, nspans, ppt, pwidth);
- }
-}
-
-void
-xglSetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *psrc,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted)
-{
- XGL_GC_PRIV (pGC);
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *bits)
-{
- XGL_GC_PRIV (pGC);
-
- if (pGC->alu != GXcopy || (pGCPriv->flags & xglGCPlaneMaskFlag))
- {
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PutImage) (pDrawable, pGC, depth,
- x, y, w, h, leftPad, format, bits);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- }
- else
- {
- RegionPtr pClip = pGC->pCompositeClip;
- RegionRec region;
- BoxRec box;
-
- XGL_DRAWABLE_PIXMAP (pDrawable);
-
- if (!xglMapPixmapBits (pPixmap))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_GC_UNWRAP (funcs);
- XGL_GC_UNWRAP (ops);
-
- (*pGC->ops->PutImage) (pDrawable, pGC, depth,
- x, y, w, h, leftPad, format, bits);
-
- XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
- XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-
- box.x1 = pDrawable->x + x;
- box.y1 = pDrawable->y + y;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
-
- REGION_INIT (pDrawable->pScreen, &region, &box, 1);
- REGION_INTERSECT (pDrawable->pScreen, &region, pClip, &region);
-
- xglAddSurfaceDamage (pDrawable, &region);
-
- REGION_UNINIT (pDrawable->pScreen, &region);
- }
-}
-
-RegionPtr
-xglCopyArea (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcX,
- int srcY,
- int w,
- int h,
- int dstX,
- int dstY)
-{
- RegionPtr pRegion;
- BoxRec box;
-
- XGL_GC_PRIV (pGC);
-
- box.x1 = pSrc->x + srcX;
- box.y1 = pSrc->y + srcY;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
-
- if (pGC->alu != GXcopy || (pGCPriv->flags &= ~xglGCReadOnlyDrawableFlag))
- {
- if (!xglSyncBits (pSrc, &box))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDst);
- pRegion = (*pGC->ops->CopyArea) (pSrc, pDst, pGC,
- srcX, srcY, w, h, dstX, dstY);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDst);
- }
- else
- {
- /* xglCopyProc handles fall-back */
- pRegion = fbDoCopy (pSrc, pDst, pGC,
- srcX, srcY,
- w, h,
- dstX, dstY,
- xglCopyProc, 0,
- (void *) &box);
- }
-
- return pRegion;
-}
-
-RegionPtr
-xglCopyPlane (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcX,
- int srcY,
- int w,
- int h,
- int dstX,
- int dstY,
- unsigned long bitPlane)
-{
- RegionPtr pRegion;
- BoxRec box;
-
- XGL_GC_PRIV (pGC);
-
- box.x1 = pSrc->x + srcX;
- box.y1 = pSrc->y + srcY;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
-
- if (!xglSyncBits (pSrc, &box))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDst);
- pRegion = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC,
- srcX, srcY, w, h, dstX, dstY,
- bitPlane);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDst);
-
- return pRegion;
-}
-
-void
-xglPolyPoint (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit)
-{
- XGL_GC_PRIV (pGC);
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPolylines (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
-{
- if (pGC->lineWidth == 0)
- {
- XGL_GC_PRIV (pGC);
-
- if (!pGCPriv->flags)
- {
- if (pGC->lineStyle == LineSolid)
- {
- if (xglFillLine (pDrawable, pGC, mode, npt, ppt))
- {
- xglAddCurrentBitDamage (pDrawable);
- return;
- }
- }
- }
-
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, ppt);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- }
- else
- {
- if (pGC->lineStyle != LineSolid)
- miWideDash (pDrawable, pGC, mode, npt, ppt);
- else
- miWideLine (pDrawable, pGC, mode, npt, ppt);
- }
-}
-
-void
-xglPolySegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nsegInit,
- xSegment *pSegInit)
-{
- if (pGC->lineWidth == 0)
- {
- XGL_GC_PRIV (pGC);
-
- if (!pGCPriv->flags)
- {
- if (pGC->lineStyle == LineSolid)
- {
- if (xglFillSegment (pDrawable, pGC, nsegInit, pSegInit))
- {
- xglAddCurrentBitDamage (pDrawable);
- return;
- }
- }
- }
-
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolySegment) (pDrawable, pGC, nsegInit, pSegInit);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- } else
- miPolySegment (pDrawable, pGC, nsegInit, pSegInit);
-}
-
-void
-xglPolyArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *pArcs)
-{
- if (pGC->lineWidth == 0)
- {
- XGL_GC_PRIV (pGC);
-
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolyArc) (pDrawable, pGC, narcs, pArcs);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- } else
- miPolyArc (pDrawable, pGC, narcs, pArcs);
-}
-
-void
-xglPolyFillRect (DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect)
-{
- XGL_GC_PRIV (pGC);
-
- if (pGCPriv->flags || pGC->fillStyle == FillStippled)
- {
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrect, prect);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- }
- else
- {
- /* xglFillRect handles fall-back */
- xglFillRect (pDrawable, pGC, nrect, prect);
- }
-}
-
-void
-xglPolyFillArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *pArcs)
-{
- XGL_GC_PRIV (pGC);
-
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolyFillArc) (pDrawable, pGC, narcs, pArcs);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- XGL_GC_PRIV (pGC);
-
- if (!(pGCPriv->flags & ~xglGCBadFunctionFlag))
- {
- if (xglSolidGlyph (pDrawable,
- pGC,
- x,
- y,
- nglyph,
- ppci,
- pglyphBase))
- {
- xglAddCurrentBitDamage (pDrawable);
- return;
- }
- }
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci,
- pglyphBase);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- XGL_GC_PRIV (pGC);
-
- if (!pGCPriv->flags)
- {
- if (xglFillGlyph (pDrawable,
- pGC,
- x,
- y,
- nglyph,
- ppci,
- pglyphBase))
- {
- xglAddCurrentBitDamage (pDrawable);
- return;
- }
- }
-
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPushPixels (GCPtr pGC,
- PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w,
- int h,
- int x,
- int y)
-{
- XGL_GC_PRIV (pGC);
-
- if (!xglSyncBits (&pBitmap->drawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PushPixels) (pGC, pBitmap, pDrawable, w, h, x, y);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-Bool
-xglCreateGC (GCPtr pGC)
-{
- static glitz_color_t black = { 0x0, 0x0, 0x0, 0xffff };
- ScreenPtr pScreen = pGC->pScreen;
- Bool ret;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_GC_PRIV (pGC);
-
- XGL_SCREEN_UNWRAP (CreateGC);
- ret = (*pScreen->CreateGC) (pGC);
- XGL_SCREEN_WRAP (CreateGC, xglCreateGC);
-
- XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
- XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-
- pGCPriv->flags = 0;
- pGCPriv->op = GLITZ_OPERATOR_SRC;
- pGCPriv->fg = black;
- pGCPriv->bg = black;
-
- return ret;
-}
-
-void
-xglValidateGC (GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable)
-{
- XGL_GC_PRIV (pGC);
-
- if (changes & GCTile)
- {
- if (!pGC->tileIsPixel &&
- FbEvenTile (pGC->tile.pixmap->drawable.width *
- pDrawable->bitsPerPixel))
- xglSyncBits (&pGC->tile.pixmap->drawable, NULL);
- }
-
- if (changes & GCStipple)
- {
- if (pGC->stipple)
- xglSyncBits (&pGC->stipple->drawable, NULL);
- }
-
- XGL_GC_UNWRAP (funcs);
- XGL_GC_UNWRAP (ops);
- (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);
- XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
- XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-
- if (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
- {
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if (pPixmapPriv->format)
- pGCPriv->flags &= ~xglGCSoftwareDrawableFlag;
- else
- pGCPriv->flags |= xglGCSoftwareDrawableFlag;
-
- if (pPixmapPriv->target)
- pGCPriv->flags &= ~xglGCReadOnlyDrawableFlag;
- else
- pGCPriv->flags |= xglGCReadOnlyDrawableFlag;
- }
-
- if (changes & GCFunction)
- {
- switch (pGC->alu) {
- case GXclear:
- pGCPriv->op = GLITZ_OPERATOR_CLEAR;
- pGCPriv->flags &= ~xglGCBadFunctionFlag;
- break;
- case GXcopy:
- pGCPriv->op = GLITZ_OPERATOR_SRC;
- pGCPriv->flags &= ~xglGCBadFunctionFlag;
- break;
- case GXnoop:
- pGCPriv->op = GLITZ_OPERATOR_DST;
- pGCPriv->flags &= ~xglGCBadFunctionFlag;
- break;
- default:
- pGCPriv->flags |= xglGCBadFunctionFlag;
- break;
- }
- }
-
- if (changes & GCPlaneMask)
- {
- FbBits mask;
-
- mask = FbFullMask (pDrawable->depth);
-
- if ((pGC->planemask & mask) != mask)
- pGCPriv->flags |= xglGCPlaneMaskFlag;
- else
- pGCPriv->flags &= ~xglGCPlaneMaskFlag;
- }
-
- if (changes & (GCForeground | GCBackground))
- {
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if (pPixmapPriv->pPixel)
- {
- xglPixelToColor (pPixmapPriv->pPixel, pGC->fgPixel, &pGCPriv->fg);
- xglPixelToColor (pPixmapPriv->pPixel, pGC->bgPixel, &pGCPriv->bg);
- }
- }
-}
diff --git a/hw/xgl/xglgeometry.c b/hw/xgl/xglgeometry.c
deleted file mode 100644
index 7c46e31ca..000000000
--- a/hw/xgl/xglgeometry.c
+++ /dev/null
@@ -1,723 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-
-xglDataTypeInfoRec xglGeometryDataTypes[2] = {
- { GLITZ_DATA_TYPE_SHORT, sizeof (glitz_short_t) },
- { GLITZ_DATA_TYPE_FLOAT, sizeof (glitz_float_t) }
-};
-
-glitz_buffer_hint_t usageTypes[] = {
- GLITZ_BUFFER_HINT_STREAM_DRAW,
- GLITZ_BUFFER_HINT_STATIC_DRAW,
- GLITZ_BUFFER_HINT_DYNAMIC_DRAW
-};
-
-void
-xglGeometryResize (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int size)
-{
- XGL_SCREEN_PRIV (pScreen);
-
- if (size == pGeometry->size)
- return;
-
- if (pGeometry->broken)
- return;
-
- if (pGeometry->usage == GEOMETRY_USAGE_SYSMEM)
- {
- pGeometry->data = xrealloc (pGeometry->data, size);
-
- if (pGeometry->buffer)
- glitz_buffer_destroy (pGeometry->buffer);
-
- pGeometry->buffer = NULL;
-
- if (pGeometry->data)
- {
- pGeometry->buffer = glitz_buffer_create_for_data (pGeometry->data);
- if (!pGeometry->buffer)
- {
- pGeometry->broken = TRUE;
- return;
- }
- }
- else if (size)
- {
- pGeometry->broken = TRUE;
- return;
- }
- }
- else
- {
- glitz_buffer_t *newBuffer;
- if (size)
- {
- newBuffer =
- glitz_vertex_buffer_create (pScreenPriv->drawable, NULL, size,
- usageTypes[pGeometry->usage]);
- if (!newBuffer)
- {
- pGeometry->broken = TRUE;
- return;
- }
- } else
- newBuffer = NULL;
-
- if (pGeometry->buffer && newBuffer)
- {
- void *oldData, *newData;
-
- oldData = glitz_buffer_map (pGeometry->buffer,
- GLITZ_BUFFER_ACCESS_READ_ONLY);
- newData = glitz_buffer_map (newBuffer,
- GLITZ_BUFFER_ACCESS_WRITE_ONLY);
-
- if (oldData && newData)
- memcpy (newData, oldData, MIN (size, pGeometry->size));
-
- glitz_buffer_unmap (pGeometry->buffer);
- glitz_buffer_unmap (newBuffer);
-
- glitz_buffer_destroy (pGeometry->buffer);
- }
- pGeometry->buffer = newBuffer;
- }
-
- pGeometry->size = size;
-
- if (pGeometry->endOffset > size)
- pGeometry->endOffset = size;
-}
-
-#define MAP_GEOMETRY(pScreen, pGeometry, offset, units, ptr, _size) \
- if ((pGeometry)->broken) \
- return; \
- (_size) = (units) * xglGeometryDataTypes[(pGeometry)->dataType].size; \
- if (((pGeometry)->size - (offset)) < (_size)) \
- { \
- xglGeometryResize (pScreen, pGeometry, \
- (pGeometry)->endOffset + (_size) + 500); \
- if ((pGeometry)->broken) \
- return; \
- } \
- (ptr) = glitz_buffer_map ((pGeometry)->buffer, \
- GLITZ_BUFFER_ACCESS_WRITE_ONLY); \
- if (!(ptr)) \
- { \
- (pGeometry)->broken = TRUE; \
- return; \
- } \
- (ptr) += (offset)
-
-#define UNMAP_GEOMETRY(pGeometry, offset, _size) \
- if (glitz_buffer_unmap ((pGeometry)->buffer)) \
- { \
- (pGeometry)->broken = TRUE; \
- return; \
- } \
- if (((offset) + (_size)) > (pGeometry)->endOffset) \
- { \
- (pGeometry)->endOffset = (offset) + (_size); \
- (pGeometry)->count = (pGeometry)->endOffset / \
- (2 * xglGeometryDataTypes[(pGeometry)->dataType].size); \
- }
-
-/*
- * Adds a number of boxes as GL_QUAD primitives
- */
-void
-xglGeometryAddBox (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- BoxPtr pBox,
- int nBox,
- int offset)
-{
- int size;
- char *ptr;
-
- if (nBox < 1)
- return;
-
- MAP_GEOMETRY (pScreen, pGeometry, offset, nBox * 8, ptr, size);
-
- switch (pGeometry->dataType) {
- case GEOMETRY_DATA_TYPE_SHORT:
- {
- glitz_short_t *data = (glitz_short_t *) ptr;
-
- while (nBox--)
- {
- *data++ = (glitz_short_t) pBox->x1;
- *data++ = (glitz_short_t) pBox->y1;
- *data++ = (glitz_short_t) pBox->x2;
- *data++ = (glitz_short_t) pBox->y1;
- *data++ = (glitz_short_t) pBox->x2;
- *data++ = (glitz_short_t) pBox->y2;
- *data++ = (glitz_short_t) pBox->x1;
- *data++ = (glitz_short_t) pBox->y2;
-
- pBox++;
- }
- } break;
- case GEOMETRY_DATA_TYPE_FLOAT:
- {
- glitz_float_t *data = (glitz_float_t *) ptr;
-
- while (nBox--)
- {
- *data++ = (glitz_float_t) pBox->x1;
- *data++ = (glitz_float_t) pBox->y1;
- *data++ = (glitz_float_t) pBox->x2;
- *data++ = (glitz_float_t) pBox->y1;
- *data++ = (glitz_float_t) pBox->x2;
- *data++ = (glitz_float_t) pBox->y2;
- *data++ = (glitz_float_t) pBox->x1;
- *data++ = (glitz_float_t) pBox->y2;
-
- pBox++;
- }
- } break;
- }
-
- UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * Adds a number of spans as GL_LINE primitives
- */
-void
-xglGeometryAddSpan (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- DDXPointPtr ppt,
- int *pwidth,
- int n,
- int offset)
-{
- int size;
- char *ptr;
-
- if (n < 1)
- return;
-
- MAP_GEOMETRY (pScreen, pGeometry, offset, n * 4, ptr, size);
-
- switch (pGeometry->dataType) {
- case GEOMETRY_DATA_TYPE_SHORT:
- {
- glitz_short_t *data = (glitz_short_t *) ptr;
-
- while (n--)
- {
- *data++ = (glitz_short_t) ppt->x;
- *data++ = (glitz_short_t) ppt->y;
- *data++ = (glitz_short_t) (ppt->x + *pwidth);
- *data++ = (glitz_short_t) ppt->y;
-
- ppt++;
- pwidth++;
- }
- } break;
- case GEOMETRY_DATA_TYPE_FLOAT:
- {
- glitz_float_t *data = (glitz_float_t *) ptr;
-
- while (n--)
- {
- *data++ = (glitz_float_t) ppt->x;
- *data++ = (glitz_float_t) ppt->y;
- *data++ = (glitz_float_t) (ppt->x + *pwidth);
- *data++ = (glitz_float_t) ppt->y;
-
- ppt++;
- pwidth++;
- }
- } break;
- }
-
- UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * This macro is needed for end pixels to be rasterized correctly using
- * OpenGL as OpenGL line segments are half-opened.
- */
-#define ADJUST_END_POINT(start, end, isPoint) \
- (((end) > (start)) ? (end) + 1: \
- ((end) < (start)) ? (end) - 1: \
- (isPoint) ? (end) + 1: \
- (end))
-
-/*
- * Adds a number of connected lines as GL_LINE_STRIP primitives
- */
-void
-xglGeometryAddLine (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int loop,
- int mode,
- int npt,
- DDXPointPtr ppt,
- int offset)
-{
- DDXPointRec pt;
- int size;
- char *ptr;
-
- if (npt < 2)
- return;
-
- MAP_GEOMETRY (pScreen, pGeometry, offset, npt * 2, ptr, size);
-
- pt.x = 0;
- pt.y = 0;
-
- switch (pGeometry->dataType) {
- case GEOMETRY_DATA_TYPE_SHORT:
- {
- glitz_short_t *data = (glitz_short_t *) ptr;
-
- while (npt--)
- {
- if (mode == CoordModePrevious)
- {
- pt.x += ppt->x;
- pt.y += ppt->y;
- }
- else
- {
- pt.x = ppt->x;
- pt.y = ppt->y;
- }
-
- if (npt || loop)
- {
- *data++ = (glitz_short_t) pt.x;
- *data++ = (glitz_short_t) pt.y;
- }
- else
- {
- ppt--;
- *data++ = (glitz_short_t)
- ADJUST_END_POINT (ppt->x, pt.x, ppt->y == pt.y);
- *data++ = (glitz_short_t) ADJUST_END_POINT (ppt->y, pt.y, 0);
- }
-
- ppt++;
- }
- } break;
- case GEOMETRY_DATA_TYPE_FLOAT:
- {
- glitz_float_t *data = (glitz_float_t *) ptr;
-
- while (npt--)
- {
- if (mode == CoordModePrevious)
- {
- pt.x += ppt->x;
- pt.y += ppt->y;
- }
- else
- {
- pt.x = ppt->x;
- pt.y = ppt->y;
- }
-
- if (npt || loop)
- {
- *data++ = (glitz_float_t) pt.x;
- *data++ = (glitz_float_t) pt.y;
- }
- else
- {
- ppt--;
- *data++ = (glitz_float_t)
- ADJUST_END_POINT (ppt->x, pt.x, ppt->y == pt.y);
- *data++ = (glitz_float_t) ADJUST_END_POINT (ppt->y, pt.y, 0);
- }
-
- ppt++;
- }
- } break;
- }
-
- UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * Adds a number of line segments as GL_LINE primitives
- */
-void
-xglGeometryAddSegment (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int nsegInit,
- xSegment *pSegInit,
- int offset)
-{
- int size;
- char *ptr;
-
- if (nsegInit < 1)
- return;
-
- MAP_GEOMETRY (pScreen, pGeometry, offset, nsegInit * 4, ptr, size);
-
- switch (pGeometry->dataType) {
- case GEOMETRY_DATA_TYPE_SHORT:
- {
- glitz_short_t *data = (glitz_short_t *) ptr;
-
- while (nsegInit--)
- {
- *data++ = (glitz_short_t) pSegInit->x1;
- *data++ = (glitz_short_t) pSegInit->y1;
- *data++ = (glitz_short_t)
- ADJUST_END_POINT (pSegInit->x1, pSegInit->x2,
- pSegInit->y1 == pSegInit->y2);
- *data++ = (glitz_short_t)
- ADJUST_END_POINT (pSegInit->y1, pSegInit->y2, 0);
-
- pSegInit++;
- }
- } break;
- case GEOMETRY_DATA_TYPE_FLOAT:
- {
- glitz_float_t *data = (glitz_float_t *) ptr;
-
- while (nsegInit--)
- {
- *data++ = (glitz_float_t) pSegInit->x1;
- *data++ = (glitz_float_t) pSegInit->y1;
- *data++ = (glitz_float_t)
- ADJUST_END_POINT (pSegInit->x1, pSegInit->x2,
- pSegInit->y1 == pSegInit->y2);
- *data++ = (glitz_float_t)
- ADJUST_END_POINT (pSegInit->y1, pSegInit->y2, 0);
-
- pSegInit++;
- }
- } break;
- }
-
- UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-void
-xglGeometryForGlyph (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- unsigned int nGlyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase)
-{
- CharInfoPtr *ppci;
- CharInfoPtr pci;
- unsigned char *glyphbase = (pointer) ~0;
- unsigned char *pglyph;
- int x = 0;
- int gx, gy;
- int gWidth, gHeight;
- int n, lastX = 0, lastY = 0;
- glitz_multi_array_t *array;
- glitz_buffer_t *buffer;
-
- ppci = ppciInit;
- n = nGlyph;
-
- while (n--)
- {
- pglyph = FONTGLYPHBITS (pglyphBase, *ppci++);
- if (pglyph < glyphbase)
- glyphbase = pglyph;
- }
-
- buffer = glitz_buffer_create_for_data (glyphbase);
- if (!buffer)
- {
- pGeometry->broken = TRUE;
- return;
- }
-
- GEOMETRY_SET_BUFFER (pGeometry, buffer);
-
- array = glitz_multi_array_create (nGlyph);
- if (!array)
- {
- pGeometry->broken = TRUE;
- return;
- }
-
- GEOMETRY_SET_MULTI_ARRAY (pGeometry, array);
-
- ppci = ppciInit;
- while (nGlyph--)
- {
- pci = *ppci++;
- pglyph = FONTGLYPHBITS (pglyphBase, pci);
- gWidth = GLYPHWIDTHPIXELS (pci);
- gHeight = GLYPHHEIGHTPIXELS (pci);
-
- if (gWidth && gHeight)
- {
- gx = x + pci->metrics.leftSideBearing;
- gy = -pci->metrics.ascent;
-
- glitz_multi_array_add (array,
- (pglyph - glyphbase) * 8,
- gWidth, gHeight,
- (gx - lastX) << 16, (gy - lastY) << 16);
- lastX = gx;
- lastY = gy;
- }
- x += pci->metrics.characterWidth;
- }
-
- glitz_buffer_destroy (buffer);
- glitz_multi_array_destroy (array);
-}
-
-#define FIXED_LINE_X_TO_FLOAT(line, v) \
- (((glitz_float_t) \
- ((line).p1.x + (xFixed_16_16) \
- (((xFixed_32_32) ((v) - (line).p1.y) * \
- ((line).p2.x - (line).p1.x)) / \
- ((line).p2.y - (line).p1.y)))) / 65536)
-
-#define FIXED_LINE_X_CEIL_TO_FLOAT(line, v) \
- (((glitz_float_t) \
- ((line).p1.x + (xFixed_16_16) \
- (((((line).p2.y - (line).p1.y) - 1) + \
- ((xFixed_32_32) ((v) - (line).p1.y) * \
- ((line).p2.x - (line).p1.x))) / \
- ((line).p2.y - (line).p1.y)))) / 65536)
-
-/*
- * Adds a number of trapezoids as GL_QUAD primitives
- */
-void
-xglGeometryAddTrapezoid (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- xTrapezoid *pTrap,
- int nTrap,
- int offset)
-{
- int size;
- char *ptr;
-
- if (nTrap < 1)
- return;
-
- MAP_GEOMETRY (pScreen, pGeometry, offset, nTrap * 8, ptr, size);
-
- switch (pGeometry->dataType) {
- case GEOMETRY_DATA_TYPE_SHORT:
- /* not supported */
- pGeometry->broken = TRUE;
- break;
- case GEOMETRY_DATA_TYPE_FLOAT:
- {
- glitz_float_t *data = (glitz_float_t *) ptr;
- glitz_float_t top, bottom;
-
- while (nTrap--)
- {
- top = FIXED_TO_FLOAT (pTrap->top);
- bottom = FIXED_TO_FLOAT (pTrap->bottom);
-
- *data++ = FIXED_LINE_X_TO_FLOAT (pTrap->left, pTrap->top);
- *data++ = top;
- *data++ = FIXED_LINE_X_CEIL_TO_FLOAT (pTrap->right, pTrap->top);
- *data++ = top;
- *data++ = FIXED_LINE_X_CEIL_TO_FLOAT (pTrap->right, pTrap->bottom);
- *data++ = bottom;
- *data++ = FIXED_LINE_X_TO_FLOAT (pTrap->left, pTrap->bottom);
- *data++ = bottom;
-
- pTrap++;
- }
- } break;
- }
-
- UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * Adds a number of traps as GL_QUAD primitives
- */
-void
-xglGeometryAddTrap (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- xTrap *pTrap,
- int nTrap,
- int offset)
-{
- int size;
- char *ptr;
-
- if (nTrap < 1)
- return;
-
- MAP_GEOMETRY (pScreen, pGeometry, offset, nTrap * 8, ptr, size);
-
- switch (pGeometry->dataType) {
- case GEOMETRY_DATA_TYPE_SHORT:
- /* not supported */
- pGeometry->broken = TRUE;
- break;
- case GEOMETRY_DATA_TYPE_FLOAT:
- {
- glitz_float_t *data = (glitz_float_t *) ptr;
- glitz_float_t top, bottom;
-
- while (nTrap--)
- {
- top = FIXED_TO_FLOAT (pTrap->top.y);
- bottom = FIXED_TO_FLOAT (pTrap->bot.y);
-
- *data++ = FIXED_TO_FLOAT (pTrap->top.l);
- *data++ = top;
- *data++ = FIXED_TO_FLOAT (pTrap->top.r);
- *data++ = top;
- *data++ = FIXED_TO_FLOAT (pTrap->bot.r);
- *data++ = bottom;
- *data++ = FIXED_TO_FLOAT (pTrap->bot.l);
- *data++ = bottom;
-
- pTrap++;
- }
- } break;
- }
-
- UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/* XXX: scratch geometry size never shrinks, it just gets larger when
- required. this is not acceptable. */
-xglGeometryPtr
-xglGetScratchGeometryWithSize (ScreenPtr pScreen,
- int size)
-{
- xglGeometryPtr pGeometry;
-
- XGL_SCREEN_PRIV (pScreen);
-
- pGeometry = &pScreenPriv->scratchGeometry;
-
- if (pGeometry->broken || pGeometry->size < size)
- {
- GEOMETRY_UNINIT (pGeometry);
- GEOMETRY_INIT (pScreen, pGeometry, pGeometry->type,
- pScreenPriv->geometryUsage, size);
- }
- else
- {
- if (pGeometry->array)
- {
- glitz_multi_array_destroy (pGeometry->array);
- pGeometry->array = NULL;
- }
- pGeometry->endOffset = 0;
- pGeometry->xOff = 0;
- pGeometry->yOff = 0;
- pGeometry->first = 0;
- pGeometry->count = 0;
- pGeometry->width = 2;
- }
-
- return pGeometry;
-}
-
-xglGeometryPtr
-xglGetScratchVertexGeometryWithType (ScreenPtr pScreen,
- int type,
- int count)
-{
- xglGeometryPtr pGeometry;
- int stride;
-
- stride = 2 * xglGeometryDataTypes[type].size;
-
- pGeometry = xglGetScratchGeometryWithSize (pScreen, count * stride);
-
- pGeometry->type = GLITZ_GEOMETRY_TYPE_VERTEX;
- pGeometry->dataType = type;
-
- pGeometry->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS;
- pGeometry->f.vertex.type = xglGeometryDataTypes[type].type;
- pGeometry->f.vertex.bytes_per_vertex = stride;
- pGeometry->f.vertex.attributes = 0;
-
- return pGeometry;
-}
-
-xglGeometryPtr
-xglGetScratchVertexGeometry (ScreenPtr pScreen,
- int count)
-{
- xglGeometryPtr pGeometry;
- int type, stride;
-
- XGL_SCREEN_PRIV (pScreen);
-
- type = pScreenPriv->geometryDataType;
- stride = 2 * xglGeometryDataTypes[type].size;
-
- pGeometry = xglGetScratchGeometryWithSize (pScreen, count * stride);
-
- pGeometry->type = GLITZ_GEOMETRY_TYPE_VERTEX;
- pGeometry->dataType = type;
-
- pGeometry->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS;
- pGeometry->f.vertex.type = xglGeometryDataTypes[type].type;
- pGeometry->f.vertex.bytes_per_vertex = stride;
- pGeometry->f.vertex.attributes = 0;
-
- return pGeometry;
-}
-
-Bool
-xglSetGeometry (xglGeometryPtr pGeometry,
- glitz_surface_t *surface)
-{
- if (pGeometry->broken)
- return FALSE;
-
- glitz_set_geometry (surface, pGeometry->type, &pGeometry->f,
- pGeometry->buffer);
-
- if (pGeometry->array)
- glitz_set_multi_array (surface, pGeometry->array,
- pGeometry->xOff, pGeometry->yOff);
- else
- glitz_set_array (surface,
- pGeometry->first, pGeometry->width, pGeometry->count,
- pGeometry->xOff, pGeometry->yOff);
-
- return TRUE;
-}
diff --git a/hw/xgl/xglget.c b/hw/xgl/xglget.c
deleted file mode 100644
index 70f29e2e5..000000000
--- a/hw/xgl/xglget.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-void
-xglGetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d)
-{
- ScreenPtr pScreen = pDrawable->pScreen;
- glitz_surface_t *surface;
- int xOff, yOff;
- BoxRec box;
-
- XGL_SCREEN_PRIV (pScreen);
-
- /* Many apps use GetImage to sync with the visable frame buffer */
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- glitz_surface_flush (pScreenPriv->surface);
- glitz_drawable_finish (pScreenPriv->drawable);
- }
-
- XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
- box.x1 = pDrawable->x + xOff + x;
- box.y1 = pDrawable->y + yOff + y;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
-
- if (!xglSyncBits (pDrawable, &box))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_SCREEN_UNWRAP (GetImage);
- (*pScreen->GetImage) (pDrawable, x, y, w, h, format, planeMask, d);
- XGL_SCREEN_WRAP (GetImage, xglGetImage);
-}
-
-void
-xglGetSpans (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart)
-{
- ScreenPtr pScreen = pDrawable->pScreen;
-
- XGL_SCREEN_PRIV (pScreen);
-
- if (!xglSyncBits (pDrawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_SCREEN_UNWRAP (GetSpans);
- (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
- XGL_SCREEN_WRAP (GetSpans, xglGetSpans);
-}
diff --git a/hw/xgl/xglglx.c b/hw/xgl/xglglx.c
deleted file mode 100644
index 22e8cc09c..000000000
--- a/hw/xgl/xglglx.c
+++ /dev/null
@@ -1,3580 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-#ifdef GLXEXT
-
-#include <GL/gl.h>
-
-#include "glxserver.h"
-#include "glxdrawable.h"
-#include "glxscreens.h"
-#include "micmap.h"
-
-extern void
-GlxSetVisualConfigs (int nconfigs,
- __GLXvisualConfig *configs,
- void **privates);
-
-extern void
-GlxWrapInitVisuals (miInitVisualsProcPtr *);
-
-extern int
-GlxInitVisuals (VisualPtr *visualp,
- DepthPtr *depthp,
- int *nvisualp,
- int *ndepthp,
- int *rootDepthp,
- VisualID *defaultVisp,
- unsigned long sizes,
- int bitsPerRGB,
- int preferredVis);
-
-extern void
-__glXFlushContextCache (void);
-
-extern __GLXscreenInfo __glDDXScreenInfo;
-
-extern __glProcTable __glMesaRenderTable;
-extern __glProcTableEXT __glMesaRenderTableEXT;
-
-typedef Bool (*GLXScreenProbeProc) (int screen);
-typedef __GLinterface *(*GLXCreateContextProc) (__GLimports *imports,
- __GLcontextModes *modes,
- __GLinterface *shareGC);
-typedef void (*GLXCreateBufferProc) (__GLXdrawablePrivate *glxPriv);
-typedef GLboolean (*GLXSwapBuffersProc) (__GLXdrawablePrivate *glxPriv);
-
-typedef struct _xglGLXScreenInfo {
- GLXScreenProbeProc screenProbe;
- GLXCreateContextProc createContext;
- GLXCreateBufferProc createBuffer;
-} xglGLXScreenInfoRec, *xglGLXScreenInfoPtr;
-
-static xglGLXScreenInfoRec screenInfoPriv;
-
-typedef GLboolean (*GLResizeBuffersProc) (__GLdrawableBuffer *buffer,
- GLint x,
- GLint y,
- GLuint width,
- GLuint height,
- __GLdrawablePrivate *glPriv,
- GLuint bufferMask);
-typedef void (*GLFreeBuffersProc) (__GLdrawablePrivate *glPriv);
-
-typedef struct _xglGLBuffer {
- GLXSwapBuffersProc swapBuffers;
- GLResizeBuffersProc resizeBuffers;
- GLFreeBuffersProc freeBuffers;
- ScreenPtr pScreen;
- DrawablePtr pDrawable;
- PixmapPtr pPixmap;
- GCPtr pGC, swapGC;
- RegionRec damage;
- void *private;
-} xglGLBufferRec, *xglGLBufferPtr;
-
-typedef int xglGLXVisualConfigRec, *xglGLXVisualConfigPtr;
-
-typedef struct _xglDisplayList *xglDisplayListPtr;
-
-#define XGL_LIST_OP_CALLS 0
-#define XGL_LIST_OP_DRAW 1
-#define XGL_LIST_OP_COPY 2
-#define XGL_LIST_OP_LIST 3
-
-typedef struct _xglCopyOp {
- void (*copyProc) (struct _xglCopyOp *pOp);
- union {
- struct {
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- GLenum type;
- } pixels;
- struct {
- GLenum target;
- GLint level;
- GLenum internalformat;
- GLint x;
- GLint y;
- GLsizei width;
- GLint border;
- } tex_image_1d;
- struct {
- GLenum target;
- GLint level;
- GLenum internalformat;
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- GLint border;
- } tex_image_2d;
- struct {
- GLenum target;
- GLint level;
- GLint xoffset;
- GLint x;
- GLint y;
- GLsizei width;
- } tex_sub_image_1d;
- struct {
- GLenum target;
- GLint level;
- GLint xoffset;
- GLint yoffset;
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- } tex_sub_image_2d;
- struct {
- GLenum target;
- GLenum internalformat;
- GLint x;
- GLint y;
- GLsizei width;
- } color_table;
- struct {
- GLenum target;
- GLsizei start;
- GLint x;
- GLint y;
- GLsizei width;
- } color_sub_table;
- struct {
- GLenum target;
- GLenum internalformat;
- GLint x;
- GLint y;
- GLsizei width;
- } convolution_filter_1d;
- struct {
- GLenum target;
- GLenum internalformat;
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- } convolution_filter_2d;
- struct {
- GLenum target;
- GLint level;
- GLint xoffset;
- GLint yoffset;
- GLint zoffset;
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- } tex_sub_image_3d;
- } u;
-} xglCopyOpRec, *xglCopyOpPtr;
-
-typedef struct _xglListOp {
- int type;
- union {
- GLuint name;
- xglCopyOpPtr copy;
- xglDisplayListPtr list;
- } u;
-} xglListOpRec, *xglListOpPtr;
-
-typedef struct _xglDisplayList {
- xglListOpPtr pOp;
- int nOp;
- int size;
- int refcnt;
-} xglDisplayListRec;
-
-typedef struct _xglTexObj {
- GLuint name;
-} xglTexObjRec, *xglTexObjPtr;
-
-typedef struct _xglGLAttributes {
- GLbitfield mask;
- GLenum drawBuffer;
- GLenum readBuffer;
- xRectangle viewport;
- xRectangle scissor;
- GLboolean scissorTest;
-} xglGLAttributesRec, *xglGLAttributesPtr;
-
-typedef struct _xglGLContext {
- __GLinterface iface;
- __GLinterface *mIface;
- int refcnt;
- struct _xglGLContext *shared;
- glitz_context_t *context;
- __glProcTableEXT glRenderTableEXT;
- PFNGLWINDOWPOS3FMESAPROC WindowPos3fMESA;
- Bool needInit;
- Bool target;
- glitz_surface_t *draw;
- int tx, ty;
- xglGLBufferPtr pDrawBuffer;
- char *versionString;
- GLenum error;
- xglHashTablePtr texObjects;
- xglHashTablePtr displayLists;
- GLuint list;
- GLenum listMode;
- xglDisplayListPtr pList;
- GLuint groupList;
- xglGLAttributesRec attrib;
- xglGLAttributesPtr pAttribStack;
- int nAttribStack;
-} xglGLContextRec, *xglGLContextPtr;
-
-xglGLContextPtr cctx = NULL;
-
-static void
-xglViewport (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- cctx->attrib.viewport.x = x;
- cctx->attrib.viewport.y = y;
- cctx->attrib.viewport.width = width;
- cctx->attrib.viewport.height = height;
-
- glitz_context_set_viewport (cctx->context, x, y, width, height);
-}
-
-static void
-xglScissor (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- cctx->attrib.scissor.x = x;
- cctx->attrib.scissor.y = y;
- cctx->attrib.scissor.width = width;
- cctx->attrib.scissor.height = height;
-
- if (cctx->attrib.scissorTest)
- glitz_context_set_scissor (cctx->context, x, y, width, height);
-}
-
-static void
-xglDrawBuffer (GLenum mode)
-{
- if (mode != cctx->attrib.drawBuffer)
- ErrorF ("NYI xglDrawBuffer: 0x%x\n", mode);
-}
-
-static void
-xglDisable (GLenum cap)
-{
- switch (cap) {
- case GL_SCISSOR_TEST:
- if (cctx->attrib.scissorTest)
- {
- cctx->attrib.scissorTest = GL_FALSE;
- glitz_context_set_scissor (cctx->context,
- 0, 0,
- cctx->pDrawBuffer->pDrawable->width,
- cctx->pDrawBuffer->pDrawable->height);
- }
- break;
- default:
- glDisable (cap);
- }
-}
-
-static void
-xglEnable (GLenum cap)
-{
- switch (cap) {
- case GL_SCISSOR_TEST:
- cctx->attrib.scissorTest = GL_TRUE;
- glitz_context_set_scissor (cctx->context,
- cctx->attrib.scissor.x,
- cctx->attrib.scissor.y,
- cctx->attrib.scissor.width,
- cctx->attrib.scissor.height);
- break;
- default:
- glEnable (cap);
- }
-}
-
-static void
-xglReadBuffer (GLenum mode)
-{
- if (mode != cctx->attrib.readBuffer)
- ErrorF ("NYI xglReadBuffer: 0x%x\n", mode);
-}
-
-static void
-xglPushAttrib (GLbitfield mask)
-{
- xglGLAttributesPtr pAttrib;
- GLint depth;
-
- glGetIntegerv (GL_MAX_ATTRIB_STACK_DEPTH, &depth);
-
- if (cctx->nAttribStack == depth)
- {
- cctx->error = GL_STACK_OVERFLOW;
- return;
- }
-
- cctx->pAttribStack =
- realloc (cctx->pAttribStack,
- sizeof (xglGLAttributesRec) * (cctx->nAttribStack + 1));
-
- if (!cctx->pAttribStack)
- {
- cctx->error = GL_OUT_OF_MEMORY;
- return;
- }
-
- pAttrib = &cctx->pAttribStack[cctx->nAttribStack];
- pAttrib->mask = mask;
-
- if (mask & GL_COLOR_BUFFER_BIT)
- pAttrib->drawBuffer = cctx->attrib.drawBuffer;
-
- if (mask & GL_PIXEL_MODE_BIT)
- pAttrib->readBuffer = cctx->attrib.readBuffer;
-
- if (mask & GL_SCISSOR_BIT)
- {
- pAttrib->scissorTest = cctx->attrib.scissorTest;
- pAttrib->scissor = cctx->attrib.scissor;
- }
- else if (mask & GL_ENABLE_BIT)
- pAttrib->scissorTest = cctx->attrib.scissorTest;
-
- if (mask & GL_VIEWPORT_BIT)
- pAttrib->viewport = cctx->attrib.viewport;
-
- cctx->nAttribStack++;
-
- glPushAttrib (mask);
-}
-
-static void
-xglPopAttrib (void)
-{
- xglGLAttributesPtr pAttrib;
- GLbitfield mask;
-
- if (!cctx->nAttribStack)
- {
- cctx->error = GL_STACK_UNDERFLOW;
- return;
- }
-
- cctx->nAttribStack--;
-
- pAttrib = &cctx->pAttribStack[cctx->nAttribStack];
- mask = pAttrib->mask;
-
- if (mask & GL_COLOR_BUFFER_BIT)
- xglDrawBuffer (pAttrib->drawBuffer);
-
- if (mask & GL_PIXEL_MODE_BIT)
- xglReadBuffer (pAttrib->readBuffer);
-
- if (mask & GL_SCISSOR_BIT)
- {
- xglScissor (pAttrib->scissor.x,
- pAttrib->scissor.y,
- pAttrib->scissor.width,
- pAttrib->scissor.height);
-
- if (pAttrib->scissorTest)
- xglEnable (GL_SCISSOR_TEST);
- else
- xglDisable (GL_SCISSOR_TEST);
- }
- else if (mask & GL_ENABLE_BIT)
- {
- if (pAttrib->scissorTest)
- xglEnable (GL_SCISSOR_TEST);
- else
- xglDisable (GL_SCISSOR_TEST);
- }
-
- if (mask & GL_VIEWPORT_BIT)
- xglViewport (pAttrib->viewport.x,
- pAttrib->viewport.y,
- pAttrib->viewport.width,
- pAttrib->viewport.height);
-
- cctx->pAttribStack =
- realloc (cctx->pAttribStack,
- sizeof (xglGLAttributesRec) * cctx->nAttribStack);
-
- glPopAttrib ();
-}
-
-static GLint
-xglGetTextureBinding (GLenum pname)
-{
- xglTexObjPtr pTexObj;
- GLuint key;
- GLint texture;
-
- glGetIntegerv (pname, &texture);
-
- key = xglHashFirstEntry (cctx->shared->texObjects);
- while (key)
- {
- pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, key);
- if (pTexObj && pTexObj->name == texture)
- return key;
-
- key = xglHashNextEntry (cctx->shared->texObjects, key);
- }
-
- return 0;
-}
-
-#define INT_TO_BOOLEAN(I) ((I) ? GL_TRUE : GL_FALSE)
-#define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE)
-
-static void
-xglGetBooleanv (GLenum pname,
- GLboolean *params)
-{
- switch (pname) {
- case GL_DOUBLEBUFFER:
- params[0] = GL_TRUE;
- break;
- case GL_DRAW_BUFFER:
- params[0] = ENUM_TO_BOOLEAN (cctx->attrib.drawBuffer);
- break;
- case GL_READ_BUFFER:
- params[0] = ENUM_TO_BOOLEAN (cctx->attrib.readBuffer);
- break;
- case GL_SCISSOR_BOX:
- params[0] = INT_TO_BOOLEAN (cctx->attrib.scissor.x);
- params[1] = INT_TO_BOOLEAN (cctx->attrib.scissor.y);
- params[2] = INT_TO_BOOLEAN (cctx->attrib.scissor.width);
- params[3] = INT_TO_BOOLEAN (cctx->attrib.scissor.height);
- break;
- case GL_SCISSOR_TEST:
- params[0] = cctx->attrib.scissorTest;
- break;
- case GL_VIEWPORT:
- params[0] = INT_TO_BOOLEAN (cctx->attrib.viewport.x);
- params[1] = INT_TO_BOOLEAN (cctx->attrib.viewport.y);
- params[2] = INT_TO_BOOLEAN (cctx->attrib.viewport.width);
- params[3] = INT_TO_BOOLEAN (cctx->attrib.viewport.height);
- break;
- case GL_TEXTURE_BINDING_1D:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_3D:
- /* should be safe to fall-through here */
- default:
- glGetBooleanv (pname, params);
- }
-}
-
-#define ENUM_TO_DOUBLE(E) ((GLdouble) (E))
-#define BOOLEAN_TO_DOUBLE(B) ((B) ? 1.0F : 0.0F)
-
-static void
-xglGetDoublev (GLenum pname,
- GLdouble *params)
-{
- switch (pname) {
- case GL_DOUBLEBUFFER:
- params[0] = BOOLEAN_TO_DOUBLE (GL_TRUE);
- break;
- case GL_DRAW_BUFFER:
- params[0] = ENUM_TO_DOUBLE (cctx->attrib.drawBuffer);
- break;
- case GL_READ_BUFFER:
- params[0] = ENUM_TO_DOUBLE (cctx->attrib.readBuffer);
- break;
- case GL_SCISSOR_BOX:
- params[0] = cctx->attrib.scissor.x;
- params[1] = cctx->attrib.scissor.y;
- params[2] = cctx->attrib.scissor.width;
- params[3] = cctx->attrib.scissor.height;
- break;
- case GL_SCISSOR_TEST:
- params[0] = BOOLEAN_TO_DOUBLE (cctx->attrib.scissorTest);
- break;
- case GL_VIEWPORT:
- params[0] = cctx->attrib.viewport.x;
- params[1] = cctx->attrib.viewport.y;
- params[2] = cctx->attrib.viewport.width;
- params[3] = cctx->attrib.viewport.height;
- break;
- case GL_TEXTURE_BINDING_1D:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_3D:
- params[0] = xglGetTextureBinding (pname);
- break;
- default:
- glGetDoublev (pname, params);
- }
-}
-
-#define ENUM_TO_FLOAT(E) ((GLfloat) (E))
-#define BOOLEAN_TO_FLOAT(B) ((B) ? 1.0F : 0.0F)
-
-static void
-xglGetFloatv (GLenum pname,
- GLfloat *params)
-{
- switch (pname) {
- case GL_DOUBLEBUFFER:
- params[0] = BOOLEAN_TO_FLOAT (GL_TRUE);
- break;
- case GL_DRAW_BUFFER:
- params[0] = ENUM_TO_FLOAT (cctx->attrib.drawBuffer);
- break;
- case GL_READ_BUFFER:
- params[0] = ENUM_TO_FLOAT (cctx->attrib.readBuffer);
- break;
- case GL_SCISSOR_BOX:
- params[0] = cctx->attrib.scissor.x;
- params[1] = cctx->attrib.scissor.y;
- params[2] = cctx->attrib.scissor.width;
- params[3] = cctx->attrib.scissor.height;
- break;
- case GL_SCISSOR_TEST:
- params[0] = BOOLEAN_TO_FLOAT (cctx->attrib.scissorTest);
- break;
- case GL_VIEWPORT:
- params[0] = cctx->attrib.viewport.x;
- params[1] = cctx->attrib.viewport.y;
- params[2] = cctx->attrib.viewport.width;
- params[3] = cctx->attrib.viewport.height;
- break;
- case GL_TEXTURE_BINDING_1D:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_3D:
- params[0] = xglGetTextureBinding (pname);
- break;
- default:
- glGetFloatv (pname, params);
- }
-}
-
-#define ENUM_TO_INT(E) ((GLint) (E))
-#define BOOLEAN_TO_INT(B) ((GLint) (B))
-
-static void
-xglGetIntegerv (GLenum pname,
- GLint *params)
-{
- switch (pname) {
- case GL_DOUBLEBUFFER:
- params[0] = BOOLEAN_TO_INT (GL_TRUE);
- break;
- case GL_DRAW_BUFFER:
- params[0] = ENUM_TO_INT (cctx->attrib.drawBuffer);
- break;
- case GL_READ_BUFFER:
- params[0] = ENUM_TO_INT (cctx->attrib.readBuffer);
- break;
- case GL_SCISSOR_BOX:
- params[0] = cctx->attrib.scissor.x;
- params[1] = cctx->attrib.scissor.y;
- params[2] = cctx->attrib.scissor.width;
- params[3] = cctx->attrib.scissor.height;
- break;
- case GL_SCISSOR_TEST:
- params[0] = BOOLEAN_TO_INT (cctx->attrib.scissorTest);
- break;
- case GL_VIEWPORT:
- params[0] = cctx->attrib.viewport.x;
- params[1] = cctx->attrib.viewport.y;
- params[2] = cctx->attrib.viewport.width;
- params[3] = cctx->attrib.viewport.height;
- break;
- case GL_TEXTURE_BINDING_1D:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_3D:
- params[0] = xglGetTextureBinding (pname);
- break;
- default:
- glGetIntegerv (pname, params);
- }
-}
-
-static GLboolean
-xglIsEnabled (GLenum cap)
-{
- switch (cap) {
- case GL_SCISSOR_TEST:
- return cctx->attrib.scissorTest;
- default:
- return glIsEnabled (cap);
- }
-}
-
-static GLenum
-xglGetError (void)
-{
- if (cctx->error != GL_NO_ERROR)
- return cctx->error;
-
- return glGetError ();
-}
-
-static const GLubyte *
-xglGetString (GLenum name)
-{
- switch (name) {
- case GL_VERSION:
- if (!cctx->versionString)
- {
- static const char *version = "1.2 (%s)";
- const char *nativeVersion = glGetString (GL_VERSION);
-
- cctx->versionString = xalloc (strlen (version) +
- strlen (nativeVersion));
- if (cctx->versionString)
- sprintf (cctx->versionString, version, nativeVersion);
- }
- return cctx->versionString;
- default:
- return glGetString (name);
- }
-}
-
-static void
-xglGenTextures (GLsizei n,
- GLuint *textures)
-{
- xglTexObjPtr pTexObj;
- GLuint name;
-
- name = xglHashFindFreeKeyBlock (cctx->shared->texObjects, n);
-
- glGenTextures (n, textures);
-
- while (n--)
- {
- pTexObj = xalloc (sizeof (xglTexObjRec));
- if (pTexObj)
- {
- pTexObj->name = *textures;
- xglHashInsert (cctx->shared->texObjects, name, pTexObj);
- }
- else
- {
- glDeleteTextures (1, textures);
- cctx->error = GL_OUT_OF_MEMORY;
- }
-
- *textures++ = name++;
- }
-}
-
-static void
-xglBindTexture (GLenum target,
- GLuint texture)
-{
- if (texture)
- {
- xglTexObjPtr pTexObj;
-
- pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
- texture);
- if (!pTexObj)
- {
- pTexObj = xalloc (sizeof (xglTexObjRec));
- if (!pTexObj)
- {
- cctx->error = GL_OUT_OF_MEMORY;
- return;
- }
-
- glGenTextures (1, &pTexObj->name);
- xglHashInsert (cctx->shared->texObjects, texture, pTexObj);
- }
-
- glBindTexture (target, pTexObj->name);
- }
- else
- glBindTexture (target, 0);
-}
-
-static GLboolean
-xglAreTexturesResident (GLsizei n,
- const GLuint *textures,
- GLboolean *residences)
-{
- GLboolean allResident = GL_TRUE;
- int i, j;
-
- if (n < 0)
- {
- cctx->error = GL_INVALID_VALUE;
- return GL_FALSE;
- }
-
- if (!textures || !residences)
- return GL_FALSE;
-
- for (i = 0; i < n; i++)
- {
- xglTexObjPtr pTexObj;
- GLboolean resident;
-
- if (textures[i] == 0)
- {
- cctx->error = GL_INVALID_VALUE;
- return GL_FALSE;
- }
-
- pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
- textures[i]);
- if (!pTexObj)
- {
- cctx->error = GL_INVALID_VALUE;
- return GL_FALSE;
- }
-
- if (glAreTexturesResident (1, &pTexObj->name, &resident))
- {
- if (!allResident)
- residences[i] = GL_TRUE;
- }
- else
- {
- if (allResident)
- {
- allResident = GL_FALSE;
-
- for (j = 0; j < i; j++)
- residences[j] = GL_TRUE;
- }
- residences[i] = GL_FALSE;
- }
- }
-
- return allResident;
-}
-
-static void
-xglDeleteTextures (GLsizei n,
- const GLuint *textures)
-{
- xglTexObjPtr pTexObj;
-
- while (n--)
- {
- pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
- *textures);
- if (pTexObj)
- {
- glDeleteTextures (1, &pTexObj->name);
- xglHashRemove (cctx->shared->texObjects, *textures);
- xfree (pTexObj);
- }
- textures++;
- }
-}
-
-static GLboolean
-xglIsTexture (GLuint texture)
-{
- xglTexObjPtr pTexObj;
-
- if (!texture)
- return GL_FALSE;
-
- pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, texture);
- if (pTexObj)
- return glIsTexture (pTexObj->name);
-
- return GL_FALSE;
-}
-
-static void
-xglPrioritizeTextures (GLsizei n,
- const GLuint *textures,
- const GLclampf *priorities)
-{
- xglTexObjPtr pTexObj;
- int i;
-
- if (n < 0)
- {
- cctx->error = GL_INVALID_VALUE;
- return;
- }
-
- if (!priorities)
- return;
-
- for (i = 0; i < n; i++)
- {
- if (textures[i] <= 0)
- continue;
-
- pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
- textures[i]);
- if (pTexObj)
- glPrioritizeTextures (1, &pTexObj->name, &priorities[i]);
- }
-}
-
-static xglDisplayListPtr
-xglCreateList (void)
-{
- xglDisplayListPtr pDisplayList;
-
- pDisplayList = xalloc (sizeof (xglDisplayListRec));
- if (!pDisplayList)
- return NULL;
-
- pDisplayList->pOp = NULL;
- pDisplayList->nOp = 0;
- pDisplayList->size = 0;
- pDisplayList->refcnt = 1;
-
- return pDisplayList;
-}
-
-static void
-xglDestroyList (xglDisplayListPtr pDisplayList)
-{
- xglListOpPtr pOp = pDisplayList->pOp;
- int nOp = pDisplayList->nOp;
-
- pDisplayList->refcnt--;
- if (pDisplayList->refcnt)
- return;
-
- while (nOp--)
- {
- switch (pOp->type) {
- case XGL_LIST_OP_CALLS:
- case XGL_LIST_OP_DRAW:
- glDeleteLists (pOp->u.name, 1);
- break;
- case XGL_LIST_OP_COPY:
- xfree (pOp->u.copy);
- break;
- case XGL_LIST_OP_LIST:
- xglDestroyList (pOp->u.list);
- break;
- }
-
- pOp++;
- }
-
- if (pDisplayList->pOp)
- xfree (pDisplayList->pOp);
-
- xfree (pDisplayList);
-}
-
-static Bool
-xglResizeList (xglDisplayListPtr pDisplayList,
- int nOp)
-{
- if (pDisplayList->size < nOp)
- {
- int size = pDisplayList->nOp ? pDisplayList->nOp : 4;
-
- while (size < nOp)
- size <<= 1;
-
- pDisplayList->pOp = xrealloc (pDisplayList->pOp,
- sizeof (xglListOpRec) * size);
- if (!pDisplayList->pOp)
- return FALSE;
-
- pDisplayList->size = size;
- }
-
- return TRUE;
-}
-
-static void
-xglStartList (int type,
- GLenum mode)
-{
- if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
- {
- cctx->error = GL_OUT_OF_MEMORY;
- return;
- }
-
- cctx->pList->pOp[cctx->pList->nOp].type = type;
- cctx->pList->pOp[cctx->pList->nOp].u.name = glGenLists (1);
-
- glNewList (cctx->pList->pOp[cctx->pList->nOp].u.name, mode);
-
- cctx->pList->nOp++;
-}
-
-static GLuint
-xglGenLists (GLsizei range)
-{
- xglDisplayListPtr pDisplayList;
- GLuint first, name;
-
- first = xglHashFindFreeKeyBlock (cctx->shared->displayLists, range);
-
- name = first;
- for (name = first; range--; name++)
- {
- pDisplayList = xglCreateList ();
- if (pDisplayList)
- {
- xglHashInsert (cctx->shared->displayLists, name, pDisplayList);
- }
- else
- {
- cctx->error = GL_OUT_OF_MEMORY;
- }
- }
-
- return first;
-}
-
-static void
-xglNewList (GLuint list,
- GLenum mode)
-{
- if (!list)
- {
- cctx->error = GL_INVALID_VALUE;
- return;
- }
-
- if (cctx->list)
- {
- cctx->error = GL_INVALID_OPERATION;
- return;
- }
-
- cctx->pList = xglCreateList ();
- if (!cctx->pList)
- {
- cctx->error = GL_OUT_OF_MEMORY;
- return;
- }
-
- cctx->list = list;
- cctx->listMode = mode;
-
- xglStartList (XGL_LIST_OP_CALLS, mode);
-}
-
-static void
-xglEndList (void)
-{
- xglDisplayListPtr pDisplayList;
-
- if (!cctx->list)
- {
- cctx->error = GL_INVALID_OPERATION;
- return;
- }
-
- glEndList ();
-
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (cctx->shared->displayLists, cctx->list);
- if (pDisplayList)
- {
- xglHashRemove (cctx->shared->displayLists, cctx->list);
- xglDestroyList (pDisplayList);
- }
-
- xglHashInsert (cctx->shared->displayLists, cctx->list, cctx->pList);
-
- cctx->list = 0;
-}
-
-#define XGL_GLX_DRAW_DECLARATIONS(pBox, nBox) \
- GCPtr pGC = cctx->pDrawBuffer->pGC; \
- BoxPtr (pBox) = REGION_RECTS (pGC->pCompositeClip); \
- int (nBox) = REGION_NUM_RECTS (pGC->pCompositeClip); \
- DrawablePtr pDrawable = cctx->pDrawBuffer->pDrawable; \
- int scissorX1 = cctx->attrib.scissor.x; \
- int scissorX2 = scissorX1 + cctx->attrib.scissor.width; \
- int scissorY2 = pDrawable->height - cctx->attrib.scissor.y; \
- int scissorY1 = scissorY2 - cctx->attrib.scissor.height
-
-#define XGL_GLX_DRAW_SCISSOR_CLIP(box) \
- if ((box)->x1 < scissorX1) \
- (box)->x1 = scissorX1; \
- if ((box)->y1 < scissorY1) \
- (box)->y1 = scissorY1; \
- if ((box)->x2 > scissorX2) \
- (box)->x2 = scissorX2; \
- if ((box)->y2 > scissorY2) \
- (box)->y2 = scissorY2
-
-#define XGL_GLX_DRAW_DAMAGE(pBox, pRegion) \
- if (cctx->attrib.drawBuffer == GL_FRONT) \
- { \
- REGION_INIT (pGC->pScreen, pRegion, pBox, 1); \
- REGION_UNION (pGC->pScreen, \
- &cctx->pDrawBuffer->damage, \
- &cctx->pDrawBuffer->damage, \
- pRegion); \
- REGION_UNINIT (pGC->pScreen, pRegion); \
- }
-
-#define XGL_GLX_DRAW_SET_SCISSOR_BOX(box) \
- glitz_context_set_scissor (cctx->context, \
- (box)->x1, \
- pDrawable->height - (box)->y2, \
- (box)->x2 - (box)->x1, \
- (box)->y2 - (box)->y1)
-
-
-static void
-xglDrawList (GLuint list)
-{
- RegionRec region;
- BoxRec box;
-
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- while (nBox--)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
-
- glCallList (list);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
-}
-
-static void
-xglCallDisplayList (xglDisplayListPtr pDisplayList)
-{
- if (cctx->list)
- {
- if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
- {
- cctx->error = GL_OUT_OF_MEMORY;
- return;
- }
-
- pDisplayList->refcnt++;
-
- cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_LIST;
- cctx->pList->pOp[cctx->pList->nOp].u.list = pDisplayList;
- cctx->pList->nOp++;
- }
- else
- {
- xglListOpPtr pOp = pDisplayList->pOp;
- int nOp = pDisplayList->nOp;
-
- while (nOp--)
- {
- switch (pOp->type) {
- case XGL_LIST_OP_CALLS:
- glCallList (pOp->u.name);
- break;
- case XGL_LIST_OP_DRAW:
- xglDrawList (pOp->u.name);
- break;
- case XGL_LIST_OP_COPY:
- (*pOp->u.copy->copyProc) (pOp->u.copy);
- break;
- case XGL_LIST_OP_LIST:
- xglCallDisplayList (pOp->u.list);
- break;
- }
-
- pOp++;
- }
- }
-}
-
-static void
-xglCallList (GLuint list)
-{
- xglDisplayListPtr pDisplayList;
-
- if (!list)
- {
- cctx->error = GL_INVALID_VALUE;
- return;
- }
-
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (cctx->shared->displayLists, list);
- if (pDisplayList)
- xglCallDisplayList (pDisplayList);
-}
-
-static void
-xglCallLists (GLsizei n,
- GLenum type,
- const GLvoid *lists)
-{
- xglDisplayListPtr pDisplayList;
- GLuint list;
- GLint base, i;
-
- glGetIntegerv (GL_LIST_BASE, &base);
-
- for (i = 0; i < n; i++)
- {
- switch (type) {
- case GL_BYTE:
- list = (GLuint) *(((GLbyte *) lists) + n);
- break;
- case GL_UNSIGNED_BYTE:
- list = (GLuint) *(((GLubyte *) lists) + n);
- break;
- case GL_SHORT:
- list = (GLuint) *(((GLshort *) lists) + n);
- break;
- case GL_UNSIGNED_SHORT:
- list = (GLuint) *(((GLushort *) lists) + n);
- break;
- case GL_INT:
- list = (GLuint) *(((GLint *) lists) + n);
- break;
- case GL_UNSIGNED_INT:
- list = (GLuint) *(((GLuint *) lists) + n);
- break;
- case GL_FLOAT:
- list = (GLuint) *(((GLfloat *) lists) + n);
- break;
- case GL_2_BYTES:
- {
- GLubyte *ubptr = ((GLubyte *) lists) + 2 * n;
- list = (GLuint) *ubptr * 256 + (GLuint) *(ubptr + 1);
- } break;
- case GL_3_BYTES:
- {
- GLubyte *ubptr = ((GLubyte *) lists) + 3 * n;
- list = (GLuint) * ubptr * 65536
- + (GLuint) * (ubptr + 1) * 256
- + (GLuint) * (ubptr + 2);
- } break;
- case GL_4_BYTES:
- {
- GLubyte *ubptr = ((GLubyte *) lists) + 4 * n;
- list = (GLuint) * ubptr * 16777216
- + (GLuint) * (ubptr + 1) * 65536
- + (GLuint) * (ubptr + 2) * 256
- + (GLuint) * (ubptr + 3);
- } break;
- default:
- cctx->error = GL_INVALID_ENUM;
- return;
- }
-
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (cctx->shared->displayLists, base + list);
- if (pDisplayList)
- xglCallDisplayList (pDisplayList);
- }
-}
-
-static void
-xglDeleteLists (GLuint list,
- GLsizei range)
-{
- xglDisplayListPtr pDisplayList;
- GLint i;
-
- if (range < 0)
- {
- cctx->error = GL_INVALID_VALUE;
- return;
- }
-
- for (i = 0; i < range; i++)
- {
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (cctx->shared->displayLists, list + i);
- if (pDisplayList)
- {
- xglHashRemove (cctx->shared->displayLists, list + i);
- xglDestroyList (pDisplayList);
- }
- }
-}
-
-static GLboolean
-xglIsList (GLuint list)
-{
- xglDisplayListPtr pDisplayList;
-
- if (!list)
- return GL_FALSE;
-
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (cctx->shared->displayLists, list);
- if (pDisplayList)
- return GL_TRUE;
-
- return GL_FALSE;
-}
-
-static void
-xglFlush (void)
-{
- xglGLBufferPtr pBuffer = cctx->pDrawBuffer;
-
- glFlush ();
-
- if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage))
- {
- DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage);
- REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage);
- }
-}
-
-static void
-xglFinish (void)
-{
- xglGLBufferPtr pBuffer = cctx->pDrawBuffer;
-
- glFinish ();
-
- if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage))
- {
- DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage);
- REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage);
- }
-}
-
-static void
-xglClear (GLbitfield mask)
-{
- GLenum mode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glClear (mask);
- glEndList ();
-
- mode = cctx->listMode;
- }
- else
- mode = GL_COMPILE_AND_EXECUTE;
-
- if (mode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec box;
-
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- while (nBox--)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
-
- glClear (mask);
-
- if (mask & GL_COLOR_BUFFER_BIT)
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglAccum (GLenum op,
- GLfloat value)
-{
- if (op == GL_RETURN)
- {
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glAccum (GL_RETURN, value);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec box;
-
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- while (nBox--)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
-
- glAccum (GL_RETURN, value);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
- }
- else
- glAccum (op, value);
-}
-
-static void
-xglDrawArrays (GLenum mode,
- GLint first,
- GLsizei count)
-{
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glDrawArrays (mode, first, count);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec box;
-
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- while (nBox--)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
-
- glDrawArrays (mode, first, count);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglDrawElements (GLenum mode,
- GLsizei count,
- GLenum type,
- const GLvoid *indices)
-{
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glDrawElements (mode, count, type, indices);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec box;
-
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- while (nBox--)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
-
- glDrawElements (mode, count, type, indices);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglDrawPixels (GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const GLvoid *pixels)
-{
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glDrawPixels (width, height, format, type, pixels);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec box;
-
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- while (nBox--)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
-
- glDrawPixels (width, height, format, type, pixels);
-
- if (format != GL_STENCIL_INDEX)
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglBitmap (GLsizei width,
- GLsizei height,
- GLfloat xorig,
- GLfloat yorig,
- GLfloat xmove,
- GLfloat ymove,
- const GLubyte *bitmap)
-{
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glBitmap (width, height, xorig, yorig, xmove, ymove, bitmap);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec box;
-
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- while (nBox--)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
-
- glBitmap (width, height, xorig, yorig, xmove, ymove, bitmap);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglRectdv (const GLdouble *v1,
- const GLdouble *v2)
-{
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glRectdv (v1, v2);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec box;
-
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- while (nBox--)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
-
- glRectdv (v1, v2);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglRectfv (const GLfloat *v1,
- const GLfloat *v2)
-{
- GLdouble dv1[2];
- GLdouble dv2[2];
-
- dv1[0] = (GLdouble) v1[0];
- dv1[1] = (GLdouble) v1[1];
- dv2[0] = (GLdouble) v2[0];
- dv2[1] = (GLdouble) v2[1];
-
- xglRectdv (dv1, dv2);
-}
-
-static void
-xglRectiv (const GLint *v1,
- const GLint *v2)
-{
- GLdouble dv1[2];
- GLdouble dv2[2];
-
- dv1[0] = (GLdouble) v1[0];
- dv1[1] = (GLdouble) v1[1];
- dv2[0] = (GLdouble) v2[0];
- dv2[1] = (GLdouble) v2[1];
-
- xglRectdv (dv1, dv2);
-}
-
-static void
-xglRectsv (const GLshort *v1,
- const GLshort *v2)
-{
- GLdouble dv1[2];
- GLdouble dv2[2];
-
- dv1[0] = (GLdouble) v1[0];
- dv1[1] = (GLdouble) v1[1];
- dv2[0] = (GLdouble) v2[0];
- dv2[1] = (GLdouble) v2[1];
-
- xglRectdv (dv1, dv2);
-}
-
-static void
-xglBegin (GLenum mode)
-{
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- }
- else
- {
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- if (nBox == 1)
- {
- BoxRec box = *pBox;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
- }
- else
- {
- if (!cctx->groupList)
- cctx->groupList = glGenLists (1);
-
- glNewList (cctx->groupList, GL_COMPILE);
- }
- }
-
- glBegin (mode);
-}
-
-static void
-xglEnd (void)
-{
- glEnd ();
-
- if (!cctx->list || cctx->listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec box;
- GLuint list;
-
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- if (cctx->list)
- {
- list = cctx->pList->pOp[cctx->pList->nOp - 1].u.name;
- }
- else
- {
- if (nBox == 1)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- return;
- }
-
- list = cctx->groupList;
- }
-
- glEndList ();
-
- while (nBox--)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
-
- glCallList (list);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglCopyOp (xglCopyOpPtr pOp)
-{
- if (cctx->list)
- {
- xglCopyOpPtr pCopyOp;
-
- pCopyOp = xalloc (sizeof (xglCopyOpRec));
- if (!pCopyOp)
- {
- cctx->error = GL_OUT_OF_MEMORY;
- return;
- }
-
- if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
- {
- xfree (pCopyOp);
- cctx->error = GL_OUT_OF_MEMORY;
- return;
- }
-
- glEndList ();
-
- *pCopyOp = *pOp;
-
- cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_COPY;
- cctx->pList->pOp[cctx->pList->nOp].u.copy = pCopyOp;
- cctx->pList->nOp++;
-
- if (cctx->listMode == GL_COMPILE_AND_EXECUTE)
- (*pOp->copyProc) (pOp);
-
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
- }
- else
- (*pOp->copyProc) (pOp);
-}
-
-static void
-xglDoCopyPixels (xglCopyOpPtr pOp)
-{
- RegionRec region;
- BoxRec box;
-
- XGL_GLX_DRAW_DECLARATIONS (pBox, nBox);
-
- while (nBox--)
- {
- box = *pBox++;
-
- XGL_GLX_DRAW_SCISSOR_CLIP (&box);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_DRAW_SET_SCISSOR_BOX (&box);
-
- glCopyPixels (cctx->tx + pOp->u.pixels.x,
- cctx->ty + pOp->u.pixels.y,
- pOp->u.pixels.width,
- pOp->u.pixels.height,
- pOp->u.pixels.type);
-
- if (pOp->u.pixels.type == GL_COLOR)
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
-}
-
-static void
-xglCopyPixels (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum type)
-{
- xglCopyOpRec copy;
-
- copy.copyProc = xglDoCopyPixels;
- copy.u.pixels.x = x;
- copy.u.pixels.y = y;
- copy.u.pixels.width = width;
- copy.u.pixels.height = height;
- copy.u.pixels.type = type;
-
- xglCopyOp (&copy);
-}
-
-static void
-xglReadPixels (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- GLvoid *pixels)
-{
- glReadPixels (cctx->tx + x, cctx->ty + y,
- width, height, format, type, pixels);
-}
-
-static void
-xglDoCopyTexImage1D (xglCopyOpPtr pOp)
-{
- glCopyTexImage1D (pOp->u.tex_image_1d.target,
- pOp->u.tex_image_1d.level,
- pOp->u.tex_image_1d.internalformat,
- cctx->tx + pOp->u.tex_image_1d.x,
- cctx->ty + pOp->u.tex_image_1d.y,
- pOp->u.tex_image_1d.width,
- pOp->u.tex_image_1d.border);
-}
-
-static void
-xglCopyTexImage1D (GLenum target,
- GLint level,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLint border)
-{
- xglCopyOpRec copy;
-
- copy.copyProc = xglDoCopyTexImage1D;
- copy.u.tex_image_1d.target = target;
- copy.u.tex_image_1d.level = level;
- copy.u.tex_image_1d.internalformat = internalformat;
- copy.u.tex_image_1d.x = x;
- copy.u.tex_image_1d.y = y;
- copy.u.tex_image_1d.width = width;
- copy.u.tex_image_1d.border = border;
-
- xglCopyOp (&copy);
-}
-
-static void
-xglDoCopyTexImage2D (xglCopyOpPtr pOp)
-{
- glCopyTexImage2D (pOp->u.tex_image_2d.target,
- pOp->u.tex_image_2d.level,
- pOp->u.tex_image_2d.internalformat,
- cctx->tx + pOp->u.tex_image_2d.x,
- cctx->ty + pOp->u.tex_image_2d.y,
- pOp->u.tex_image_2d.width,
- pOp->u.tex_image_2d.height,
- pOp->u.tex_image_2d.border);
-}
-
-static void
-xglCopyTexImage2D (GLenum target,
- GLint level,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- xglCopyOpRec copy;
-
- copy.copyProc = xglDoCopyTexImage2D;
- copy.u.tex_image_2d.target = target;
- copy.u.tex_image_2d.level = level;
- copy.u.tex_image_2d.internalformat = internalformat;
- copy.u.tex_image_2d.x = x;
- copy.u.tex_image_2d.y = y;
- copy.u.tex_image_2d.width = width;
- copy.u.tex_image_2d.height = height;
- copy.u.tex_image_2d.border = border;
-
- xglCopyOp (&copy);
-}
-
-static void
-xglDoCopyTexSubImage1D (xglCopyOpPtr pOp)
-{
- glCopyTexSubImage1D (pOp->u.tex_sub_image_1d.target,
- pOp->u.tex_sub_image_1d.level,
- pOp->u.tex_sub_image_1d.xoffset,
- cctx->tx + pOp->u.tex_sub_image_1d.x,
- cctx->ty + pOp->u.tex_sub_image_1d.y,
- pOp->u.tex_sub_image_1d.width);
-}
-
-static void
-xglCopyTexSubImage1D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint x,
- GLint y,
- GLsizei width)
-{
- xglCopyOpRec copy;
-
- copy.copyProc = xglDoCopyTexSubImage1D;
- copy.u.tex_sub_image_1d.target = target;
- copy.u.tex_sub_image_1d.level = level;
- copy.u.tex_sub_image_1d.xoffset = xoffset;
- copy.u.tex_sub_image_1d.x = x;
- copy.u.tex_sub_image_1d.y = y;
- copy.u.tex_sub_image_1d.width = width;
-
- xglCopyOp (&copy);
-}
-
-static void
-xglDoCopyTexSubImage2D (xglCopyOpPtr pOp)
-{
- glCopyTexSubImage2D (pOp->u.tex_sub_image_2d.target,
- pOp->u.tex_sub_image_2d.level,
- pOp->u.tex_sub_image_2d.xoffset,
- pOp->u.tex_sub_image_2d.yoffset,
- cctx->tx + pOp->u.tex_sub_image_2d.x,
- cctx->ty + pOp->u.tex_sub_image_2d.y,
- pOp->u.tex_sub_image_2d.width,
- pOp->u.tex_sub_image_2d.height);
-}
-
-static void
-xglCopyTexSubImage2D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- xglCopyOpRec copy;
-
- copy.copyProc = xglDoCopyTexSubImage2D;
- copy.u.tex_sub_image_2d.target = target;
- copy.u.tex_sub_image_2d.level = level;
- copy.u.tex_sub_image_2d.xoffset = xoffset;
- copy.u.tex_sub_image_2d.yoffset = yoffset;
- copy.u.tex_sub_image_2d.x = x;
- copy.u.tex_sub_image_2d.y = y;
- copy.u.tex_sub_image_2d.width = width;
- copy.u.tex_sub_image_2d.height = height;
-
- xglCopyOp (&copy);
-}
-
-static void
-xglDoCopyColorTable (xglCopyOpPtr pOp)
-{
- glCopyColorTable (pOp->u.color_table.target,
- pOp->u.color_table.internalformat,
- cctx->tx + pOp->u.color_table.x,
- cctx->ty + pOp->u.color_table.y,
- pOp->u.color_table.width);
-}
-
-static void
-xglCopyColorTable (GLenum target,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width)
-{
- xglCopyOpRec copy;
-
- copy.copyProc = xglDoCopyColorTable;
- copy.u.color_table.target = target;
- copy.u.color_table.internalformat = internalformat;
- copy.u.color_table.x = x;
- copy.u.color_table.y = y;
- copy.u.color_table.width = width;
-
- xglCopyOp (&copy);
-}
-
-static void
-xglDoCopyColorSubTable (xglCopyOpPtr pOp)
-{
- glCopyColorTable (pOp->u.color_sub_table.target,
- pOp->u.color_sub_table.start,
- cctx->tx + pOp->u.color_sub_table.x,
- cctx->ty + pOp->u.color_sub_table.y,
- pOp->u.color_sub_table.width);
-}
-
-static void
-xglCopyColorSubTable (GLenum target,
- GLsizei start,
- GLint x,
- GLint y,
- GLsizei width)
-{
- xglCopyOpRec copy;
-
- copy.copyProc = xglDoCopyColorSubTable;
- copy.u.color_sub_table.target = target;
- copy.u.color_sub_table.start = start;
- copy.u.color_sub_table.x = x;
- copy.u.color_sub_table.y = y;
- copy.u.color_sub_table.width = width;
-
- xglCopyOp (&copy);
-}
-
-static void
-xglDoCopyConvolutionFilter1D (xglCopyOpPtr pOp)
-{
- glCopyConvolutionFilter1D (pOp->u.convolution_filter_1d.target,
- pOp->u.convolution_filter_1d.internalformat,
- cctx->tx + pOp->u.convolution_filter_1d.x,
- cctx->ty + pOp->u.convolution_filter_1d.y,
- pOp->u.convolution_filter_1d.width);
-}
-
-static void
-xglCopyConvolutionFilter1D (GLenum target,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width)
-{
- xglCopyOpRec copy;
-
- copy.copyProc = xglDoCopyConvolutionFilter1D;
- copy.u.convolution_filter_1d.target = target;
- copy.u.convolution_filter_1d.internalformat = internalformat;
- copy.u.convolution_filter_1d.x = x;
- copy.u.convolution_filter_1d.y = y;
- copy.u.convolution_filter_1d.width = width;
-
- xglCopyOp (&copy);
-}
-
-static void
-xglDoCopyConvolutionFilter2D (xglCopyOpPtr pOp)
-{
- glCopyConvolutionFilter2D (pOp->u.convolution_filter_2d.target,
- pOp->u.convolution_filter_2d.internalformat,
- cctx->tx + pOp->u.convolution_filter_2d.x,
- cctx->ty + pOp->u.convolution_filter_2d.y,
- pOp->u.convolution_filter_2d.width,
- pOp->u.convolution_filter_2d.height);
-}
-
-static void
-xglCopyConvolutionFilter2D (GLenum target,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- xglCopyOpRec copy;
-
- copy.copyProc = xglDoCopyConvolutionFilter2D;
- copy.u.convolution_filter_2d.target = target;
- copy.u.convolution_filter_2d.internalformat = internalformat;
- copy.u.convolution_filter_2d.x = x;
- copy.u.convolution_filter_2d.y = y;
- copy.u.convolution_filter_2d.width = width;
- copy.u.convolution_filter_2d.height = height;
-
- xglCopyOp (&copy);
-}
-
-static void
-xglDoCopyTexSubImage3D (xglCopyOpPtr pOp)
-{
- glCopyTexSubImage3D (pOp->u.tex_sub_image_3d.target,
- pOp->u.tex_sub_image_3d.level,
- pOp->u.tex_sub_image_3d.xoffset,
- pOp->u.tex_sub_image_3d.yoffset,
- pOp->u.tex_sub_image_3d.zoffset,
- cctx->tx + pOp->u.tex_sub_image_3d.x,
- cctx->ty + pOp->u.tex_sub_image_3d.y,
- pOp->u.tex_sub_image_3d.width,
- pOp->u.tex_sub_image_3d.height);
-}
-
-static void
-xglCopyTexSubImage3D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- xglCopyOpRec copy;
-
- copy.copyProc = xglDoCopyTexSubImage3D;
- copy.u.tex_sub_image_3d.target = target;
- copy.u.tex_sub_image_3d.level = level;
- copy.u.tex_sub_image_3d.xoffset = xoffset;
- copy.u.tex_sub_image_3d.yoffset = yoffset;
- copy.u.tex_sub_image_3d.zoffset = zoffset;
- copy.u.tex_sub_image_3d.x = x;
- copy.u.tex_sub_image_3d.y = y;
- copy.u.tex_sub_image_3d.width = width;
- copy.u.tex_sub_image_3d.height = height;
-
- xglCopyOp (&copy);
-}
-
-__glProcTable __glNativeRenderTable = {
- xglNewList, /* glNewList */
- xglEndList, /* glEndList */
- xglCallList, /* glCallList */
- xglCallLists, /* glCallLists */
- xglDeleteLists, /* glDeleteLists */
- xglGenLists, /* glGenLists */
- glListBase,
- xglBegin, /* glBegin */
- xglBitmap, /* glBitmap */
- glColor3bv,
- glColor3dv,
- glColor3fv,
- glColor3iv,
- glColor3sv,
- glColor3ubv,
- glColor3uiv,
- glColor3usv,
- glColor4bv,
- glColor4dv,
- glColor4fv,
- glColor4iv,
- glColor4sv,
- glColor4ubv,
- glColor4uiv,
- glColor4usv,
- glEdgeFlagv,
- xglEnd, /* glEnd */
- glIndexdv,
- glIndexfv,
- glIndexiv,
- glIndexsv,
- glNormal3bv,
- glNormal3dv,
- glNormal3fv,
- glNormal3iv,
- glNormal3sv,
- glRasterPos2dv,
- glRasterPos2fv,
- glRasterPos2iv,
- glRasterPos2sv,
- glRasterPos3dv,
- glRasterPos3fv,
- glRasterPos3iv,
- glRasterPos3sv,
- glRasterPos4dv,
- glRasterPos4fv,
- glRasterPos4iv,
- glRasterPos4sv,
- xglRectdv, /* glRectdv */
- xglRectfv, /* glRectfv */
- xglRectiv, /* glRectiv */
- xglRectsv, /* glRectsv */
- glTexCoord1dv,
- glTexCoord1fv,
- glTexCoord1iv,
- glTexCoord1sv,
- glTexCoord2dv,
- glTexCoord2fv,
- glTexCoord2iv,
- glTexCoord2sv,
- glTexCoord3dv,
- glTexCoord3fv,
- glTexCoord3iv,
- glTexCoord3sv,
- glTexCoord4dv,
- glTexCoord4fv,
- glTexCoord4iv,
- glTexCoord4sv,
- glVertex2dv,
- glVertex2fv,
- glVertex2iv,
- glVertex2sv,
- glVertex3dv,
- glVertex3fv,
- glVertex3iv,
- glVertex3sv,
- glVertex4dv,
- glVertex4fv,
- glVertex4iv,
- glVertex4sv,
- glClipPlane,
- glColorMaterial,
- glCullFace,
- glFogf,
- glFogfv,
- glFogi,
- glFogiv,
- glFrontFace,
- glHint,
- glLightf,
- glLightfv,
- glLighti,
- glLightiv,
- glLightModelf,
- glLightModelfv,
- glLightModeli,
- glLightModeliv,
- glLineStipple,
- glLineWidth,
- glMaterialf,
- glMaterialfv,
- glMateriali,
- glMaterialiv,
- glPointSize,
- glPolygonMode,
- glPolygonStipple,
- xglScissor, /* glScissor */
- glShadeModel,
- glTexParameterf,
- glTexParameterfv,
- glTexParameteri,
- glTexParameteriv,
- glTexImage1D,
- glTexImage2D,
- glTexEnvf,
- glTexEnvfv,
- glTexEnvi,
- glTexEnviv,
- glTexGend,
- glTexGendv,
- glTexGenf,
- glTexGenfv,
- glTexGeni,
- glTexGeniv,
- glFeedbackBuffer,
- glSelectBuffer,
- glRenderMode,
- glInitNames,
- glLoadName,
- glPassThrough,
- glPopName,
- glPushName,
- xglDrawBuffer, /* glDrawBuffer */
- xglClear, /* glClear */
- glClearAccum,
- glClearIndex,
- glClearColor,
- glClearStencil,
- glClearDepth,
- glStencilMask,
- glColorMask,
- glDepthMask,
- glIndexMask,
- xglAccum, /* glAccum */
- xglDisable, /* glDisable */
- xglEnable, /* glEnable */
- xglFinish, /* glFinish */
- xglFlush, /* glFlush */
- xglPopAttrib, /* glPopAttrib */
- xglPushAttrib, /* glPushAttrib */
- glMap1d,
- glMap1f,
- glMap2d,
- glMap2f,
- glMapGrid1d,
- glMapGrid1f,
- glMapGrid2d,
- glMapGrid2f,
- glEvalCoord1dv,
- glEvalCoord1fv,
- glEvalCoord2dv,
- glEvalCoord2fv,
- glEvalMesh1,
- glEvalPoint1,
- glEvalMesh2,
- glEvalPoint2,
- glAlphaFunc,
- glBlendFunc,
- glLogicOp,
- glStencilFunc,
- glStencilOp,
- glDepthFunc,
- glPixelZoom,
- glPixelTransferf,
- glPixelTransferi,
- glPixelStoref,
- glPixelStorei,
- glPixelMapfv,
- glPixelMapuiv,
- glPixelMapusv,
- xglReadBuffer, /* glReadBuffer */
- xglCopyPixels, /* glCopyPixels */
- xglReadPixels, /* glReadPixels */
- xglDrawPixels, /* glDrawPixels */
- xglGetBooleanv, /* glGetBooleanv */
- glGetClipPlane,
- xglGetDoublev, /* glGetDoublev */
- xglGetError, /* glGetError */
- xglGetFloatv, /* glGetFloatv */
- xglGetIntegerv, /* glGetIntegerv */
- glGetLightfv,
- glGetLightiv,
- glGetMapdv,
- glGetMapfv,
- glGetMapiv,
- glGetMaterialfv,
- glGetMaterialiv,
- glGetPixelMapfv,
- glGetPixelMapuiv,
- glGetPixelMapusv,
- glGetPolygonStipple,
- xglGetString, /* glGetString */
- glGetTexEnvfv,
- glGetTexEnviv,
- glGetTexGendv,
- glGetTexGenfv,
- glGetTexGeniv,
- glGetTexImage,
- glGetTexParameterfv,
- glGetTexParameteriv,
- glGetTexLevelParameterfv,
- glGetTexLevelParameteriv,
- xglIsEnabled, /* glIsEnabled */
- xglIsList, /* glIsList */
- glDepthRange,
- glFrustum,
- glLoadIdentity,
- glLoadMatrixf,
- glLoadMatrixd,
- glMatrixMode,
- glMultMatrixf,
- glMultMatrixd,
- glOrtho,
- glPopMatrix,
- glPushMatrix,
- glRotated,
- glRotatef,
- glScaled,
- glScalef,
- glTranslated,
- glTranslatef,
- xglViewport, /* glViewport */
- glArrayElement,
- xglBindTexture, /* glBindTexture */
- glColorPointer,
- glDisableClientState,
- xglDrawArrays, /* glDrawArrays */
- xglDrawElements, /* glDrawElements */
- glEdgeFlagPointer,
- glEnableClientState,
- glIndexPointer,
- glIndexubv,
- glInterleavedArrays,
- glNormalPointer,
- glPolygonOffset,
- glTexCoordPointer,
- glVertexPointer,
- xglAreTexturesResident, /* glAreTexturesResident */
- xglCopyTexImage1D, /* glCopyTexImage1D */
- xglCopyTexImage2D, /* glCopyTexImage2D */
- xglCopyTexSubImage1D, /* glCopyTexSubImage1D */
- xglCopyTexSubImage2D, /* glCopyTexSubImage2D */
- xglDeleteTextures, /* glDeleteTextures */
- xglGenTextures, /* glGenTextures */
- glGetPointerv,
- xglIsTexture, /* glIsTexture */
- xglPrioritizeTextures, /* glPrioritizeTextures */
- glTexSubImage1D,
- glTexSubImage2D,
- glPopClientAttrib,
- glPushClientAttrib,
- glBlendColor,
- glBlendEquation,
- glColorTable,
- glColorTableParameterfv,
- glColorTableParameteriv,
- xglCopyColorTable, /* glCopyColorTable */
- glGetColorTable,
- glGetColorTableParameterfv,
- glGetColorTableParameteriv,
- glColorSubTable,
- xglCopyColorSubTable, /* glCopyColorSubTable */
- glConvolutionFilter1D,
- glConvolutionFilter2D,
- glConvolutionParameterf,
- glConvolutionParameterfv,
- glConvolutionParameteri,
- glConvolutionParameteriv,
- xglCopyConvolutionFilter1D, /* glCopyConvolutionFilter1D */
- xglCopyConvolutionFilter2D, /* glCopyConvolutionFilter2D */
- glGetConvolutionFilter,
- glGetConvolutionParameterfv,
- glGetConvolutionParameteriv,
- glGetSeparableFilter,
- glSeparableFilter2D,
- glGetHistogram,
- glGetHistogramParameterfv,
- glGetHistogramParameteriv,
- glGetMinmax,
- glGetMinmaxParameterfv,
- glGetMinmaxParameteriv,
- glHistogram,
- glMinmax,
- glResetHistogram,
- glResetMinmax,
- glTexImage3D,
- glTexSubImage3D,
- xglCopyTexSubImage3D /* glCopyTexSubImage3D */
-};
-
-/* GL_ARB_multitexture */
-static void
-xglNoOpActiveTextureARB (GLenum texture) {}
-static void
-xglNoOpClientActiveTextureARB (GLenum texture) {}
-static void
-xglNoOpMultiTexCoord1dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord1fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord1ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord1svARB (GLenum target, const GLshort *v) {}
-static void
-xglNoOpMultiTexCoord2dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord2fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord2ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord2svARB (GLenum target, const GLshort *v) {}
-static void
-xglNoOpMultiTexCoord3dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord3fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord3ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord3svARB (GLenum target, const GLshort *v) {}
-static void
-xglNoOpMultiTexCoord4dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord4fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord4ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord4svARB (GLenum target, const GLshort *v) {}
-
-/* GL_ARB_multisample */
-static void
-xglNoOpSampleCoverageARB (GLclampf value, GLboolean invert) {}
-
-/* GL_EXT_texture_object */
-static GLboolean
-xglNoOpAreTexturesResidentEXT (GLsizei n,
- const GLuint *textures,
- GLboolean *residences)
-{
- return GL_FALSE;
-}
-static void
-xglNoOpGenTexturesEXT (GLsizei n, GLuint *textures) {}
-static GLboolean
-xglNoOpIsTextureEXT (GLuint texture)
-{
- return GL_FALSE;
-}
-
-/* GL_SGIS_multisample */
-static void
-xglNoOpSampleMaskSGIS (GLclampf value, GLboolean invert) {}
-static void
-xglNoOpSamplePatternSGIS (GLenum pattern) {}
-
-/* GL_EXT_point_parameters */
-static void
-xglNoOpPointParameterfEXT (GLenum pname, GLfloat param) {}
-static void
-xglNoOpPointParameterfvEXT (GLenum pname, const GLfloat *params) {}
-
-/* GL_MESA_window_pos */
-static void
-xglNoOpWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z) {}
-static void
-xglWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z)
-{
- (*cctx->glRenderTableEXT.WindowPos3fMESA) (cctx->tx + x, cctx->ty + y, z);
-}
-
-/* GL_EXT_blend_func_separate */
-static void
-xglNoOpBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorAlpha, GLenum dfactorAlpha) {}
-
-/* GL_EXT_fog_coord */
-static void
-xglNoOpFogCoordfvEXT (const GLfloat *coord) {}
-static void
-xglNoOpFogCoorddvEXT (const GLdouble *coord) {}
-static void
-xglNoOpFogCoordPointerEXT (GLenum type, GLsizei stride,
- const GLvoid *pointer) {}
-
-/* GL_EXT_secondary_color */
-static void
-xglNoOpSecondaryColor3bvEXT (const GLbyte *v) {}
-static void
-xglNoOpSecondaryColor3dvEXT (const GLdouble *v) {}
-static void
-xglNoOpSecondaryColor3fvEXT (const GLfloat *v) {}
-static void
-xglNoOpSecondaryColor3ivEXT (const GLint *v) {}
-static void
-xglNoOpSecondaryColor3svEXT (const GLshort *v) {}
-static void
-xglNoOpSecondaryColor3ubvEXT (const GLubyte *v) {}
-static void
-xglNoOpSecondaryColor3uivEXT (const GLuint *v) {}
-static void
-xglNoOpSecondaryColor3usvEXT (const GLushort *v) {}
-static void
-xglNoOpSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride,
- const GLvoid *pointer) {}
-
-
-/* GL_NV_point_sprite */
-static void
-xglNoOpPointParameteriNV (GLenum pname, GLint params) {}
-static void
-xglNoOpPointParameterivNV (GLenum pname, const GLint *params) {}
-
-/* GL_EXT_stencil_two_side */
-static void
-xglNoOpActiveStencilFaceEXT (GLenum face) {}
-
-__glProcTableEXT __glNoOpRenderTableEXT = {
- xglNoOpActiveTextureARB,
- xglNoOpClientActiveTextureARB,
- xglNoOpMultiTexCoord1dvARB,
- xglNoOpMultiTexCoord1fvARB,
- xglNoOpMultiTexCoord1ivARB,
- xglNoOpMultiTexCoord1svARB,
- xglNoOpMultiTexCoord2dvARB,
- xglNoOpMultiTexCoord2fvARB,
- xglNoOpMultiTexCoord2ivARB,
- xglNoOpMultiTexCoord2svARB,
- xglNoOpMultiTexCoord3dvARB,
- xglNoOpMultiTexCoord3fvARB,
- xglNoOpMultiTexCoord3ivARB,
- xglNoOpMultiTexCoord3svARB,
- xglNoOpMultiTexCoord4dvARB,
- xglNoOpMultiTexCoord4fvARB,
- xglNoOpMultiTexCoord4ivARB,
- xglNoOpMultiTexCoord4svARB,
- xglNoOpSampleCoverageARB,
- xglNoOpAreTexturesResidentEXT,
- xglNoOpGenTexturesEXT,
- xglNoOpIsTextureEXT,
- xglNoOpSampleMaskSGIS,
- xglNoOpSamplePatternSGIS,
- xglNoOpPointParameterfEXT,
- xglNoOpPointParameterfvEXT,
- xglNoOpWindowPos3fMESA,
- xglNoOpBlendFuncSeparateEXT,
- xglNoOpFogCoordfvEXT,
- xglNoOpFogCoorddvEXT,
- xglNoOpFogCoordPointerEXT,
- xglNoOpSecondaryColor3bvEXT,
- xglNoOpSecondaryColor3dvEXT,
- xglNoOpSecondaryColor3fvEXT,
- xglNoOpSecondaryColor3ivEXT,
- xglNoOpSecondaryColor3svEXT,
- xglNoOpSecondaryColor3ubvEXT,
- xglNoOpSecondaryColor3uivEXT,
- xglNoOpSecondaryColor3usvEXT,
- xglNoOpSecondaryColorPointerEXT,
- xglNoOpPointParameteriNV,
- xglNoOpPointParameterivNV,
- xglNoOpActiveStencilFaceEXT
-};
-
-static void
-xglInitExtensions (xglGLContextPtr pContext)
-{
- const char *extensions;
-
- pContext->glRenderTableEXT = __glNoOpRenderTableEXT;
-
- extensions = glGetString (GL_EXTENSIONS);
-
- if (strstr (extensions, "GL_ARB_multitexture"))
- {
- pContext->glRenderTableEXT.ActiveTextureARB =
- (PFNGLACTIVETEXTUREARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glActiveTextureARB");
- pContext->glRenderTableEXT.ClientActiveTextureARB =
- (PFNGLCLIENTACTIVETEXTUREARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glClientActiveTextureARB");
- pContext->glRenderTableEXT.MultiTexCoord1dvARB =
- (PFNGLMULTITEXCOORD1DVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord1dvARB");
- pContext->glRenderTableEXT.MultiTexCoord1fvARB =
- (PFNGLMULTITEXCOORD1FVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord1fvARB");
- pContext->glRenderTableEXT.MultiTexCoord1ivARB =
- (PFNGLMULTITEXCOORD1IVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord1ivARB");
- pContext->glRenderTableEXT.MultiTexCoord1svARB =
- (PFNGLMULTITEXCOORD1SVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord1svARB");
- pContext->glRenderTableEXT.MultiTexCoord2dvARB =
- (PFNGLMULTITEXCOORD2DVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord2dvARB");
- pContext->glRenderTableEXT.MultiTexCoord2fvARB =
- (PFNGLMULTITEXCOORD2FVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord2fvARB");
- pContext->glRenderTableEXT.MultiTexCoord2ivARB =
- (PFNGLMULTITEXCOORD2IVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord2ivARB");
- pContext->glRenderTableEXT.MultiTexCoord2svARB =
- (PFNGLMULTITEXCOORD2SVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord2svARB");
- pContext->glRenderTableEXT.MultiTexCoord3dvARB =
- (PFNGLMULTITEXCOORD3DVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord3dvARB");
- pContext->glRenderTableEXT.MultiTexCoord3fvARB =
- (PFNGLMULTITEXCOORD3FVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord3fvARB");
- pContext->glRenderTableEXT.MultiTexCoord3ivARB =
- (PFNGLMULTITEXCOORD3IVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord3ivARB");
- pContext->glRenderTableEXT.MultiTexCoord3svARB =
- (PFNGLMULTITEXCOORD3SVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord3svARB");
- pContext->glRenderTableEXT.MultiTexCoord4dvARB =
- (PFNGLMULTITEXCOORD4DVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord4dvARB");
- pContext->glRenderTableEXT.MultiTexCoord4fvARB =
- (PFNGLMULTITEXCOORD4FVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord4fvARB");
- pContext->glRenderTableEXT.MultiTexCoord4ivARB =
- (PFNGLMULTITEXCOORD4IVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord4ivARB");
- pContext->glRenderTableEXT.MultiTexCoord4svARB =
- (PFNGLMULTITEXCOORD4SVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord4svARB");
- }
-
- if (strstr (extensions, "GL_ARB_multisample"))
- {
- pContext->glRenderTableEXT.SampleCoverageARB =
- (PFNGLSAMPLECOVERAGEARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSampleCoverageARB");
- }
-
- if (strstr (extensions, "GL_EXT_texture_object"))
- {
- pContext->glRenderTableEXT.AreTexturesResidentEXT =
- xglAreTexturesResident;
- pContext->glRenderTableEXT.GenTexturesEXT = xglGenTextures;
- pContext->glRenderTableEXT.IsTextureEXT = xglIsTexture;
- }
-
- if (strstr (extensions, "GL_SGIS_multisample"))
- {
- pContext->glRenderTableEXT.SampleMaskSGIS =
- (PFNGLSAMPLEMASKSGISPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSampleMaskSGIS");
- pContext->glRenderTableEXT.SamplePatternSGIS =
- (PFNGLSAMPLEPATTERNSGISPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSamplePatternSGIS");
- }
-
- if (strstr (extensions, "GL_EXT_point_parameters"))
- {
- pContext->glRenderTableEXT.PointParameterfEXT =
- (PFNGLPOINTPARAMETERFEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glPointParameterfEXT");
- pContext->glRenderTableEXT.PointParameterfvEXT =
- (PFNGLPOINTPARAMETERFVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glPointParameterfvEXT");
- }
-
- if (strstr (extensions, "GL_MESA_window_pos"))
- {
- pContext->WindowPos3fMESA =
- (PFNGLWINDOWPOS3FMESAPROC)
- glitz_context_get_proc_address (pContext->context,
- "glWindowPos3fMESA");
- pContext->glRenderTableEXT.WindowPos3fMESA = xglWindowPos3fMESA;
- }
-
- if (strstr (extensions, "GL_EXT_blend_func_separate"))
- {
- pContext->glRenderTableEXT.BlendFuncSeparateEXT =
- (PFNGLBLENDFUNCSEPARATEEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glBlendFuncSeparateEXT");
- }
-
- if (strstr (extensions, "GL_EXT_fog_coord"))
- {
- pContext->glRenderTableEXT.FogCoordfvEXT =
- (PFNGLFOGCOORDFVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glFogCoordfvEXT");
- pContext->glRenderTableEXT.FogCoorddvEXT =
- (PFNGLFOGCOORDDVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glFogCoorddvEXT");
- pContext->glRenderTableEXT.FogCoordPointerEXT =
- (PFNGLFOGCOORDPOINTEREXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glFogCoordPointerEXT");
- }
-
- if (strstr (extensions, "GL_EXT_secondary_color"))
- {
- pContext->glRenderTableEXT.SecondaryColor3bvEXT =
- (PFNGLSECONDARYCOLOR3BVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3bvEXT");
- pContext->glRenderTableEXT.SecondaryColor3dvEXT =
- (PFNGLSECONDARYCOLOR3DVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3dvEXT");
- pContext->glRenderTableEXT.SecondaryColor3fvEXT =
- (PFNGLSECONDARYCOLOR3FVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3fvEXT");
- pContext->glRenderTableEXT.SecondaryColor3ivEXT =
- (PFNGLSECONDARYCOLOR3IVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3ivEXT");
- pContext->glRenderTableEXT.SecondaryColor3svEXT =
- (PFNGLSECONDARYCOLOR3SVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3svEXT");
- pContext->glRenderTableEXT.SecondaryColor3ubvEXT =
- (PFNGLSECONDARYCOLOR3UBVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3ubvEXT");
- pContext->glRenderTableEXT.SecondaryColor3uivEXT =
- (PFNGLSECONDARYCOLOR3UIVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3uivEXT");
- pContext->glRenderTableEXT.SecondaryColor3usvEXT =
- (PFNGLSECONDARYCOLOR3USVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3usvEXT");
- pContext->glRenderTableEXT.SecondaryColorPointerEXT =
- (PFNGLSECONDARYCOLORPOINTEREXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColorPointerEXT");
- }
-
- if (strstr (extensions, "GL_NV_point_sprite"))
- {
- pContext->glRenderTableEXT.PointParameteriNV =
- (PFNGLPOINTPARAMETERINVPROC)
- glitz_context_get_proc_address (pContext->context,
- "glPointParameteriNV");
- pContext->glRenderTableEXT.PointParameterivNV =
- (PFNGLPOINTPARAMETERIVNVPROC)
- glitz_context_get_proc_address (pContext->context,
- "glPointParameterivNV");
- }
-
- if (strstr (extensions, "GL_EXT_stencil_two_side"))
- {
- pContext->glRenderTableEXT.ActiveStencilFaceEXT =
- (PFNGLACTIVESTENCILFACEEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glActiveStencilFaceEXT");
- }
-
- pContext->needInit = FALSE;
-}
-
-static void
-xglFreeContext (xglGLContextPtr pContext)
-{
- pContext->refcnt--;
- if (pContext->shared == pContext)
- pContext->refcnt--;
-
- if (pContext->refcnt)
- return;
-
- if (pContext->shared != pContext)
- xglFreeContext (pContext->shared);
-
- if (pContext->texObjects)
- {
- xglTexObjPtr pTexObj;
- GLuint key;
-
- do {
- key = xglHashFirstEntry (pContext->texObjects);
- if (key)
- {
- pTexObj = (xglTexObjPtr) xglHashLookup (pContext->texObjects,
- key);
- if (pTexObj)
- {
- glDeleteTextures (1, &pTexObj->name);
- xfree (pTexObj);
- }
- xglHashRemove (pContext->texObjects, key);
- }
- } while (key);
-
- xglDeleteHashTable (pContext->texObjects);
- }
-
- if (pContext->displayLists)
- {
- xglDisplayListPtr pDisplayList;
- GLuint key;
-
- do {
- key = xglHashFirstEntry (pContext->displayLists);
- if (key)
- {
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (pContext->displayLists, key);
- if (pDisplayList)
- xglDestroyList (pDisplayList);
-
- xglHashRemove (pContext->displayLists, key);
- }
- } while (key);
-
- xglDeleteHashTable (pContext->displayLists);
- }
-
- if (pContext->groupList)
- glDeleteLists (pContext->groupList, 1);
-
- if (pContext->pAttribStack)
- xfree (pContext->pAttribStack);
-
- glitz_context_destroy (pContext->context);
-
- if (pContext->versionString)
- xfree (pContext->versionString);
-
- xfree (pContext);
-}
-
-static GLboolean
-xglDestroyContext (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- xglFreeContext (pContext);
-
- return (*iface->exports.destroyContext) ((__GLcontext *) iface);
-}
-
-static GLboolean
-xglLoseCurrent (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- __glXFlushContextCache ();
-
- return (*iface->exports.loseCurrent) ((__GLcontext *) iface);
-}
-
-static GLboolean
-xglMakeCurrent (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
- __GLdrawablePrivate *drawPriv = iface->imports.getDrawablePrivate (gc);
- __GLdrawablePrivate *readPriv = iface->imports.getReadablePrivate (gc);
- xglGLBufferPtr pDrawBufferPriv = drawPriv->private;
- xglGLBufferPtr pReadBufferPriv = readPriv->private;
- ScreenPtr pScreen = pDrawBufferPriv->pScreen;
- DrawablePtr pDrawable = pDrawBufferPriv->pDrawable;
- PixmapPtr pPixmap = pDrawBufferPriv->pPixmap;
- GLboolean status;
-
- pContext->target = xglPrepareTarget (pDrawable);
- if (pContext->target && pPixmap)
- {
- pContext->target = xglPrepareTarget (&pPixmap->drawable);
- if (pContext->target)
- {
- xglPixmapPtr pFront = XGL_GET_DRAWABLE_PIXMAP_PRIV (pDrawable);
- xglPixmapPtr pBack = XGL_GET_PIXMAP_PRIV (pPixmap);
- XID value = FALSE;
- int status;
-
- pContext->attrib.scissor.x = pContext->attrib.scissor.y = 0;
- pContext->attrib.scissor.width = pDrawable->width;
- pContext->attrib.scissor.height = pDrawable->height;
-
- pContext->attrib.viewport.x = pContext->attrib.viewport.y = 0;
- pContext->attrib.viewport.width = pDrawable->width;
- pContext->attrib.viewport.height = pDrawable->height;
-
- pContext->draw = pBack->surface;
-
- if (pBack->pArea)
- {
- xglOffscreenPtr pOffscreen = (xglOffscreenPtr)
- pBack->pArea->pRoot->closure;
-
- pContext->tx = pBack->pArea->x;
- pContext->ty =
- glitz_drawable_get_height (pOffscreen->drawable) -
- pBack->pArea->y - pDrawable->height;
- }
- else
- pContext->tx = pContext->ty = 0;
-
- pContext->pDrawBuffer = pDrawBufferPriv;
-
- if (!pFront->lock) pFront->lock++;
- if (!pBack->lock) pBack->lock++;
-
- glitz_context_set_surface (pContext->context, pContext->draw);
-
- if (!pDrawBufferPriv->pGC)
- pDrawBufferPriv->pGC =
- CreateGC (&pPixmap->drawable,
- GCGraphicsExposures, &value,
- &status);
-
- ValidateGC (&pPixmap->drawable, pDrawBufferPriv->pGC);
-
- if (!pDrawBufferPriv->swapGC)
- pDrawBufferPriv->swapGC =
- CreateGC (pDrawable,
- GCGraphicsExposures, &value,
- &status);
-
- ValidateGC (pDrawable, pDrawBufferPriv->swapGC);
-
- return GL_TRUE;
- }
- } else
- pContext->target = xglPixmapTargetNo;
-
- if (pPixmap)
- {
- (*pScreen->DestroyPixmap) (pPixmap);
- pDrawBufferPriv->pPixmap = NULL;
- }
-
- drawPriv->private = pDrawBufferPriv->private;
- readPriv->private = pReadBufferPriv->private;
-
- status = (*iface->exports.makeCurrent) ((__GLcontext *) iface);
-
- drawPriv->private = pDrawBufferPriv;
- readPriv->private = pReadBufferPriv;
-
- return status;
-}
-
-static GLboolean
-xglShareContext (__GLcontext *gc,
- __GLcontext *gcShare)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- xglGLContextPtr pContextShare = (xglGLContextPtr) gcShare;
- __GLinterface *iface = pContext->mIface;
- __GLinterface *ifaceShare = pContextShare->mIface;
-
- return (*iface->exports.shareContext) ((__GLcontext *) iface,
- (__GLcontext *) ifaceShare);
-}
-
-static GLboolean
-xglCopyContext (__GLcontext *dst,
- const __GLcontext *src,
- GLuint mask)
-{
- xglGLContextPtr pDst = (xglGLContextPtr) dst;
- xglGLContextPtr pSrc = (xglGLContextPtr) src;
- __GLinterface *dstIface = pDst->mIface;
- __GLinterface *srcIface = pSrc->mIface;
-
- glitz_context_copy (pSrc->context, pDst->context, mask);
-
- return (*dstIface->exports.copyContext) ((__GLcontext *) dstIface,
- (const __GLcontext *) srcIface,
- mask);
-}
-
-static GLboolean
-xglForceCurrent (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- if (pContext->target)
- {
- cctx = pContext;
-
- glitz_context_make_current (cctx->context);
-
- if (cctx->needInit)
- xglInitExtensions (cctx);
-
- __glRenderTable = &__glNativeRenderTable;
- __glRenderTableEXT = &cctx->glRenderTableEXT;
-
- return GL_TRUE;
- }
-
- cctx = NULL;
- __glRenderTable = &__glMesaRenderTable;
- __glRenderTableEXT = &__glMesaRenderTableEXT;
-
- return (*iface->exports.forceCurrent) ((__GLcontext *) iface);
-}
-
-static GLboolean
-xglNotifyResize (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- return (*iface->exports.notifyResize) ((__GLcontext *) iface);
-}
-
-static void
-xglNotifyDestroy (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- return (*iface->exports.notifyDestroy) ((__GLcontext *) iface);
-}
-
-static void
-xglNotifySwapBuffers (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- return (*iface->exports.notifySwapBuffers) ((__GLcontext *) iface);
-}
-
-static struct __GLdispatchStateRec *
-xglDispatchExec (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- return (*iface->exports.dispatchExec) ((__GLcontext *) iface);
-}
-
-static void
-xglBeginDispatchOverride (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- return (*iface->exports.beginDispatchOverride) ((__GLcontext *) iface);
-}
-
-static void
-xglEndDispatchOverride (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- return (*iface->exports.endDispatchOverride) ((__GLcontext *) iface);
-}
-
-static void
-xglLoseCurrentContext (void *closure)
-{
- cctx = NULL;
- __glRenderTable = &__glMesaRenderTable;
- __glRenderTableEXT = &__glMesaRenderTableEXT;
-
- __glXFlushContextCache ();
-}
-
-static __GLinterface *
-xglCreateContext (__GLimports *imports,
- __GLcontextModes *modes,
- __GLinterface *shareGC)
-{
- glitz_drawable_format_t *format;
- xglGLContextPtr pShareContext = (xglGLContextPtr) shareGC;
- xglGLContextPtr pContext;
- __GLinterface *shareIface = NULL;
- __GLinterface *iface;
- __GLXcontext *glxCtx = (__GLXcontext *) imports->other;
-
- XGL_SCREEN_PRIV (glxCtx->pScreen);
-
- format = glitz_drawable_get_format (pScreenPriv->drawable);
-
- pContext = xalloc (sizeof (xglGLContextRec));
- if (!pContext)
- return NULL;
-
- pContext->context = glitz_context_create (pScreenPriv->drawable, format);
- glitz_context_set_user_data (pContext->context, NULL,
- xglLoseCurrentContext);
-
- pContext->needInit = TRUE;
- pContext->draw = NULL;
- pContext->target = FALSE;
- pContext->versionString = NULL;
- pContext->error = GL_NO_ERROR;
- pContext->shared = NULL;
- pContext->list = 0;
- pContext->groupList = 0;
- pContext->pAttribStack = NULL;
- pContext->nAttribStack = 0;
- pContext->refcnt = 1;
-
- pContext->attrib.drawBuffer = GL_BACK;
- pContext->attrib.readBuffer = GL_BACK;
- pContext->attrib.scissorTest = GL_FALSE;
-
- if (shareGC)
- {
- pContext->texObjects = NULL;
- pContext->displayLists = NULL;
-
- pContext->shared = pShareContext->shared;
- shareIface = pShareContext->mIface;
- }
- else
- {
- pContext->texObjects = xglNewHashTable ();
- if (!pContext->texObjects)
- {
- xglFreeContext (pContext);
- return NULL;
- }
-
- pContext->displayLists = xglNewHashTable ();
- if (!pContext->displayLists)
- {
- xglFreeContext (pContext);
- return NULL;
- }
-
- pContext->shared = pContext;
- }
-
- pContext->shared->refcnt++;
-
- iface = (*screenInfoPriv.createContext) (imports, modes, shareIface);
- if (!iface)
- {
- xglFreeContext (pContext);
- return NULL;
- }
-
- pContext->mIface = iface;
- pContext->iface.imports = *imports;
-
- pContext->iface.exports.destroyContext = xglDestroyContext;
- pContext->iface.exports.loseCurrent = xglLoseCurrent;
- pContext->iface.exports.makeCurrent = xglMakeCurrent;
- pContext->iface.exports.shareContext = xglShareContext;
- pContext->iface.exports.copyContext = xglCopyContext;
- pContext->iface.exports.forceCurrent = xglForceCurrent;
- pContext->iface.exports.notifyResize = xglNotifyResize;
- pContext->iface.exports.notifyDestroy = xglNotifyDestroy;
- pContext->iface.exports.notifySwapBuffers = xglNotifySwapBuffers;
- pContext->iface.exports.dispatchExec = xglDispatchExec;
- pContext->iface.exports.beginDispatchOverride = xglBeginDispatchOverride;
- pContext->iface.exports.endDispatchOverride = xglEndDispatchOverride;
-
- return (__GLinterface *) pContext;
-}
-
-static GLboolean
-xglSwapBuffers (__GLXdrawablePrivate *glxPriv)
-{
- __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
- xglGLBufferPtr pBufferPriv = glPriv->private;
- DrawablePtr pDrawable = pBufferPriv->pDrawable;
- PixmapPtr pPixmap = pBufferPriv->pPixmap;
- GCPtr pGC = pBufferPriv->swapGC;
- GLboolean ret;
-
- if (pPixmap)
- {
- /* Discard front buffer damage */
- REGION_EMPTY (pGC->pScreen, &pBufferPriv->damage);
-
- if (pGC)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr) pPixmap,
- pDrawable, pGC,
- 0, 0,
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- 0, 0);
-
- return GL_TRUE;
- }
-
- return GL_FALSE;
- }
-
- glPriv->private = pBufferPriv->private;
- ret = (*pBufferPriv->swapBuffers) (glxPriv);
- glPriv->private = pBufferPriv;
-
- return ret;
-}
-
-static GLboolean
-xglResizeBuffers (__GLdrawableBuffer *buffer,
- GLint x,
- GLint y,
- GLuint width,
- GLuint height,
- __GLdrawablePrivate *glPriv,
- GLuint bufferMask)
-{
- xglGLBufferPtr pBufferPriv = glPriv->private;
- DrawablePtr pDrawable = pBufferPriv->pDrawable;
- PixmapPtr pPixmap = pBufferPriv->pPixmap;
- ScreenPtr pScreen = pBufferPriv->pScreen;
- Bool status;
-
- if (pPixmap)
- {
- if (pPixmap->drawable.width != width ||
- pPixmap->drawable.height != height)
- {
- (*pScreen->DestroyPixmap) (pPixmap);
- pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
- pDrawable->depth);
-
- /* give good initial score */
- XGL_GET_PIXMAP_PRIV (pPixmap)->score = 4000;
- pBufferPriv->pPixmap = pPixmap;
- }
- ValidateGC (pDrawable, pBufferPriv->swapGC);
- }
-
- glPriv->private = pBufferPriv->private;
- status = (*pBufferPriv->resizeBuffers) (buffer,
- x, y, width, height,
- glPriv,
- bufferMask);
- glPriv->private = pBufferPriv;
-
- return status;
-}
-
-static void
-xglFreeBuffers (__GLdrawablePrivate *glPriv)
-{
- xglGLBufferPtr pBufferPriv = glPriv->private;
- ScreenPtr pScreen = pBufferPriv->pScreen;
-
- glPriv->private = pBufferPriv->private;
-
- (*pBufferPriv->freeBuffers) (glPriv);
-
- if (pBufferPriv->pPixmap)
- (*pScreen->DestroyPixmap) (pBufferPriv->pPixmap);
-
- if (pBufferPriv->pGC)
- FreeGC (pBufferPriv->pGC, (GContext) 0);
-
- if (pBufferPriv->swapGC)
- FreeGC (pBufferPriv->swapGC, (GContext) 0);
-
- xfree (pBufferPriv);
-}
-
-static void
-xglCreateBuffer (__GLXdrawablePrivate *glxPriv)
-{
- __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
- DrawablePtr pDrawable = glxPriv->pDraw;
- ScreenPtr pScreen = pDrawable->pScreen;
- xglGLBufferPtr pBufferPriv;
-
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- pBufferPriv = xalloc (sizeof (xglGLBufferRec));
- if (!pBufferPriv)
- FatalError ("No memory");
-
- pBufferPriv->pScreen = pScreen;
- pBufferPriv->pDrawable = pDrawable;
- pBufferPriv->pPixmap = NULL;
- pBufferPriv->pGC = NULL;
- pBufferPriv->swapGC = NULL;
-
- REGION_INIT (pScreen, &pBufferPriv->damage, NullBox, 0);
-
- if (glxPriv->pGlxVisual->doubleBuffer)
- pBufferPriv->pPixmap =
- (*pScreen->CreatePixmap) (pScreen,
- pDrawable->width,
- pDrawable->height,
- pDrawable->depth);
-
- /* give good initial score */
- pPixmapPriv->score = 4000;
-
- (*screenInfoPriv.createBuffer) (glxPriv);
-
- /* Wrap the front buffer's resize routine */
- pBufferPriv->resizeBuffers = glPriv->frontBuffer.resize;
- glPriv->frontBuffer.resize = xglResizeBuffers;
-
- /* Wrap the swap buffers routine */
- pBufferPriv->swapBuffers = glxPriv->swapBuffers;
- glxPriv->swapBuffers = xglSwapBuffers;
-
- /* Wrap private and freePrivate */
- pBufferPriv->private = glPriv->private;
- pBufferPriv->freeBuffers = glPriv->freePrivate;
- glPriv->private = (void *) pBufferPriv;
- glPriv->freePrivate = xglFreeBuffers;
-}
-
-static Bool
-xglScreenProbe (int screen)
-{
- Bool status;
-
- status = (*screenInfoPriv.screenProbe) (screen);
-
- /* Wrap createBuffer */
- if (__glDDXScreenInfo.createBuffer != xglCreateBuffer)
- {
- screenInfoPriv.createBuffer = __glDDXScreenInfo.createBuffer;
- __glDDXScreenInfo.createBuffer = xglCreateBuffer;
- }
-
- /* Wrap createContext */
- if (__glDDXScreenInfo.createContext != xglCreateContext)
- {
- screenInfoPriv.createContext = __glDDXScreenInfo.createContext;
- __glDDXScreenInfo.createContext = xglCreateContext;
- }
-
- return status;
-}
-
-Bool
-xglInitVisualConfigs (ScreenPtr pScreen)
-{
- miInitVisualsProcPtr initVisualsProc = NULL;
- VisualPtr visuals;
- int nvisuals;
- DepthPtr depths;
- int ndepths;
- int rootDepth;
- VisualID defaultVis;
- glitz_drawable_format_t *format;
- xglPixelFormatPtr pPixel;
- __GLXvisualConfig *pConfig;
- xglGLXVisualConfigPtr pConfigPriv, *ppConfigPriv;
- XID *installedCmaps;
- ColormapPtr installedCmap;
- int numInstalledCmaps;
- int numConfig = 1;
- int depth, bpp, i;
-
- XGL_SCREEN_PRIV (pScreen);
-
- depth = pScreenPriv->pVisual->pPixel->depth;
- bpp = pScreenPriv->pVisual->pPixel->masks.bpp;
- format = glitz_drawable_get_format (pScreenPriv->drawable);
- pPixel = pScreenPriv->pixmapFormats[depth].pPixel;
-
- pConfig = xcalloc (sizeof (__GLXvisualConfig), numConfig);
- if (!pConfig)
- return FALSE;
-
- pConfigPriv = xcalloc (sizeof (xglGLXVisualConfigRec), numConfig);
- if (!pConfigPriv)
- {
- xfree (pConfig);
- return FALSE;
- }
-
- ppConfigPriv = xcalloc (sizeof (xglGLXVisualConfigPtr), numConfig);
- if (!ppConfigPriv)
- {
- xfree (pConfigPriv);
- xfree (pConfig);
- return FALSE;
- }
-
- installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID));
- if (!installedCmaps)
- {
- xfree (ppConfigPriv);
- xfree (pConfigPriv);
- xfree (pConfig);
- return FALSE;
- }
-
- for (i = 0; i < numConfig; i++)
- {
- ppConfigPriv[i] = &pConfigPriv[i];
-
- pConfig[i].vid = (VisualID) (-1);
- pConfig[i].class = -1;
- pConfig[i].rgba = TRUE;
-
- pConfig[i].redSize = format->color.red_size;
- pConfig[i].greenSize = format->color.green_size;
- pConfig[i].blueSize = format->color.blue_size;
-
- pConfig[i].redMask = pPixel->masks.red_mask;
- pConfig[i].greenMask = pPixel->masks.green_mask;
- pConfig[i].blueMask = pPixel->masks.blue_mask;
-
- if (format->color.alpha_size)
- {
- pConfig[i].alphaSize = format->color.alpha_size;
- pConfig[i].alphaMask = pPixel->masks.alpha_mask;
- }
- else
- {
- pConfig[i].alphaSize = 0;
- pConfig[i].alphaMask = 0;
- }
-
- pConfig[i].doubleBuffer = TRUE;
- pConfig[i].depthSize = format->depth_size;
- pConfig[i].stencilSize = format->stencil_size;
- pConfig[i].stereo = FALSE;
-
- if (depth == 16)
- pConfig[i].bufferSize = 16;
- else
- pConfig[i].bufferSize = 32;
-
- pConfig[i].auxBuffers = 0;
- pConfig[i].level = 0;
-
- pConfig[i].visualRating = GLX_NONE;
-
- pConfig[i].transparentPixel = GLX_NONE;
- pConfig[i].transparentRed = 0;
- pConfig[i].transparentGreen = 0;
- pConfig[i].transparentBlue = 0;
- pConfig[i].transparentAlpha = 0;
- pConfig[i].transparentIndex = 0;
- }
-
- GlxSetVisualConfigs (numConfig, pConfig, (void **) ppConfigPriv);
-
- /* Wrap screenProbe */
- if (__glDDXScreenInfo.screenProbe != xglScreenProbe)
- {
- screenInfoPriv.screenProbe = __glDDXScreenInfo.screenProbe;
- __glDDXScreenInfo.screenProbe = xglScreenProbe;
- }
-
- visuals = pScreen->visuals;
- nvisuals = pScreen->numVisuals;
- depths = pScreen->allowedDepths;
- ndepths = pScreen->numDepths;
- rootDepth = pScreen->rootDepth;
- defaultVis = pScreen->rootVisual;
-
- /* Find installed colormaps */
- numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen,
- installedCmaps);
-
- GlxWrapInitVisuals (&initVisualsProc);
- GlxInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootDepth,
- &defaultVis, ((unsigned long) 1 << (bpp - 1)), 8, -1);
-
- /* Fix up any existing installed colormaps. */
- for (i = 0; i < numInstalledCmaps; i++)
- {
- int j;
-
- installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
- if (!installedCmap)
- continue;
-
- j = installedCmap->pVisual - pScreen->visuals;
- installedCmap->pVisual = &visuals[j];
- }
-
- pScreen->visuals = visuals;
- pScreen->numVisuals = nvisuals;
- pScreen->allowedDepths = depths;
- pScreen->numDepths = ndepths;
- pScreen->rootDepth = rootDepth;
- pScreen->rootVisual = defaultVis;
-
- xfree (installedCmaps);
- xfree (pConfigPriv);
- xfree (pConfig);
-
- ErrorF ("[glx] initialized\n");
-
- return TRUE;
-}
-
-#endif /* GLXEXT */
diff --git a/hw/xgl/xglglyph.c b/hw/xgl/xglglyph.c
deleted file mode 100644
index b5b905730..000000000
--- a/hw/xgl/xglglyph.c
+++ /dev/null
@@ -1,1169 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-#ifdef RENDER
-#include "gcstruct.h"
-#include "picturestr.h"
-
-#define BITMAP_CACHE_SIZE 256000
-#define BITMAP_CACHE_MAX_LEVEL ~0
-#define BITMAP_CACHE_MAX_SIZE 512
-
-#define TEXTURE_CACHE_SIZE 512
-#define TEXTURE_CACHE_MAX_LEVEL 64
-#define TEXTURE_CACHE_MAX_HEIGHT 72
-#define TEXTURE_CACHE_MAX_WIDTH 72
-
-#define NEXT_GLYPH_SERIAL_NUMBER ((++glyphSerialNumber) > MAX_SERIAL_NUM ? \
- (glyphSerialNumber = 1): glyphSerialNumber)
-
-#define GLYPH_GET_AREA_PRIV(pArea) \
- ((xglGlyphAreaPtr) (pArea)->devPrivate.ptr)
-
-#define GLYPH_AREA_PRIV(pArea) \
- xglGlyphAreaPtr pAreaPriv = GLYPH_GET_AREA_PRIV (pArea)
-
-#define NEEDS_COMPONENT(f) (PICT_FORMAT_A (f) != 0 && PICT_FORMAT_RGB (f) != 0)
-
-#define WRITE_VEC2(ptr, _x, _y) \
- *(ptr)++ = (_x); \
- *(ptr)++ = (_y)
-
-#define WRITE_BOX(ptr, _vx1, _vy1, _vx2, _vy2, box) \
- WRITE_VEC2 (ptr, _vx1, _vy1); \
- WRITE_VEC2 (ptr, (box).x1, (box).y2); \
- WRITE_VEC2 (ptr, _vx2, _vy1); \
- WRITE_VEC2 (ptr, (box).x2, (box).y2); \
- WRITE_VEC2 (ptr, _vx2, _vy2); \
- WRITE_VEC2 (ptr, (box).x2, (box).y1); \
- WRITE_VEC2 (ptr, _vx1, _vy2); \
- WRITE_VEC2 (ptr, (box).x1, (box).y1)
-
-typedef union _xglGlyphList {
- glitz_short_t *s;
- glitz_float_t *f;
-} xglGlyphListRec, *xglGlyphListPtr;
-
-typedef struct _xglGlyphArray {
- int lastX, lastY;
-} xglGlyphArrayRec, *xglGlyphArrayPtr;
-
-typedef union _xglGlyphVertexData {
- xglGlyphArrayRec array;
- xglGlyphListRec list;
-} xglGlyphVertexDataRec, *xglGlyphVertexDataPtr;
-
-typedef struct _xglGlyphOp {
- GlyphListPtr pLists;
- int listLen;
- GlyphPtr *ppGlyphs;
- int nGlyphs;
- int xOff;
- int yOff;
- Bool noCache;
-} xglGlyphOpRec, *xglGlyphOpPtr;
-
-unsigned long glyphSerialNumber = 0;
-
-xglAreaRec zeroSizeArea = {
- 0, 0,
- 0, 0,
- 0, 0,
- { NULL, NULL, NULL, NULL }, NULL,
- (pointer) 0,
- { 0 }
-};
-
-static Bool
-xglGlyphCreate (xglAreaPtr pArea)
-{
- return TRUE;
-}
-
-static Bool
-xglGlyphMoveIn (xglAreaPtr pArea,
- pointer closure)
-{
- xglGlyphCachePtr pCache = (xglGlyphCachePtr) pArea->pRoot->closure;
- GlyphPtr pGlyph = (GlyphPtr) closure;
-
- XGL_GLYPH_PRIV (pCache->pScreen, pGlyph);
-
- pGlyphPriv->pArea = pArea;
-
- return TRUE;
-}
-
-static void
-xglGlyphMoveOut (xglAreaPtr pArea,
- pointer closure)
-{
- xglGlyphCachePtr pCache = (xglGlyphCachePtr) pArea->pRoot->closure;
- GlyphPtr pGlyph = (GlyphPtr) closure;
-
- XGL_GLYPH_PRIV (pCache->pScreen, pGlyph);
-
- pGlyphPriv->pArea = NULL;
-}
-
-static int
-xglGlyphCompareScore (xglAreaPtr pArea,
- pointer closure1,
- pointer closure2)
-{
- GLYPH_AREA_PRIV (pArea);
-
- if (pAreaPriv->serial == glyphSerialNumber)
- return 1;
-
- return -1;
-}
-
-static const xglAreaFuncsRec xglGlyphAreaFuncs = {
- xglGlyphCreate,
- xglGlyphMoveIn,
- xglGlyphMoveOut,
- xglGlyphCompareScore
-};
-
-Bool
-xglRealizeGlyph (ScreenPtr pScreen,
- GlyphPtr pGlyph)
-{
- PictureScreenPtr pPictureScreen = GetPictureScreen (pScreen);
- Bool ret;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_GLYPH_PRIV (pScreen, pGlyph);
-
- XGL_PICTURE_SCREEN_UNWRAP (RealizeGlyph);
- ret = (*pPictureScreen->RealizeGlyph) (pScreen, pGlyph);
- XGL_PICTURE_SCREEN_WRAP (RealizeGlyph, xglRealizeGlyph);
-
- pGlyphPriv->pArea = NULL;
-
- return ret;
-}
-
-void
-xglUnrealizeGlyph (ScreenPtr pScreen,
- GlyphPtr pGlyph)
-{
- PictureScreenPtr pPictureScreen = GetPictureScreen (pScreen);
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_GLYPH_PRIV (pScreen, pGlyph);
-
- XGL_PICTURE_SCREEN_UNWRAP (UnrealizeGlyph);
- (*pPictureScreen->UnrealizeGlyph) (pScreen, pGlyph);
- XGL_PICTURE_SCREEN_WRAP (UnrealizeGlyph, xglUnrealizeGlyph);
-
- if (pGlyphPriv->pArea && pGlyphPriv->pArea->width)
- xglWithdrawArea (pGlyphPriv->pArea);
-}
-
-Bool
-xglInitGlyphCache (xglGlyphCachePtr pCache,
- ScreenPtr pScreen,
- PictFormatPtr format)
-{
- XGL_SCREEN_PRIV (pScreen);
-
- pCache->depth = format->depth;
-
- if (!pScreenPriv->pSolidAlpha)
- {
- xglCreateSolidAlphaPicture (pScreen);
- if (!pScreenPriv->pSolidAlpha)
- return FALSE;
- }
-
- if (pCache->depth == 1)
- {
- int stride;
-
- GEOMETRY_INIT (pScreen, &pCache->u.geometry,
- GLITZ_GEOMETRY_TYPE_VERTEX,
- GEOMETRY_USAGE_STATIC, BITMAP_CACHE_SIZE);
- GEOMETRY_SET_VERTEX_DATA_TYPE (&pCache->u.geometry,
- pScreenPriv->geometryDataType);
-
- stride = pCache->u.geometry.f.vertex.bytes_per_vertex;
- if (!xglRootAreaInit (&pCache->rootArea,
- BITMAP_CACHE_MAX_LEVEL,
- BITMAP_CACHE_SIZE / (stride * 4),
- 0, sizeof (xglGlyphAreaRec),
- (xglAreaFuncsPtr) &xglGlyphAreaFuncs,
- (pointer) pCache))
- {
- GEOMETRY_UNINIT (&pCache->u.geometry);
- return FALSE;
- }
- }
- else
- {
-
- xglGlyphTexturePtr pTexture = &pCache->u.texture;
- glitz_surface_attributes_t attr;
- xglPixmapFormatPtr pFormat;
- glitz_vertex_format_t *vertex;
-
- if (!xglRootAreaInit (&pCache->rootArea,
- TEXTURE_CACHE_MAX_LEVEL,
- TEXTURE_CACHE_SIZE, TEXTURE_CACHE_SIZE,
- sizeof (xglGlyphAreaRec),
- (xglAreaFuncsPtr) &xglGlyphAreaFuncs,
- (pointer) pCache))
- return FALSE;
-
- pFormat = &pScreenPriv->pixmapFormats[format->depth];
-
- if (pScreenPriv->geometryDataType == GEOMETRY_DATA_TYPE_SHORT)
- {
- attr.unnormalized = 1;
- pTexture->mask =
- glitz_surface_create (pScreenPriv->drawable, pFormat->format,
- TEXTURE_CACHE_SIZE, TEXTURE_CACHE_SIZE,
- GLITZ_SURFACE_UNNORMALIZED_MASK, &attr);
- } else
- pTexture->mask = NULL;
-
- if (!pTexture->mask)
- {
- pTexture->mask =
- glitz_surface_create (pScreenPriv->drawable, pFormat->format,
- TEXTURE_CACHE_SIZE, TEXTURE_CACHE_SIZE,
- 0, NULL);
- if (!pTexture->mask)
- return FALSE;
-
- pTexture->geometryDataType = GEOMETRY_DATA_TYPE_FLOAT;
- } else
- pTexture->geometryDataType = GEOMETRY_DATA_TYPE_SHORT;
-
- if (NEEDS_COMPONENT (format->format))
- glitz_surface_set_component_alpha (pTexture->mask, 1);
-
- vertex = &pCache->u.texture.format.vertex;
- vertex->primitive = GLITZ_PRIMITIVE_QUADS;
- vertex->mask.size = GLITZ_COORDINATE_SIZE_XY;
- vertex->attributes = GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK;
-
- if (pTexture->geometryDataType == GEOMETRY_DATA_TYPE_FLOAT)
- {
- vertex->type = GLITZ_DATA_TYPE_FLOAT;
- vertex->bytes_per_vertex = sizeof (glitz_float_t) * 4;
- vertex->mask.offset = sizeof (glitz_float_t) * 2;
- vertex->mask.type = GLITZ_DATA_TYPE_FLOAT;
- }
- else
- {
- vertex->type = GLITZ_DATA_TYPE_SHORT;
- vertex->bytes_per_vertex = sizeof (glitz_short_t) * 4;
- vertex->mask.offset = sizeof (glitz_short_t) * 2;
- vertex->mask.type = GLITZ_DATA_TYPE_SHORT;
- }
-
- pTexture->pixel.masks = pFormat->pPixel->masks;
- pTexture->pixel.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
- pTexture->pixel.bytes_per_line = 0;
- pTexture->pixel.xoffset = 0;
- pTexture->pixel.skip_lines = 0;
- }
-
- pCache->pScreen = pScreen;
-
- return TRUE;
-}
-
-void
-xglFiniGlyphCache (xglGlyphCachePtr pCache)
-{
- if (pCache->pScreen)
- {
- xglRootAreaFini (&pCache->rootArea);
-
- if (pCache->depth == 1)
- {
- GEOMETRY_UNINIT (&pCache->u.geometry);
- }
- else
- {
- if (pCache->u.texture.mask)
- glitz_surface_destroy (pCache->u.texture.mask);
- }
-
- pCache->pScreen = NULL;
- }
-}
-
-static xglAreaPtr
-xglCacheGlyph (xglGlyphCachePtr pCache,
- GlyphPtr pGlyph)
-{
- ScreenPtr pScreen = pCache->pScreen;
-
- XGL_GLYPH_PRIV (pScreen, pGlyph);
-
- if (pCache->depth == 1)
- {
- PixmapPtr pPixmap;
- RegionPtr pRegion;
- int nBox;
-
- pPixmap = GetScratchPixmapHeader (pScreen,
- pGlyph->info.width,
- pGlyph->info.height,
- pCache->depth, pCache->depth, 0,
- (pointer) (pGlyph + 1));
- if (!pPixmap)
- return NULL;
-
- (*pScreen->ModifyPixmapHeader) (pPixmap,
- pGlyph->info.width,
- pGlyph->info.height,
- 0, 0, -1, (pointer) (pGlyph + 1));
-
- pRegion = (*pScreen->BitmapToRegion) (pPixmap);
- FreeScratchPixmapHeader (pPixmap);
-
- if (!pRegion)
- return NULL;
-
- nBox = REGION_NUM_RECTS (pRegion);
- if (nBox > BITMAP_CACHE_MAX_SIZE)
- {
- REGION_DESTROY (pScreen, pRegion);
- return NULL;
- }
-
- if (nBox > 0)
- {
- /* Find available area */
- if (!xglFindArea (pCache->rootArea.pArea, nBox, 0,
- FALSE, (pointer) pGlyph))
- {
- /* Kicking out area with lower score */
- xglFindArea (pCache->rootArea.pArea, nBox, 0,
- TRUE, (pointer) pGlyph);
- }
-
- if (pGlyphPriv->pArea)
- {
- int stride;
-
- GLYPH_AREA_PRIV (pGlyphPriv->pArea);
-
- pAreaPriv->serial = glyphSerialNumber;
- pAreaPriv->u.range.first = pGlyphPriv->pArea->x * 4;
- pAreaPriv->u.range.count = nBox * 4;
-
- stride = pCache->u.geometry.f.vertex.bytes_per_vertex;
- GEOMETRY_ADD_REGION_AT (pScreen, &pCache->u.geometry, pRegion,
- pGlyphPriv->pArea->x * stride * 4);
- }
- } else
- pGlyphPriv->pArea = &zeroSizeArea;
-
- REGION_DESTROY (pScreen, pRegion);
- }
- else
- {
- xglGlyphTexturePtr pTexture = &pCache->u.texture;
-
- if (pGlyph->info.width > TEXTURE_CACHE_MAX_WIDTH ||
- pGlyph->info.height > TEXTURE_CACHE_MAX_HEIGHT)
- return NULL;
-
- if (pGlyph->info.width > 0 && pGlyph->info.height > 0)
- {
- glitz_buffer_t *buffer;
-
- buffer = glitz_buffer_create_for_data (pGlyph + 1);
- if (!buffer)
- return NULL;
-
- /* Find available area */
- if (!xglFindArea (pCache->rootArea.pArea,
- pGlyph->info.width, pGlyph->info.height,
- FALSE, (pointer) pGlyph))
- {
- /* Kicking out area with lower score */
- xglFindArea (pCache->rootArea.pArea,
- pGlyph->info.width, pGlyph->info.height,
- TRUE, (pointer) pGlyph);
- }
-
- if (pGlyphPriv->pArea)
- {
- glitz_point_fixed_t p1, p2;
- glitz_pixel_format_t pixel;
-
- GLYPH_AREA_PRIV (pGlyphPriv->pArea);
-
- pixel = pTexture->pixel;
- pixel.bytes_per_line =
- PixmapBytePad (pGlyph->info.width, pCache->depth);
-
- glitz_set_pixels (pTexture->mask,
- pGlyphPriv->pArea->x,
- pGlyphPriv->pArea->y,
- pGlyph->info.width,
- pGlyph->info.height,
- &pixel,
- buffer);
-
- p1.x = pGlyphPriv->pArea->x << 16;
- p1.y = pGlyphPriv->pArea->y << 16;
- p2.x = (pGlyphPriv->pArea->x + pGlyph->info.width) << 16;
- p2.y = (pGlyphPriv->pArea->y + pGlyph->info.height) << 16;
-
- glitz_surface_translate_point (pTexture->mask, &p1, &p1);
- glitz_surface_translate_point (pTexture->mask, &p2, &p2);
-
- pAreaPriv->serial = glyphSerialNumber;
- if (pTexture->geometryDataType)
- {
- pAreaPriv->u.box.fBox.x1 = FIXED_TO_FLOAT (p1.x);
- pAreaPriv->u.box.fBox.y1 = FIXED_TO_FLOAT (p1.y);
- pAreaPriv->u.box.fBox.x2 = FIXED_TO_FLOAT (p2.x);
- pAreaPriv->u.box.fBox.y2 = FIXED_TO_FLOAT (p2.y);
- }
- else
- {
- pAreaPriv->u.box.sBox.x1 = p1.x >> 16;
- pAreaPriv->u.box.sBox.y1 = p1.y >> 16;
- pAreaPriv->u.box.sBox.x2 = p2.x >> 16;
- pAreaPriv->u.box.sBox.y2 = p2.y >> 16;
- }
- }
- glitz_buffer_destroy (buffer);
- } else
- pGlyphPriv->pArea = &zeroSizeArea;
- }
-
- return pGlyphPriv->pArea;
-}
-
-static void
-xglUncachedGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- xglGlyphOpPtr pOp)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PicturePtr pPicture = NULL;
- PixmapPtr pPixmap = NULL;
- xglGlyphCachePtr pCache;
- int depth = pOp->pLists->format->depth;
- GlyphPtr glyph;
- INT16 xOff, yOff;
- xglGlyphPtr pGlyphPriv;
- xglAreaPtr pArea;
- Bool usingCache = !pOp->noCache;
-
- XGL_SCREEN_PRIV (pScreen);
-
- pCache = &pScreenPriv->glyphCache[depth];
- if (usingCache)
- {
- if (!pCache->pScreen)
- {
- if (!xglInitGlyphCache (pCache, pScreen, pOp->pLists->format))
- usingCache = FALSE;
- }
- }
-
- while (pOp->nGlyphs)
- {
- glyph = *pOp->ppGlyphs;
-
- if (!pOp->listLen)
- {
- pOp->pLists++;
- pOp->listLen = pOp->pLists->len;
- pOp->xOff += pOp->pLists->xOff;
- pOp->yOff += pOp->pLists->yOff;
- }
-
- xOff = pOp->xOff;
- yOff = pOp->yOff;
-
- if (usingCache)
- {
- pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, glyph);
- pArea = pGlyphPriv->pArea;
- if (pSrc)
- {
- if (!pArea)
- pArea = xglCacheGlyph (pCache, glyph);
-
- if (pArea)
- break;
- }
- } else
- pArea = NULL;
-
- pOp->listLen--;
- pOp->nGlyphs--;
- pOp->ppGlyphs++;
-
- pOp->xOff += glyph->info.xOff;
- pOp->yOff += glyph->info.yOff;
-
- if (pArea)
- continue;
-
- if (!pPicture)
- {
- CARD32 componentAlpha;
- int error;
-
- pPixmap = GetScratchPixmapHeader (pScreen,
- glyph->info.width,
- glyph->info.height,
- depth, depth,
- 0, (pointer) (glyph + 1));
- if (!pPixmap)
- return;
-
- componentAlpha = NEEDS_COMPONENT (pOp->pLists->format->format);
- pPicture = CreatePicture (0, &pPixmap->drawable,
- pOp->pLists->format,
- CPComponentAlpha, &componentAlpha,
- serverClient, &error);
- if (!pPicture)
- {
- FreeScratchPixmapHeader (pPixmap);
- return;
- }
- }
-
- (*pScreen->ModifyPixmapHeader) (pPixmap,
- glyph->info.width, glyph->info.height,
- 0, 0, -1, (pointer) (glyph + 1));
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- if (pSrc)
- CompositePicture (op,
- pSrc,
- pPicture,
- pDst,
- xSrc + (xOff - glyph->info.x),
- ySrc + (yOff - glyph->info.y),
- 0, 0,
- xOff - glyph->info.x,
- yOff - glyph->info.y,
- glyph->info.width,
- glyph->info.height);
- else
- CompositePicture (PictOpAdd,
- pPicture,
- NULL,
- pDst,
- 0, 0,
- 0, 0,
- xOff - glyph->info.x,
- yOff - glyph->info.y,
- glyph->info.width,
- glyph->info.height);
- }
-
- if (pPicture)
- {
- FreeScratchPixmapHeader (pPixmap);
- FreePicture ((pointer) pPicture, 0);
- }
-}
-
-static Bool
-xglCachedGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- xglGlyphOpPtr pOp)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- xglGlyphOpRec opSave = *pOp;
- xglGlyphCachePtr pCache;
- xglGlyphVertexDataRec vData;
- xglGeometryPtr pGeometry;
- GlyphPtr glyph;
- xglGlyphPtr pGlyphPriv;
- xglAreaPtr pArea;
- xglGlyphAreaPtr pGlyphArea;
- BoxRec extents;
- INT16 xOff, yOff, x1, x2, y1, y2;
- int depth = pOp->pLists->format->depth;
- int i, remaining = pOp->nGlyphs;
- int nGlyph = 0;
- glitz_surface_t *mask = NULL;
-
- XGL_SCREEN_PRIV (pScreen);
-
- pCache = &pScreenPriv->glyphCache[depth];
- if (!pCache->pScreen)
- {
- if (!xglInitGlyphCache (pCache, pScreen, pOp->pLists->format))
- {
- pOp->noCache = TRUE;
- return 1;
- }
- }
-
- /* update serial number for all glyphs already in cache so that
- we don't accidentally replace one. */
- for (i = 0; i < pOp->nGlyphs; i++)
- {
- pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pOp->ppGlyphs[i]);
- pArea = pGlyphPriv->pArea;
- if (pArea && pArea->width)
- GLYPH_GET_AREA_PRIV (pArea)->serial = glyphSerialNumber;
- }
-
- for (i = 0; i < pOp->nGlyphs; i++)
- {
- pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pOp->ppGlyphs[i]);
- pArea = pGlyphPriv->pArea;
- if (!pArea)
- pArea = xglCacheGlyph (pCache, pOp->ppGlyphs[i]);
-
- if (pArea)
- {
- if (pArea->width)
- nGlyph++;
- }
- else if (pSrc)
- break;
- }
-
- if (nGlyph)
- {
- if (depth == 1)
- {
- glitz_multi_array_t *multiArray;
-
- pGeometry = &pCache->u.geometry;
- pGeometry->xOff = pGeometry->yOff = 0;
-
- multiArray = glitz_multi_array_create (nGlyph);
- if (!multiArray)
- return 1;
-
- GEOMETRY_SET_MULTI_ARRAY (pGeometry, multiArray);
- glitz_multi_array_destroy (multiArray);
-
- vData.array.lastX = 0;
- vData.array.lastY = 0;
- }
- else
- {
- i = 4 * pCache->u.texture.format.vertex.bytes_per_vertex * nGlyph;
- pGeometry = xglGetScratchGeometryWithSize (pScreen, i);
-
- pGeometry->f = pCache->u.texture.format;
- pGeometry->type = GLITZ_GEOMETRY_TYPE_VERTEX;
- mask = pCache->u.texture.mask;
-
- vData.list.s = glitz_buffer_map (pGeometry->buffer,
- GLITZ_BUFFER_ACCESS_WRITE_ONLY);
- }
- } else
- pGeometry = NULL;
-
- extents.x1 = MAXSHORT;
- extents.y1 = MAXSHORT;
- extents.x2 = MINSHORT;
- extents.y2 = MINSHORT;
-
- while (pOp->nGlyphs)
- {
- glyph = *pOp->ppGlyphs;
-
- if (!pOp->listLen)
- {
- pOp->pLists++;
- pOp->listLen = pOp->pLists->len;
- pOp->xOff += pOp->pLists->xOff;
- pOp->yOff += pOp->pLists->yOff;
- }
-
- xOff = pOp->xOff;
- yOff = pOp->yOff;
-
- pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, glyph);
- pArea = pGlyphPriv->pArea;
- if (!pArea && pSrc)
- break;
-
- pOp->listLen--;
- pOp->nGlyphs--;
- pOp->ppGlyphs++;
-
- pOp->xOff += glyph->info.xOff;
- pOp->yOff += glyph->info.yOff;
-
- if (!pArea)
- continue;
-
- x1 = xOff - glyph->info.x;
- x2 = x1 + glyph->info.width;
- if (x1 < extents.x1)
- extents.x1 = x1;
- if (x2 > extents.x2)
- extents.x2 = x2;
-
- y1 = yOff - glyph->info.y;
- y2 = y1 + glyph->info.height;
- if (y1 < extents.y1)
- extents.y1 = y1;
- if (y2 > extents.y2)
- extents.y2 = y2;
-
- if (pArea->width)
- {
- pGlyphArea = GLYPH_GET_AREA_PRIV (pArea);
- if (depth == 1)
- {
- glitz_multi_array_add (pGeometry->array,
- pGlyphArea->u.range.first, 2,
- pGlyphArea->u.range.count,
- (x1 - vData.array.lastX) << 16,
- (y1 - vData.array.lastY) << 16);
- vData.array.lastX = x1;
- vData.array.lastY = y1;
- }
- else
- {
- if (pCache->u.texture.geometryDataType)
- {
- WRITE_BOX (vData.list.f, x1, y1, x2, y2,
- pGlyphArea->u.box.fBox);
- }
- else
- {
- WRITE_BOX (vData.list.s, x1, y1, x2, y2,
- pGlyphArea->u.box.sBox);
- }
- }
- }
- remaining--;
- }
-
- NEXT_GLYPH_SERIAL_NUMBER;
-
- if (nGlyph)
- {
- if (depth != 1)
- {
- glitz_buffer_unmap (pGeometry->buffer);
- pGeometry->count = nGlyph * 4;
- }
-
- xSrc += extents.x1;
- ySrc += extents.y1;
-
- if (!pSrc)
- {
- op = PictOpAdd;
- pSrc = pScreenPriv->pSolidAlpha;
-
- if (remaining)
- *pOp = opSave;
- }
-
- GEOMETRY_TRANSLATE (pGeometry,
- pDst->pDrawable->x,
- pDst->pDrawable->y);
-
- if (xglComp (op,
- pSrc,
- NULL,
- pDst,
- xSrc, ySrc,
- 0, 0,
- pDst->pDrawable->x + extents.x1,
- pDst->pDrawable->y + extents.y1,
- extents.x2 - extents.x1,
- extents.y2 - extents.y1,
- pGeometry,
- mask))
- {
- xglAddCurrentBitDamage (pDst->pDrawable);
- return remaining;
- }
-
- remaining = ~0;
- *pOp = opSave;
- pOp->noCache = TRUE;
- }
- else
- {
- if (remaining)
- {
- *pOp = opSave;
- pOp->noCache = TRUE;
- }
- }
-
- return remaining;
-}
-
-static Bool
-xglGlyphExtents (PicturePtr pDst,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs,
- BoxPtr extents)
-{
- GlyphPtr glyph;
- BoxRec line;
- int x1, x2, y1, y2;
- int n;
- int x;
- int y;
- Bool overlap = FALSE;
-
- x = 0;
- y = 0;
-
- extents->x1 = MAXSHORT;
- extents->x2 = MINSHORT;
- extents->y1 = MAXSHORT;
- extents->y2 = MINSHORT;
-
- while (!list->len)
- {
- if (--nlist)
- {
- x += list->xOff;
- y += list->yOff;
- list++;
- }
- else
- {
- return FALSE;
- }
- }
-
- glyph = *glyphs;
- x1 = (x + list->xOff) - glyph->info.x;
- if (x1 < MINSHORT)
- x1 = MINSHORT;
- y1 = (y + list->yOff) - glyph->info.y;
- if (y1 < MINSHORT)
- y1 = MINSHORT;
-
- line.x1 = x1;
- line.x2 = x1;
- line.y1 = y1;
- line.y2 = y1;
-
- while (nlist--)
- {
- x += list->xOff;
- y += list->yOff;
- n = list->len;
- list++;
-
- while (n--)
- {
- glyph = *glyphs++;
- x1 = x - glyph->info.x;
- if (x1 < MINSHORT)
- x1 = MINSHORT;
- y1 = y - glyph->info.y;
- if (y1 < MINSHORT)
- y1 = MINSHORT;
- x2 = x1 + glyph->info.width;
- if (x2 > MAXSHORT)
- x2 = MAXSHORT;
- y2 = y1 + glyph->info.height;
- if (y2 > MAXSHORT)
- y2 = MAXSHORT;
-
- if (x1 >= line.x2)
- {
- line.x2 = x2;
- if (y1 < line.y1)
- line.y1 = y1;
- if (y2 > line.y2)
- line.y2 = y2;
- }
- else if (x2 <= line.x1)
- {
- line.x1 = x1;
- if (y1 < line.y1)
- line.y1 = y1;
- if (y2 > line.y2)
- line.y2 = y2;
- }
- else
- {
- if (line.y1 >= extents->y2)
- {
- extents->y2 = line.y2;
- if (line.y1 < extents->y1)
- extents->y1 = line.y1;
- }
- else if (line.y2 <= extents->y1)
- {
- extents->y1 = line.y1;
- if (line.y2 > extents->y2)
- extents->y2 = line.y2;
- }
- else
- {
- if (line.y1 < extents->y1)
- extents->y1 = line.y1;
- if (line.y2 > extents->y2)
- extents->y2 = line.y2;
-
- overlap = TRUE;
- }
-
- if (line.x1 < extents->x1)
- extents->x1 = line.x1;
- if (line.x2 > extents->x2)
- extents->x2 = line.x2;
-
- line.x1 = x1;
- line.y1 = y1;
- line.x2 = x2;
- line.y2 = y2;
- }
-
- x += glyph->info.xOff;
- y += glyph->info.yOff;
- }
- }
-
- if (line.y1 >= extents->y2)
- {
- extents->y2 = line.y2;
- if (line.y1 < extents->y1)
- extents->y1 = line.y1;
- }
- else if (line.y2 <= extents->y1)
- {
- extents->y1 = line.y1;
- if (line.y2 > extents->y2)
- extents->y2 = line.y2;
- }
- else
- {
- if (line.y1 < extents->y1)
- extents->y1 = line.y1;
- if (line.y2 > extents->y2)
- extents->y2 = line.y2;
-
- overlap = TRUE;
- }
-
- if (line.x1 < extents->x1)
- extents->x1 = line.x1;
- if (line.x2 > extents->x2)
- extents->x2 = line.x2;
-
- xglPictureClipExtents (pDst, extents);
-
- return overlap;
-}
-
-/* returns 0 if all glyph lists don't have the same format */
-static CARD32
-xglGlyphListFormatId (GlyphListPtr list,
- int nlist)
-{
- CARD32 id = list->format->id;
-
- nlist--;
- list++;
-
- while (nlist--)
- {
- if (list->format->id != id)
- return 0;
-
- list++;
- }
-
- return id;
-}
-
-void
-xglGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PicturePtr pMask = NULL, pSrcPicture, pDstPicture;
- BoxRec extents;
- xglGlyphOpRec glyphOp;
- int xDst = list->xOff, yDst = list->yOff;
- int overlap;
- int target;
-
- XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
-
- overlap = xglGlyphExtents (pDst, nlist, list, glyphs, &extents);
- if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
- return;
-
- target = xglPrepareTarget (pDst->pDrawable);
-
- if (op != PictOpAdd && maskFormat &&
- (overlap || op != PictOpOver ||
- xglGlyphListFormatId (list, nlist) != maskFormat->id))
- {
- PixmapPtr pPixmap;
- CARD32 componentAlpha;
- GCPtr pGC;
- xRectangle rect;
- int error;
-
- rect.x = 0;
- rect.y = 0;
- rect.width = extents.x2 - extents.x1;
- rect.height = extents.y2 - extents.y1;
-
- pPixmap = (*pScreen->CreatePixmap) (pScreen,
- rect.width, rect.height,
- maskFormat->depth);
- if (!pPixmap)
- return;
-
- componentAlpha = NEEDS_COMPONENT (maskFormat->format);
- pMask = CreatePicture (0, &pPixmap->drawable,
- maskFormat, CPComponentAlpha, &componentAlpha,
- serverClient, &error);
- if (!pMask)
- {
- (*pScreen->DestroyPixmap) (pPixmap);
- return;
- }
-
- /* make sure destination drawable is locked */
- pPixmapPriv->lock++;
-
- /* lock mask if we are not doing accelerated drawing to destination */
- if (!target)
- XGL_GET_PIXMAP_PRIV (pPixmap)->lock = 1;
-
- ValidatePicture (pMask);
- pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
- ValidateGC (&pPixmap->drawable, pGC);
- (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect);
- FreeScratchGC (pGC);
-
- (*pScreen->DestroyPixmap) (pPixmap);
-
- target = xglPrepareTarget (pMask->pDrawable);
-
- glyphOp.xOff = -extents.x1;
- glyphOp.yOff = -extents.y1;
- pSrcPicture = NULL;
- pDstPicture = pMask;
- }
- else
- {
- /* make sure destination drawable is locked */
- pPixmapPriv->lock++;
-
- glyphOp.xOff = 0;
- glyphOp.yOff = 0;
- pSrcPicture = pSrc;
- pDstPicture = pDst;
- }
-
- glyphOp.ppGlyphs = glyphs;
- glyphOp.noCache = !target;
-
- while (nlist--)
- {
- glyphOp.xOff += list->xOff;
- glyphOp.yOff += list->yOff;
- glyphOp.listLen = list->len;
- glyphOp.nGlyphs = list->len;
- glyphOp.pLists = list++;
-
- for (; nlist; nlist--, list++)
- {
- if (list->format->id != glyphOp.pLists->format->id)
- break;
-
- glyphOp.nGlyphs += list->len;
- }
-
- while (glyphOp.nGlyphs)
- {
- if (glyphOp.noCache || xglCachedGlyphs (op,
- pSrcPicture,
- pDstPicture,
- xSrc - xDst, ySrc - yDst,
- &glyphOp))
- xglUncachedGlyphs (op,
- pSrcPicture,
- pDstPicture,
- xSrc - xDst, ySrc - yDst,
- &glyphOp);
- }
- }
-
- if (pMask)
- {
- xglLeaveOffscreenArea ((PixmapPtr) pMask->pDrawable);
-
- CompositePicture (op,
- pSrc,
- pMask,
- pDst,
- xSrc + extents.x1 - xDst,
- ySrc + extents.y1 - yDst,
- 0, 0,
- extents.x1, extents.y1,
- extents.x2 - extents.x1,
- extents.y2 - extents.y1);
-
- FreePicture ((pointer) pMask, (XID) 0);
- }
-
- /* release destination drawable lock */
- pPixmapPriv->lock--;
-
-}
-
-#endif
diff --git a/hw/xgl/xglhash.c b/hw/xgl/xglhash.c
deleted file mode 100644
index a541d7dd4..000000000
--- a/hw/xgl/xglhash.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-#ifdef GLXEXT
-
-/* This is just a wrapper around Mesa's hash functions. */
-
-extern struct _mesa_HashTable *
-_mesa_NewHashTable (void);
-
-extern void
-_mesa_DeleteHashTable (struct _mesa_HashTable *table);
-
-extern void *
-_mesa_HashLookup (const struct _mesa_HashTable *table,
- unsigned int key);
-
-extern void
-_mesa_HashInsert (struct _mesa_HashTable *table,
- unsigned int key,
- void *data);
-
-extern void
-_mesa_HashRemove (struct _mesa_HashTable *table,
- unsigned int key);
-
-extern unsigned int
-_mesa_HashFirstEntry (struct _mesa_HashTable *table);
-
-extern unsigned int
-_mesa_HashNextEntry (const struct _mesa_HashTable *table,
- unsigned int key);
-
-extern unsigned int
-_mesa_HashFindFreeKeyBlock (struct _mesa_HashTable *table,
- unsigned int numKeys);
-
-
-xglHashTablePtr
-xglNewHashTable (void)
-{
- return (xglHashTablePtr) _mesa_NewHashTable ();
-}
-
-void
-xglDeleteHashTable (xglHashTablePtr pTable)
-{
- _mesa_DeleteHashTable ((struct _mesa_HashTable *) pTable);
-}
-
-void *
-xglHashLookup (const xglHashTablePtr pTable,
- unsigned int key)
-{
- return _mesa_HashLookup ((struct _mesa_HashTable *) pTable, key);
-}
-
-void
-xglHashInsert (xglHashTablePtr pTable,
- unsigned int key,
- void *data)
-{
- _mesa_HashInsert ((struct _mesa_HashTable *) pTable, key, data);
-}
-
-void
-xglHashRemove (xglHashTablePtr pTable,
- unsigned int key)
-{
- _mesa_HashRemove ((struct _mesa_HashTable *) pTable, key);
-}
-
-unsigned int
-xglHashFirstEntry (xglHashTablePtr pTable)
-{
- return _mesa_HashFirstEntry ((struct _mesa_HashTable *) pTable);
-}
-
-unsigned int
-xglHashNextEntry (const xglHashTablePtr pTable,
- unsigned int key)
-{
- return _mesa_HashNextEntry ((struct _mesa_HashTable *) pTable, key);
-}
-
-unsigned int
-xglHashFindFreeKeyBlock (xglHashTablePtr pTable,
- unsigned int numKeys)
-{
- return _mesa_HashFindFreeKeyBlock ((struct _mesa_HashTable *) pTable,
- numKeys);
-}
-
-#endif
diff --git a/hw/xgl/xglinput.c b/hw/xgl/xglinput.c
deleted file mode 100644
index 91becc3c1..000000000
--- a/hw/xgl/xglinput.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "inputstr.h"
-#include "mipointer.h"
-
-#define XK_PUBLISHING
-#include <X11/keysym.h>
-#if HAVE_X11_XF86KEYSYM_H
-#include <X11/XF86keysym.h>
-#endif
-
-#define NUM_BUTTONS 5
-
-int
-xglMouseProc (DeviceIntPtr pDevice,
- int onoff)
-{
- BYTE map[NUM_BUTTONS + 1];
- DevicePtr pDev = (DevicePtr) pDevice;
- int i;
-
- switch (onoff) {
- case DEVICE_INIT:
- for (i = 1; i <= NUM_BUTTONS; i++)
- map[i] = i;
-
- InitPointerDeviceStruct (pDev,
- map,
- NUM_BUTTONS,
- miPointerGetMotionEvents,
- (PtrCtrlProcPtr) NoopDDA,
- miPointerGetMotionBufferSize ());
- break;
- case DEVICE_ON:
- pDev->on = TRUE;
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- pDev->on = FALSE;
- break;
- }
-
- return Success;
-}
-
-void
-xglBell (int volume,
- DeviceIntPtr pDev,
- pointer ctrl,
- int something)
-{
-}
-
-void
-xglKbdCtrl (DeviceIntPtr pDevice,
- KeybdCtrl *ctrl)
-{
-}
-
-#define XGL_KEYMAP_WIDTH 2
-
-KeySym xglKeymap[] = {
-/* 1 8 */ XK_Escape, NoSymbol,
-/* 2 9 */ XK_1, XK_exclam,
-/* 3 10 */ XK_2, XK_at,
-/* 4 11 */ XK_3, XK_numbersign,
-/* 5 12 */ XK_4, XK_dollar,
-/* 6 13 */ XK_5, XK_percent,
-/* 7 14 */ XK_6, XK_asciicircum,
-/* 8 15 */ XK_7, XK_ampersand,
-/* 9 16 */ XK_8, XK_asterisk,
-/* 10 17 */ XK_9, XK_parenleft,
-/* 11 18 */ XK_0, XK_parenright,
-/* 12 19 */ XK_minus, XK_underscore,
-/* 13 20 */ XK_equal, XK_plus,
-/* 14 21 */ XK_BackSpace, NoSymbol,
-/* 15 22 */ XK_Tab, NoSymbol,
-/* 16 23 */ XK_Q, NoSymbol,
-/* 17 24 */ XK_W, NoSymbol,
-/* 18 25 */ XK_E, NoSymbol,
-/* 19 26 */ XK_R, NoSymbol,
-/* 20 27 */ XK_T, NoSymbol,
-/* 21 28 */ XK_Y, NoSymbol,
-/* 22 29 */ XK_U, NoSymbol,
-/* 23 30 */ XK_I, NoSymbol,
-/* 24 31 */ XK_O, NoSymbol,
-/* 25 32 */ XK_P, NoSymbol,
-/* 26 33 */ XK_bracketleft, XK_braceleft,
-/* 27 34 */ XK_bracketright, XK_braceright,
-/* 28 35 */ XK_Return, NoSymbol,
-/* 29 36 */ XK_Control_L, NoSymbol,
-/* 30 37 */ XK_A, NoSymbol,
-/* 31 38 */ XK_S, NoSymbol,
-/* 32 39 */ XK_D, NoSymbol,
-/* 33 40 */ XK_F, NoSymbol,
-/* 34 41 */ XK_G, NoSymbol,
-/* 35 42 */ XK_H, NoSymbol,
-/* 36 43 */ XK_J, NoSymbol,
-/* 37 44 */ XK_K, NoSymbol,
-/* 38 45 */ XK_L, NoSymbol,
-/* 39 46 */ XK_semicolon, XK_colon,
-/* 40 47 */ XK_apostrophe, XK_quotedbl,
-/* 41 48 */ XK_grave, XK_asciitilde,
-/* 42 49 */ XK_Shift_L, NoSymbol,
-/* 43 50 */ XK_backslash, XK_bar,
-/* 44 51 */ XK_Z, NoSymbol,
-/* 45 52 */ XK_X, NoSymbol,
-/* 46 53 */ XK_C, NoSymbol,
-/* 47 54 */ XK_V, NoSymbol,
-/* 48 55 */ XK_B, NoSymbol,
-/* 49 56 */ XK_N, NoSymbol,
-/* 50 57 */ XK_M, NoSymbol,
-/* 51 58 */ XK_comma, XK_less,
-/* 52 59 */ XK_period, XK_greater,
-/* 53 60 */ XK_slash, XK_question,
-/* 54 61 */ XK_Shift_R, NoSymbol,
-/* 55 62 */ XK_KP_Multiply, NoSymbol,
-/* 56 63 */ XK_Alt_L, XK_Meta_L,
-/* 57 64 */ XK_space, NoSymbol,
-/* 58 65 */ XK_Caps_Lock, NoSymbol,
-/* 59 66 */ XK_F1, NoSymbol,
-/* 60 67 */ XK_F2, NoSymbol,
-/* 61 68 */ XK_F3, NoSymbol,
-/* 62 69 */ XK_F4, NoSymbol,
-/* 63 70 */ XK_F5, NoSymbol,
-/* 64 71 */ XK_F6, NoSymbol,
-/* 65 72 */ XK_F7, NoSymbol,
-/* 66 73 */ XK_F8, NoSymbol,
-/* 67 74 */ XK_F9, NoSymbol,
-/* 68 75 */ XK_F10, NoSymbol,
-/* 69 76 */ XK_Break, XK_Pause,
-/* 70 77 */ XK_Scroll_Lock, NoSymbol,
-/* 71 78 */ XK_KP_Home, XK_KP_7,
-/* 72 79 */ XK_KP_Up, XK_KP_8,
-/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
-/* 74 81 */ XK_KP_Subtract, NoSymbol,
-/* 75 82 */ XK_KP_Left, XK_KP_4,
-/* 76 83 */ XK_KP_5, NoSymbol,
-/* 77 84 */ XK_KP_Right, XK_KP_6,
-/* 78 85 */ XK_KP_Add, NoSymbol,
-/* 79 86 */ XK_KP_End, XK_KP_1,
-/* 80 87 */ XK_KP_Down, XK_KP_2,
-/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
-/* 82 89 */ XK_KP_Insert, XK_KP_0,
-/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
-/* 84 91 */ NoSymbol, NoSymbol,
-/* 85 92 */ NoSymbol, NoSymbol,
-/* 86 93 */ NoSymbol, NoSymbol,
-/* 87 94 */ XK_F11, NoSymbol,
-/* 88 95 */ XK_F12, NoSymbol,
-/* 89 96 */ XK_Control_R, NoSymbol,
-/* 90 97 */ XK_KP_Enter, NoSymbol,
-/* 91 98 */ XK_KP_Divide, NoSymbol,
-/* 92 99 */ XK_Sys_Req, XK_Print,
-/* 93 100 */ XK_Alt_R, XK_Meta_R,
-/* 94 101 */ XK_Num_Lock, NoSymbol,
-/* 95 102 */ XK_Home, NoSymbol,
-/* 96 103 */ XK_Up, NoSymbol,
-/* 97 104 */ XK_Page_Up, NoSymbol,
-/* 98 105 */ XK_Left, NoSymbol,
-/* 99 106 */ XK_Right, NoSymbol,
-/* 100 107 */ XK_End, NoSymbol,
-/* 101 108 */ XK_Down, NoSymbol,
-/* 102 109 */ XK_Page_Down, NoSymbol,
-/* 103 110 */ XK_Insert, NoSymbol,
-/* 104 111 */ XK_Delete, NoSymbol,
-/* 105 112 */ XK_Super_L, NoSymbol,
-/* 106 113 */ XK_Super_R, NoSymbol,
-/* 107 114 */ XK_Menu, NoSymbol,
-
-/* 108 115 */ XK_Next, NoSymbol, /* right button on side */
-/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */
-/* 110 117 */ XK_Up, NoSymbol, /* joypad */
-/* 111 118 */ XK_Down, NoSymbol,
-/* 112 119 */ XK_Left, NoSymbol,
-/* 113 120 */ XK_Right, NoSymbol,
-/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */
-/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */
-/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
-};
-
-CARD8 xglModMap[MAP_LENGTH];
-
-KeySymsRec xglKeySyms = {
- xglKeymap,
- 8,
- 8 + (sizeof (xglKeymap) / sizeof (xglKeymap[0]) / XGL_KEYMAP_WIDTH) - 1,
- XGL_KEYMAP_WIDTH
-};
-
-int
-xglKeybdProc (DeviceIntPtr pDevice,
- int onoff)
-{
- Bool ret;
- DevicePtr pDev = (DevicePtr) pDevice;
-
- if (!pDev)
- return BadImplementation;
-
- switch (onoff) {
- case DEVICE_INIT:
- if (pDev != LookupKeyboardDevice ())
- return !Success;
-
- ret = InitKeyboardDeviceStruct (pDev,
- &xglKeySyms,
- xglModMap,
- xglBell,
- xglKbdCtrl);
- if (!ret)
- return BadImplementation;
- break;
- case DEVICE_ON:
- pDev->on = TRUE;
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- pDev->on = FALSE;
- break;
- }
-
- return Success;
-}
-
-void
-xglInitInput (int argc, char **argv)
-{
- DeviceIntPtr pKeyboard, pPointer;
-
- pPointer = AddInputDevice (xglMouseProc, TRUE);
- pKeyboard = AddInputDevice (xglKeybdProc, TRUE);
-
- RegisterPointerDevice (pPointer);
- RegisterKeyboardDevice (pKeyboard);
-
- miRegisterPointerDevice (screenInfo.screens[0], pPointer);
- mieqInit (&pKeyboard->public, &pPointer->public);
-}
diff --git a/hw/xgl/xgloffscreen.c b/hw/xgl/xgloffscreen.c
deleted file mode 100644
index c6f8a9165..000000000
--- a/hw/xgl/xgloffscreen.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-static glitz_drawable_buffer_t _buffers[] = {
- GLITZ_DRAWABLE_BUFFER_BACK_COLOR,
- GLITZ_DRAWABLE_BUFFER_FRONT_COLOR
-};
-
-#define MAX_OFFSCREEN_LEVEL 8
-
-static Bool
-xglOffscreenCreate (xglAreaPtr pArea)
-{
- return TRUE;
-}
-
-static Bool
-xglOffscreenMoveIn (xglAreaPtr pArea,
- pointer closure)
-{
- xglOffscreenPtr pOffscreen = (xglOffscreenPtr) pArea->pRoot->closure;
- PixmapPtr pPixmap = (PixmapPtr) closure;
-
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (!xglSyncSurface (&pPixmap->drawable))
- FatalError (XGL_SW_FAILURE_STRING);
-
- pPixmapPriv->pArea = pArea;
- pPixmapPriv->target = xglPixmapTargetIn;
-
- glitz_surface_attach (pPixmapPriv->surface,
- pOffscreen->drawable, pOffscreen->buffer,
- pArea->x, pArea->y);
-
- XGL_INCREMENT_PIXMAP_SCORE (pPixmapPriv, 100);
-
- return TRUE;
-}
-
-static void
-xglOffscreenMoveOut (xglAreaPtr pArea,
- pointer closure)
-{
- PixmapPtr pPixmap = (PixmapPtr) closure;
-
- XGL_PIXMAP_PRIV (pPixmap);
-
- glitz_surface_detach (pPixmapPriv->surface);
-
- pPixmapPriv->pArea = NULL;
- pPixmapPriv->target = xglPixmapTargetOut;
-}
-
-static int
-xglOffscreenCompareScore (xglAreaPtr pArea,
- pointer closure1,
- pointer closure2)
-{
- int s1, s2;
-
- XGL_PIXMAP_PRIV ((PixmapPtr) closure1);
-
- s1 = pPixmapPriv->score;
- s2 = XGL_GET_PIXMAP_PRIV ((PixmapPtr) closure2)->score;
-
- if (s1 > s2)
- XGL_DECREMENT_PIXMAP_SCORE (pPixmapPriv, 10);
-
- if (pPixmapPriv->lock)
- return 1;
-
- return s1 - s2;
-}
-
-static const xglAreaFuncsRec xglOffscreenAreaFuncs = {
- xglOffscreenCreate,
- xglOffscreenMoveIn,
- xglOffscreenMoveOut,
- xglOffscreenCompareScore
-};
-
-Bool
-xglInitOffscreen (ScreenPtr pScreen,
- xglScreenInfoPtr pScreenInfo)
-{
- xglOffscreenPtr pOffscreen;
- glitz_drawable_format_t *format;
-
- XGL_SCREEN_PRIV (pScreen);
-
- pOffscreen = pScreenPriv->pOffscreen;
-
- pScreenPriv->nOffscreen = 0;
-
- format = glitz_drawable_get_format (pScreenPriv->drawable);
-
- /*
- * Use back buffer as offscreen area.
- */
- if (format->doublebuffer)
- {
- pOffscreen->drawable = pScreenPriv->drawable;
- pOffscreen->format = format;
- pOffscreen->buffer = GLITZ_DRAWABLE_BUFFER_BACK_COLOR;
-
- if (xglRootAreaInit (&pOffscreen->rootArea,
- MAX_OFFSCREEN_LEVEL,
- pScreenInfo->width,
- pScreenInfo->height, 0,
- (xglAreaFuncsPtr) &xglOffscreenAreaFuncs,
- (pointer) pOffscreen))
- {
- glitz_drawable_reference (pOffscreen->drawable);
-
- pScreenPriv->nOffscreen++;
- pOffscreen++;
- ErrorF ("Initialized %dx%d back buffer offscreen area\n",
- pScreenInfo->width, pScreenInfo->height);
- }
- }
-
- if (nxglPbufferVisuals)
- {
- glitz_drawable_t *pbuffer;
- unsigned int width, height;
- int i;
-
- for (i = 0; i < nxglPbufferVisuals; i++)
- {
- /*
- * This can be a bit tricky. I've noticed that when some OpenGL
- * drivers can't create an accelerated pbuffer of the size we're
- * requesting they create a software one with the correct
- * size, but that's not what we want. So if your OpenGL driver
- * supports accelerated pbuffers but offscreen drawing is really
- * slow, try decrementing these values.
- */
- width = 2048;
- height = 2048;
-
- do {
- pbuffer =
- glitz_create_pbuffer_drawable (pScreenPriv->drawable,
- xglPbufferVisuals[i].format,
- width, height);
- width >>= 1;
- height >>= 1;
- } while (!pbuffer && width);
-
- if (pbuffer)
- {
- int j = 0;
-
- width = glitz_drawable_get_width (pbuffer);
- height = glitz_drawable_get_height (pbuffer);
-
- /*
- * No back buffer? only add front buffer.
- */
- if (!xglPbufferVisuals[i].format->doublebuffer)
- j++;
-
- while (j < 2)
- {
- pOffscreen->drawable = pbuffer;
- pOffscreen->format = xglPbufferVisuals[i].format;
- pOffscreen->buffer = _buffers[j];
-
- if (xglRootAreaInit (&pOffscreen->rootArea,
- MAX_OFFSCREEN_LEVEL,
- width, height, 0,
- (xglAreaFuncsPtr)
- &xglOffscreenAreaFuncs,
- (pointer) pOffscreen))
- {
- glitz_drawable_reference (pbuffer);
-
- pScreenPriv->nOffscreen++;
- pOffscreen++;
- ErrorF ("Initialized %dx%d pbuffer offscreen area\n",
- width, height);
- }
- j++;
- }
- glitz_drawable_destroy (pbuffer);
- }
- }
- }
-
- return TRUE;
-}
-
-void
-xglFiniOffscreen (ScreenPtr pScreen)
-{
- int n;
-
- XGL_SCREEN_PRIV (pScreen);
-
- n = pScreenPriv->nOffscreen;
- while (n--)
- {
- xglRootAreaFini (&pScreenPriv->pOffscreen[n].rootArea);
- glitz_drawable_destroy (pScreenPriv->pOffscreen[n].drawable);
- }
-
- pScreenPriv->nOffscreen = 0;
-}
-
-Bool
-xglFindOffscreenArea (ScreenPtr pScreen,
- PixmapPtr pPixmap)
-{
- xglOffscreenPtr pOffscreen;
- int nOffscreen;
- glitz_color_format_t *pColor;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (pPixmapPriv->score < 0)
- return FALSE;
-
- pColor = &pPixmapPriv->format->color;
-
- pOffscreen = pScreenPriv->pOffscreen;
- nOffscreen = pScreenPriv->nOffscreen;
-
- while (nOffscreen--)
- {
- if (pOffscreen->format->color.red_size >= pColor->red_size &&
- pOffscreen->format->color.green_size >= pColor->green_size &&
- pOffscreen->format->color.blue_size >= pColor->blue_size &&
- pOffscreen->format->color.alpha_size >= pColor->alpha_size)
- {
- /* Find available area */
- if (xglFindArea (pOffscreen->rootArea.pArea,
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- FALSE,
- (pointer) pPixmap))
- return TRUE;
-
- /* Kicking out area with lower score */
- if (xglFindArea (pOffscreen->rootArea.pArea,
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- TRUE,
- (pointer) pPixmap))
- return TRUE;
- }
-
- pOffscreen++;
- }
-
- return FALSE;
-}
-
-void
-xglLeaveOffscreenArea (PixmapPtr pPixmap)
-{
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (pPixmapPriv->pArea)
- xglLeaveArea (pPixmapPriv->pArea);
-
- pPixmapPriv->pArea = NULL;
-}
diff --git a/hw/xgl/xgloutput.c b/hw/xgl/xgloutput.c
deleted file mode 100644
index 788dafb43..000000000
--- a/hw/xgl/xgloutput.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-typedef struct _xglDepth {
- CARD8 depth;
- CARD8 bpp;
-} xglDepthRec, *xglDepthPtr;
-
-static xglDepthRec xglDepths[] = {
- { 1, 1 },
- { 4, 4 },
- { 8, 8 },
- { 15, 16 },
- { 16, 16 },
- { 24, 32 },
- { 32, 32 }
-};
-
-#define NUM_XGL_DEPTHS (sizeof (xglDepths) / sizeof (xglDepths[0]))
-
-void
-xglSetPixmapFormats (ScreenInfo *pScreenInfo)
-{
- int i;
-
- pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
- pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
- pScreenInfo->numPixmapFormats = 0;
-
- for (i = 0; i < NUM_XGL_DEPTHS; i++) {
- PixmapFormatRec *format;
-
- format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
-
- format->depth = xglDepths[i].depth;
- format->bitsPerPixel = xglDepths[i].bpp;
- format->scanlinePad = BITMAP_SCANLINE_PAD;
- }
-}
diff --git a/hw/xgl/xglparse.c b/hw/xgl/xglparse.c
deleted file mode 100644
index 663d79872..000000000
--- a/hw/xgl/xglparse.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-char *
-xglParseFindNext (char *cur,
- char *delim,
- char *save,
- char *last)
-{
- while (*cur && !strchr (delim, *cur))
- *save++ = *cur++;
-
- *save = 0;
- *last = *cur;
-
- if (*cur)
- cur++;
-
- return cur;
-}
-
-void
-xglParseScreen (xglScreenInfoPtr pScreenInfo,
- char *arg)
-{
- char delim;
- char save[1024];
- int i, pixels, mm;
-
- pScreenInfo->width = 0;
- pScreenInfo->height = 0;
- pScreenInfo->widthMm = 0;
- pScreenInfo->heightMm = 0;
-
- if (!arg)
- return;
-
- if (strlen (arg) >= sizeof (save))
- return;
-
- for (i = 0; i < 2; i++)
- {
- arg = xglParseFindNext (arg, "x/@XY", save, &delim);
- if (!save[0])
- return;
-
- pixels = atoi (save);
- mm = 0;
-
- if (delim == '/')
- {
- arg = xglParseFindNext (arg, "x@XY", save, &delim);
- if (!save[0])
- return;
-
- mm = atoi (save);
- }
-
- if (i == 0)
- {
- pScreenInfo->width = pixels;
- pScreenInfo->widthMm = mm;
- }
- else
- {
- pScreenInfo->height = pixels;
- pScreenInfo->heightMm = mm;
- }
-
- if (delim != 'x')
- return;
- }
-}
-
-void
-xglUseMsg (void)
-{
- ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] "
- "specify screen characteristics\n");
- ErrorF ("-fullscreen run fullscreen\n");
- ErrorF ("-vertextype [short|float] set vertex data type\n");
- ErrorF ("-vbostream "
- "use vertex buffer objects for streaming of vertex data\n");
- ErrorF ("-yinverted Y is upside-down\n");
- ErrorF ("-pbomask [1|4|8|16|32] "
- "set bpp's to use with pixel buffer objects\n");
- ErrorF ("-lines "
- "accelerate lines that are not vertical or horizontal\n");
-}
-
-int
-xglProcessArgument (xglScreenInfoPtr pScreenInfo,
- int argc,
- char **argv,
- int i)
-{
- if (!strcmp (argv[i], "-screen"))
- {
- if ((i + 1) < argc)
- {
- xglParseScreen (pScreenInfo, argv[i + 1]);
- }
- else
- return 1;
-
- return 2;
- }
- else if (!strcmp (argv[i], "-fullscreen"))
- {
- pScreenInfo->fullscreen = TRUE;
- return 1;
- }
- else if (!strcmp (argv[i], "-vertextype"))
- {
- if ((i + 1) < argc)
- {
- if (!strcasecmp (argv[i + 1], "short"))
- pScreenInfo->geometryDataType = GEOMETRY_DATA_TYPE_SHORT;
- else if (!strcasecmp (argv[i + 1], "float"))
- pScreenInfo->geometryDataType = GEOMETRY_DATA_TYPE_FLOAT;
- }
- else
- return 1;
-
- return 2;
- }
- else if (!strcmp (argv[i], "-vbostream"))
- {
- pScreenInfo->geometryUsage = GEOMETRY_USAGE_STREAM;
- return 1;
- }
- else if (!strcmp (argv[i], "-yinverted"))
- {
- pScreenInfo->yInverted = TRUE;
- return 1;
- }
- else if (!strcmp (argv[i], "-pbomask"))
- {
- if ((i + 1) < argc)
- {
- pScreenInfo->pboMask = atoi (argv[i + 1]);
- }
- else
- return 1;
-
- return 2;
- }
- else if (!strcmp (argv[i], "-lines"))
- {
- pScreenInfo->lines = TRUE;
- return 1;
- }
-
- return 0;
-}
diff --git a/hw/xgl/xglpict.c b/hw/xgl/xglpict.c
deleted file mode 100644
index ec79eda68..000000000
--- a/hw/xgl/xglpict.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "fb.h"
-
-#ifdef RENDER
-
-#define XGL_PICTURE_FALLBACK_PROLOGUE(pPicture, func) \
- xglSyncDamageBoxBits (pPicture->pDrawable); \
- XGL_PICTURE_SCREEN_UNWRAP (func)
-
-#define XGL_PICTURE_FALLBACK_EPILOGUE(pPicture, func, xglfunc) \
- XGL_PICTURE_SCREEN_WRAP (func, xglfunc); \
- xglAddCurrentSurfaceDamage (pPicture->pDrawable)
-
-void
-xglComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- PictureScreenPtr pPictureScreen;
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
-
- XGL_SCREEN_PRIV (pScreen);
-
- if (xglComp (op,
- pSrc, pMask, pDst,
- xSrc, ySrc,
- xMask, yMask,
- xDst + pDst->pDrawable->x, yDst + pDst->pDrawable->y,
- width, height,
- NULL, NULL))
- {
- xglAddCurrentBitDamage (pDst->pDrawable);
- return;
- }
-
- pPictureScreen = GetPictureScreen (pScreen);
-
- if (!xglSyncBits (pSrc->pDrawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
-
- if (pMask)
- {
- if (!xglSyncBits (pMask->pDrawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
- }
-
- if (op == PictOpSrc)
- {
- XGL_DRAWABLE_PIXMAP (pDst->pDrawable);
-
- if (!xglMapPixmapBits (pPixmap))
- FatalError (XGL_SW_FAILURE_STRING);
- } else
- xglSyncDamageBoxBits (pDst->pDrawable);
-
- XGL_PICTURE_SCREEN_UNWRAP (Composite);
- (*pPictureScreen->Composite) (op, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height);
- XGL_PICTURE_SCREEN_WRAP (Composite, xglComposite);
-
- if (op == PictOpSrc)
- {
- RegionRec region;
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
-
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if (pMask)
- {
- xMask += pMask->pDrawable->x;
- yMask += pMask->pDrawable->y;
- }
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- return;
-
- xglAddSurfaceDamage (pDst->pDrawable, &region);
- REGION_UNINIT (pDst->pDrawable->pScreen, &region);
- } else
- xglAddCurrentSurfaceDamage (pDst->pDrawable);
-}
-
-void
-xglAddTriangles (PicturePtr pDst,
- INT16 xOff,
- INT16 yOff,
- int ntri,
- xTriangle *tris)
-{
- PictureScreenPtr pPictureScreen;
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
-
- pPictureScreen = GetPictureScreen (pScreen);
-
- pPixmapPriv->damageBox.x1 = 0;
- pPixmapPriv->damageBox.y1 = 0;
- pPixmapPriv->damageBox.x2 = pDst->pDrawable->width;
- pPixmapPriv->damageBox.y2 = pDst->pDrawable->height;
-
- XGL_PICTURE_FALLBACK_PROLOGUE (pDst, AddTriangles);
- (*pPictureScreen->AddTriangles) (pDst, xOff, yOff, ntri, tris);
- XGL_PICTURE_FALLBACK_EPILOGUE (pDst, AddTriangles, xglAddTriangles);
-}
-
-
-void
-xglChangePicture (PicturePtr pPicture,
- Mask mask)
-{
- PictureScreenPtr pPictureScreen;
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
-
- pPictureScreen = GetPictureScreen (pScreen);
-
- if (pPicture->stateChanges & CPRepeat)
- pPixmapPriv->pictureMask |= xglPCFillMask;
-
- if (pPicture->stateChanges & CPComponentAlpha)
- pPixmapPriv->pictureMask |= xglPCComponentAlphaMask;
-
- if (pPicture->stateChanges & CPDither)
- pPixmapPriv->pictureMask |= xglPCDitherMask;
-
- XGL_PICTURE_SCREEN_UNWRAP (ChangePicture);
- (*pPictureScreen->ChangePicture) (pPicture, mask);
- XGL_PICTURE_SCREEN_WRAP (ChangePicture, xglChangePicture);
-}
-
-int
-xglChangePictureTransform (PicturePtr pPicture,
- PictTransform *transform)
-{
- PictureScreenPtr pPictureScreen;
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- int ret;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
-
- pPictureScreen = GetPictureScreen (pScreen);
-
- pPixmapPriv->pictureMask |= xglPCTransformMask;
-
- XGL_PICTURE_SCREEN_UNWRAP (ChangePictureTransform);
- ret = (*pPictureScreen->ChangePictureTransform) (pPicture, transform);
- XGL_PICTURE_SCREEN_WRAP (ChangePictureTransform,
- xglChangePictureTransform);
-
- return ret;
-}
-
-int
-xglChangePictureFilter (PicturePtr pPicture,
- int filter,
- xFixed *params,
- int nparams)
-{
- PictureScreenPtr pPictureScreen;
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- int ret;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
-
- pPictureScreen = GetPictureScreen (pScreen);
-
- pPixmapPriv->pictureMask |= xglPCFilterMask;
-
- XGL_PICTURE_SCREEN_UNWRAP (ChangePictureFilter);
- ret = (*pPictureScreen->ChangePictureFilter) (pPicture, filter,
- params, nparams);
- XGL_PICTURE_SCREEN_WRAP (ChangePictureFilter, xglChangePictureFilter);
-
- return ret;
-}
-
-void
-xglUpdatePicture (PicturePtr pPicture)
-{
- glitz_surface_t *surface;
-
- XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
-
- surface = pPixmapPriv->surface;
-
- if (pPixmapPriv->pictureMask & xglPCFillMask)
- {
- if (pPicture->repeat)
- glitz_surface_set_fill (surface, GLITZ_FILL_REPEAT);
- else
- glitz_surface_set_fill (surface, GLITZ_FILL_TRANSPARENT);
- }
-
- if (pPixmapPriv->pictureMask & xglPCFilterMask)
- {
- switch (pPicture->filter) {
- case PictFilterNearest:
- case PictFilterFast:
- glitz_surface_set_filter (surface, GLITZ_FILTER_NEAREST, NULL, 0);
- break;
- case PictFilterGood:
- case PictFilterBest:
- case PictFilterBilinear:
- glitz_surface_set_filter (surface, GLITZ_FILTER_BILINEAR, NULL, 0);
- break;
- case PictFilterConvolution:
- glitz_surface_set_filter (surface, GLITZ_FILTER_CONVOLUTION,
- (glitz_fixed16_16_t *)
- pPicture->filter_params,
- pPicture->filter_nparams);
- break;
- }
- }
-
- if (pPixmapPriv->pictureMask & xglPCTransformMask)
- {
- glitz_surface_set_transform (surface, (glitz_transform_t *)
- pPicture->transform);
- }
-
- if (pPixmapPriv->pictureMask & xglPCComponentAlphaMask)
- {
- if (pPicture->componentAlpha)
- glitz_surface_set_component_alpha (surface, 1);
- else
- glitz_surface_set_component_alpha (surface, 0);
- }
-
- if (pPixmapPriv->pictureMask & xglPCDitherMask)
- {
- if (pPicture->dither)
- glitz_surface_set_dither (surface, 1);
- else
- glitz_surface_set_dither (surface, 0);
- }
-
- pPixmapPriv->pictureMask &= ~XGL_PICTURE_CHANGES (~0);
-}
-
-static int
-xglVisualDepth (ScreenPtr pScreen, VisualPtr pVisual)
-{
- DepthPtr pDepth;
- int d, v;
-
- for (d = 0; d < pScreen->numDepths; d++)
- {
- pDepth = &pScreen->allowedDepths[d];
- for (v = 0; v < pDepth->numVids; v++)
- if (pDepth->vids[v] == pVisual->vid)
- return pDepth->depth;
- }
-
- return 0;
-}
-
-typedef struct _xglformatInit {
- CARD32 format;
- CARD8 depth;
-} xglFormatInitRec, *xglFormatInitPtr;
-
-static int
-xglAddFormat (xglFormatInitPtr formats,
- int nformat,
- CARD32 format,
- CARD8 depth)
-{
- int n;
-
- for (n = 0; n < nformat; n++)
- if (formats[n].format == format && formats[n].depth == depth)
- return nformat;
-
- formats[nformat].format = format;
- formats[nformat].depth = depth;
-
- return ++nformat;
-}
-
-#define Mask(n) ((n) == 32 ? 0xffffffff : ((1 << (n)) - 1))
-
-Bool
-xglPictureInit (ScreenPtr pScreen)
-{
- int f, nformats = 0;
- PictFormatPtr pFormats;
- xglFormatInitRec formats[64];
- CARD32 format;
- CARD8 depth;
- VisualPtr pVisual;
- int v;
- int bpp;
- int r, g, b;
- int d;
- DepthPtr pDepth;
-
- /* formats required by protocol */
- formats[nformats].format = PICT_a1;
- formats[nformats].depth = 1;
- nformats++;
- formats[nformats].format = PICT_a4;
- formats[nformats].depth = 4;
- nformats++;
- formats[nformats].format = PICT_a8;
- formats[nformats].depth = 8;
- nformats++;
- formats[nformats].format = PICT_a8r8g8b8;
- formats[nformats].depth = 32;
- nformats++;
-
- /* now look through the depths and visuals adding other formats */
- for (v = 0; v < pScreen->numVisuals; v++)
- {
- pVisual = &pScreen->visuals[v];
- depth = xglVisualDepth (pScreen, pVisual);
- if (!depth)
- continue;
-
- bpp = BitsPerPixel (depth);
- switch (pVisual->class) {
- case DirectColor:
- case TrueColor:
- r = Ones (pVisual->redMask);
- g = Ones (pVisual->greenMask);
- b = Ones (pVisual->blueMask);
- if (pVisual->offsetBlue == 0 &&
- pVisual->offsetGreen == b &&
- pVisual->offsetRed == b + g)
- {
- format = PICT_FORMAT (bpp, PICT_TYPE_ARGB, 0, r, g, b);
- nformats = xglAddFormat (formats, nformats, format, depth);
- }
- break;
- case StaticColor:
- case PseudoColor:
- case StaticGray:
- case GrayScale:
- break;
- }
- }
-
- /* walk supported depths and add missing Direct formats */
- for (d = 0; d < pScreen->numDepths; d++)
- {
- pDepth = &pScreen->allowedDepths[d];
- bpp = BitsPerPixel (pDepth->depth);
- format = 0;
- switch (bpp) {
- case 16:
- if (pDepth->depth == 15)
- nformats = xglAddFormat (formats, nformats,
- PICT_x1r5g5b5, pDepth->depth);
- if (pDepth->depth == 16)
- nformats = xglAddFormat (formats, nformats,
- PICT_r5g6b5, pDepth->depth);
- break;
- case 24:
- if (pDepth->depth == 24)
- nformats = xglAddFormat (formats, nformats,
- PICT_r8g8b8, pDepth->depth);
- break;
- case 32:
- if (pDepth->depth == 24)
- nformats = xglAddFormat (formats, nformats,
- PICT_x8r8g8b8, pDepth->depth);
- break;
- }
- }
-
- pFormats = (PictFormatPtr) xalloc (nformats * sizeof (PictFormatRec));
- if (!pFormats)
- return 0;
-
- memset (pFormats, '\0', nformats * sizeof (PictFormatRec));
- for (f = 0; f < nformats; f++)
- {
- pFormats[f].id = FakeClientID (0);
- pFormats[f].depth = formats[f].depth;
- format = formats[f].format;
- pFormats[f].format = format;
- pFormats[f].type = PictTypeDirect;
- switch (PICT_FORMAT_TYPE (format)) {
- case PICT_TYPE_ARGB:
- pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A (format));
- if (pFormats[f].direct.alphaMask)
- pFormats[f].direct.alpha = (PICT_FORMAT_R (format) +
- PICT_FORMAT_G (format) +
- PICT_FORMAT_B (format));
-
- pFormats[f].direct.redMask = Mask (PICT_FORMAT_R (format));
- pFormats[f].direct.red = (PICT_FORMAT_G (format) +
- PICT_FORMAT_B (format));
-
- pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G (format));
- pFormats[f].direct.green = PICT_FORMAT_B (format);
-
- pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B (format));
- pFormats[f].direct.blue = 0;
- break;
- case PICT_TYPE_A:
- pFormats[f].direct.alpha = 0;
- pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A (format));
- break;
- case PICT_TYPE_COLOR:
- case PICT_TYPE_GRAY:
- break;
- }
- }
-
- if (!fbPictureInit (pScreen, pFormats, nformats))
- return FALSE;
-
- if (PictureAddFilter (pScreen,
- FilterConvolution,
- miFilterValidateParams) < 0)
- return FALSE;
-
- return TRUE;
-}
-
-void
-xglPictureClipExtents (PicturePtr pPicture,
- BoxPtr extents)
-{
- if (pPicture->clientClipType != CT_NONE)
- {
- BoxPtr clip = REGION_EXTENTS (pPicture->pDrawable->pScreen,
- (RegionPtr) pPicture->clientClip);
-
- if (extents->x1 < pPicture->clipOrigin.x + clip->x1)
- extents->x1 = pPicture->clipOrigin.x + clip->x1;
-
- if (extents->y1 < pPicture->clipOrigin.y + clip->y1)
- extents->y1 = pPicture->clipOrigin.y + clip->y1;
-
- if (extents->x2 > pPicture->clipOrigin.x + clip->x2)
- extents->x2 = pPicture->clipOrigin.x + clip->x2;
-
- if (extents->y2 > pPicture->clipOrigin.y + clip->y2)
- extents->y2 = pPicture->clipOrigin.y + clip->y2;
- }
- else
- {
- if (extents->x1 < 0)
- extents->x1 = 0;
-
- if (extents->y1 < 0)
- extents->y1 = 0;
-
- if (extents->x2 > pPicture->pDrawable->width)
- extents->x2 = pPicture->pDrawable->width;
-
- if (extents->y2 > pPicture->pDrawable->height)
- extents->y2 = pPicture->pDrawable->height;
- }
-}
-
-#endif
diff --git a/hw/xgl/xglpixmap.c b/hw/xgl/xglpixmap.c
deleted file mode 100644
index ee6454779..000000000
--- a/hw/xgl/xglpixmap.c
+++ /dev/null
@@ -1,601 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "fb.h"
-
-static glitz_buffer_hint_t xglPixmapUsageHints[] = {
- (glitz_buffer_hint_t) 0, /* reserved for system memory */
- GLITZ_BUFFER_HINT_STREAM_DRAW,
- GLITZ_BUFFER_HINT_STREAM_READ,
- GLITZ_BUFFER_HINT_STREAM_COPY,
- GLITZ_BUFFER_HINT_STATIC_DRAW,
- GLITZ_BUFFER_HINT_STATIC_READ,
- GLITZ_BUFFER_HINT_STATIC_COPY,
- GLITZ_BUFFER_HINT_DYNAMIC_DRAW,
- GLITZ_BUFFER_HINT_DYNAMIC_READ,
- GLITZ_BUFFER_HINT_DYNAMIC_COPY
-};
-
-#define NUM_XGL_PIXMAP_USAGE_HINTS \
- (sizeof (xglPixmapUsageHints) / sizeof (xglPixmapUsageHints[0]))
-
-#define XGL_PIXMAP_USAGE_HINT(hint) (xglPixmapUsageHints[hint])
-
-static void
-xglPixmapDamageReport (DamagePtr pDamage,
- RegionPtr pRegion,
- void *closure)
-{
- PixmapPtr pPixmap = (PixmapPtr) closure;
- BoxPtr pExt;
-
- XGL_PIXMAP_PRIV (pPixmap);
-
- pExt = REGION_EXTENTS (pPixmap->drawable.pScreen, pRegion);
-
- if (BOX_NOTEMPTY (&pPixmapPriv->damageBox))
- {
- if (pExt->x1 < pPixmapPriv->damageBox.x1)
- pPixmapPriv->damageBox.x1 = pExt->x1;
-
- if (pExt->y1 < pPixmapPriv->damageBox.y1)
- pPixmapPriv->damageBox.y1 = pExt->y1;
-
- if (pExt->x2 > pPixmapPriv->damageBox.x2)
- pPixmapPriv->damageBox.x2 = pExt->x2;
-
- if (pExt->y2 > pPixmapPriv->damageBox.y2)
- pPixmapPriv->damageBox.y2 = pExt->y2;
- } else
- pPixmapPriv->damageBox = *pExt;
-}
-
-
-static Bool
-xglPixmapCreateDamage (PixmapPtr pPixmap)
-{
- XGL_PIXMAP_PRIV (pPixmap);
-
- pPixmapPriv->pDamage =
- DamageCreate (xglPixmapDamageReport, (DamageDestroyFunc) 0,
- DamageReportRawRegion, TRUE,
- pPixmap->drawable.pScreen,
- (void *) pPixmap);
- if (!pPixmapPriv->pDamage)
- return FALSE;
-
- DamageRegister (&pPixmap->drawable, pPixmapPriv->pDamage);
-
- return TRUE;
-}
-
-static Bool
-xglPixmapSurfaceInit (PixmapPtr pPixmap,
- unsigned long features,
- int width,
- int height)
-{
- XGL_PIXMAP_PRIV (pPixmap);
-
- pPixmapPriv->surface = NULL;
- pPixmapPriv->pArea = NULL;
- pPixmapPriv->score = 0;
- pPixmapPriv->acceleratedTile = FALSE;
- pPixmapPriv->pictureMask = ~0;
- pPixmapPriv->target = xglPixmapTargetNo;
- pPixmapPriv->lock = 0;
-
- if (pPixmapPriv->format)
- {
- if (!pPixmapPriv->pDamage)
- if (!xglPixmapCreateDamage (pPixmap))
- FatalError (XGL_SW_FAILURE_STRING);
-
- if (width && height)
- {
- if (width == 1 && height == 1)
- {
- pPixmapPriv->acceleratedTile = TRUE;
- }
- else if (features & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK)
- {
- if ((features & GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) ||
- (POWER_OF_TWO (width) && POWER_OF_TWO (height)))
- pPixmapPriv->acceleratedTile = TRUE;
- }
-
- pPixmapPriv->target = xglPixmapTargetOut;
-
- /*
- * Do not allow accelerated drawing to bitmaps.
- */
- if (pPixmap->drawable.depth == 1)
- pPixmapPriv->target = xglPixmapTargetNo;
-
- /*
- * Drawing to really small pixmaps is not worth accelerating.
- */
- if (width < 8 && height < 8)
- pPixmapPriv->target = xglPixmapTargetNo;
- }
- }
-
- return TRUE;
-}
-
-PixmapPtr
-xglCreatePixmap (ScreenPtr pScreen,
- int width,
- int height,
- int depth)
-{
- xglPixmapPtr pPixmapPriv;
- PixmapPtr pPixmap;
-
- XGL_SCREEN_PRIV (pScreen);
-
- pPixmap = AllocatePixmap (pScreen, 0);
- if (!pPixmap)
- return NullPixmap;
-
- pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
- pPixmap->drawable.pScreen = pScreen;
- pPixmap->drawable.depth = depth;
- pPixmap->drawable.bitsPerPixel = BitsPerPixel (depth);
- pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = width;
- pPixmap->drawable.height = height;
-
-#ifdef COMPOSITE
- pPixmap->screen_x = 0;
- pPixmap->screen_y = 0;
-#endif
-
- pPixmap->devKind = 0;
- pPixmap->refcnt = 1;
- pPixmap->devPrivate.ptr = 0;
-
- pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap);
-
- pPixmapPriv->format = pScreenPriv->pixmapFormats[depth].format;
- pPixmapPriv->pPixel = pScreenPriv->pixmapFormats[depth].pPixel;
- pPixmapPriv->pDamage = NULL;
-
- if (!xglPixmapSurfaceInit (pPixmap, pScreenPriv->features, width, height))
- return NullPixmap;
-
- pPixmapPriv->buffer = NULL;
- pPixmapPriv->bits = (pointer) 0;
- pPixmapPriv->stride = 0;
- pPixmapPriv->pGeometry = NULL;
-
- pPixmapPriv->allBits = TRUE;
- pPixmapPriv->bitBox.x1 = 0;
- pPixmapPriv->bitBox.y1 = 0;
- pPixmapPriv->bitBox.x2 = 32767;
- pPixmapPriv->bitBox.y2 = 32767;
- pPixmapPriv->damageBox = miEmptyBox;
-
- return pPixmap;
-}
-
-void
-xglFiniPixmap (PixmapPtr pPixmap)
-{
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (pPixmapPriv->pArea)
- xglWithdrawArea (pPixmapPriv->pArea);
-
- if (pPixmap->devPrivate.ptr)
- {
- if (pPixmapPriv->buffer)
- glitz_buffer_unmap (pPixmapPriv->buffer);
- }
-
- if (pPixmapPriv->pGeometry)
- GEOMETRY_UNINIT (pPixmapPriv->pGeometry);
-
- if (pPixmapPriv->buffer)
- glitz_buffer_destroy (pPixmapPriv->buffer);
-
- if (pPixmapPriv->bits)
- xfree (pPixmapPriv->bits);
-
- if (pPixmapPriv->surface)
- glitz_surface_destroy (pPixmapPriv->surface);
-}
-
-Bool
-xglDestroyPixmap (PixmapPtr pPixmap)
-{
- if (--pPixmap->refcnt)
- return TRUE;
-
- xglFiniPixmap (pPixmap);
-
- xfree (pPixmap);
-
- return TRUE;
-}
-
-Bool
-xglModifyPixmapHeader (PixmapPtr pPixmap,
- int width,
- int height,
- int depth,
- int bitsPerPixel,
- int devKind,
- pointer pPixData)
-{
- xglScreenPtr pScreenPriv;
- xglPixmapPtr pPixmapPriv;
- glitz_format_t *oldFormat;
- int oldWidth, oldHeight;
-
- if (!pPixmap)
- return FALSE;
-
- pScreenPriv = XGL_GET_SCREEN_PRIV (pPixmap->drawable.pScreen);
- pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap);
-
- oldFormat = pPixmapPriv->format;
- oldWidth = pPixmap->drawable.width;
- oldHeight = pPixmap->drawable.height;
-
- if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) &&
- (devKind > 0) && pPixData)
- {
- pPixmap->drawable.depth = depth;
- pPixmap->drawable.bitsPerPixel = bitsPerPixel;
- pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = width;
- pPixmap->drawable.height = height;
- pPixmapPriv->stride = devKind;
- pPixmap->refcnt = 1;
- }
- else
- {
- if (width > 0)
- pPixmap->drawable.width = width;
-
- if (height > 0)
- pPixmap->drawable.height = height;
-
- if (depth > 0)
- pPixmap->drawable.depth = depth;
-
- if (bitsPerPixel > 0)
- pPixmap->drawable.bitsPerPixel = bitsPerPixel;
- else if ((bitsPerPixel < 0) && (depth > 0))
- pPixmap->drawable.bitsPerPixel = BitsPerPixel (depth);
-
- if (devKind > 0)
- pPixmapPriv->stride = devKind;
- else if ((devKind < 0) && ((width > 0) || (depth > 0)))
- pPixmapPriv->stride = PixmapBytePad (pPixmap->drawable.width,
- pPixmap->drawable.depth);
- }
-
- depth = pPixmap->drawable.depth;
-
- pPixmapPriv->pPixel = pScreenPriv->pixmapFormats[depth].pPixel;
- pPixmapPriv->format = pScreenPriv->pixmapFormats[depth].format;
-
- if (pPixmapPriv->format != oldFormat ||
- pPixmap->drawable.width != oldWidth ||
- pPixmap->drawable.height != oldHeight)
- {
- if (pPixmapPriv->pArea)
- xglWithdrawArea (pPixmapPriv->pArea);
-
- if (pPixmapPriv->surface)
- glitz_surface_destroy (pPixmapPriv->surface);
-
- if (!xglPixmapSurfaceInit (pPixmap,
- pScreenPriv->features,
- pPixmap->drawable.width,
- pPixmap->drawable.height))
- return FALSE;
- }
-
- if (pPixData)
- {
- if (pPixmap->devPrivate.ptr)
- {
- if (pPixmapPriv->buffer)
- glitz_buffer_unmap (pPixmapPriv->buffer);
-
- pPixmap->devPrivate.ptr = 0;
- }
-
- if (pPixmapPriv->pGeometry)
- {
- GEOMETRY_UNINIT (pPixmapPriv->pGeometry);
- pPixmapPriv->pGeometry = NULL;
- }
-
- if (pPixmapPriv->buffer)
- glitz_buffer_destroy (pPixmapPriv->buffer);
-
- if (pPixmapPriv->bits)
- xfree (pPixmapPriv->bits);
-
- pPixmapPriv->bits = (pointer) 0;
- pPixmapPriv->buffer = glitz_buffer_create_for_data (pPixData);
- if (!pPixmapPriv->buffer)
- return FALSE;
-
- pPixmapPriv->allBits = TRUE;
- pPixmapPriv->bitBox.x1 = 0;
- pPixmapPriv->bitBox.y1 = 0;
- pPixmapPriv->bitBox.x2 = pPixmap->drawable.width;
- pPixmapPriv->bitBox.y2 = pPixmap->drawable.height;
-
- if (pPixmapPriv->pDamage)
- {
- RegionPtr pRegion;
-
- pRegion = DamageRegion (pPixmapPriv->pDamage);
-
- REGION_UNINIT (pPixmap->drawable.pScreen, pRegion);
- REGION_INIT (pPixmap->drawable.pScreen, pRegion,
- &pPixmapPriv->bitBox, 1);
- }
-
- /*
- * We probably don't want accelerated drawing to this pixmap.
- */
- pPixmapPriv->score = XGL_MIN_PIXMAP_SCORE;
- }
-
- /*
- * Maybe there's a nicer way to detect if this is the screen pixmap.
- */
- if (!pScreenPriv->pScreenPixmap)
- {
- glitz_surface_reference (pScreenPriv->surface);
-
- pPixmapPriv->surface = pScreenPriv->surface;
- pPixmapPriv->target = xglPixmapTargetIn;
-
- pScreenPriv->pScreenPixmap = pPixmap;
- }
-
- return TRUE;
-}
-
-RegionPtr
-xglPixmapToRegion (PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- RegionPtr pRegion;
-
- XGL_SCREEN_PRIV (pScreen);
-
- if (!xglSyncBits (&pPixmap->drawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_SCREEN_UNWRAP (BitmapToRegion);
- pRegion = (*pScreen->BitmapToRegion) (pPixmap);
- XGL_SCREEN_WRAP (BitmapToRegion, xglPixmapToRegion);
-
- return pRegion;
-}
-
-xglGeometryPtr
-xglPixmapToGeometry (PixmapPtr pPixmap,
- int xOff,
- int yOff)
-{
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (pPixmap->devPrivate.ptr)
- xglUnmapPixmapBits (pPixmap);
-
- if (!pPixmapPriv->pGeometry)
- {
- xglGeometryPtr pGeometry;
-
- if (!pPixmapPriv->buffer)
- {
- if (!xglAllocatePixmapBits (pPixmap,
- XGL_PIXMAP_USAGE_HINT_DEFAULT))
- return NULL;
- }
-
- pGeometry = xalloc (sizeof (xglGeometryRec));
- if (!pGeometry)
- return NULL;
-
- GEOMETRY_INIT (pPixmap->drawable.pScreen, pGeometry,
- GLITZ_GEOMETRY_TYPE_BITMAP,
- GEOMETRY_USAGE_DYNAMIC, 0);
-
- GEOMETRY_SET_BUFFER (pGeometry, pPixmapPriv->buffer);
-
- if (pPixmapPriv->stride < 0)
- {
- pGeometry->f.bitmap.bytes_per_line = -pPixmapPriv->stride;
- pGeometry->f.bitmap.scanline_order =
- GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
- }
- else
- {
- pGeometry->f.bitmap.bytes_per_line = pPixmapPriv->stride;
- pGeometry->f.bitmap.scanline_order =
- GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
- }
-
- pGeometry->f.bitmap.pad = ((1 + FB_MASK) >> FB_SHIFT) *
- sizeof (FbBits);
- pGeometry->width = pPixmap->drawable.width;
- pGeometry->count = pPixmap->drawable.height;
-
- pPixmapPriv->pGeometry = pGeometry;
- }
-
- pPixmapPriv->pGeometry->xOff = xOff << 16;
- pPixmapPriv->pGeometry->yOff = yOff << 16;
-
- return pPixmapPriv->pGeometry;
-}
-
-Bool
-xglCreatePixmapSurface (PixmapPtr pPixmap)
-{
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (!pPixmapPriv->format)
- return FALSE;
-
- if (!pPixmapPriv->surface)
- {
- XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
-
- pPixmapPriv->surface =
- glitz_surface_create (pScreenPriv->drawable,
- pPixmapPriv->format,
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- 0, NULL);
- if (!pPixmapPriv->surface)
- {
- pPixmapPriv->format = NULL;
- pPixmapPriv->target = xglPixmapTargetNo;
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-Bool
-xglAllocatePixmapBits (PixmapPtr pPixmap, int hint)
-{
- int width, height, bpp, stride;
-
- XGL_PIXMAP_PRIV (pPixmap);
- XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
-
- width = pPixmap->drawable.width;
- height = pPixmap->drawable.height;
- bpp = pPixmap->drawable.bitsPerPixel;
-
- stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
-
- if (stride)
- {
- glitz_buffer_t *buffer;
-
- if ((pScreenPriv->pboMask & bpp) && hint)
- {
- buffer = glitz_pixel_buffer_create (pScreenPriv->drawable,
- NULL, height * stride,
- XGL_PIXMAP_USAGE_HINT (hint));
- }
- else
- {
- pPixmapPriv->bits = xalloc (height * stride);
- if (!pPixmapPriv->bits)
- return FALSE;
-
- buffer = glitz_buffer_create_for_data (pPixmapPriv->bits);
- }
-
- if (!buffer)
- {
- if (pPixmapPriv->bits)
- xfree (pPixmapPriv->bits);
- pPixmapPriv->bits = NULL;
- return FALSE;
- }
- pPixmapPriv->buffer = buffer;
- }
-
- if (pScreenPriv->yInverted)
- pPixmapPriv->stride = stride;
- else
- pPixmapPriv->stride = -stride;
-
- return TRUE;
-}
-
-Bool
-xglMapPixmapBits (PixmapPtr pPixmap)
-{
- if (!pPixmap->devPrivate.ptr)
- {
- CARD8 *bits;
-
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (!pPixmapPriv->buffer)
- if (!xglAllocatePixmapBits (pPixmap,
- XGL_PIXMAP_USAGE_HINT_DEFAULT))
- return FALSE;
-
- bits = glitz_buffer_map (pPixmapPriv->buffer,
- GLITZ_BUFFER_ACCESS_READ_WRITE);
- if (!bits)
- return FALSE;
-
- pPixmap->devKind = pPixmapPriv->stride;
- if (pPixmapPriv->stride < 0)
- {
- pPixmap->devPrivate.ptr = bits +
- (pPixmap->drawable.height - 1) * -pPixmapPriv->stride;
- }
- else
- {
- pPixmap->devPrivate.ptr = bits;
- }
- }
-
- return TRUE;
-}
-
-Bool
-xglUnmapPixmapBits (PixmapPtr pPixmap)
-{
- XGL_PIXMAP_PRIV (pPixmap);
-
- pPixmap->devKind = 0;
- pPixmap->devPrivate.ptr = 0;
-
- if (pPixmapPriv->buffer)
- if (glitz_buffer_unmap (pPixmapPriv->buffer))
- return FALSE;
-
- return TRUE;
-}
diff --git a/hw/xgl/xglscreen.c b/hw/xgl/xglscreen.c
deleted file mode 100644
index 711f060cd..000000000
--- a/hw/xgl/xglscreen.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "inputstr.h"
-#include "mipointer.h"
-#include "damage.h"
-#include "fb.h"
-#ifdef MITSHM
-#include "shmint.h"
-static ShmFuncs shmFuncs = { NULL, xglShmPutImage };
-#endif
-#ifdef RENDER
-#include "glyphstr.h"
-#endif
-#ifdef COMPOSITE
-#include "compint.h"
-#endif
-
-int xglScreenGeneration = -1;
-int xglScreenPrivateIndex;
-int xglGCPrivateIndex;
-int xglPixmapPrivateIndex;
-int xglWinPrivateIndex;
-
-#ifdef RENDER
-int xglGlyphPrivateIndex;
-#endif
-
-#define xglQueryBestSize (void *) NoopDDA
-#define xglSaveScreen (void *) NoopDDA
-
-#define xglConstrainCursor (void *) NoopDDA
-#define xglCursorLimits (void *) NoopDDA
-#define xglDisplayCursor (void *) NoopDDA
-#define xglRealizeCursor (void *) NoopDDA
-#define xglUnrealizeCursor (void *) NoopDDA
-#define xglRecolorCursor (void *) NoopDDA
-#define xglSetCursorPosition (void *) NoopDDA
-
-static PixmapPtr
-xglGetWindowPixmap (WindowPtr pWin)
-{
- return XGL_GET_WINDOW_PIXMAP (pWin);
-}
-
-static void
-xglSetWindowPixmap (WindowPtr pWin,
- PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- XGL_SCREEN_PRIV (pScreen);
-
- XGL_SCREEN_UNWRAP (SetWindowPixmap);
- (*pScreen->SetWindowPixmap) (pWin, pPixmap);
- XGL_SCREEN_WRAP (SetWindowPixmap, xglSetWindowPixmap);
-
- XGL_GET_WINDOW_PRIV(pWin)->pPixmap = pPixmap;
-}
-
-static Bool
-xglAllocatePrivates (ScreenPtr pScreen)
-{
- xglScreenPtr pScreenPriv;
-
- if (xglScreenGeneration != serverGeneration)
- {
- xglScreenPrivateIndex = AllocateScreenPrivateIndex ();
- if (xglScreenPrivateIndex < 0)
- return FALSE;
-
- xglGCPrivateIndex = AllocateGCPrivateIndex ();
- if (xglGCPrivateIndex < 0)
- return FALSE;
-
- xglPixmapPrivateIndex = AllocatePixmapPrivateIndex ();
- if (xglPixmapPrivateIndex < 0)
- return FALSE;
-
- xglWinPrivateIndex = AllocateWindowPrivateIndex ();
- if (xglWinPrivateIndex < 0)
- return FALSE;
-
-#ifdef RENDER
- xglGlyphPrivateIndex = AllocateGlyphPrivateIndex ();
- if (xglGlyphPrivateIndex < 0)
- return FALSE;
-#endif
-
- xglScreenGeneration = serverGeneration;
- }
-
- if (!AllocateGCPrivate (pScreen, xglGCPrivateIndex, sizeof (xglGCRec)))
- return FALSE;
-
- if (!AllocatePixmapPrivate (pScreen, xglPixmapPrivateIndex,
- sizeof (xglPixmapRec)))
- return FALSE;
-
- if (!AllocateWindowPrivate (pScreen, xglWinPrivateIndex,
- sizeof (xglWinRec)))
- return FALSE;
-
- pScreenPriv = xalloc (sizeof (xglScreenRec));
- if (!pScreenPriv)
- return FALSE;
-
- XGL_SET_SCREEN_PRIV (pScreen, pScreenPriv);
-
- return TRUE;
-}
-
-Bool
-xglScreenInit (ScreenPtr pScreen,
- xglScreenInfoPtr pScreenInfo)
-{
- xglScreenPtr pScreenPriv;
- int depth, bpp;
-
-#ifdef RENDER
- PictureScreenPtr pPictureScreen;
-#endif
-
- if (!xglAllocatePrivates (pScreen))
- return FALSE;
-
- pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen);
-
- pScreenPriv->pScreenPixmap = NULL;
-
- pScreenPriv->pVisual = &xglVisuals[0];
- pScreenPriv->drawable = pScreenInfo->drawable;
- pScreenPriv->features =
- glitz_drawable_get_features (pScreenInfo->drawable);
-
- depth = pScreenPriv->pVisual->pPixel->depth;
- bpp = pScreenPriv->pVisual->pPixel->masks.bpp;
-
- if (!xglInitOffscreen (pScreen, pScreenInfo))
- return FALSE;
-
- xglInitPixmapFormats (pScreen);
- if (!pScreenPriv->pixmapFormats[depth].format)
- return FALSE;
-
- pScreenPriv->geometryDataType = pScreenInfo->geometryDataType;
- pScreenPriv->geometryUsage = pScreenInfo->geometryUsage;
- pScreenPriv->yInverted = pScreenInfo->yInverted;
- pScreenPriv->pboMask = pScreenInfo->pboMask;
- pScreenPriv->lines = pScreenInfo->lines;
-
- GEOMETRY_INIT (pScreen, &pScreenPriv->scratchGeometry,
- GLITZ_GEOMETRY_TYPE_VERTEX,
- pScreenPriv->geometryUsage, 0);
-
- pScreenPriv->surface =
- glitz_surface_create (pScreenPriv->drawable,
- pScreenPriv->pixmapFormats[depth].format,
- pScreenInfo->width, pScreenInfo->height,
- 0, NULL);
- if (!pScreenPriv->surface)
- return FALSE;
-
- glitz_surface_attach (pScreenPriv->surface,
- pScreenPriv->drawable,
- GLITZ_DRAWABLE_BUFFER_FRONT_COLOR,
- 0, 0);
-
- if (monitorResolution == 0)
- monitorResolution = XGL_DEFAULT_DPI;
-
- if (!fbSetupScreen (pScreen, NULL,
- pScreenInfo->width, pScreenInfo->height,
- monitorResolution, monitorResolution,
- pScreenInfo->width, bpp))
- return FALSE;
-
- pScreen->SaveScreen = xglSaveScreen;
-
- pScreen->CreatePixmap = xglCreatePixmap;
- pScreen->DestroyPixmap = xglDestroyPixmap;
-
- if (!fbFinishScreenInit (pScreen, NULL,
- pScreenInfo->width, pScreenInfo->height,
- monitorResolution, monitorResolution,
- pScreenInfo->width, bpp))
- return FALSE;
-
-#ifdef MITSHM
- ShmRegisterFuncs (pScreen, &shmFuncs);
-#endif
-
-#ifdef RENDER
- if (!xglPictureInit (pScreen))
- return FALSE;
-#endif
-
- XGL_SCREEN_WRAP (GetImage, xglGetImage);
- XGL_SCREEN_WRAP (GetSpans, xglGetSpans);
-
- XGL_SCREEN_WRAP (CopyWindow, xglCopyWindow);
- XGL_SCREEN_WRAP (CreateWindow, xglCreateWindow);
- XGL_SCREEN_WRAP (ChangeWindowAttributes, xglChangeWindowAttributes);
- XGL_SCREEN_WRAP (PaintWindowBackground, xglPaintWindowBackground);
- XGL_SCREEN_WRAP (PaintWindowBorder, xglPaintWindowBorder);
-
- XGL_SCREEN_WRAP (CreateGC, xglCreateGC);
-
- pScreen->ConstrainCursor = xglConstrainCursor;
- pScreen->CursorLimits = xglCursorLimits;
- pScreen->DisplayCursor = xglDisplayCursor;
- pScreen->RealizeCursor = xglRealizeCursor;
- pScreen->UnrealizeCursor = xglUnrealizeCursor;
- pScreen->RecolorCursor = xglRecolorCursor;
- pScreen->SetCursorPosition = xglSetCursorPosition;
-
- pScreen->ModifyPixmapHeader = xglModifyPixmapHeader;
-
- XGL_SCREEN_WRAP (BitmapToRegion, xglPixmapToRegion);
-
- pScreen->GetWindowPixmap = xglGetWindowPixmap;
-
- XGL_SCREEN_WRAP (SetWindowPixmap, xglSetWindowPixmap);
-
-#ifdef RENDER
- pPictureScreen = GetPictureScreenIfSet (pScreen);
- if (pPictureScreen)
- {
- if (!AllocateGlyphPrivate (pScreen, xglGlyphPrivateIndex,
- sizeof (xglGlyphRec)))
- return FALSE;
-
- XGL_PICTURE_SCREEN_WRAP (RealizeGlyph, xglRealizeGlyph);
- XGL_PICTURE_SCREEN_WRAP (UnrealizeGlyph, xglUnrealizeGlyph);
- XGL_PICTURE_SCREEN_WRAP (Composite, xglComposite);
- XGL_PICTURE_SCREEN_WRAP (Glyphs, xglGlyphs);
- XGL_PICTURE_SCREEN_WRAP (Trapezoids, xglTrapezoids);
- XGL_PICTURE_SCREEN_WRAP (AddTraps, xglAddTraps);
- XGL_PICTURE_SCREEN_WRAP (AddTriangles, xglAddTriangles);
- XGL_PICTURE_SCREEN_WRAP (ChangePicture, xglChangePicture);
- XGL_PICTURE_SCREEN_WRAP (ChangePictureTransform,
- xglChangePictureTransform);
- XGL_PICTURE_SCREEN_WRAP (ChangePictureFilter, xglChangePictureFilter);
- }
-#endif
-
- XGL_SCREEN_WRAP (BackingStoreFuncs.SaveAreas, xglSaveAreas);
- XGL_SCREEN_WRAP (BackingStoreFuncs.RestoreAreas, xglRestoreAreas);
-
- if (!fbCreateDefColormap (pScreen))
- return FALSE;
-
-#ifdef COMPOSITE
- if (!compScreenInit (pScreen))
- return FALSE;
-#endif
-
-#ifdef GLXEXT
- if (!xglInitVisualConfigs (pScreen))
- return FALSE;
-#endif
-
- /* Damage is required */
- DamageSetup (pScreen);
-
- XGL_SCREEN_WRAP (CloseScreen, xglCloseScreen);
-
- return TRUE;
-}
-
-Bool
-xglFinishScreenInit (ScreenPtr pScreen)
-{
-
-#ifdef RENDER
- glitz_vertex_format_t *format;
- static glitz_color_t clearBlack = { 0x0, 0x0, 0x0, 0x0 };
- static glitz_color_t solidWhite = { 0xffff, 0xffff, 0xffff, 0xffff };
- int i;
-#endif
-
- XGL_SCREEN_PRIV (pScreen);
-
- pScreenPriv->solid =
- glitz_surface_create (pScreenPriv->drawable,
- pScreenPriv->pixmapFormats[32].format,
- 1, 1, 0, NULL);
- if (!pScreenPriv->solid)
- return FALSE;
-
- glitz_surface_set_fill (pScreenPriv->solid, GLITZ_FILL_REPEAT);
-
-#ifdef RENDER
- for (i = 0; i < 33; i++)
- pScreenPriv->glyphCache[i].pScreen = NULL;
-
- pScreenPriv->pSolidAlpha = NULL;
-
- pScreenPriv->trapInfo.mask =
- glitz_surface_create (pScreenPriv->drawable,
- pScreenPriv->pixmapFormats[8].format,
- 2, 1, 0, NULL);
- if (!pScreenPriv->trapInfo.mask)
- return FALSE;
-
- glitz_set_rectangle (pScreenPriv->trapInfo.mask, &clearBlack, 0, 0, 1, 1);
- glitz_set_rectangle (pScreenPriv->trapInfo.mask, &solidWhite, 1, 0, 1, 1);
-
- glitz_surface_set_fill (pScreenPriv->trapInfo.mask, GLITZ_FILL_NEAREST);
- glitz_surface_set_filter (pScreenPriv->trapInfo.mask,
- GLITZ_FILTER_BILINEAR,
- NULL, 0);
-
- format = &pScreenPriv->trapInfo.format.vertex;
- format->primitive = GLITZ_PRIMITIVE_QUADS;
- format->attributes = GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK;
-
- format->mask.type = GLITZ_DATA_TYPE_FLOAT;
- format->mask.size = GLITZ_COORDINATE_SIZE_X;
- format->bytes_per_vertex = sizeof (glitz_float_t);
-
- if (pScreenPriv->geometryDataType)
- {
- format->type = GLITZ_DATA_TYPE_FLOAT;
- format->bytes_per_vertex += 2 * sizeof (glitz_float_t);
- format->mask.offset = 2 * sizeof (glitz_float_t);
- }
- else
- {
- format->type = GLITZ_DATA_TYPE_SHORT;
- format->bytes_per_vertex += 2 * sizeof (glitz_short_t);
- format->mask.offset = 2 * sizeof (glitz_short_t);
- }
-#endif
-
- return TRUE;
-}
-
-Bool
-xglCloseScreen (int index,
- ScreenPtr pScreen)
-{
- XGL_SCREEN_PRIV (pScreen);
- XGL_PIXMAP_PRIV (pScreenPriv->pScreenPixmap);
-
-#ifdef RENDER
- int i;
-
- for (i = 0; i < 33; i++)
- xglFiniGlyphCache (&pScreenPriv->glyphCache[i]);
-
- if (pScreenPriv->pSolidAlpha)
- FreePicture ((pointer) pScreenPriv->pSolidAlpha, 0);
-
- if (pScreenPriv->trapInfo.mask)
- glitz_surface_destroy (pScreenPriv->trapInfo.mask);
-#endif
-
- xglFiniPixmap (pScreenPriv->pScreenPixmap);
- if (pPixmapPriv->pDamage)
- DamageDestroy (pPixmapPriv->pDamage);
-
- if (pScreenPriv->solid)
- glitz_surface_destroy (pScreenPriv->solid);
-
- if (pScreenPriv->surface)
- glitz_surface_destroy (pScreenPriv->surface);
-
- xglFiniOffscreen (pScreen);
-
- GEOMETRY_UNINIT (&pScreenPriv->scratchGeometry);
-
- XGL_SCREEN_UNWRAP (CloseScreen);
- xfree (pScreenPriv);
-
- return (*pScreen->CloseScreen) (index, pScreen);
-}
-
-#ifdef RENDER
-void
-xglCreateSolidAlphaPicture (ScreenPtr pScreen)
-{
- static xRenderColor solidWhite = { 0xffff, 0xffff, 0xffff, 0xffff };
- static xRectangle one = { 0, 0, 1, 1 };
- PixmapPtr pPixmap;
- PictFormatPtr pFormat;
- int error;
- Pixel pixel;
- GCPtr pGC;
- CARD32 tmpval[2];
-
- XGL_SCREEN_PRIV (pScreen);
-
- pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
- if (!pFormat)
- return;
-
- pGC = GetScratchGC (pFormat->depth, pScreen);
- if (!pGC)
- return;
-
- pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, pFormat->depth);
- if (!pPixmap)
- return;
-
- miRenderColorToPixel (pFormat, &solidWhite, &pixel);
-
- tmpval[0] = GXcopy;
- tmpval[1] = pixel;
-
- ChangeGC (pGC, GCFunction | GCForeground, tmpval);
- ValidateGC (&pPixmap->drawable, pGC);
- (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one);
- FreeScratchGC (pGC);
-
- tmpval[0] = xTrue;
- pScreenPriv->pSolidAlpha =
- CreatePicture (0, &pPixmap->drawable, pFormat,
- CPRepeat, tmpval, 0, &error);
- (*pScreen->DestroyPixmap) (pPixmap);
-
- if (pScreenPriv->pSolidAlpha)
- ValidatePicture (pScreenPriv->pSolidAlpha);
-}
-#endif
diff --git a/hw/xgl/xglshm.c b/hw/xgl/xglshm.c
deleted file mode 100644
index 3ac0c9453..000000000
--- a/hw/xgl/xglshm.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "gcstruct.h"
-
-#ifdef MITSHM
-
-void
-xglShmPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- unsigned int format,
- int w,
- int h,
- int sx,
- int sy,
- int sw,
- int sh,
- int dx,
- int dy,
- char *data)
-{
- ScreenPtr pScreen = pDrawable->pScreen;
- PixmapPtr pPixmapHeader = NULL;
- PixmapPtr pPixmap;
- int saveTarget;
-
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if ((format == ZPixmap) || (depth == 1))
- {
- pPixmap = pPixmapHeader =
- GetScratchPixmapHeader (pScreen, w, h, depth,
- BitsPerPixel (depth),
- PixmapBytePad (w, depth),
- (pointer) data);
- if (pPixmap)
- XGL_GET_PIXMAP_PRIV (pPixmap)->format = NULL;
- }
- else
- {
- pPixmap = (*pScreen->CreatePixmap) (pScreen, sw, sh, depth);
- if (pPixmap)
- {
- GCPtr pScratchGC;
-
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (!xglAllocatePixmapBits (pPixmap,
- XGL_PIXMAP_USAGE_HINT_DEFAULT))
- {
- (*pScreen->DestroyPixmap) (pPixmap);
- return;
- }
- pPixmapPriv->format = NULL;
- pPixmapPriv->target = xglPixmapTargetNo;
-
- pScratchGC = GetScratchGC (depth, pScreen);
- if (!pScratchGC)
- {
- (*pScreen->DestroyPixmap) (pPixmap);
- return;
- }
-
- ValidateGC ((DrawablePtr) pPixmap, pScratchGC);
- (*pGC->ops->PutImage) ((DrawablePtr) pPixmap, pScratchGC, depth,
- -sx, -sy, w, h, 0,
- (format == XYPixmap) ? XYPixmap : ZPixmap,
- data);
-
- FreeScratchGC (pScratchGC);
-
- sx = sy = 0;
- }
- }
-
- if (!pPixmap)
- return;
-
- /* CopyArea should always be done in software */
- saveTarget = pPixmapPriv->target;
- pPixmapPriv->target = xglPixmapTargetNo;
-
- if (format == XYBitmap)
- (*pGC->ops->CopyPlane) ((DrawablePtr) pPixmap, pDrawable, pGC,
- sx, sy, sw, sh, dx, dy, 1L);
- else
- (*pGC->ops->CopyArea) ((DrawablePtr) pPixmap, pDrawable, pGC,
- sx, sy, sw, sh, dx, dy);
-
- pPixmapPriv->target = saveTarget;
-
- if (pPixmapHeader)
- FreeScratchPixmapHeader (pPixmapHeader);
- else
- (*pScreen->DestroyPixmap) (pPixmap);
-}
-
-#endif
diff --git a/hw/xgl/xglsolid.c b/hw/xgl/xglsolid.c
deleted file mode 100644
index 789c9dd12..000000000
--- a/hw/xgl/xglsolid.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "gcstruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-
-Bool
-xglSolid (DrawablePtr pDrawable,
- glitz_operator_t op,
- glitz_color_t *color,
- xglGeometryPtr pGeometry,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox)
-{
- glitz_surface_t *surface;
- int xOff, yOff;
-
- XGL_SCREEN_PRIV (pDrawable->pScreen);
-
- if (nBox < 1)
- return TRUE;
-
- if (!xglPrepareTarget (pDrawable))
- return FALSE;
-
- XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
- glitz_set_rectangle (pScreenPriv->solid, color, 0, 0, 1, 1);
-
- if (pGeometry)
- {
- glitz_surface_set_clip_region (surface, xOff, yOff,
- (glitz_box_t *) pBox, nBox);
- }
- else
- {
- pGeometry = xglGetScratchVertexGeometry (pDrawable->pScreen, 4 * nBox);
- GEOMETRY_ADD_BOX (pDrawable->pScreen, pGeometry, pBox, nBox);
- }
-
- GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
-
- if (!GEOMETRY_ENABLE (pGeometry, surface))
- return FALSE;
-
- glitz_composite (op,
- pScreenPriv->solid, NULL, surface,
- 0, 0,
- 0, 0,
- x + xOff,
- y + yOff,
- width, height);
-
- glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
-
- if (glitz_surface_get_status (surface))
- return FALSE;
-
- return TRUE;
-}
-
-Bool
-xglSolidGlyph (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nGlyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- xglGeometryRec geometry;
- int xBack, widthBack;
- int yBack, heightBack;
-
- XGL_GC_PRIV (pGC);
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- GEOMETRY_INIT (pDrawable->pScreen, &geometry,
- GLITZ_GEOMETRY_TYPE_BITMAP,
- GEOMETRY_USAGE_SYSMEM, 0);
-
- GEOMETRY_FOR_GLYPH (pDrawable->pScreen,
- &geometry,
- nGlyph,
- ppci,
- pglyphBase);
-
- GEOMETRY_TRANSLATE (&geometry, x, y);
-
- widthBack = 0;
- while (nGlyph--)
- widthBack += (*ppci++)->metrics.characterWidth;
-
- xBack = x;
- if (widthBack < 0)
- {
- xBack += widthBack;
- widthBack = -widthBack;
- }
- yBack = y - FONTASCENT (pGC->font);
- heightBack = FONTASCENT (pGC->font) + FONTDESCENT (pGC->font);
-
- if (xglSolid (pDrawable,
- pGCPriv->op,
- &pGCPriv->bg,
- NULL,
- xBack,
- yBack,
- widthBack,
- heightBack,
- REGION_RECTS (pGC->pCompositeClip),
- REGION_NUM_RECTS (pGC->pCompositeClip)))
- {
- if (xglSolid (pDrawable,
- pGCPriv->op,
- &pGCPriv->fg,
- &geometry,
- xBack,
- yBack,
- widthBack,
- heightBack,
- REGION_RECTS (pGC->pCompositeClip),
- REGION_NUM_RECTS (pGC->pCompositeClip)))
- {
- GEOMETRY_UNINIT (&geometry);
- return TRUE;
- }
- }
-
- GEOMETRY_UNINIT (&geometry);
- return FALSE;
-}
diff --git a/hw/xgl/xglsync.c b/hw/xgl/xglsync.c
deleted file mode 100644
index 8856352f6..000000000
--- a/hw/xgl/xglsync.c
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-/*
- * A pixmap may exist both in hardware and in software. Synchronization
- * is handled as follows:
- *
- * Regions modified by software and hardware needs to be tracked.
- * A software operation requires that a rectangle of pixels matching the
- * extents of the operation is synchronized. A hardware operation
- * requires that all pixels are synchronized. If the bounds of a
- * hardware operation intersects the bounds of a currently synchronized
- * software rectangle, the software rectangle will be discarded and the
- * next software operation will require re-synchronization.
- *
- * A software rectangle of pixels is synchronized as follows. If a
- * previously synchronized rectangle exists, then if this previous
- * rectangle subsumes our new rectangle no pixels are fetched from
- * hardware as all pixels that need to be synchronized are already up to
- * date. If a previously synchronized rectangle exists and it intersects
- * with our new rectangle, then both these rectangles are merged into a
- * larger rectangle and pixels not part of the previous rectangle are
- * fetched form hardware. If a previously synchronized rectangle exists
- * and it doesn't intersect with our new rectangle, then the previous
- * rectangle is discarded and pixels are fetched from hardware so that
- * our new rectangle becomes synchronized.
- *
- * If the pixmap exists in hardware and if it can be a target of a
- * drawing operation, then it is kept synchronized all the time, any
- * pixels modified by software will be transfered to hardware right
- * away. If the pixmap exists in hardware but it can only be used as
- * source of a drawing operation, then synchronization is performed
- * only when needed.
- */
-
-#define ALL_BITS(pPixmap, pBox) \
- ((pBox)->x1 <= 0 && (pBox)->y1 <= 0 && \
- (pBox)->x2 >= (pPixmap)->drawable.width && \
- (pBox)->y2 >= (pPixmap)->drawable.height)
-
-Bool
-xglSyncBits (DrawablePtr pDrawable,
- BoxPtr pExtents)
-{
- RegionRec region;
- BoxPtr pBitBox;
- BoxRec box;
-
- XGL_DRAWABLE_PIXMAP (pDrawable);
- XGL_PIXMAP_PRIV (pPixmap);
-
- XGL_DECREMENT_PIXMAP_SCORE (pPixmapPriv, 20);
-
- if (pPixmapPriv->allBits)
- return xglMapPixmapBits (pPixmap);
-
- pBitBox = &pPixmapPriv->bitBox;
-
- if (pPixmapPriv->target == xglPixmapTargetIn && pExtents)
- {
- box.x1 = MAX (0, pExtents->x1);
- box.y1 = MAX (0, pExtents->y1);
- box.x2 = MAX (0, MIN (pPixmap->drawable.width, pExtents->x2));
- box.y2 = MAX (0, MIN (pPixmap->drawable.height, pExtents->y2));
-
- if (!BOX_NOTEMPTY (&box))
- return xglMapPixmapBits (pPixmap);
-
- if (BOX_NOTEMPTY (pBitBox))
- {
- RegionRec bitRegion;
-
- REGION_INIT (pDrawable->pScreen, &bitRegion, pBitBox, 1);
-
- switch (RECT_IN_REGION (pDrawable->pScreen, &bitRegion, &box)) {
- case rgnIN:
- REGION_INIT (pDrawable->pScreen, &region, NullBox, 0);
- break;
- case rgnOUT:
- REGION_INIT (pDrawable->pScreen, &region, &box, 1);
- *pBitBox = box;
- pPixmapPriv->allBits = ALL_BITS (pPixmap, pBitBox);
- break;
- case rgnPART:
- pBitBox->x1 = MIN (pBitBox->x1, box.x1);
- pBitBox->y1 = MIN (pBitBox->y1, box.y1);
- pBitBox->x2 = MAX (pBitBox->x2, box.x2);
- pBitBox->y2 = MAX (pBitBox->y2, box.y2);
- pPixmapPriv->allBits = ALL_BITS (pPixmap, pBitBox);
-
- REGION_INIT (pDrawable->pScreen, &region, pBitBox, 1);
- REGION_SUBTRACT (pDrawable->pScreen, &region, &region,
- &bitRegion);
-
- break;
- }
- REGION_UNINIT (pDrawable->pScreen, &bitRegion);
- }
- else
- {
- REGION_INIT (pDrawable->pScreen, &region, &box, 1);
- *pBitBox = box;
- pPixmapPriv->allBits = ALL_BITS (pPixmap, pBitBox);
- }
- }
- else
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pPixmap->drawable.width;
- box.y2 = pPixmap->drawable.height;
-
- REGION_INIT (pDrawable->pScreen, &region, &box, 1);
-
- if (BOX_NOTEMPTY (pBitBox))
- {
- RegionRec bitRegion;
-
- REGION_INIT (pDrawable->pScreen, &bitRegion, pBitBox, 1);
- REGION_SUBTRACT (pDrawable->pScreen, &region, &region, &bitRegion);
- REGION_UNINIT (pDrawable->pScreen, &bitRegion);
- }
-
- *pBitBox = box;
- pPixmapPriv->allBits = TRUE;
- }
-
- if (!pPixmapPriv->buffer)
- if (!xglAllocatePixmapBits (pPixmap, XGL_PIXMAP_USAGE_HINT_DEFAULT))
- return FALSE;
-
- if (pPixmapPriv->pDamage)
- {
- RegionPtr pRegion;
-
- pRegion = DamageRegion (pPixmapPriv->pDamage);
- REGION_SUBTRACT (pDrawable->pScreen, &region, &region, pRegion);
- }
-
- if (REGION_NOTEMPTY (pDrawable->pScreen, &region) && pPixmapPriv->surface)
- {
- glitz_pixel_format_t format;
- BoxPtr pBox;
- int nBox;
-
- if (!xglSyncSurface (pDrawable))
- FatalError (XGL_SW_FAILURE_STRING);
-
- xglUnmapPixmapBits (pPixmap);
-
- pBox = REGION_RECTS (&region);
- nBox = REGION_NUM_RECTS (&region);
-
- format.masks = pPixmapPriv->pPixel->masks;
-
- while (nBox--)
- {
- format.xoffset = pBox->x1;
-
- if (pPixmapPriv->stride < 0)
- {
- format.skip_lines = pPixmap->drawable.height - pBox->y2;
- format.bytes_per_line = -pPixmapPriv->stride;
- format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
- }
- else
- {
- format.skip_lines = pBox->y1;
- format.bytes_per_line = pPixmapPriv->stride;
- format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
- }
-
- glitz_get_pixels (pPixmapPriv->surface,
- pBox->x1,
- pBox->y1,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1,
- &format,
- pPixmapPriv->buffer);
-
- pBox++;
- }
- }
-
- REGION_UNINIT (pDrawable->pScreen, &region);
-
- return xglMapPixmapBits (pPixmap);
-}
-
-void
-xglSyncDamageBoxBits (DrawablePtr pDrawable)
-{
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if (!xglSyncBits (pDrawable, &pPixmapPriv->damageBox))
- FatalError (XGL_SW_FAILURE_STRING);
-}
-
-Bool
-xglSyncSurface (DrawablePtr pDrawable)
-{
- RegionPtr pRegion;
-
- XGL_DRAWABLE_PIXMAP (pDrawable);
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (!pPixmapPriv->surface)
- {
- if (!pPixmapPriv->format)
- return FALSE;
-
- if (!xglCreatePixmapSurface (pPixmap))
- return FALSE;
- }
-
- pRegion = DamageRegion (pPixmapPriv->pDamage);
-
- if (REGION_NOTEMPTY (pDrawable->pScreen, pRegion))
- {
- glitz_pixel_format_t format;
- BoxPtr pBox;
- BoxPtr pExt;
- int nBox;
-
- xglUnmapPixmapBits (pPixmap);
-
- nBox = REGION_NUM_RECTS (pRegion);
- pBox = REGION_RECTS (pRegion);
- pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion);
-
- format.masks = pPixmapPriv->pPixel->masks;
- format.xoffset = pExt->x1;
-
- if (pPixmapPriv->stride < 0)
- {
- format.skip_lines = pPixmap->drawable.height - pExt->y2;
- format.bytes_per_line = -pPixmapPriv->stride;
- format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
- }
- else
- {
- format.skip_lines = pExt->y1;
- format.bytes_per_line = pPixmapPriv->stride;
- format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
- }
-
- glitz_surface_set_clip_region (pPixmapPriv->surface,
- 0, 0, (glitz_box_t *) pBox, nBox);
-
- glitz_set_pixels (pPixmapPriv->surface,
- pExt->x1,
- pExt->y1,
- pExt->x2 - pExt->x1,
- pExt->y2 - pExt->y1,
- &format,
- pPixmapPriv->buffer);
-
- glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0);
-
- REGION_EMPTY (pDrawable->pScreen, pRegion);
- }
-
- return TRUE;
-}
-
-Bool
-xglPrepareTarget (DrawablePtr pDrawable)
-{
- XGL_DRAWABLE_PIXMAP (pDrawable);
- XGL_PIXMAP_PRIV (pPixmap);
-
- switch (pPixmapPriv->target) {
- case xglPixmapTargetNo:
- break;
- case xglPixmapTargetIn:
- XGL_INCREMENT_PIXMAP_SCORE (pPixmapPriv, 10);
-
- if (xglSyncSurface (pDrawable))
- return TRUE;
- break;
- case xglPixmapTargetOut:
- XGL_INCREMENT_PIXMAP_SCORE (pPixmapPriv, 10);
-
- if (pPixmapPriv->lock)
- return FALSE;
-
- if (xglFindOffscreenArea (pDrawable->pScreen, pPixmap))
- return TRUE;
- break;
- }
-
- return FALSE;
-}
-
-void
-xglAddSurfaceDamage (DrawablePtr pDrawable,
- RegionPtr pRegion)
-{
- RegionPtr pDamageRegion;
- glitz_surface_t *surface;
- int xOff, yOff;
-
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- pPixmapPriv->damageBox = miEmptyBox;
- if (!pPixmapPriv->format)
- return;
-
- XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
- if (xOff || yOff)
- REGION_TRANSLATE (pDrawable->pScreen, pRegion, xOff, yOff);
-
- pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
-
- REGION_UNION (pDrawable->pScreen, pDamageRegion, pDamageRegion, pRegion);
-
- if (xOff || yOff)
- REGION_TRANSLATE (pDrawable->pScreen, pRegion, -xOff, -yOff);
-}
-
-void
-xglAddCurrentSurfaceDamage (DrawablePtr pDrawable)
-{
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if (!pPixmapPriv->format)
- {
- pPixmapPriv->damageBox = miEmptyBox;
- return;
- }
-
- if (BOX_NOTEMPTY (&pPixmapPriv->damageBox))
- {
- RegionPtr pDamageRegion;
- RegionRec region;
-
- pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
-
- REGION_INIT (pDrawable->pScreen, &region, &pPixmapPriv->damageBox, 1);
- REGION_UNION (pDrawable->pScreen,
- pDamageRegion, pDamageRegion, &region);
- REGION_UNINIT (pDrawable->pScreen, &region);
-
- pPixmapPriv->damageBox = miEmptyBox;
- }
-}
-
-void
-xglAddCurrentBitDamage (DrawablePtr pDrawable)
-{
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if (pPixmapPriv->target == xglPixmapTargetIn &&
- pPixmapPriv->damageBox.x1 < pPixmapPriv->bitBox.x2 &&
- pPixmapPriv->damageBox.y1 < pPixmapPriv->bitBox.y2 &&
- pPixmapPriv->damageBox.x2 > pPixmapPriv->bitBox.x1 &&
- pPixmapPriv->damageBox.y2 > pPixmapPriv->bitBox.y1)
- {
- pPixmapPriv->bitBox = miEmptyBox;
- pPixmapPriv->allBits = FALSE;
- }
-
- pPixmapPriv->damageBox = miEmptyBox;
-}
diff --git a/hw/xgl/xgltile.c b/hw/xgl/xgltile.c
deleted file mode 100644
index d2a440f92..000000000
--- a/hw/xgl/xgltile.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-
-static glitz_geometry_format_t tileGeometryFormat = {
- {
- GLITZ_PRIMITIVE_QUADS,
- GLITZ_DATA_TYPE_FLOAT,
- sizeof (glitz_float_t) * 4,
- GLITZ_VERTEX_ATTRIBUTE_SRC_COORD_MASK, {
- GLITZ_DATA_TYPE_FLOAT,
- GLITZ_COORDINATE_SIZE_XY,
- sizeof (glitz_float_t) * 2,
- }, {
- 0, 0, 0
- }
- }
-};
-
-xglGeometryPtr
-xglTiledBoxGeometry (PixmapPtr pTile,
- int tileX,
- int tileY,
- BoxPtr pBox,
- int nBox)
-{
- ScreenPtr pScreen = pTile->drawable.pScreen;
- glitz_point_fixed_t p1, p2;
- xglGeometryPtr pGeometry;
- glitz_float_t x1, x2, y1, y2;
- int x, y, width, height, i;
- int xTile, yTile;
- int widthTile, heightTile;
- int widthTmp, xTmp, yTmp, xTileTmp;
- int tileWidth, tileHeight;
- int size = 0;
- glitz_float_t *data;
-
- XGL_PIXMAP_PRIV (pTile);
-
- tileWidth = pTile->drawable.width;
- tileHeight = pTile->drawable.height;
-
- for (i = 0; i < nBox; i++)
- size +=
- (((pBox[i].x2 - pBox[i].x1) / tileWidth) + 2) *
- (((pBox[i].y2 - pBox[i].y1) / tileHeight) + 2);
-
- pGeometry = xglGetScratchVertexGeometryWithType (pScreen,
- GEOMETRY_DATA_TYPE_FLOAT,
- 8 * size);
-
- data = glitz_buffer_map (pGeometry->buffer,
- GLITZ_BUFFER_ACCESS_WRITE_ONLY);
-
- while (nBox--)
- {
- x = pBox->x1;
- y = pBox->y1;
- width = pBox->x2 - pBox->x1;
- height = pBox->y2 - pBox->y1;
-
- xTile = MOD (tileX + x, tileWidth);
- yTile = MOD (tileY + y, tileHeight);
-
- yTmp = y;
-
- while (height)
- {
- heightTile = MIN (tileHeight - yTile, height);
-
- xTileTmp = xTile;
- widthTmp = width;
- xTmp = x;
-
- while (widthTmp)
- {
- widthTile = MIN (tileWidth - xTileTmp, widthTmp);
-
- p1.x = xTileTmp << 16;
- p1.y = yTile << 16;
- p2.x = (xTileTmp + widthTile) << 16;
- p2.y = (yTile + heightTile) << 16;
-
- glitz_surface_translate_point (pPixmapPriv->surface, &p1, &p1);
- glitz_surface_translate_point (pPixmapPriv->surface, &p2, &p2);
-
- x1 = FIXED_TO_FLOAT (p1.x);
- y1 = FIXED_TO_FLOAT (p1.y);
- x2 = FIXED_TO_FLOAT (p2.x);
- y2 = FIXED_TO_FLOAT (p2.y);
-
- *data++ = (glitz_float_t) xTmp;
- *data++ = (glitz_float_t) yTmp;
- *data++ = x1;
- *data++ = y1;
-
- *data++ = (glitz_float_t) (xTmp + widthTile);
- *data++ = (glitz_float_t) yTmp;
- *data++ = x2;
- *data++ = y1;
-
- *data++ = (glitz_float_t) (xTmp + widthTile);
- *data++ = (glitz_float_t) (yTmp + heightTile);
- *data++ = x2;
- *data++ = y2;
-
- *data++ = (glitz_float_t) xTmp;
- *data++ = (glitz_float_t) (yTmp + heightTile);
- *data++ = x1;
- *data++ = y2;
-
- pGeometry->endOffset += sizeof (glitz_float_t) * 16;
-
- xTileTmp = 0;
- xTmp += widthTile;
- widthTmp -= widthTile;
- }
-
- yTile = 0;
- yTmp += heightTile;
- height -= heightTile;
- }
-
- pBox++;
- }
-
- if (glitz_buffer_unmap (pGeometry->buffer))
- return NULL;
-
- pGeometry->f = tileGeometryFormat;
- pGeometry->count =
- pGeometry->endOffset / tileGeometryFormat.vertex.bytes_per_vertex;
-
- pPixmapPriv->pictureMask |= xglPCFillMask;
- glitz_surface_set_fill (pPixmapPriv->surface, GLITZ_FILL_TRANSPARENT);
-
- return pGeometry;
-}
-
-Bool
-xglTile (DrawablePtr pDrawable,
- glitz_operator_t op,
- PixmapPtr pTile,
- int tileX,
- int tileY,
- xglGeometryPtr pGeometry,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox)
-{
- xglPixmapPtr pTilePriv;
- glitz_surface_t *surface;
- int xOff, yOff;
-
- if (nBox < 1)
- return TRUE;
-
- if (!xglPrepareTarget (pDrawable))
- return FALSE;
-
- if (!xglSyncSurface (&pTile->drawable))
- return FALSE;
-
- XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
- pTilePriv = XGL_GET_PIXMAP_PRIV (pTile);
-
- pTilePriv->pictureMask |= xglPCFilterMask | xglPCTransformMask;
- glitz_surface_set_filter (pTilePriv->surface,
- GLITZ_FILTER_NEAREST,
- NULL, 0);
- glitz_surface_set_transform (pTilePriv->surface, NULL);
-
- if (pTilePriv->acceleratedTile)
- {
- if (pGeometry)
- {
- glitz_surface_set_clip_region (surface, xOff, yOff,
- (glitz_box_t *) pBox, nBox);
- nBox = 0;
- }
- else
- {
- pGeometry = xglGetScratchVertexGeometry (pDrawable->pScreen,
- 4 * nBox);
- GEOMETRY_ADD_BOX (pDrawable->pScreen, pGeometry, pBox, nBox);
- }
-
- GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
-
- if (!GEOMETRY_ENABLE (pGeometry, surface))
- return FALSE;
-
- pTilePriv->pictureMask |= xglPCFillMask;
- glitz_surface_set_fill (pTilePriv->surface, GLITZ_FILL_REPEAT);
-
- glitz_composite (op,
- pTilePriv->surface, NULL, surface,
- x + tileX,
- y + tileY,
- 0, 0,
- x + xOff,
- y + yOff,
- width, height);
-
- glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
-
- if (!glitz_surface_get_status (surface))
- return TRUE;
-
- if (!nBox)
- return FALSE;
- }
- else
- {
- if (pGeometry)
- return FALSE;
- }
-
- pGeometry = xglTiledBoxGeometry (pTile, tileX, tileY, pBox, nBox);
- if (!pGeometry)
- return FALSE;
-
- GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
-
- if (!GEOMETRY_ENABLE (pGeometry, surface))
- return FALSE;
-
- glitz_composite (op,
- pTilePriv->surface, NULL, surface,
- 0, 0,
- 0, 0,
- x + xOff,
- y + yOff,
- width, height);
-
- if (glitz_surface_get_status (surface))
- return FALSE;
-
- return TRUE;
-}
diff --git a/hw/xgl/xgltrap.c b/hw/xgl/xgltrap.c
deleted file mode 100644
index fa5af8260..000000000
--- a/hw/xgl/xgltrap.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "gcstruct.h"
-#include "damage.h"
-
-#ifdef RENDER
-
-#define XGL_TRAP_FALLBACK_PROLOGUE(pPicture, func) \
- xglSyncDamageBoxBits (pPicture->pDrawable); \
- XGL_PICTURE_SCREEN_UNWRAP (func)
-
-#define XGL_TRAP_FALLBACK_EPILOGUE(pPicture, func, xglfunc) \
- XGL_PICTURE_SCREEN_WRAP (func, xglfunc); \
- xglAddCurrentSurfaceDamage (pPicture->pDrawable)
-
-/* just a guess */
-#define SMOOTH_TRAPS_ESTIMATE_RECTS(nTrap) (30 * nTrap)
-
-#define LINE_FIXED_X(l, _y, v) \
- dx = (l)->p2.x - (l)->p1.x; \
- ex = (xFixed_32_32) ((_y) - (l)->p1.y) * dx; \
- dy = (l)->p2.y - (l)->p1.y; \
- (v) = (l)->p1.x + (xFixed) (ex / dy)
-
-#define LINE_FIXED_X_CEIL(l, _y, v) \
- dx = (l)->p2.x - (l)->p1.x; \
- ex = (xFixed_32_32) ((_y) - (l)->p1.y) * dx; \
- dy = (l)->p2.y - (l)->p1.y; \
- (v) = (l)->p1.x + (xFixed) ((ex + (dy - 1)) / dy)
-
-static Bool
-xglTrapezoidExtents (PicturePtr pDst,
- int ntrap,
- xTrapezoid *traps,
- BoxPtr extents)
-{
- Bool x_overlap, overlap = FALSE;
- xFixed dx, dy, top, bottom;
- xFixed_32_32 ex;
-
- if (!ntrap)
- {
- extents->x1 = MAXSHORT;
- extents->x2 = MINSHORT;
- extents->y1 = MAXSHORT;
- extents->y2 = MINSHORT;
-
- return FALSE;
- }
-
- extents->y1 = xFixedToInt (traps->top);
- extents->y2 = xFixedToInt (xFixedCeil (traps->bottom));
-
- LINE_FIXED_X (&traps->left, traps->top, top);
- LINE_FIXED_X (&traps->left, traps->bottom, bottom);
- extents->x1 = xFixedToInt (MIN (top, bottom));
-
- LINE_FIXED_X_CEIL (&traps->right, traps->top, top);
- LINE_FIXED_X_CEIL (&traps->right, traps->bottom, bottom);
- extents->x2 = xFixedToInt (xFixedCeil (MAX (top, bottom)));
-
- ntrap--;
- traps++;
-
- for (; ntrap; ntrap--, traps++)
- {
- INT16 x1, y1, x2, y2;
-
- if (!xTrapezoidValid (traps))
- continue;
-
- y1 = xFixedToInt (traps->top);
- y2 = xFixedToInt (xFixedCeil (traps->bottom));
-
- LINE_FIXED_X (&traps->left, traps->top, top);
- LINE_FIXED_X (&traps->left, traps->bottom, bottom);
- x1 = xFixedToInt (MIN (top, bottom));
-
- LINE_FIXED_X_CEIL (&traps->right, traps->top, top);
- LINE_FIXED_X_CEIL (&traps->right, traps->bottom, bottom);
- x2 = xFixedToInt (xFixedCeil (MAX (top, bottom)));
-
- x_overlap = FALSE;
- if (x1 >= extents->x2)
- extents->x2 = x2;
- else if (x2 <= extents->x1)
- extents->x1 = x1;
- else
- {
- x_overlap = TRUE;
- if (x1 < extents->x1)
- extents->x1 = x1;
- if (x2 > extents->x2)
- extents->x2 = x2;
- }
-
- if (y1 >= extents->y2)
- extents->y2 = y2;
- else if (y2 <= extents->y1)
- extents->y1 = y1;
- else
- {
- if (y1 < extents->y1)
- extents->y1 = y1;
- if (y2 > extents->y2)
- extents->y2 = y2;
-
- if (x_overlap)
- overlap = TRUE;
- }
- }
-
- xglPictureClipExtents (pDst, extents);
-
- return overlap;
-}
-
-void
-xglTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nTrap,
- xTrapezoid *traps)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PicturePtr pMask = NULL, pSrcPicture, pDstPicture;
- xglGeometryPtr pGeometry = NULL;
- glitz_surface_t *mask = NULL;
- unsigned int polyEdge = pDst->polyEdge;
- INT16 xDst, yDst;
- INT16 xOff, yOff;
- BoxRec extents;
- Bool overlap;
- Bool target;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
-
- xDst = traps[0].left.p1.x >> 16;
- yDst = traps[0].left.p1.y >> 16;
-
- overlap = xglTrapezoidExtents (pDst, nTrap, traps, &extents);
- if (extents.y1 >= extents.y2 || extents.x1 >= extents.x2)
- return;
-
- target = xglPrepareTarget (pDst->pDrawable);
-
- if (nTrap > 1 && op != PictOpAdd && maskFormat &&
- (overlap || op != PictOpOver))
- {
- PixmapPtr pPixmap;
- GCPtr pGC;
- xRectangle rect;
- int error;
- int area;
-
- if (!pScreenPriv->pSolidAlpha)
- {
- xglCreateSolidAlphaPicture (pScreen);
- if (!pScreenPriv->pSolidAlpha)
- return;
- }
-
- rect.x = 0;
- rect.y = 0;
- rect.width = extents.x2 - extents.x1;
- rect.height = extents.y2 - extents.y1;
-
- pPixmap = (*pScreen->CreatePixmap) (pScreen,
- rect.width, rect.height,
- maskFormat->depth);
- if (!pPixmap)
- return;
-
- pMask = CreatePicture (0, &pPixmap->drawable, maskFormat,
- 0, 0, serverClient, &error);
- if (!pMask)
- {
- (*pScreen->DestroyPixmap) (pPixmap);
- return;
- }
-
- /* make sure destination drawable is locked */
- pPixmapPriv->lock++;
-
- /* lock mask if we are not doing accelerated drawing to destination */
- area = rect.width * rect.height;
- if (!target || (SMOOTH_TRAPS_ESTIMATE_RECTS (nTrap) * 4) > area)
- XGL_GET_PIXMAP_PRIV (pPixmap)->lock = 1;
-
- ValidatePicture (pMask);
- pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
- ValidateGC (&pPixmap->drawable, pGC);
- (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect);
- FreeScratchGC (pGC);
-
- (*pScreen->DestroyPixmap) (pPixmap);
-
- target = xglPrepareTarget (pMask->pDrawable);
-
- xOff = -extents.x1;
- yOff = -extents.y1;
- pSrcPicture = pScreenPriv->pSolidAlpha;
- pDstPicture = pMask;
- }
- else
- {
- /* make sure destination drawable is locked */
- pPixmapPriv->lock++;
-
- if (maskFormat)
- {
- if (maskFormat->depth == 1)
- polyEdge = PolyEdgeSharp;
- else
- polyEdge = PolyEdgeSmooth;
- }
-
- xOff = 0;
- yOff = 0;
- pSrcPicture = pSrc;
- pDstPicture = pDst;
- }
-
- if (target)
- {
- if (maskFormat || polyEdge == PolyEdgeSmooth)
- {
- glitz_vertex_format_t *format;
- xTrapezoid *pTrap = traps;
- int nAddedTrap, n = nTrap;
- int offset = 0;
- int size = SMOOTH_TRAPS_ESTIMATE_RECTS (n);
-
- mask = pScreenPriv->trapInfo.mask;
- format = &pScreenPriv->trapInfo.format.vertex;
-
- size *= format->bytes_per_vertex;
- pGeometry = xglGetScratchGeometryWithSize (pScreen, size);
-
- while (n)
- {
- if (pGeometry->size < size)
- GEOMETRY_RESIZE (pScreen, pGeometry, size);
-
- if (!pGeometry->buffer)
- {
- if (pMask)
- FreePicture (pMask, 0);
-
- pPixmapPriv->lock--;
- return;
- }
-
- offset +=
- glitz_add_trapezoids (pGeometry->buffer,
- offset, size - offset, format->type,
- mask, (glitz_trapezoid_t *) pTrap, n,
- &nAddedTrap);
-
- n -= nAddedTrap;
- pTrap += nAddedTrap;
- size *= 2;
- }
-
- pGeometry->f = pScreenPriv->trapInfo.format;
- pGeometry->count = offset / format->bytes_per_vertex;
- }
- else
- {
- pGeometry =
- xglGetScratchVertexGeometryWithType (pScreen,
- GEOMETRY_DATA_TYPE_FLOAT,
- 4 * nTrap);
- if (!pGeometry->buffer)
- {
- if (pMask)
- FreePicture (pMask, 0);
-
- pPixmapPriv->lock--;
- return;
- }
-
- GEOMETRY_ADD_TRAPEZOID (pScreen, pGeometry, traps, nTrap);
- }
-
- GEOMETRY_TRANSLATE (pGeometry,
- pDstPicture->pDrawable->x + xOff,
- pDstPicture->pDrawable->y + yOff);
- }
-
- if (pGeometry &&
- xglComp (pMask ? PictOpAdd : op,
- pSrcPicture,
- NULL,
- pDstPicture,
- extents.x1 + xOff + xSrc - xDst,
- extents.y1 + yOff + ySrc - yDst,
- 0, 0,
- pDstPicture->pDrawable->x + extents.x1 + xOff,
- pDstPicture->pDrawable->y + extents.y1 + yOff,
- extents.x2 - extents.x1,
- extents.y2 - extents.y1,
- pGeometry,
- mask))
- {
- /* no intermediate mask? we need to register damage from here as
- CompositePicture will never be called. */
- if (!pMask)
- {
- RegionRec region;
-
- REGION_INIT (pScreen, &region, &extents, 1);
- REGION_TRANSLATE (pScreen, &region,
- pDst->pDrawable->x, pDst->pDrawable->y);
-
- DamageDamageRegion (pDst->pDrawable, &region);
-
- REGION_UNINIT (pScreen, &region);
- }
-
- xglAddCurrentBitDamage (pDstPicture->pDrawable);
- }
- else
- {
- XGL_DRAWABLE_PIXMAP_PRIV (pDstPicture->pDrawable);
-
- pPixmapPriv->damageBox.x1 = extents.x1 + xOff;
- pPixmapPriv->damageBox.y1 = extents.y1 + yOff;
- pPixmapPriv->damageBox.x2 = extents.x2 + xOff;
- pPixmapPriv->damageBox.y2 = extents.y2 + yOff;
-
- xglSyncDamageBoxBits (pDstPicture->pDrawable);
-
- if (pMask || (polyEdge == PolyEdgeSmooth &&
- op == PictOpAdd && miIsSolidAlpha (pSrc)))
- {
- PictureScreenPtr ps = GetPictureScreen (pScreen);
-
- for (; nTrap; nTrap--, traps++)
- (*ps->RasterizeTrapezoid) (pDstPicture, traps, xOff, yOff);
-
- xglAddCurrentSurfaceDamage (pDstPicture->pDrawable);
- } else
- miTrapezoids (op, pSrc, pDstPicture, NULL,
- xSrc, ySrc, nTrap, traps);
- }
-
- if (pMask)
- {
- xglLeaveOffscreenArea ((PixmapPtr) pMask->pDrawable);
-
- CompositePicture (op, pSrc, pMask, pDst,
- extents.x1 + xSrc - xDst,
- extents.y1 + ySrc - yDst,
- 0, 0,
- extents.x1, extents.y1,
- extents.x2 - extents.x1,
- extents.y2 - extents.y1);
-
- FreePicture (pMask, 0);
- }
-
- /* release destination drawable lock */
- pPixmapPriv->lock--;
-}
-
-void
-xglAddTraps (PicturePtr pDst,
- INT16 xOff,
- INT16 yOff,
- int nTrap,
- xTrap *traps)
-{
- PictureScreenPtr pPictureScreen;
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
-
- if (!pScreenPriv->pSolidAlpha)
- {
- xglCreateSolidAlphaPicture (pScreen);
- if (!pScreenPriv->pSolidAlpha)
- return;
- }
-
- pPixmapPriv->damageBox.x1 = 0;
- pPixmapPriv->damageBox.y1 = 0;
- pPixmapPriv->damageBox.x2 = pDst->pDrawable->width;
- pPixmapPriv->damageBox.y2 = pDst->pDrawable->height;
-
- if (xglPrepareTarget (pDst->pDrawable))
- {
- glitz_vertex_format_t *format;
- xglGeometryPtr pGeometry;
- xTrap *pTrap = traps;
- int nAddedTrap, n = nTrap;
- int offset = 0;
- int size = SMOOTH_TRAPS_ESTIMATE_RECTS (n);
-
- format = &pScreenPriv->trapInfo.format.vertex;
-
- size *= format->bytes_per_vertex;
- pGeometry = xglGetScratchGeometryWithSize (pScreen, size);
-
- while (n)
- {
- if (pGeometry->size < size)
- GEOMETRY_RESIZE (pScreen, pGeometry, size);
-
- if (!pGeometry->buffer)
- return;
-
- offset +=
- glitz_add_traps (pGeometry->buffer,
- offset, size - offset, format->type,
- pScreenPriv->trapInfo.mask,
- (glitz_trap_t *) pTrap, n,
- &nAddedTrap);
-
- n -= nAddedTrap;
- pTrap += nAddedTrap;
- size *= 2;
- }
-
- pGeometry->f = pScreenPriv->trapInfo.format;
- pGeometry->count = offset / format->bytes_per_vertex;
-
- GEOMETRY_TRANSLATE (pGeometry,
- pDst->pDrawable->x + xOff,
- pDst->pDrawable->y + yOff);
-
- if (xglComp (PictOpAdd,
- pScreenPriv->pSolidAlpha,
- NULL,
- pDst,
- 0, 0,
- 0, 0,
- pDst->pDrawable->x, pDst->pDrawable->y,
- pDst->pDrawable->width, pDst->pDrawable->height,
- pGeometry,
- pScreenPriv->trapInfo.mask))
- {
- xglAddCurrentBitDamage (pDst->pDrawable);
- return;
- }
- }
-
- pPictureScreen = GetPictureScreen (pScreen);
-
- XGL_TRAP_FALLBACK_PROLOGUE (pDst, AddTraps);
- (*pPictureScreen->AddTraps) (pDst, xOff, yOff, nTrap, traps);
- XGL_TRAP_FALLBACK_EPILOGUE (pDst, AddTraps, xglAddTraps);
-}
-
-#endif
diff --git a/hw/xgl/xglwindow.c b/hw/xgl/xglwindow.c
deleted file mode 100644
index ce921385b..000000000
--- a/hw/xgl/xglwindow.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include "xgl.h"
-#include "fb.h"
-
-#define XGL_WINDOW_FALLBACK_PROLOGUE(pWin, func) \
- if (!xglMapPixmapBits (XGL_GET_DRAWABLE_PIXMAP (&pWin->drawable))) \
- FatalError (XGL_SW_FAILURE_STRING); \
- XGL_SCREEN_UNWRAP (func)
-
-#define XGL_WINDOW_FALLBACK_EPILOGUE(pWin, pRegion, func, xglfunc) \
- XGL_SCREEN_WRAP (func, xglfunc); \
- xglAddSurfaceDamage (&pWin->drawable, pRegion)
-
-Bool
-xglCreateWindow (WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- Bool ret;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_WINDOW_PRIV (pWin);
-
- XGL_SCREEN_UNWRAP (CreateWindow);
- ret = (*pScreen->CreateWindow) (pWin);
- XGL_SCREEN_WRAP (CreateWindow, xglCreateWindow);
-
- pWinPriv->pPixmap = pWin->drawable.pScreen->devPrivate;
-
- return ret;
-}
-
-Bool
-xglChangeWindowAttributes (WindowPtr pWin,
- unsigned long mask)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pPixmap;
- Bool ret;
-
- XGL_SCREEN_PRIV (pScreen);
-
- if (mask & CWBackPixmap)
- {
- if (pWin->backgroundState == BackgroundPixmap)
- {
- pPixmap = pWin->background.pixmap;
-
- if (FbEvenTile (pPixmap->drawable.width *
- pPixmap->drawable.bitsPerPixel))
- xglSyncBits (&pPixmap->drawable, NULL);
- }
- }
-
- if (mask & CWBorderPixmap)
- {
- if (pWin->borderIsPixel == FALSE)
- {
- pPixmap = pWin->border.pixmap;
-
- if (FbEvenTile (pPixmap->drawable.width *
- pPixmap->drawable.bitsPerPixel))
- xglSyncBits (&pPixmap->drawable, NULL);
- }
- }
-
- XGL_SCREEN_UNWRAP (ChangeWindowAttributes);
- ret = (*pScreen->ChangeWindowAttributes) (pWin, mask);
- XGL_SCREEN_WRAP (ChangeWindowAttributes, xglChangeWindowAttributes);
-
- return ret;
-}
-
-void
-xglCopyWindow (WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
-{
- PixmapPtr pPixmap;
- RegionRec rgnDst;
- int dx, dy;
- BoxPtr pExtent = REGION_EXTENTS (pWin->drawable.pScreen, prgnSrc);
- BoxRec box;
-
- pPixmap = XGL_GET_WINDOW_PIXMAP (pWin);
-
- box.x1 = pExtent->x1;
- box.y1 = pExtent->y1;
- box.x2 = pExtent->x2;
- box.y2 = pExtent->y2;
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
-
- REGION_TRANSLATE (pWin->drawable.pScreen, prgnSrc, -dx, -dy);
- REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
- REGION_INTERSECT (pWin->drawable.pScreen,
- &rgnDst, &pWin->borderClip, prgnSrc);
-
- fbCopyRegion (&pWin->drawable, &pWin->drawable,
- 0, &rgnDst, dx, dy, xglCopyProc, 0, (void *) &box);
-
- REGION_UNINIT (pWin->drawable.pScreen, &rgnDst);
-}
-
-static Bool
-xglFillRegionSolid (DrawablePtr pDrawable,
- RegionPtr pRegion,
- Pixel pixel)
-{
- glitz_color_t color;
- BoxPtr pExtent;
-
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if (!pPixmapPriv->target)
- return FALSE;
-
- pExtent = REGION_EXTENTS (pDrawable->pScreen, pRegion);
-
- xglPixelToColor (pPixmapPriv->pPixel, pixel, &color);
-
- if (xglSolid (pDrawable,
- GLITZ_OPERATOR_SRC,
- &color,
- NULL,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- REGION_RECTS (pRegion),
- REGION_NUM_RECTS (pRegion)))
- return TRUE;
-
- return FALSE;
-}
-
-static Bool
-xglFillRegionTiled (DrawablePtr pDrawable,
- RegionPtr pRegion,
- PixmapPtr pTile,
- int tileX,
- int tileY)
-{
- BoxPtr pExtent;
-
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if (!pPixmapPriv->target)
- return FALSE;
-
- pExtent = REGION_EXTENTS (pDrawable->pScreen, pRegion);
-
- if (xglTile (pDrawable,
- GLITZ_OPERATOR_SRC,
- pTile,
- tileX, tileY,
- NULL,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- REGION_RECTS (pRegion),
- REGION_NUM_RECTS (pRegion)))
- return TRUE;
-
- return FALSE;
-}
-
-void
-xglPaintWindowBackground (WindowPtr pWin,
- RegionPtr pRegion,
- int what)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- XGL_SCREEN_PRIV (pScreen);
-
- switch (pWin->backgroundState) {
- case None:
- return;
- case ParentRelative:
- do {
- pWin = pWin->parent;
- } while (pWin->backgroundState == ParentRelative);
-
- (*pScreen->PaintWindowBackground) (pWin, pRegion, what);
- return;
- case BackgroundPixmap:
- if (xglFillRegionTiled (&pWin->drawable,
- pRegion,
- pWin->background.pixmap,
- -pWin->drawable.x,
- -pWin->drawable.y))
- {
- xglAddCurrentBitDamage (&pWin->drawable);
- return;
- }
-
- if (!xglSyncBits (&pWin->background.pixmap->drawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
- break;
- case BackgroundPixel:
- if (xglFillRegionSolid (&pWin->drawable,
- pRegion,
- pWin->background.pixel))
- {
- xglAddCurrentBitDamage (&pWin->drawable);
- return;
- }
- break;
- }
-
- XGL_WINDOW_FALLBACK_PROLOGUE (pWin, PaintWindowBackground);
- (*pScreen->PaintWindowBackground) (pWin, pRegion, what);
- XGL_WINDOW_FALLBACK_EPILOGUE (pWin, pRegion, PaintWindowBackground,
- xglPaintWindowBackground);
-}
-
-void
-xglPaintWindowBorder (WindowPtr pWin,
- RegionPtr pRegion,
- int what)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- XGL_SCREEN_PRIV (pScreen);
-
- if (pWin->borderIsPixel)
- {
- if (xglFillRegionSolid (&pWin->drawable,
- pRegion,
- pWin->border.pixel))
- {
- xglAddCurrentBitDamage (&pWin->drawable);
- return;
- }
- }
- else
- {
- WindowPtr pBgWin = pWin;
-
- while (pBgWin->backgroundState == ParentRelative)
- pBgWin = pBgWin->parent;
-
- if (xglFillRegionTiled (&pBgWin->drawable,
- pRegion,
- pWin->border.pixmap,
- -pBgWin->drawable.x,
- -pBgWin->drawable.y))
- {
- xglAddCurrentBitDamage (&pWin->drawable);
- return;
- }
-
- if (!xglSyncBits (&pWin->border.pixmap->drawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
- }
-
- XGL_WINDOW_FALLBACK_PROLOGUE (pWin, PaintWindowBorder);
- (*pScreen->PaintWindowBorder) (pWin, pRegion, what);
- XGL_WINDOW_FALLBACK_EPILOGUE (pWin, pRegion, PaintWindowBorder,
- xglPaintWindowBorder);
-}