xserver/hw/xgl .cvsignore, 1.2, 1.3 Makefile.am, 1.1, 1.2 kbd.c, 1.1,
NONE mouse.c, 1.1, NONE xgl.h, 1.1, 1.2 xglbstore.c, NONE,
1.1 xglcmap.c, NONE, 1.1 xglcomp.c, NONE, 1.1 xglcopy.c, NONE,
1.1 xglcursor.c, 1.1, NONE xglfill.c, NONE, 1.1 xglgc.c, 1.1,
1.2 xglgeometry.c, NONE, 1.1 xglget.c, NONE, 1.1 xglinit.c,
1.1, NONE xglinput.c, 1.1, 1.2 xgloffscreen.c, NONE,
1.1 xgloutput.c, 1.1, 1.2 xglparse.c, NONE, 1.1 xglpict.c,
NONE, 1.1 xglpixel.c, NONE, 1.1 xglpixmap.c, 1.1,
1.2 xglscreen.c, NONE, 1.1 xglsolid.c, NONE, 1.1 xglspans.c,
1.1, NONE xglsync.c, NONE, 1.1 xgltile.c, NONE,
1.1 xglwindow.c, NONE, 1.1 xglx.c, 1.1, NONE
David Reveman
xserver-commit at pdx.freedesktop.org
Thu Nov 4 15:19:15 PST 2004
Committed by: davidr
Update of /cvs/xserver/xserver/hw/xgl
In directory gabe:/tmp/cvs-serv32506/hw/xgl
Modified Files:
.cvsignore Makefile.am xgl.h xglgc.c xglinput.c xgloutput.c
xglpixmap.c
Added Files:
xglbstore.c xglcmap.c xglcomp.c xglcopy.c xglfill.c
xglgeometry.c xglget.c xgloffscreen.c xglparse.c xglpict.c
xglpixel.c xglscreen.c xglsolid.c xglsync.c xgltile.c
xglwindow.c
Removed Files:
kbd.c mouse.c xglcursor.c xglinit.c xglspans.c xglx.c
Log Message:
Add working Xgl server code
Index: .cvsignore
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- .cvsignore 4 Jun 2004 17:06:58 -0000 1.2
+++ .cvsignore 4 Nov 2004 23:19:13 -0000 1.3
@@ -3,4 +3,4 @@
Makefile
Makefile.in
*.o
-Xgl
+libxgl.a
Index: Makefile.am
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.am 4 Jun 2004 17:06:18 -0000 1.1
+++ Makefile.am 4 Nov 2004 23:19:13 -0000 1.2
@@ -1,17 +1,30 @@
-INCLUDES = \
- @XGL_INCS@ \
- @XSERVER_CFLAGS@
+SUBDIRS = . $(XGLX_DIRS)
-bin_PROGRAMS = Xgl
+INCLUDES = \
+ @XGL_INCS@ \
+ @XSERVER_CFLAGS@ \
+ @XGLSERVER_CFLAGS@
-Xgl_SOURCES = \
- xglgc.c \
- xglinit.c \
- xglinput.c \
- xgloutput.c \
- xglpixmap.c \
- xglspans.c
+noinst_LIBRARIES = libxgl.a
-Xgl_LDADD = \
- @XGL_LIBS@ \
- @XSERVER_LIBS@
+libxgl_a_SOURCES = \
+ xglinput.c \
+ xgloutput.c \
+ xglcmap.c \
+ xglparse.c \
+ xglscreen.c \
+ xgloffscreen.c \
+ xglgeometry.c \
+ xglpixmap.c \
+ xglsync.c \
+ xglsolid.c \
+ xgltile.c \
+ xglpixel.c \
+ xglcopy.c \
+ xglfill.c \
+ xglwindow.c \
+ xglbstore.c \
+ xglget.c \
+ xglgc.c \
+ xglcomp.c \
+ xglpict.c
--- kbd.c DELETED ---
--- mouse.c DELETED ---
Index: xgl.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xgl.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xgl.h 4 Jun 2004 17:06:18 -0000 1.1
+++ xgl.h 4 Nov 2004 23:19:13 -0000 1.2
@@ -1,89 +1,601 @@
/*
- * $Id$
- *
- * Copyright © 2004 Keith Packard
+ * 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 names of
[...1047 lines suppressed...]
+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);
+
+#endif
+
#endif /* _XGL_H_ */
--- NEW FILE: xglbstore.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xglcmap.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xglcomp.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xglcopy.c ---
(This appears to be a binary file; contents omitted.)
--- xglcursor.c DELETED ---
--- NEW FILE: xglfill.c ---
(This appears to be a binary file; contents omitted.)
Index: xglgc.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglgc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xglgc.c 4 Jun 2004 17:06:18 -0000 1.1
+++ xglgc.c 4 Nov 2004 23:19:13 -0000 1.2
@@ -1,113 +1,554 @@
/*
- * $Id$
- *
- * Copyright © 2004 Keith Packard
+ * 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 names 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.
*
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard 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.
*
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 at freedesktop.org>
*/
#include "xgl.h"
+#include "fb.h"
+#include "gcstruct.h"
+#include "migc.h"
-static void
-xglValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
-{
- pGC->lastWinOrg.x = pDrawable->x;
- pGC->lastWinOrg.y = pDrawable->y;
+#define XGL_GC_OP_FALLBACK_PROLOGUE(pDrawable) \
+ xglSyncDamageBoxBits (pDrawable); \
+ XGL_GC_UNWRAP (funcs); \
+ XGL_GC_UNWRAP (ops)
- if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
- (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
- )
- {
- miComputeCompositeClip (pGC, pDrawable);
- }
-}
+#define XGL_GC_OP_FALLBACK_EPILOGUE(pDrawable) \
+ XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs); \
+ XGL_GC_WRAP (ops, (GCOps *) &xglGCOps); \
+ xglAddSurfaceDamage (pDrawable)
-static const GCFuncs xglGCFuncs = {
+#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,
+ miCopyClip
};
-static void
-xglPolyLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
-{
- void (*line) (DrawablePtr, GCPtr, int mode, int npt, DDXPointPtr ppt);
-
- if (pGC->lineWidth == 0)
- {
- line = miZeroLine;
- }
- else
- {
- if (pGC->lineStyle != LineSolid)
- line = miWideDash;
- else
- line = miWideLine;
- }
- (*line) (pDrawable, pGC, mode, npt, ppt);
-}
-
-static const GCOps xglGCOps = {
+static const GCOps xglGCOps = {
xglFillSpans,
xglSetSpans,
- miPutImage,
- miCopyArea,
- miCopyPlane,
- miPolyPoint,
- xglPolyLine,
- miPolySegment,
+ xglPutImage,
+ xglCopyArea,
+ xglCopyPlane,
+ xglPolyPoint,
+ xglPolylines,
+ xglPolySegment,
miPolyRectangle,
- miPolyArc,
+ xglPolyArc,
miFillPolygon,
- miPolyFillRect,
- miPolyFillArc,
+ xglPolyFillRect,
+ xglPolyFillArc,
miPolyText8,
miPolyText16,
miImageText8,
miImageText16,
- miImageGlyphBlt,
- miPolyGlyphBlt,
+ xglImageGlyphBlt,
+ xglPolyGlyphBlt,
xglPushPixels
#ifdef NEED_LINEHELPER
- ,NULL
+ , NULL
#endif
};
+void
+xglFillSpans (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nspans,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted)
+{
+ XGL_GC_PRIV (pGC);
+
+ if (!pGCPriv->flags)
+ {
+ if (xglFillSpan (pDrawable, pGC, nspans, ppt, pwidth))
+ {
+ xglAddBitDamage (pDrawable);
+ return;
+ }
+ }
+
+ XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->FillSpans) (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+}
+
+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);
+
+ switch (format) {
+ case XYBitmap:
+ break;
+ case XYPixmap:
+ case ZPixmap:
+ if (!pGCPriv->flags)
+ {
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ if (!pPixmapPriv->allBits &&
+ pPixmapPriv->target == xglPixmapTargetIn)
+ {
+ if (xglSetPixels (pDrawable,
+ bits,
+ PixmapBytePad (w, pDrawable->depth),
+ FALSE,
+ x + pDrawable->x, y + pDrawable->y,
+ w, h,
+ REGION_RECTS (pGC->pCompositeClip),
+ REGION_NUM_RECTS (pGC->pCompositeClip)))
+ {
+ xglAddBitDamage (pDrawable);
+ return;
+ }
+ }
+ }
+ break;
+ }
+
+ 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);
+}
+
+RegionPtr
+xglCopyArea (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcX,
+ int srcY,
+ int w,
+ int h,
+ int dstX,
+ int dstY)
+{
+ unsigned long flags;
+ RegionPtr pRegion;
+ BoxRec box;
+
+ XGL_GC_PRIV (pGC);
+
+ flags = pGCPriv->flags;
+
+ if (XGL_GET_DRAWABLE_PIXMAP_PRIV (pSrc)->target == xglPixmapTargetIn)
+ flags &= ~xglGCReadOnlyDrawableFlag;
+
+ if (!flags)
+ {
+ Bool ret;
+
+ ret = TRUE;
+ pRegion = fbDoCopy (pSrc, pDst, pGC,
+ srcX, srcY,
+ w, h,
+ dstX, dstY,
+ xglCopyProc, 0,
+ (void *) &ret);
+ if (ret)
+ {
+ xglAddBitDamage (pDst);
+ return pRegion;
+ }
+
+ if (pRegion)
+ REGION_DESTROY (pDst->pScreen, pRegion);
+ }
+
+ 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->CopyArea) (pSrc, pDst, pGC,
+ srcX, srcY, w, h, dstX, dstY);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDst);
+
+ 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))
+ {
+ xglAddBitDamage (pDrawable);
+ return;
+ }
+ }
+ }
+
+ XGL_GC_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))
+ {
+ xglAddBitDamage (pDrawable);
+ return;
+ }
+ }
+ }
+
+ XGL_GC_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_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)
+ {
+ if (xglFillRect (pDrawable, pGC, nrect, prect))
+ {
+ xglAddBitDamage (pDrawable);
+ return;
+ }
+ }
+
+ XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrect, prect);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+}
+
+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);
+
+ 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);
+
+ XGL_GC_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)
{
- pGC->clientClip = NULL;
- pGC->clientClipType = CT_NONE;
+ static glitz_color_t black = { 0x0, 0x0, 0x0, 0xffff };
+ ScreenPtr pScreen = pGC->pScreen;
+ Bool ret;
- pGC->funcs = (GCFuncs *) &xglGCFuncs;
- pGC->ops = (GCOps *) &xglGCOps;
- pGC->pCompositeClip = 0;
- pGC->fExpose = 1;
- pGC->freeCompClip = FALSE;
- pGC->pRotatedPixmap = 0;
- return TRUE;
+ 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);
+
+ 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);
+ }
+ }
}
--- NEW FILE: xglgeometry.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xglget.c ---
(This appears to be a binary file; contents omitted.)
--- xglinit.c DELETED ---
Index: xglinput.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglinput.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xglinput.c 4 Jun 2004 17:06:18 -0000 1.1
+++ xglinput.c 4 Nov 2004 23:19:13 -0000 1.2
@@ -1,90 +1,89 @@
/*
- * $Id$
- *
- * Copyright © 2004 Keith Packard
+ * 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 names 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.
*
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard 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.
*
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 at freedesktop.org>
*/
#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
-Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
-{
- return TRUE;
-}
-
-void
-ProcessInputEvents ()
-{
-}
-
#define NUM_BUTTONS 5
-static int
-xglMouseProc (DeviceIntPtr pDevice, int onoff)
+int
+xglMouseProc (DeviceIntPtr pDevice,
+ int onoff)
{
- BYTE map[NUM_BUTTONS + 1];
- DevicePtr pDev = (DevicePtr) pDevice;
- int i;
+ 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());
+
+ InitPointerDeviceStruct (pDev,
+ map,
+ NUM_BUTTONS,
+ miPointerGetMotionEvents,
+ (PtrCtrlProcPtr) NoopDDA,
+ miPointerGetMotionBufferSize ());
break;
case DEVICE_ON:
pDev->on = TRUE;
break;
case DEVICE_OFF:
case DEVICE_CLOSE:
- if (pDev->on)
- {
- pDev->on = FALSE;
- }
+ pDev->on = FALSE;
break;
}
+
return Success;
}
-static void
-xglBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
+void
+xglBell (int volume,
+ DeviceIntPtr pDev,
+ pointer ctrl,
+ int something)
{
}
-static void
-xglKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+void
+xglKbdCtrl (DeviceIntPtr pDevice,
+ KeybdCtrl *ctrl)
{
}
#define XGL_KEYMAP_WIDTH 2
-KeySym xglKeymap[] = {
+KeySym xglKeymap[] = {
/* 1 8 */ XK_Escape, NoSymbol,
/* 2 9 */ XK_1, XK_exclam,
/* 3 10 */ XK_2, XK_at,
@@ -204,35 +203,35 @@
/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
};
-CARD8 xglModMap[MAP_LENGTH];
+CARD8 xglModMap[MAP_LENGTH];
-KeySymsRec xglKeySyms = {
+KeySymsRec xglKeySyms = {
xglKeymap,
8,
8 + (sizeof (xglKeymap) / sizeof (xglKeymap[0]) / XGL_KEYMAP_WIDTH) - 1,
XGL_KEYMAP_WIDTH
};
-static int
-xglKeybdProc(DeviceIntPtr pDevice, int onoff)
+int
+xglKeybdProc (DeviceIntPtr pDevice,
+ int onoff)
{
- Bool ret;
- DevicePtr pDev = (DevicePtr)pDevice;
+ Bool ret;
+ DevicePtr pDev = (DevicePtr) pDevice;
if (!pDev)
return BadImplementation;
- switch (onoff)
- {
+ switch (onoff) {
case DEVICE_INIT:
- if (pDev != LookupKeyboardDevice())
- {
+ if (pDev != LookupKeyboardDevice ())
return !Success;
- }
- ret = InitKeyboardDeviceStruct(pDev,
- &xglKeySyms,
- xglModMap,
- xglBell, xglKbdCtrl);
+
+ ret = InitKeyboardDeviceStruct (pDev,
+ &xglKeySyms,
+ xglModMap,
+ xglBell,
+ xglKbdCtrl);
if (!ret)
return BadImplementation;
break;
@@ -241,24 +240,24 @@
break;
case DEVICE_OFF:
case DEVICE_CLOSE:
- if (pDev->on)
- {
- pDev->on = FALSE;
- }
+ pDev->on = FALSE;
break;
}
+
return Success;
}
void
-InitInput (int argc, char **argv)
+xglInitInput (int argc, char **argv)
{
- DeviceIntPtr pKeyboard, pPointer;
+ 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);
+ pPointer = AddInputDevice (xglMouseProc, TRUE);
+ pKeyboard = AddInputDevice (xglKeybdProc, TRUE);
+
+ RegisterPointerDevice (pPointer);
+ RegisterKeyboardDevice (pKeyboard);
+
+ miRegisterPointerDevice (screenInfo.screens[0], pPointer);
+ mieqInit (&pKeyboard->public, &pPointer->public);
}
--- NEW FILE: xgloffscreen.c ---
(This appears to be a binary file; contents omitted.)
Index: xgloutput.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xgloutput.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xgloutput.c 4 Jun 2004 17:06:18 -0000 1.1
+++ xgloutput.c 4 Nov 2004 23:19:13 -0000 1.2
@@ -1,38 +1,39 @@
/*
- * $Id$
- *
- * Copyright © 2004 Keith Packard
+ * 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 names 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.
*
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard 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.
*
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 at freedesktop.org>
*/
#include "xgl.h"
-typedef struct _xglDepths {
- CARD8 depth;
- CARD8 bpp;
-} XglDepths;
+typedef struct _xglDepth {
+ CARD8 depth;
+ CARD8 bpp;
+} xglDepthRec, *xglDepthPtr;
-static XglDepths xglDepths[] = {
- { 1, 1 },
- { 4, 4 },
- { 8, 8 },
+static xglDepthRec xglDepths[] = {
+ { 1, 1 },
+ { 4, 4 },
+ { 8, 8 },
{ 15, 16 },
{ 16, 16 },
{ 24, 32 },
@@ -41,148 +42,24 @@
#define NUM_XGL_DEPTHS (sizeof (xglDepths) / sizeof (xglDepths[0]))
-static void
+void
xglSetPixmapFormats (ScreenInfo *pScreenInfo)
{
- int i;
+ int i;
- pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ 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 = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
- format->depth = xglDepths[i].depth;
- format->bitsPerPixel = xglDepths[i].bpp;
- format->scanlinePad = BITMAP_SCANLINE_PAD;
- }
-}
-
-#define xglQueryBestSize (void *) NoopDDA
-#define xglSaveScreen (void *) NoopDDA
-#define miGetImage (void *) NoopDDA
-#define xglCreateWindow (void *) NoopDDA
-#define xglDestroyWindow (void *) NoopDDA
-#define xglPositionWindow (void *) NoopDDA
-#define xglChangeWindowAttributes (void *) NoopDDA
-#define xglRealizeWindow (void *) NoopDDA
-#define xglUnrealizeWindow (void *) NoopDDA
-#define xglPaintWindowBackground (void *) NoopDDA
-#define xglPaintWindowBorder (void *) NoopDDA
-#define xglCopyWindow (void *) NoopDDA
-#define xglRealizeFont (void *) NoopDDA
-#define xglUnrealizeFont (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
-
-#define xglCreateColormap (void *) NoopDDA
-#define xglDestroyColormap (void *) NoopDDA
-#define xglInstallColormap (void *) NoopDDA
-#define xglUninstallColormap (void *) NoopDDA
-#define xglListInstalledColormaps (void *) NoopDDA
-#define xglStoreColors (void *) NoopDDA
-#define xglResolveColor (void *) NoopDDA
-#define xglBitmapToRegion (void *) NoopDDA
-
-static PixmapPtr
-xglGetWindowPixmap (WindowPtr pWin)
-{
- return 0;
-}
-
-static void
-xglSetWindowPixmap (WindowPtr pWin, PixmapPtr pPixmap)
-{
-}
-
-static void
-xglSetupScreen (ScreenPtr pScreen)
-{
- pScreen->defColormap = FakeClientID (0);
- pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
-
- pScreen->QueryBestSize = xglQueryBestSize;
- pScreen->SaveScreen = xglSaveScreen;
- pScreen->GetImage = miGetImage;
- pScreen->GetSpans = xglGetSpans;
-
- pScreen->CreateWindow = xglCreateWindow;
- pScreen->DestroyWindow = xglDestroyWindow;
- pScreen->PositionWindow = xglPositionWindow;
- pScreen->ChangeWindowAttributes = xglChangeWindowAttributes;
- pScreen->RealizeWindow = xglRealizeWindow;
- pScreen->UnrealizeWindow = xglUnrealizeWindow;
- pScreen->PaintWindowBackground = xglPaintWindowBackground;
- pScreen->PaintWindowBorder = xglPaintWindowBorder;
- pScreen->CopyWindow = xglCopyWindow;
-
- pScreen->CreatePixmap = xglCreatePixmap;
- pScreen->DestroyPixmap = xglDestroyPixmap;
-
- pScreen->RealizeFont = xglRealizeFont;
- pScreen->UnrealizeFont = xglUnrealizeFont;
-
- pScreen->ConstrainCursor = xglConstrainCursor;
- pScreen->CursorLimits = xglCursorLimits;
- pScreen->DisplayCursor = xglDisplayCursor;
- pScreen->RealizeCursor = xglRealizeCursor;
- pScreen->UnrealizeCursor = xglUnrealizeCursor;
- pScreen->RecolorCursor = xglRecolorCursor;
- pScreen->SetCursorPosition = xglSetCursorPosition;
-
- pScreen->CreateGC = xglCreateGC;
-
- pScreen->CreateColormap = miInitializeColormap;
- pScreen->DestroyColormap = xglDestroyColormap;
- pScreen->InstallColormap = miInstallColormap;
- pScreen->UninstallColormap = miUninstallColormap;
- pScreen->ListInstalledColormaps = miListInstalledColormaps;
- pScreen->StoreColors = xglStoreColors;
- pScreen->ResolveColor = miResolveColor;
-
- pScreen->BitmapToRegion = xglBitmapToRegion;
-
- pScreen->GetWindowPixmap = xglGetWindowPixmap;
- pScreen->SetWindowPixmap = xglSetWindowPixmap;
-}
-
-static Bool
-xglScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
-{
- VisualPtr visuals;
- DepthPtr depths;
- int nvisuals;
- int ndepth;
- int rootDepth;
- VisualID defaultVisual;
-
- rootDepth = 24;
- miInitVisuals (&visuals, &depths, &nvisuals,
- &ndepth, &rootDepth, &defaultVisual,
- 1 << 31, 8, -1);
- miScreenInit (pScreen, 0, 800, 600, 96, 96, 800, rootDepth,
- ndepth, depths, defaultVisual, nvisuals, visuals);
- xglSetupScreen (pScreen);
- if (!miCreateDefColormap (pScreen))
- return FALSE;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ pScreenInfo->numPixmapFormats = 0;
- return TRUE;
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- xglSetPixmapFormats (pScreenInfo);
+ for (i = 0; i < NUM_XGL_DEPTHS; i++) {
+ PixmapFormatRec *format;
- AddScreen (xglScreenInit, argc, argv);
+ format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
+
+ format->depth = xglDepths[i].depth;
+ format->bitsPerPixel = xglDepths[i].bpp;
+ format->scanlinePad = BITMAP_SCANLINE_PAD;
+ }
}
-
--- NEW FILE: xglparse.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xglpict.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xglpixel.c ---
(This appears to be a binary file; contents omitted.)
Index: xglpixmap.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglpixmap.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xglpixmap.c 4 Jun 2004 17:06:18 -0000 1.1
+++ xglpixmap.c 4 Nov 2004 23:19:13 -0000 1.2
@@ -1,28 +1,125 @@
/*
- * $Id$
- *
- * Copyright © 2004 Keith Packard
+ * 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 names 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.
*
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard 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.
*
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 at freedesktop.org>
*/
#include "xgl.h"
+#include "fb.h"
+
+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,
+ (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;
+
+ if (pPixmapPriv->format)
+ {
+ if (!pPixmapPriv->pDamage)
+ if (!xglPixmapCreateDamage (pPixmap))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ if (width && height)
+ {
+ 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;
+
+ /*
+ * Don't allow depth 8 pixmaps into offscreen drawables as
+ * no trapezoid acceleration is hooked up yet.
+ */
+ if (pPixmap->drawable.depth <= 8)
+ 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,
@@ -30,12 +127,15 @@
int height,
int depth)
{
- PixmapPtr pPixmap;
+ 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;
@@ -47,22 +147,310 @@
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->allBits = TRUE;
+ pPixmapPriv->bitBox.x1 = 0;
+ pPixmapPriv->bitBox.y1 = 0;
+ pPixmapPriv->bitBox.x2 = 32767;
+ pPixmapPriv->bitBox.y2 = 32767;
+ pPixmapPriv->damageBox = miEmptyBox;
+
return pPixmap;
}
Bool
xglDestroyPixmap (PixmapPtr pPixmap)
{
- if(--pPixmap->refcnt)
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (--pPixmap->refcnt)
return TRUE;
- xfree(pPixmap);
+
+ if (pPixmapPriv->pArea)
+ xglWithdrawOffscreenArea (pPixmapPriv->pArea);
+
+ if (pPixmap->devPrivate.ptr)
+ {
+ if (pPixmapPriv->buffer)
+ glitz_buffer_unmap (pPixmapPriv->buffer);
+ }
+
+ if (pPixmapPriv->buffer)
+ glitz_buffer_destroy (pPixmapPriv->buffer);
+
+ if (pPixmapPriv->bits)
+ xfree (pPixmapPriv->bits);
+
+ if (pPixmapPriv->surface)
+ glitz_surface_destroy (pPixmapPriv->surface);
+
+ 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)
+ xglWithdrawOffscreenArea (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->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->pPixel = pScreenPriv->pVisual[0].pPixel;
+ pPixmapPriv->target = xglPixmapTargetIn;
+
+ pScreenPriv->pScreenPixmap = pPixmap;
+ }
+
+ return TRUE;
+}
+
+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);
+ if (!pPixmapPriv->surface)
+ {
+ pPixmapPriv->format = NULL;
+ pPixmapPriv->target = xglPixmapTargetNo;
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+Bool
+xglAllocatePixmapBits (PixmapPtr pPixmap)
+{
+ int width, height, bpp, stride;
+
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ width = pPixmap->drawable.width;
+ height = pPixmap->drawable.height;
+ bpp = pPixmap->drawable.bitsPerPixel;
+
+ stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
+
+ pPixmapPriv->stride = stride;
+
+ if (stride)
+ {
+ pPixmapPriv->bits = xalloc (height * stride);
+ if (!pPixmapPriv->bits)
+ return FALSE;
+
+ pPixmapPriv->buffer =
+ glitz_buffer_create_for_data (pPixmapPriv->bits);
+ if (!pPixmapPriv->buffer)
+ {
+ xfree (pPixmapPriv->bits);
+ pPixmapPriv->bits = NULL;
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+Bool
+xglMapPixmapBits (PixmapPtr pPixmap)
+{
+ if (!pPixmap->devPrivate.ptr)
+ {
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (!pPixmapPriv->buffer)
+ if (!xglAllocatePixmapBits (pPixmap))
+ return FALSE;
+
+ pPixmap->devKind = pPixmapPriv->stride;
+ pPixmap->devPrivate.ptr =
+ glitz_buffer_map (pPixmapPriv->buffer,
+ GLITZ_BUFFER_ACCESS_READ_WRITE);
+ if (!pPixmap->devPrivate.ptr)
+ return FALSE;
+ }
+
+ 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;
}
--- NEW FILE: xglscreen.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xglsolid.c ---
(This appears to be a binary file; contents omitted.)
--- xglspans.c DELETED ---
--- NEW FILE: xglsync.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xgltile.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xglwindow.c ---
(This appears to be a binary file; contents omitted.)
--- xglx.c DELETED ---
More information about the xserver-commit
mailing list