xserver/hw/xgl Makefile.am, 1.9, 1.10 xgl.h, 1.16, 1.17 xglarea.c,
1.2, 1.3 xglbstore.c, 1.3, 1.4 xglcmap.c, 1.8, 1.9 xglcomp.c,
1.6, NONE xglcompose.c, NONE, 1.1 xglcopy.c, 1.8,
1.9 xglfill.c, 1.7, 1.8 xglgc.c, 1.8, 1.9 xglgeometry.c, 1.4,
1.5 xglget.c, 1.4, 1.5 xglglx.c, 1.13, 1.14 xglglx.h, NONE,
1.1 xglglyph.c, 1.6, 1.7 xglinit.c, 1.3, 1.4 xglinput.c, 1.5,
1.6 xglloader.c, 1.1, 1.2 xgloutput.c, 1.4, 1.5 xglparse.c,
1.6, 1.7 xglpict.c, 1.7, 1.8 xglpixmap.c, 1.12,
1.13 xglscreen.c, 1.11, 1.12 xglshm.c, 1.3, 1.4 xglsolid.c,
1.4, 1.5 xglsync.c, 1.10, 1.11 xgltile.c, 1.3, 1.4 xgltrap.c,
1.7, 1.8 xglwindow.c, 1.5, 1.6 xglxv.c, NONE, 1.1
Dave Airlie
xserver-commit at pdx.freedesktop.org
Tue Jan 3 01:56:25 PST 2006
- Previous message: xserver/hw/xgl/glxext Makefile.am, 1.1, 1.2 xglglxext.c, 1.1,
1.2 xglglxext.h, 1.2, 1.3 xglglxlog.c, NONE, 1.1
- Next message: xserver/hw/xgl/egl xegl.c,1.7,1.8 xeglinit.c,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: airlied
Update of /cvs/xserver/xserver/hw/xgl
In directory gabe:/tmp/cvs-serv16345
Modified Files:
Makefile.am xgl.h xglarea.c xglbstore.c xglcmap.c xglcopy.c
xglfill.c xglgc.c xglgeometry.c xglget.c xglglx.c xglglyph.c
xglinit.c xglinput.c xglloader.c xgloutput.c xglparse.c
xglpict.c xglpixmap.c xglscreen.c xglshm.c xglsolid.c
xglsync.c xgltile.c xgltrap.c xglwindow.c
Added Files:
xglcompose.c xglglx.h xglxv.c
Removed Files:
xglcomp.c
Log Message:
commit all Xgl changes from Xgl code drop (EGL still to do)
Index: Makefile.am
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile.am 23 Dec 2005 02:07:58 -0000 1.9
+++ Makefile.am 3 Jan 2006 09:56:22 -0000 1.10
@@ -26,6 +26,8 @@
libxgl_a_SOURCES = \
xgl.h \
+ xglmodule.h \
+ xglglx.h \
xglinput.c \
xgloutput.c \
xglcmap.c \
@@ -44,22 +46,23 @@
xglget.c \
xglgc.c \
xglshm.c \
- xglcomp.c \
+ xglcompose.c \
xglpict.c \
xglglyph.c \
xgltrap.c \
- xglhash.c \
xglloader.c \
- xglglx.c
+ xglhash.c \
+ xglglx.c \
+ xglxv.c
if XGLSERVER
Xgl_DEPENDENCIES = @XGL_LIBS@
Xgl_LDFLAGS = -export-dynamic
Xgl_SOURCES = xglinit.c
Xgl_LDADD = \
- @XGL_LIBS@ \
@XSERVER_LIBS@ \
- @XGLSERVER_LIBS@
+ @XGLSERVER_LIBS@ \
+ @XGL_LIBS@
Xgl_programs = Xgl
endif
Index: xgl.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xgl.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- xgl.h 23 Dec 2005 02:07:58 -0000 1.16
+++ xgl.h 3 Jan 2006 09:56:22 -0000 1.17
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -30,8 +30,6 @@
#include <config.h>
#endif
-#include <stdint.h>
-#include <stdio.h>
#include <X11/X.h>
#define NEED_EVENTS
#include <X11/Xproto.h>
@@ -51,24 +49,56 @@
#ifdef RENDER
#include "mipict.h"
+#else
+#ifdef XV
+#undef XV /* Xv implementation require RENDER */
+#endif
+#endif
+
+#ifdef XV
+#define XGL_XV_FORMAT_YUY2 0
+#define XGL_XV_FORMAT_YV12 1
+#define XGL_XV_FORMAT_RGB 2
+#define XGL_XV_FORMAT_NUM 3
#endif
extern WindowPtr *WindowTable;
#define XGL_DEFAULT_PBO_MASK 0
+typedef struct _xglSizeConstraint {
+ int minWidth;
+ int minHeight;
+ int aboveWidth;
+ int aboveHeight;
+} xglSizeConstraintRec, *xglSizeConstraintPtr;
+
+typedef struct _xglAccelInfo {
+ Bool enabled;
+ Bool pbuffer;
+ xglSizeConstraintRec size;
+} xglAccelInfoRec, *xglAccelInfoPtr;
+
+typedef struct _xglScreenAccelInfo {
+ xglAccelInfoRec pixmap;
+ xglAccelInfoRec window;
+ xglAccelInfoRec glx;
+ xglAccelInfoRec xv;
+} xglScreenAccelInfoRec, *xglScreenAccelInfoPtr;
+
typedef struct _xglScreenInfo {
- glitz_drawable_t *drawable;
- unsigned int width;
- unsigned int height;
- unsigned int widthMm;
- unsigned int heightMm;
- int geometryDataType;
- int geometryUsage;
- Bool yInverted;
- int pboMask;
- Bool lines;
- Bool fbo;
+ glitz_drawable_t *drawable;
+ unsigned int depth;
+ unsigned int width;
+ unsigned int height;
+ unsigned int widthMm;
+ unsigned int heightMm;
+ int geometryDataType;
+ int geometryUsage;
+ Bool yInverted;
+ int pboMask;
+ Bool lines;
+ xglScreenAccelInfoRec accel;
} xglScreenInfoRec, *xglScreenInfoPtr;
extern xglScreenInfoRec xglScreenInfo;
@@ -79,18 +109,17 @@
} xglPixelFormatRec, *xglPixelFormatPtr;
typedef struct _xglVisual {
- glitz_drawable_format_t *format;
- xglPixelFormatPtr pPixel;
- unsigned long visuals;
-} xglVisualRec, *xglVisualPtr;
-
-typedef struct _xglPixmapFormat {
- glitz_format_t *format;
+ struct _xglVisual *next;
+ VisualID vid;
xglPixelFormatPtr pPixel;
-} xglPixmapFormatRec, *xglPixmapFormatPtr;
+ Bool pbuffer;
+ struct {
+ glitz_drawable_format_t *drawable;
+ glitz_format_t *surface;
+ } format;
+} xglVisualRec, *xglVisualPtr;
extern xglVisualPtr xglVisuals;
-extern int nxglVisuals;
#define xglAreaAvailable 0
#define xglAreaDivided 1
@@ -111,7 +140,7 @@
typedef struct _xglAreaFuncs {
Bool (*Create) (xglAreaPtr pArea);
-
+
Bool (*MoveIn) (xglAreaPtr pArea,
pointer closure);
@@ -121,7 +150,7 @@
int (*CompareScore) (xglAreaPtr pArea,
pointer closure1,
pointer closure2);
-
+
} xglAreaFuncsRec, *xglAreaFuncsPtr;
typedef struct _xglRootArea {
@@ -163,7 +192,7 @@
} xglRangeRec, *xglRangePtr;
typedef struct _xglGlyphTexture {
- glitz_surface_t *mask;
+ PicturePtr pMask;
glitz_pixel_format_t pixel;
glitz_geometry_format_t format;
int geometryDataType;
@@ -203,11 +232,18 @@
typedef struct _xglScreen {
xglVisualPtr pVisual;
- xglPixmapFormatRec pixmapFormats[33];
+
+#ifdef GLXEXT
+ xglVisualPtr pGlxVisual;
+#endif
+
+#ifdef XV
+ xglVisualRec pXvVisual[XGL_XV_FORMAT_NUM];
+#endif
+
+ xglVisualPtr rootVisual;
glitz_drawable_t *drawable;
glitz_surface_t *surface;
- glitz_surface_t *backSurface;
- glitz_surface_t *solid;
PixmapPtr pScreenPixmap;
unsigned long features;
int geometryUsage;
@@ -215,22 +251,22 @@
Bool yInverted;
int pboMask;
Bool lines;
- Bool fbo;
xglGeometryRec scratchGeometry;
-
+ xglScreenAccelInfoRec accel;
+
#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;
+ DestroyWindowProcPtr DestroyWindow;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
PaintWindowBackgroundProcPtr PaintWindowBackground;
PaintWindowBorderProcPtr PaintWindowBorder;
@@ -255,16 +291,11 @@
#endif
BSFuncRec BackingStoreFuncs;
-
-#ifdef GLXEXT
- DestroyWindowProcPtr DestroyWindow;
-#endif
-
} xglScreenRec, *xglScreenPtr;
extern int xglScreenPrivateIndex;
-#define XGL_GET_SCREEN_PRIV(pScreen) \
+#define XGL_GET_SCREEN_PRIV(pScreen) \
((xglScreenPtr) (pScreen)->devPrivates[xglScreenPrivateIndex].ptr)
#define XGL_SET_SCREEN_PRIV(pScreen, v) \
@@ -290,17 +321,17 @@
#endif
#define xglGCSoftwareDrawableFlag (1L << 0)
-#define xglGCReadOnlyDrawableFlag (1L << 1)
-#define xglGCBadFunctionFlag (1L << 2)
-#define xglGCPlaneMaskFlag (1L << 3)
-
+#define xglGCBadFunctionFlag (1L << 1)
+#define xglGCPlaneMaskFlag (1L << 2)
+
typedef struct _xglGC {
- glitz_color_t fg;
- glitz_color_t bg;
- glitz_operator_t op;
- unsigned long flags;
- GCFuncsPtr funcs;
- GCOpsPtr ops;
+ glitz_surface_t *fg;
+ glitz_surface_t *bg;
+ glitz_format_id_t id;
+ glitz_operator_t op;
+ unsigned long flags;
+ GCFuncsPtr funcs;
+ GCOpsPtr ops;
} xglGCRec, *xglGCPtr;
extern int xglGCPrivateIndex;
@@ -321,7 +352,7 @@
#define xglPCFillMask (1L << 0)
#define xglPCFilterMask (1L << 1)
-#define xglPCTransformMask (1L << 2)
+#define xglPCTransformMask (1L << 2)
#define xglPCComponentAlphaMask (1L << 3)
#define xglPCDitherMask (1L << 4)
@@ -331,22 +362,36 @@
#define xglPixmapTargetOut 1
#define xglPixmapTargetIn 2
+#ifdef XV
+
+typedef struct _xglXvPort {
+ PixmapPtr pPixmap;
+ PicturePtr pSrc;
+ PicturePtr pDst;
+} xglXvPortRec, *xglXvPortPtr;
+
+#endif
+
typedef struct _xglPixmap {
- xglPixelFormatPtr pPixel;
- glitz_format_t *format;
- glitz_surface_t *surface;
- glitz_buffer_t *buffer;
- int target;
- Bool acceleratedTile;
- pointer bits;
- int stride;
- DamagePtr pDamage;
- BoxRec damageBox;
- BoxRec bitBox;
- Bool allBits;
- unsigned long pictureMask;
- xglGeometryPtr pGeometry;
- int lock;
+ xglVisualPtr pVisual;
+ glitz_surface_t *surface;
+ glitz_drawable_t *drawable;
+ glitz_buffer_t *buffer;
+ int target;
+ Bool acceleratedTile;
+ pointer bits;
+ int stride;
+ DamagePtr pDamage;
+ BoxRec damageBox;
+ RegionRec bitRegion;
+ Bool allBits;
+ unsigned long pictureMask;
+ xglGeometryPtr pGeometry;
+
+#ifdef XV
+ xglXvPortPtr pPortPriv;
+#endif
+
} xglPixmapRec, *xglPixmapPtr;
extern int xglPixmapPrivateIndex;
@@ -361,7 +406,7 @@
#define XGL_PICTURE_FAILURES(pictureMask) (pictureMask & 0xffff0000)
typedef struct _xglWin {
- PixmapPtr pPixmap;
+ PixmapPtr pPixmap;
} xglWinRec, *xglWinPtr;
extern int xglWinPrivateIndex;
@@ -460,27 +505,41 @@
void
xglSetPixmapFormats (ScreenInfo *pScreenInfo);
+void
+xglSetRootClip (ScreenPtr pScreen,
+ Bool enable);
+
/* xglcmap.c */
void
-xglSetVisualTypesAndMasks (ScreenInfo *pScreenInfo,
- glitz_drawable_format_t *format,
- unsigned long visuals);
+xglSetVisualTypes (int depth,
+ int visuals,
+ int redSize,
+ int greenSize,
+ int blueSize);
-void
-xglInitVisuals (ScreenInfo *pScreenInfo);
+Bool
+xglHasVisualTypes (xglVisualPtr pVisual,
+ int depth);
-void
-xglClearVisualTypes (void);
+glitz_format_t *
+xglFindBestSurfaceFormat (ScreenPtr pScreen,
+ xglPixelFormatPtr pPixel);
void
-xglInitPixmapFormats (ScreenPtr pScreen);
+xglInitVisuals (ScreenPtr pScreen);
+
+xglVisualPtr
+xglFindVisualWithDepth (ScreenPtr pScreen,
+ int depth);
+
+xglVisualPtr
+xglFindVisualWithId (ScreenPtr pScreen,
+ int vid);
void
-xglPixelToColor (xglPixelFormatPtr pFormat,
- CARD32 pixel,
- glitz_color_t *color);
+xglClearVisualTypes (void);
/* xglparse.c */
@@ -677,7 +736,7 @@
#define GEOMETRY_ADD_REGION_AT(pScreen, pGeometry, pRegion, offset) \
xglGeometryAddBox (pScreen, pGeometry, \
REGION_RECTS (pRegion), \
- REGION_NUM_RECTS (pRegion), \
+ REGION_NUM_RECTS (pRegion), \
offset)
#define GEOMETRY_ADD_REGION(pScreen, pGeometry, pRegion) \
@@ -789,7 +848,7 @@
int count);
Bool
-xglSetGeometry (xglGeometryPtr pGeometry,
+xglSetGeometry (xglGeometryPtr pGeometry,
glitz_surface_t *surface);
@@ -810,7 +869,7 @@
PixmapPtr
xglCreatePixmap (ScreenPtr pScreen,
int width,
- int height,
+ int height,
int depth);
void
@@ -828,6 +887,10 @@
int devKind,
pointer pPixData);
+void
+xglSetPixmapVisual (PixmapPtr pPixmap,
+ xglVisualPtr pVisual);
+
RegionPtr
xglPixmapToRegion (PixmapPtr pPixmap);
@@ -848,6 +911,14 @@
Bool
xglUnmapPixmapBits (PixmapPtr pPixmap);
+Bool
+xglCheckPixmapSize (PixmapPtr pPixmap,
+ xglSizeConstraintPtr pSize);
+
+void
+xglEnablePixmapAccel (PixmapPtr pPixmap,
+ xglAccelInfoPtr pAccel);
+
/* xglsync.c */
@@ -884,7 +955,7 @@
Bool
xglSolid (DrawablePtr pDrawable,
glitz_operator_t op,
- glitz_color_t *color,
+ glitz_surface_t *solid,
xglGeometryPtr pGeometry,
int x,
int y,
@@ -957,7 +1028,7 @@
xglFill (DrawablePtr pDrawable,
GCPtr pGC,
xglGeometryPtr pGeometry,
- int x,
+ int x,
int y,
int width,
int height,
@@ -972,8 +1043,8 @@
int *pwidth);
void
-xglFillRect (DrawablePtr pDrawable,
- GCPtr pGC,
+xglFillRect (DrawablePtr pDrawable,
+ GCPtr pGC,
int nrect,
xRectangle *prect);
@@ -986,7 +1057,7 @@
Bool
xglFillSegment (DrawablePtr pDrawable,
- GCPtr pGC,
+ GCPtr pGC,
int nsegInit,
xSegment *pSegInit);
@@ -1006,12 +1077,15 @@
xglCreateWindow (WindowPtr pWin);
Bool
+xglDestroyWindow (WindowPtr pWin);
+
+Bool
xglChangeWindowAttributes (WindowPtr pWin,
unsigned long mask);
-void
-xglCopyWindow (WindowPtr pWin,
- DDXPointRec ptOldOrg,
+void
+xglCopyWindow (WindowPtr pWin,
+ DDXPointRec ptOldOrg,
RegionPtr prgnSrc);
void
@@ -1024,6 +1098,13 @@
RegionPtr pRegion,
int what);
+PixmapPtr
+xglGetWindowPixmap (WindowPtr pWin);
+
+void
+xglSetWindowPixmap (WindowPtr pWin,
+ PixmapPtr pPixmap);
+
/* xglbstore.c */
@@ -1055,11 +1136,11 @@
char *d);
void
-xglGetSpans (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
+xglGetSpans (DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
char *pchardstStart);
@@ -1069,6 +1150,9 @@
xglCreateGC (GCPtr pGC);
void
+xglDestroyGC (GCPtr pGC);
+
+void
xglValidateGC (GCPtr pGC,
unsigned long changes,
DrawablePtr pDrawable);
@@ -1141,13 +1225,13 @@
void
xglPolySegment (DrawablePtr pDrawable,
- GCPtr pGC,
+ GCPtr pGC,
int nsegInit,
xSegment *pSegInit);
void
xglPolyArc (DrawablePtr pDrawable,
- GCPtr pGC,
+ GCPtr pGC,
int narcs,
xArc *pArcs);
@@ -1159,7 +1243,7 @@
void
xglPolyFillArc (DrawablePtr pDrawable,
- GCPtr pGC,
+ GCPtr pGC,
int narcs,
xArc *pArcs);
@@ -1214,25 +1298,6 @@
#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
@@ -1270,8 +1335,18 @@
xFixed *params,
int nparams);
-void
-xglUpdatePicture (PicturePtr pPicture);
+PicturePtr
+xglCreateDevicePicture (pointer data);
+
+Bool
+xglSyncPicture (ScreenPtr pScreen,
+ PicturePtr pPicture,
+ INT16 x,
+ INT16 y,
+ CARD16 width,
+ CARD16 height,
+ INT16 *xOff,
+ INT16 *yOff);
Bool
xglPictureInit (ScreenPtr pScreen);
@@ -1280,6 +1355,25 @@
xglPictureClipExtents (PicturePtr pPicture,
BoxPtr extents);
+
+/* xglcompose.c */
+
+Bool
+xglCompositeGeneral (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ xglGeometryPtr pGeometry,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+
/* xglglyph.c */
Bool
@@ -1331,6 +1425,7 @@
#endif
+
#ifdef XLOADABLE
/* xglloader.c */
@@ -1341,7 +1436,8 @@
} xglSymbolRec, *xglSymbolPtr;
void *
-xglLoadModule (const char *name);
+xglLoadModule (const char *name,
+ int flag);
void
xglUnloadModule (void *handle);
@@ -1353,18 +1449,17 @@
#endif
-#ifdef GLXEXT
-/* xglglx.c */
+/* xglxv.c */
-Bool
-xglLoadGLXModules (void);
+#ifdef XV
-void
-xglUnloadGLXModules (void);
+Bool
+xglXvScreenInit (ScreenPtr pScreen);
#endif
+
/* xglhash.c */
typedef struct _xglHashTable *xglHashTablePtr;
Index: xglarea.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglarea.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xglarea.c 8 Mar 2005 08:48:22 -0000 1.2
+++ xglarea.c 3 Jan 2006 09:56:22 -0000 1.3
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -31,7 +31,7 @@
{
pArea->closure = closure;
pArea->state = xglAreaOccupied;
-
+
return (*pArea->pRoot->funcs->MoveIn) (pArea, closure);
}
@@ -54,7 +54,7 @@
{
xglAreaPtr pArea;
int n = 4;
-
+
pArea = xalloc (sizeof (xglAreaRec) + pRoot->devPrivateSize);
if (!pArea)
return NULL;
@@ -67,7 +67,7 @@
pArea->pRoot = pRoot;
pArea->closure = (pointer) 0;
pArea->state = xglAreaAvailable;
-
+
while (n--)
pArea->pArea[n] = NULL;
@@ -81,13 +81,13 @@
free (pArea);
return NULL;
}
-
+
return pArea;
}
static void
xglAreaDestroy (xglAreaPtr pArea)
-{
+{
if (!pArea)
return;
@@ -98,11 +98,11 @@
else
{
int n = 4;
-
+
while (n--)
xglAreaDestroy (pArea->pArea[n]);
}
-
+
xfree (pArea);
}
@@ -111,7 +111,7 @@
{
if (!pArea)
return NULL;
-
+
switch (pArea->state) {
case xglAreaOccupied:
return pArea;
@@ -120,7 +120,7 @@
case xglAreaDivided: {
xglAreaPtr tmp, top = NULL;
int i;
-
+
for (i = 0; i < 4; i++)
{
tmp = xglAreaGetTopScoredSubArea (pArea->pArea[i]);
@@ -139,7 +139,7 @@
return top;
}
}
-
+
return NULL;
}
@@ -161,11 +161,11 @@
pArea->closure,
closure) >= 0)
return FALSE;
-
+
xglAreaMoveOut (pArea);
} else
return FALSE;
-
+
/* fall-through */
case xglAreaAvailable:
{
@@ -178,15 +178,15 @@
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])
@@ -210,7 +210,7 @@
}
pArea->state = xglAreaDivided;
-
+
if (xglAreaFind (pArea->pArea[0], width, height, kickOut, closure))
return TRUE;
}
@@ -230,7 +230,7 @@
if (xglFindArea (pArea->pArea[i], width, height, kickOut,
closure))
return TRUE;
-
+
rejected = TRUE;
}
}
@@ -257,12 +257,12 @@
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;
}
@@ -286,7 +286,7 @@
pRoot->pArea = xglAreaCreate (pRoot, 0, 0, 0, width, height);
if (!pRoot->pArea)
return FALSE;
-
+
return TRUE;
}
@@ -298,7 +298,7 @@
void
xglLeaveArea (xglAreaPtr pArea)
-{
+{
xglAreaMoveOut (pArea);
}
Index: xglbstore.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglbstore.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xglbstore.c 26 Jan 2005 10:58:52 -0000 1.3
+++ xglbstore.c 3 Jan 2006 09:56:22 -0000 1.4
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -69,12 +69,12 @@
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);
+ BackingStoreFuncs.SaveAreas);
(*pScreen->BackingStoreFuncs.SaveAreas) (pPixmap, prgnSave,
xorg, yorg, pWin);
XGL_BSTORE_FALLBACK_EPILOGUE (&pPixmap->drawable,
@@ -111,10 +111,10 @@
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,
Index: xglcmap.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglcmap.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- xglcmap.c 23 Dec 2005 02:07:58 -0000 1.8
+++ xglcmap.c 3 Jan 2006 09:56:22 -0000 1.9
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,18 +12,17 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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 novell.com>
*/
-#include <stdint.h>
#include "xgl.h"
#include "colormapst.h"
#include "micmap.h"
@@ -81,225 +80,387 @@
#define NUM_XGL_PIXEL_FORMATS \
(sizeof (xglPixelFormats) / sizeof (xglPixelFormats[0]))
-xglVisualPtr xglVisuals = NULL;
-int nxglVisuals = 0;
-
-xglVisualPtr xglPbufferVisuals = NULL;
-int nxglPbufferVisuals = 0;
+xglVisualPtr xglVisuals = NULL;
-static xglPixelFormatPtr
-xglFindPixelFormat (glitz_drawable_format_t *format,
- int visuals)
+void
+xglSetVisualTypes (int depth,
+ int visuals,
+ int redSize,
+ int greenSize,
+ int blueSize)
{
- glitz_color_format_t *color;
- int depth, i;
-
- color = &format->color;
-
- depth = color->red_size + color->green_size + color->blue_size;
+ xglPixelFormatPtr pBestFormat = 0;
+ int i, rs, gs, bs, diff, bestDiff = 0;
- 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)
{
-
- if (visuals)
- return pPixel;
+ rs = Ones (xglPixelFormats[i].masks.red_mask);
+ gs = Ones (xglPixelFormats[i].masks.green_mask);
+ bs = Ones (xglPixelFormats[i].masks.blue_mask);
- if (Ones (pPixel->masks.alpha_mask) == color->alpha_size)
- return pPixel;
+ if (redSize >= rs &&
+ greenSize >= gs &&
+ blueSize >= bs)
+ {
+ diff = (redSize - rs) + (greenSize - gs) + (blueSize - bs);
+ if (pBestFormat)
+ {
+ if (diff < bestDiff)
+ {
+ pBestFormat = &xglPixelFormats[i];
+ bestDiff = diff;
+ }
+ }
+ else
+ {
+ pBestFormat = &xglPixelFormats[i];
+ bestDiff = diff;
+ }
+ }
+ }
+ else
+ {
+ pBestFormat = &xglPixelFormats[i];
+ break;
}
}
}
-
- return NULL;
-}
-void
-xglSetVisualTypesAndMasks (ScreenInfo *pScreenInfo,
- glitz_drawable_format_t *format,
- unsigned long visuals)
-{
- xglPixelFormatPtr pPixelFormat;
+ if (pBestFormat)
+ {
+ xglVisualPtr new, *prev, v;
+ unsigned int bitsPerRGB;
+ Pixel rm, gm, bm;
- pPixelFormat = xglFindPixelFormat (format, visuals);
- if (pPixelFormat)
+ new = xalloc (sizeof (xglVisualRec));
+ if (!new)
+ return;
+
+ new->next = 0;
+
+ new->format.surface = 0;
+ new->format.drawable = 0;
+ new->pPixel = pBestFormat;
+ new->vid = 0;
+
+ bitsPerRGB = pBestFormat->bitsPerRGB;
+
+ rm = pBestFormat->masks.red_mask;
+ gm = pBestFormat->masks.green_mask;
+ bm = pBestFormat->masks.blue_mask;
+
+ fbSetVisualTypesAndMasks (depth, visuals, bitsPerRGB, rm, gm, bm);
+
+ for (prev = &xglVisuals; (v = *prev); prev = &v->next);
+ *prev = new;
+ }
+ else
{
- if (visuals)
- {
- xglVisuals = xrealloc (xglVisuals,
- (nxglVisuals + 1) * sizeof (xglVisualRec));
-
- if (xglVisuals)
- {
- xglVisuals[nxglVisuals].format = format;
- xglVisuals[nxglVisuals].pPixel = pPixelFormat;
- xglVisuals[nxglVisuals].visuals = visuals;
- nxglVisuals++;
- }
- }
+ fbSetVisualTypesAndMasks (depth, 0, 0, 0, 0, 0);
}
}
-void
-xglInitVisuals (ScreenInfo *pScreenInfo)
+Bool
+xglHasVisualTypes (xglVisualPtr pVisual,
+ int depth)
{
- int i, j;
+ xglVisualPtr v;
- 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 (v = pVisual; v; v = v->next)
+ if (v->pPixel->depth == depth)
+ return TRUE;
- 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;
+ return FALSE;
+}
- fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
- visuals, bitsPerRGB,
- rm, gm, bm);
- }
- }
+glitz_format_t *
+xglFindBestSurfaceFormat (ScreenPtr pScreen,
+ xglPixelFormatPtr pPixel)
+{
+ glitz_format_t templ, *format, *best = 0;
+ unsigned int mask;
+ unsigned short rs, gs, bs, as;
+ int i = 0;
- if (!visuals)
+ XGL_SCREEN_PRIV (pScreen);
+
+ rs = Ones (pPixel->masks.red_mask);
+ gs = Ones (pPixel->masks.green_mask);
+ bs = Ones (pPixel->masks.blue_mask);
+ as = Ones (pPixel->masks.alpha_mask);
+
+ templ.color.fourcc = GLITZ_FOURCC_RGB;
+ mask = GLITZ_FORMAT_FOURCC_MASK;
+
+ do {
+ format = glitz_find_format (pScreenPriv->drawable, mask, &templ, i++);
+ if (format)
{
- for (j = 0; j < NUM_XGL_PIXEL_FORMATS; j++)
+ if (format->color.red_size >= rs &&
+ format->color.green_size >= gs &&
+ format->color.blue_size >= bs &&
+ format->color.alpha_size >= as)
{
- if (pScreenInfo->formats[i].depth == xglPixelFormats[j].depth)
+ if (best)
{
- bitsPerRGB = xglPixelFormats[j].bitsPerRGB;
-
- rm = xglPixelFormats[j].masks.red_mask;
- gm = xglPixelFormats[j].masks.green_mask;
- bm = xglPixelFormats[j].masks.blue_mask;
- break;
+ 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;
}
}
-
- fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
- visuals, bitsPerRGB,
- rm, gm, bm);
}
+ } while (format);
+
+ return best;
+}
+
+static Bool
+xglInitVisual (ScreenPtr pScreen,
+ xglVisualPtr pVisual,
+ xglPixelFormatPtr pPixel,
+ VisualID vid)
+{
+ glitz_format_t *format;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ format = xglFindBestSurfaceFormat (pScreen, pPixel);
+ if (format)
+ {
+ glitz_drawable_format_t templ;
+ unsigned long mask;
+
+ templ.color = format->color;
+ templ.depth_size = 0;
+ templ.stencil_size = 0;
+ templ.doublebuffer = 0;
+ templ.samples = 1;
+
+ mask =
+ GLITZ_FORMAT_FOURCC_MASK |
+ GLITZ_FORMAT_RED_SIZE_MASK |
+ GLITZ_FORMAT_GREEN_SIZE_MASK |
+ GLITZ_FORMAT_BLUE_SIZE_MASK |
+ GLITZ_FORMAT_ALPHA_SIZE_MASK |
+ GLITZ_FORMAT_DEPTH_SIZE_MASK |
+ GLITZ_FORMAT_STENCIL_SIZE_MASK |
+ GLITZ_FORMAT_DOUBLEBUFFER_MASK |
+ GLITZ_FORMAT_SAMPLES_MASK;
+
+ pVisual->next = 0;
+ pVisual->vid = vid;
+ pVisual->pPixel = pPixel;
+ pVisual->pbuffer = FALSE;
+
+ pVisual->format.surface = format;
+ pVisual->format.drawable =
+ glitz_find_drawable_format (pScreenPriv->drawable,
+ mask, &templ, 0);
+
+ return TRUE;
}
+
+ return FALSE;
}
-void
-xglClearVisualTypes (void)
+static Bool
+xglInitPbufferVisual (ScreenPtr pScreen,
+ xglVisualPtr pVisual,
+ xglPixelFormatPtr pPixel,
+ VisualID vid)
{
- nxglVisuals = 0;
- nxglPbufferVisuals = 0;
+ glitz_format_t *format;
- if (xglVisuals)
- xfree (xglVisuals);
+ XGL_SCREEN_PRIV (pScreen);
- if (xglPbufferVisuals)
- xfree (xglPbufferVisuals);
+ format = xglFindBestSurfaceFormat (pScreen, pPixel);
+ if (format)
+ {
+ glitz_drawable_format_t templ, *screenFormat;
+ unsigned long mask;
- xglVisuals = NULL;
- xglPbufferVisuals = NULL;
+ /* use same drawable format as screen for pbuffers */
+ screenFormat = glitz_drawable_get_format (pScreenPriv->drawable);
+ templ.id = screenFormat->id;
- miClearVisualTypes ();
+ templ.color = format->color;
+ templ.samples = 1;
+
+ mask =
+ GLITZ_FORMAT_ID_MASK |
+ GLITZ_FORMAT_FOURCC_MASK |
+ GLITZ_FORMAT_RED_SIZE_MASK |
+ GLITZ_FORMAT_GREEN_SIZE_MASK |
+ GLITZ_FORMAT_BLUE_SIZE_MASK |
+ GLITZ_FORMAT_SAMPLES_MASK;
+
+ pVisual->next = 0;
+ pVisual->vid = vid;
+ pVisual->pPixel = pPixel;
+ pVisual->pbuffer = TRUE;
+
+ pVisual->format.surface = format;
+ pVisual->format.drawable =
+ glitz_find_pbuffer_format (pScreenPriv->drawable,
+ mask, &templ, 0);
+
+ if (pVisual->format.drawable)
+ return TRUE;
+ }
+
+ return FALSE;
}
void
-xglInitPixmapFormats (ScreenPtr pScreen)
+xglInitVisuals (ScreenPtr pScreen)
{
- glitz_format_t *format, **best;
- int i, j;
-
+ xglVisualPtr pVisual, v, new, *prev;
+ int i;
+
XGL_SCREEN_PRIV (pScreen);
- for (i = 0; i < 33; i++)
+ for (i = 0; i < pScreen->numVisuals; i++)
{
- pScreenPriv->pixmapFormats[i].pPixel = NULL;
- pScreenPriv->pixmapFormats[i].format = NULL;
-
- for (j = 0; j < NUM_XGL_PIXEL_FORMATS; j++)
+ for (pVisual = xglVisuals; pVisual; pVisual = pVisual->next)
+ if (pVisual->pPixel->depth == pScreen->visuals[i].nplanes)
+ break;
+
+ if (pVisual)
{
- if (xglPixelFormats[j].depth == i)
+ new = xalloc (sizeof (xglVisualRec));
+ if (new)
{
- int rs, gs, bs, as, k;
-
- pScreenPriv->pixmapFormats[i].pPixel = &xglPixelFormats[j];
- pScreenPriv->pixmapFormats[i].format = NULL;
- best = &pScreenPriv->pixmapFormats[i].format;
+ if (xglInitVisual (pScreen, new, pVisual->pPixel,
+ pScreen->visuals[i].vid))
+ {
+ new->next = 0;
- 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);
+ prev = &pScreenPriv->pVisual;
+ while ((v = *prev))
+ prev = &v->next;
- k = 0;
- do {
- format = glitz_find_format (pScreenPriv->drawable,
- 0, NULL, k++);
- if (format && format->color.fourcc == GLITZ_FOURCC_RGB)
+ *prev = new;
+ }
+ else
+ {
+ xfree (new);
+ }
+ }
+
+ new = xalloc (sizeof (xglVisualRec));
+ if (new)
+ {
+ if (xglInitPbufferVisual (pScreen, new, pVisual->pPixel,
+ pScreen->visuals[i].vid))
+ {
+ new->next = 0;
+
+ prev = &pScreenPriv->pVisual;
+ while ((v = *prev))
+ prev = &v->next;
+
+ *prev = new;
+ }
+ else
+ {
+ xfree (new);
+ }
+ }
+ }
+ }
+
+ /* Add additional Xgl visuals for pixmap formats */
+ for (i = 0; i < screenInfo.numPixmapFormats; i++)
+ {
+ if (!xglHasVisualTypes (pScreenPriv->pVisual,
+ screenInfo.formats[i].depth))
+ {
+ for (v = xglVisuals; v; v = v->next)
+ if (v->pPixel->depth == screenInfo.formats[i].depth)
+ break;
+
+ if (v)
+ {
+ new = xalloc (sizeof (xglVisualRec));
+ if (new)
+ {
+ if (xglInitVisual (pScreen, new, v->pPixel, 0))
{
- /* 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;
- }
+ new->next = 0;
+
+ prev = &pScreenPriv->pVisual;
+ while ((v = *prev))
+ prev = &v->next;
+
+ *prev = new;
}
- } while (format);
+ else
+ {
+ xfree (new);
+ }
+ }
}
}
}
}
-#define PIXEL_TO_COLOR(p, mask) \
- (((uint32_t) ((((uint64_t) (((uint32_t) (p)) & (mask))) * 0xffffffff) / \
- ((uint64_t) (mask)))))
+xglVisualPtr
+xglFindVisualWithDepth (ScreenPtr pScreen,
+ int depth)
+{
+ xglVisualPtr v;
-#define PIXEL_TO_RGB_COLOR(p, mask) \
- ((mask)? PIXEL_TO_COLOR (p, mask): 0)
+ XGL_SCREEN_PRIV (pScreen);
+
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->pPixel->depth == depth)
+ return v;
+ }
+
+ return 0;
+}
+
+xglVisualPtr
+xglFindVisualWithId (ScreenPtr pScreen,
+ int vid)
+{
+ xglVisualPtr v;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->vid == vid)
+ return v;
+ }
+
+ return 0;
+}
void
-xglPixelToColor (xglPixelFormatPtr pFormat,
- CARD32 pixel,
- glitz_color_t *color)
+xglClearVisualTypes (void)
{
- 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;
+ xglVisualPtr v;
+
+ while (xglVisuals)
+ {
+ v = xglVisuals;
+ xglVisuals = v->next;
+ xfree (v);
+ }
+
+ miClearVisualTypes ();
}
--- xglcomp.c DELETED ---
--- NEW FILE: xglcompose.c ---
(This appears to be a binary file; contents omitted.)
Index: xglcopy.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglcopy.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- xglcopy.c 23 Dec 2005 01:50:04 -0000 1.8
+++ xglcopy.c 3 Jan 2006 09:56:22 -0000 1.9
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -38,6 +38,8 @@
int srcXoff, srcYoff;
int dstXoff, dstYoff;
+ XGL_DRAWABLE_PIXMAP (pDst);
+
if (!nBox)
return TRUE;
@@ -50,11 +52,11 @@
{
if (!xglPrepareTarget (pSrc))
return FALSE;
-
+
if (!xglSyncSurface (pDst))
return FALSE;
}
-
+
XGL_GET_DRAWABLE (pSrc, src, srcXoff, srcYoff);
XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff);
@@ -64,18 +66,18 @@
glitz_copy_area (src,
dst,
- pDst->x + srcXoff + dx,
- pDst->y + srcYoff + dy,
- pDst->width,
- pDst->height,
- pDst->x + dstXoff,
- pDst->y + dstYoff);
+ srcXoff + dx,
+ srcYoff + dy,
+ pPixmap->drawable.width - dstXoff,
+ pPixmap->drawable.height - dstYoff,
+ dstXoff,
+ dstYoff);
glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
-
+
if (glitz_surface_get_status (dst))
return FALSE;
-
+
return TRUE;
}
@@ -96,24 +98,16 @@
if (!xglCopy (pSrc, pDst, dx, dy, pBox, nBox))
{
- RegionPtr pDamageRegion;
- glitz_surface_t *dst;
- int dstXoff, dstYoff;
- RegionRec region;
- BoxRec box;
-
+ RegionRec region;
+
XGL_DRAWABLE_PIXMAP (pDst);
XGL_PIXMAP_PRIV (pPixmap);
- XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff);
-
- pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
+ if (!xglSyncBits (pSrc, pSrcBox))
+ FatalError (XGL_SW_FAILURE_STRING);
if (!xglMapPixmapBits (pPixmap))
FatalError (XGL_SW_FAILURE_STRING);
-
- if (!xglSyncBits (pSrc, pSrcBox))
- FatalError (XGL_SW_FAILURE_STRING);
fbCopyNtoN (pSrc, pDst, pGC,
pBox, nBox,
@@ -122,19 +116,11 @@
(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, ®ion, &box, 1);
- REGION_UNION (pDst->pScreen,
- pDamageRegion, pDamageRegion, ®ion);
+ REGION_INIT (pDst->pScreen, ®ion, pBox, 1);
+ xglAddSurfaceDamage (pDst, ®ion);
REGION_UNINIT (pDst->pScreen, ®ion);
pBox++;
Index: xglfill.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglfill.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- xglfill.c 27 Apr 2005 10:34:33 -0000 1.7
+++ xglfill.c 3 Jan 2006 09:56:22 -0000 1.8
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -31,7 +31,7 @@
xglFill (DrawablePtr pDrawable,
GCPtr pGC,
xglGeometryPtr pGeometry,
- int x,
+ int x,
int y,
int width,
int height,
@@ -43,7 +43,7 @@
switch (pGC->fillStyle) {
case FillSolid:
if (xglSolid (pDrawable,
- pGCPriv->op, &pGCPriv->fg,
+ pGCPriv->op, pGCPriv->fg,
pGeometry,
x, y,
width, height,
@@ -70,26 +70,21 @@
}
static void
-xglFillBox (DrawablePtr pDrawable,
+xglFillBox (DrawablePtr pDrawable,
GCPtr pGC,
- int x,
+ int x,
int y,
int width,
int height,
BoxPtr pBox,
int nBox)
{
- BoxRec box;
-
if (!nBox)
- return;
-
+ return;
+
if (!xglFill (pDrawable, pGC, NULL, x, y, width, height, pBox, nBox))
{
- RegionRec region;
- RegionPtr pDamageRegion;
- glitz_surface_t *surface;
- int xOff, yOff;
+ RegionRec region;
XGL_DRAWABLE_PIXMAP (pDrawable);
XGL_PIXMAP_PRIV (pPixmap);
@@ -111,31 +106,18 @@
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, ®ion, &box, 1);
- REGION_UNION (pDrawable->pScreen,
- pDamageRegion, pDamageRegion, ®ion);
- REGION_UNINIT (pDrawable->pScreen, ®ion);
- }
-
+ REGION_INIT (pDrawable->pScreen, ®ion, pBox, 1);
+ xglAddSurfaceDamage (pDrawable, ®ion);
+ REGION_UNINIT (pDrawable->pScreen, ®ion);
+
pBox++;
}
} else
@@ -150,11 +132,11 @@
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);
@@ -182,8 +164,8 @@
}
void
-xglFillRect (DrawablePtr pDrawable,
- GCPtr pGC,
+xglFillRect (DrawablePtr pDrawable,
+ GCPtr pGC,
int nrect,
xRectangle *prect)
{
@@ -205,19 +187,19 @@
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;
+ 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)
{
@@ -238,7 +220,7 @@
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);
}
@@ -249,7 +231,7 @@
pExtent->x1, pExtent->y1,
pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
(heapBox) ? heapBox : stackBox, nBox);
-
+
if (heapBox)
xfree (heapBox);
}
@@ -280,19 +262,19 @@
pwidth++;
ppt++;
-
+
if (full.x1 < pExtent->x1)
full.x1 = pExtent->x1;
if (full.y1 < pExtent->y1)
- 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)
{
@@ -313,7 +295,7 @@
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);
}
@@ -324,7 +306,7 @@
pExtent->x1, pExtent->y1,
pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
(heapBox) ? heapBox : stackBox, nBox);
-
+
if (heapBox)
xfree (heapBox);
}
@@ -346,28 +328,28 @@
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;
}
@@ -383,7 +365,7 @@
pt = *pptTmp++;
}
-
+
if (ppt[npt - 1].x == ppt->x && ppt[npt - 1].y == ppt->y)
coincidentEndpoints = TRUE;
}
@@ -403,7 +385,7 @@
ppt++;
npt--;
-
+
while (npt--)
{
if (mode == CoordModePrevious)
@@ -416,13 +398,13 @@
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
@@ -437,7 +419,7 @@
else
full.x1 = full.x2 + dx - 1;
}
-
+
full.y1 = pt.y + pDrawable->y;
full.y2 = full.y1 + 1;
}
@@ -446,7 +428,7 @@
if (dy > 0)
{
full.y1 = pt.y + pDrawable->y;
-
+
if (npt || coincidentEndpoints)
full.y2 = full.y1 + dy;
else
@@ -461,28 +443,28 @@
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;
+ 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)
{
@@ -503,7 +485,7 @@
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);
}
@@ -514,7 +496,7 @@
pExtent->x1, pExtent->y1,
pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
(heapBox) ? heapBox : stackBox, nBox);
-
+
if (heapBox)
xfree (heapBox);
@@ -526,9 +508,9 @@
if (coincidentEndpoints)
npt--;
-
+
pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, npt);
-
+
GEOMETRY_ADD_LINE (pGC->pScreen, pGeometry,
coincidentEndpoints, mode, npt, ppt);
@@ -539,24 +521,27 @@
/* 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)))
+ {
+ xglAddCurrentBitDamage (pDrawable);
return TRUE;
-
+ }
+
return FALSE;
}
Bool
xglFillSegment (DrawablePtr pDrawable,
- GCPtr pGC,
+ GCPtr pGC,
int nSegInit,
xSegment *pSegInit)
{
@@ -632,19 +617,19 @@
}
pSegInit++;
-
+
if (full.x1 < pExtent->x1)
full.x1 = pExtent->x1;
if (full.y1 < pExtent->y1)
- 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)
{
@@ -665,7 +650,7 @@
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);
}
@@ -676,7 +661,7 @@
pExtent->x1, pExtent->y1,
pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
(heapBox) ? heapBox : stackBox, nBox);
-
+
if (heapBox)
xfree (heapBox);
@@ -685,24 +670,27 @@
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)))
+ {
+ xglAddCurrentBitDamage (pDrawable);
return TRUE;
-
+ }
+
return FALSE;
}
@@ -745,9 +733,10 @@
REGION_NUM_RECTS (pGC->pCompositeClip)))
{
GEOMETRY_UNINIT (&geometry);
+ xglAddCurrentBitDamage (pDrawable);
return TRUE;
}
-
+
GEOMETRY_UNINIT (&geometry);
return FALSE;
}
Index: xglgc.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglgc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- xglgc.c 27 Apr 2005 09:29:33 -0000 1.8
+++ xglgc.c 3 Jan 2006 09:56:22 -0000 1.9
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -58,7 +58,7 @@
xglValidateGC,
miChangeGC,
miCopyGC,
- miDestroyGC,
+ xglDestroyGC,
miChangeClip,
miDestroyClip,
miCopyClip
@@ -123,7 +123,7 @@
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);
@@ -163,7 +163,7 @@
XGL_GC_UNWRAP (funcs);
XGL_GC_UNWRAP (ops);
-
+
(*pGC->ops->PutImage) (pDrawable, pGC, depth,
x, y, w, h, leftPad, format, bits);
@@ -174,7 +174,7 @@
box.y1 = pDrawable->y + y;
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
-
+
REGION_INIT (pDrawable->pScreen, ®ion, &box, 1);
REGION_INTERSECT (pDrawable->pScreen, ®ion, pClip, ®ion);
@@ -197,7 +197,7 @@
{
RegionPtr pRegion;
BoxRec box;
-
+
XGL_GC_PRIV (pGC);
box.x1 = pSrc->x + srcX;
@@ -205,11 +205,11 @@
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
- if (pGC->alu != GXcopy || (pGCPriv->flags &= ~xglGCReadOnlyDrawableFlag))
+ if (pGC->alu != GXcopy || pGCPriv->flags)
{
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);
@@ -243,14 +243,14 @@
{
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);
@@ -293,13 +293,10 @@
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);
@@ -315,7 +312,7 @@
void
xglPolySegment (DrawablePtr pDrawable,
- GCPtr pGC,
+ GCPtr pGC,
int nsegInit,
xSegment *pSegInit)
{
@@ -328,10 +325,7 @@
if (pGC->lineStyle == LineSolid)
{
if (xglFillSegment (pDrawable, pGC, nsegInit, pSegInit))
- {
- xglAddCurrentBitDamage (pDrawable);
return;
- }
}
}
@@ -344,14 +338,14 @@
void
xglPolyArc (DrawablePtr pDrawable,
- GCPtr pGC,
+ 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);
@@ -367,7 +361,7 @@
{
XGL_GC_PRIV (pGC);
- if (pGCPriv->flags || pGC->fillStyle == FillStippled)
+ if (pGC->fillStyle == FillStippled || pGCPriv->flags)
{
XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
(*pGC->ops->PolyFillRect) (pDrawable, pGC, nrect, prect);
@@ -382,12 +376,12 @@
void
xglPolyFillArc (DrawablePtr pDrawable,
- GCPtr pGC,
+ 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);
@@ -404,7 +398,7 @@
{
XGL_GC_PRIV (pGC);
- if (!(pGCPriv->flags & ~xglGCBadFunctionFlag))
+ if (!pGCPriv->flags)
{
if (xglSolidGlyph (pDrawable,
pGC,
@@ -413,10 +407,7 @@
nglyph,
ppci,
pglyphBase))
- {
- xglAddCurrentBitDamage (pDrawable);
return;
- }
}
XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
@@ -445,12 +436,9 @@
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);
@@ -469,7 +457,7 @@
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);
@@ -478,10 +466,9 @@
Bool
xglCreateGC (GCPtr pGC)
{
- static glitz_color_t black = { 0x0, 0x0, 0x0, 0xffff };
- ScreenPtr pScreen = pGC->pScreen;
- Bool ret;
-
+ ScreenPtr pScreen = pGC->pScreen;
+ Bool ret;
+
XGL_SCREEN_PRIV (pScreen);
XGL_GC_PRIV (pGC);
@@ -491,16 +478,36 @@
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;
-
+
+ pGCPriv->fg = NULL;
+ pGCPriv->bg = NULL;
+ pGCPriv->id = ~0;
+
return ret;
}
void
+xglDestroyGC (GCPtr pGC)
+{
+ XGL_GC_PRIV (pGC);
+
+ if (pGCPriv->fg)
+ glitz_surface_destroy (pGCPriv->fg);
+
+ if (pGCPriv->bg)
+ glitz_surface_destroy (pGCPriv->bg);
+
+ XGL_GC_UNWRAP (funcs);
+ XGL_GC_UNWRAP (ops);
+ (*pGC->funcs->DestroyGC) (pGC);
+ XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
+ XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
+}
+
+void
xglValidateGC (GCPtr pGC,
unsigned long changes,
DrawablePtr pDrawable)
@@ -509,12 +516,12 @@
if (changes & GCTile)
{
- if (!pGC->tileIsPixel &&
+ if (!pGC->tileIsPixel &&
FbEvenTile (pGC->tile.pixmap->drawable.width *
pDrawable->bitsPerPixel))
xglSyncBits (&pGC->tile.pixmap->drawable, NULL);
}
-
+
if (changes & GCStipple)
{
if (pGC->stipple)
@@ -530,16 +537,45 @@
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;
+ if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface)
+ {
+ glitz_format_t *format;
+
+ format = pPixmapPriv->pVisual->format.surface;
+ if (format->id != pGCPriv->id)
+ {
+ XGL_SCREEN_PRIV (pDrawable->pScreen);
+
+ pGCPriv->flags |= xglGCSoftwareDrawableFlag;
+
+ if (pGCPriv->fg)
+ glitz_surface_destroy (pGCPriv->fg);
+
+ pGCPriv->fg = glitz_surface_create (pScreenPriv->drawable,
+ format, 1, 1, 0, NULL);
+ if (pGCPriv->fg)
+ glitz_surface_set_fill (pGCPriv->fg, GLITZ_FILL_REPEAT);
+
+ if (pGCPriv->bg)
+ glitz_surface_destroy (pGCPriv->bg);
+
+ pGCPriv->bg = glitz_surface_create (pScreenPriv->drawable,
+ format, 1, 1, 0, NULL);
+ if (pGCPriv->bg)
+ glitz_surface_set_fill (pGCPriv->bg, GLITZ_FILL_REPEAT);
+
+ pGCPriv->id = format->id;
+
+ if (pGCPriv->fg && pGCPriv->bg)
+ {
+ changes |= (GCForeground | GCBackground);
+ pGCPriv->flags &= ~xglGCSoftwareDrawableFlag;
+ }
+ }
+ }
else
- pGCPriv->flags |= xglGCReadOnlyDrawableFlag;
+ pGCPriv->flags |= xglGCSoftwareDrawableFlag;
}
if (changes & GCFunction)
@@ -568,21 +604,45 @@
FbBits mask;
mask = FbFullMask (pDrawable->depth);
-
+
if ((pGC->planemask & mask) != mask)
pGCPriv->flags |= xglGCPlaneMaskFlag;
else
pGCPriv->flags &= ~xglGCPlaneMaskFlag;
}
- if (changes & (GCForeground | GCBackground))
+ if (!(pGCPriv->flags & xglGCSoftwareDrawableFlag))
{
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if (pPixmapPriv->pPixel)
+ if (changes & (GCForeground | GCBackground))
{
- xglPixelToColor (pPixmapPriv->pPixel, pGC->fgPixel, &pGCPriv->fg);
- xglPixelToColor (pPixmapPriv->pPixel, pGC->bgPixel, &pGCPriv->bg);
+ glitz_pixel_format_t format;
+ glitz_buffer_t *buffer;
+ CARD32 pixel;
+
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ format.fourcc = GLITZ_FOURCC_RGB;
+ format.masks = pPixmapPriv->pVisual->pPixel->masks;
+ format.xoffset = 0;
+ format.skip_lines = 0;
+ format.bytes_per_line = sizeof (CARD32);
+ format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
+
+ buffer = glitz_buffer_create_for_data (&pixel);
+
+ if (changes & GCForeground)
+ {
+ pixel = pGC->fgPixel;
+ glitz_set_pixels (pGCPriv->fg, 0, 0, 1, 1, &format, buffer);
+ }
+
+ if (changes & GCBackground)
+ {
+ pixel = pGC->bgPixel;
+ glitz_set_pixels (pGCPriv->bg, 0, 0, 1, 1, &format, buffer);
+ }
+
+ glitz_buffer_destroy (buffer);
}
}
}
Index: xglgeometry.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglgeometry.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xglgeometry.c 9 Aug 2005 15:58:20 -0000 1.4
+++ xglgeometry.c 3 Jan 2006 09:56:22 -0000 1.5
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -44,7 +44,7 @@
int size)
{
XGL_SCREEN_PRIV (pScreen);
-
+
if (size == pGeometry->size)
return;
@@ -54,12 +54,12 @@
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);
@@ -78,6 +78,7 @@
else
{
glitz_buffer_t *newBuffer;
+
if (size)
{
newBuffer =
@@ -90,29 +91,29 @@
}
} 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;
}
@@ -149,7 +150,7 @@
(pGeometry)->count = (pGeometry)->endOffset / \
(2 * xglGeometryDataTypes[(pGeometry)->dataType].size); \
}
-
+
/*
* Adds a number of boxes as GL_QUAD primitives
*/
@@ -167,7 +168,7 @@
return;
MAP_GEOMETRY (pScreen, pGeometry, offset, nBox * 8, ptr, size);
-
+
switch (pGeometry->dataType) {
case GEOMETRY_DATA_TYPE_SHORT:
{
@@ -190,7 +191,7 @@
case GEOMETRY_DATA_TYPE_FLOAT:
{
glitz_float_t *data = (glitz_float_t *) ptr;
-
+
while (nBox--)
{
*data++ = (glitz_float_t) pBox->x1;
@@ -228,7 +229,7 @@
return;
MAP_GEOMETRY (pScreen, pGeometry, offset, n * 4, ptr, size);
-
+
switch (pGeometry->dataType) {
case GEOMETRY_DATA_TYPE_SHORT:
{
@@ -240,7 +241,7 @@
*data++ = (glitz_short_t) ppt->y;
*data++ = (glitz_short_t) (ppt->x + *pwidth);
*data++ = (glitz_short_t) ppt->y;
-
+
ppt++;
pwidth++;
}
@@ -255,13 +256,13 @@
*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);
}
@@ -298,7 +299,7 @@
pt.x = 0;
pt.y = 0;
-
+
switch (pGeometry->dataType) {
case GEOMETRY_DATA_TYPE_SHORT:
{
@@ -329,7 +330,7 @@
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;
@@ -362,7 +363,7 @@
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;
@@ -403,7 +404,7 @@
pSegInit->y1 == pSegInit->y2);
*data++ = (glitz_short_t)
ADJUST_END_POINT (pSegInit->y1, pSegInit->y2, 0);
-
+
pSegInit++;
}
} break;
@@ -420,12 +421,12 @@
pSegInit->y1 == pSegInit->y2);
*data++ = (glitz_float_t)
ADJUST_END_POINT (pSegInit->y1, pSegInit->y2, 0);
-
+
pSegInit++;
}
} break;
}
-
+
UNMAP_GEOMETRY (pGeometry, offset, size);
}
@@ -449,7 +450,7 @@
ppci = ppciInit;
n = nGlyph;
-
+
while (n--)
{
pglyph = FONTGLYPHBITS (pglyphBase, *ppci++);
@@ -482,7 +483,7 @@
pglyph = FONTGLYPHBITS (pglyphBase, pci);
gWidth = GLYPHWIDTHPIXELS (pci);
gHeight = GLYPHHEIGHTPIXELS (pci);
-
+
if (gWidth && gHeight)
{
gx = x + pci->metrics.leftSideBearing;
@@ -513,8 +514,8 @@
(((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))) / \
+ ((xFixed_32_32) ((v) - (line).p1.y) * \
+ ((line).p2.x - (line).p1.x))) / \
((line).p2.y - (line).p1.y)))) / 65536)
/*
@@ -549,7 +550,7 @@
{
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);
@@ -599,7 +600,7 @@
{
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);
@@ -626,9 +627,9 @@
xglGeometryPtr pGeometry;
XGL_SCREEN_PRIV (pScreen);
-
+
pGeometry = &pScreenPriv->scratchGeometry;
-
+
if (pGeometry->broken || pGeometry->size < size)
{
GEOMETRY_UNINIT (pGeometry);
@@ -649,7 +650,7 @@
pGeometry->count = 0;
pGeometry->width = 2;
}
-
+
return pGeometry;
}
@@ -662,17 +663,17 @@
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;
}
@@ -692,22 +693,22 @@
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,
+xglSetGeometry (xglGeometryPtr pGeometry,
glitz_surface_t *surface)
{
if (pGeometry->broken)
return FALSE;
-
+
glitz_set_geometry (surface, pGeometry->type, &pGeometry->f,
pGeometry->buffer);
@@ -718,6 +719,6 @@
glitz_set_array (surface,
pGeometry->first, pGeometry->width, pGeometry->count,
pGeometry->xOff, pGeometry->yOff);
-
+
return TRUE;
}
Index: xglget.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglget.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xglget.c 7 Jun 2005 08:53:40 -0000 1.4
+++ xglget.c 3 Jan 2006 09:56:22 -0000 1.5
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -39,10 +39,10 @@
glitz_surface_t *surface;
int xOff, yOff;
BoxRec box;
-
+
XGL_SCREEN_PRIV (pScreen);
- /* Many apps use GetImage to sync with the visable frame buffer */
+ /* Many apps use GetImage to sync with the visible frame buffer */
if (pDrawable->type == DRAWABLE_WINDOW)
{
if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
@@ -61,27 +61,27 @@
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,
+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);
Index: xglglx.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglglx.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- xglglx.c 23 Dec 2005 04:13:37 -0000 1.13
+++ xglglx.c 3 Jan 2006 09:56:22 -0000 1.14
@@ -23,36 +23,19 @@
* Author: David Reveman <davidr at novell.com>
*/
-#include "xgl.h"
+#include "xglglx.h"
#ifdef GLXEXT
-#include "glxserver.h"
-#include "glxscreens.h"
-#include "glxext.h"
-
-typedef struct _xglGLXFunc {
- void (*extensionInit) (void);
- void (*setVisualConfigs) (int nconfigs,
- __GLXvisualConfig *configs,
- void **privates);
- void (*wrapInitVisuals) (miInitVisualsProcPtr *initVisuals);
- int (*initVisuals) (VisualPtr *visualp,
- DepthPtr *depthp,
- int *nvisualp,
- int *ndepthp,
- int *rootDepthp,
- VisualID *defaultVisp,
- unsigned long sizes,
- int bitsPerRGB,
- int preferredVis);
+#ifdef XLOADABLE
+#include <dlfcn.h>
+#endif
- void (*flushContextCache) (void);
- void (*setRenderTables) (__glProcTable *table,
- __glProcTableEXT *tableEXT);
-} xglGLXFuncRec;
+xglGLXFuncRec __xglGLXFunc;
-static xglGLXFuncRec __glXFunc;
+#ifndef NGLXEXTLOG
+FILE *__xglGLXLogFp;
+#endif
static void *glXHandle = 0;
static void *glCoreHandle = 0;
@@ -86,21 +69,21 @@
void **privates)
{
if (glXHandle && glCoreHandle)
- (*__glXFunc.setVisualConfigs) (nconfigs, configs, privates);
+ (*__xglGLXFunc.setVisualConfigs) (nconfigs, configs, privates);
}
void
GlxExtensionInit (void)
{
if (glXHandle && glCoreHandle)
- (*__glXFunc.extensionInit) ();
+ (*__xglGLXFunc.extensionInit) ();
}
void
GlxWrapInitVisuals (miInitVisualsProcPtr *initVisuals)
{
if (glXHandle && glCoreHandle)
- (*__glXFunc.wrapInitVisuals) (initVisuals);
+ (*__xglGLXFunc.wrapInitVisuals) (initVisuals);
}
int
@@ -115,9 +98,9 @@
int preferredVis)
{
if (glXHandle && glCoreHandle)
- return (*__glXFunc.initVisuals) (visualp, depthp, nvisualp, ndepthp,
- rootDepthp, defaultVisp, sizes,
- bitsPerRGB, preferredVis);
+ return (*__xglGLXFunc.initVisuals) (visualp, depthp, nvisualp, ndepthp,
+ rootDepthp, defaultVisp, sizes,
+ bitsPerRGB, preferredVis);
return 0;
}
@@ -125,14 +108,14 @@
void
GlxFlushContextCache (void)
{
- (*__glXFunc.flushContextCache) ();
+ (*__xglGLXFunc.flushContextCache) ();
}
void
GlxSetRenderTables (__glProcTable *table,
__glProcTableEXT *tableEXT)
{
- (*__glXFunc.setRenderTables) (table, tableEXT);
+ (*__xglGLXFunc.setRenderTables) (table, tableEXT);
}
Bool
@@ -143,15 +126,15 @@
if (!glXHandle)
{
xglSymbolRec sym[] = {
- SYM (__glXFunc.extensionInit, "GlxExtensionInit"),
- SYM (__glXFunc.setVisualConfigs, "GlxSetVisualConfigs"),
- SYM (__glXFunc.wrapInitVisuals, "GlxWrapInitVisuals"),
- SYM (__glXFunc.initVisuals, "GlxInitVisuals"),
- SYM (__glXFunc.flushContextCache, "GlxFlushContextCache"),
- SYM (__glXFunc.setRenderTables, "GlxSetRenderTables")
+ SYM (__xglGLXFunc.extensionInit, "GlxExtensionInit"),
+ SYM (__xglGLXFunc.setVisualConfigs, "GlxSetVisualConfigs"),
+ SYM (__xglGLXFunc.wrapInitVisuals, "GlxWrapInitVisuals"),
+ SYM (__xglGLXFunc.initVisuals, "GlxInitVisuals"),
+ SYM (__xglGLXFunc.flushContextCache, "GlxFlushContextCache"),
+ SYM (__xglGLXFunc.setRenderTables, "GlxSetRenderTables")
};
- glXHandle = xglLoadModule ("glx");
+ glXHandle = xglLoadModule ("glx", RTLD_NOW | RTLD_LOCAL);
if (!glXHandle)
return FALSE;
@@ -167,21 +150,22 @@
if (!glCoreHandle)
{
xglSymbolRec sym[] = {
- SYM (__glDDXScreenInfo.screenProbe, "__MESA_screenProbe"),
- SYM (__glDDXScreenInfo.createContext, "__MESA_createContext"),
- SYM (__glDDXScreenInfo.createBuffer, "__MESA_createBuffer"),
-
- SYM (__glDDXExtensionInfo.resetExtension, "__MESA_resetExtension"),
- SYM (__glDDXExtensionInfo.initVisuals, "__MESA_initVisuals"),
+ SYM (__glDDXScreenInfo.screenProbe, "__MESA_screenProbe"),
+ SYM (__glDDXScreenInfo.createContext, "__MESA_createContext"),
+ SYM (__glDDXScreenInfo.createBuffer, "__MESA_createBuffer"),
+ SYM (__glDDXExtensionInfo.resetExtension,
+ "__MESA_resetExtension"),
+ SYM (__glDDXExtensionInfo.initVisuals, "__MESA_initVisuals"),
SYM (__glDDXExtensionInfo.setVisualConfigs,
"__MESA_setVisualConfigs")
};
- glCoreHandle = xglLoadModule ("glcore");
+ glCoreHandle = xglLoadModule ("glcore", RTLD_NOW | RTLD_LOCAL);
if (!glCoreHandle)
return FALSE;
- if (!xglLookupSymbols (glCoreHandle, sym, sizeof (sym) / sizeof (sym[0])))
+ if (!xglLookupSymbols (glCoreHandle, sym,
+ sizeof (sym) / sizeof (sym[0])))
{
xglUnloadModule (glCoreHandle);
glCoreHandle = 0;
--- NEW FILE: xglglx.h ---
(This appears to be a binary file; contents omitted.)
Index: xglglyph.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglglyph.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- xglglyph.c 7 Jun 2005 08:53:40 -0000 1.6
+++ xglglyph.c 3 Jan 2006 09:56:22 -0000 1.7
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -163,9 +163,9 @@
XGL_PICTURE_SCREEN_UNWRAP (RealizeGlyph);
ret = (*pPictureScreen->RealizeGlyph) (pScreen, pGlyph);
XGL_PICTURE_SCREEN_WRAP (RealizeGlyph, xglRealizeGlyph);
-
+
pGlyphPriv->pArea = NULL;
-
+
return ret;
}
@@ -205,7 +205,7 @@
if (pCache->depth == 1)
{
int stride;
-
+
GEOMETRY_INIT (pScreen, &pCache->u.geometry,
GLITZ_GEOMETRY_TYPE_VERTEX,
GEOMETRY_USAGE_STATIC, BITMAP_CACHE_SIZE);
@@ -228,9 +228,14 @@
{
xglGlyphTexturePtr pTexture = &pCache->u.texture;
+ glitz_surface_t *mask;
glitz_surface_attributes_t attr;
- xglPixmapFormatPtr pFormat;
glitz_vertex_format_t *vertex;
+ xglVisualPtr pVisual;
+
+ pVisual = xglFindVisualWithDepth (pScreen, format->depth);
+ if (!pVisual)
+ return FALSE;
if (!xglRootAreaInit (&pCache->rootArea,
TEXTURE_CACHE_MAX_LEVEL,
@@ -240,39 +245,46 @@
(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)
+ mask = glitz_surface_create (pScreenPriv->drawable,
+ pVisual->format.surface,
+ TEXTURE_CACHE_SIZE,
+ TEXTURE_CACHE_SIZE,
+ GLITZ_SURFACE_UNNORMALIZED_MASK,
+ &attr);
+ }
+ else
+ mask = NULL;
+
+ if (!mask)
{
- pTexture->mask =
- glitz_surface_create (pScreenPriv->drawable, pFormat->format,
- TEXTURE_CACHE_SIZE, TEXTURE_CACHE_SIZE,
- 0, NULL);
- if (!pTexture->mask)
+ mask = glitz_surface_create (pScreenPriv->drawable,
+ pVisual->format.surface,
+ TEXTURE_CACHE_SIZE,
+ TEXTURE_CACHE_SIZE,
+ 0, NULL);
+ if (!mask)
return FALSE;
pTexture->geometryDataType = GEOMETRY_DATA_TYPE_FLOAT;
- } else
+ }
+ else
pTexture->geometryDataType = GEOMETRY_DATA_TYPE_SHORT;
-
+
if (NEEDS_COMPONENT (format->format))
- glitz_surface_set_component_alpha (pTexture->mask, 1);
+ glitz_surface_set_component_alpha (mask, 1);
+
+ pTexture->pMask = xglCreateDevicePicture (mask);
+ if (!pTexture->pMask)
+ return FALSE;
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;
@@ -288,13 +300,14 @@
vertex->mask.type = GLITZ_DATA_TYPE_SHORT;
}
- pTexture->pixel.masks = pFormat->pPixel->masks;
+ pTexture->pixel.fourcc = GLITZ_FOURCC_RGB;
+ pTexture->pixel.masks = pVisual->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;
@@ -306,17 +319,17 @@
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);
+ if (pCache->u.texture.pMask)
+ FreePicture ((pointer) pCache->u.texture.pMask, 0);
}
-
+
pCache->pScreen = NULL;
}
}
@@ -326,24 +339,24 @@
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,
+ pGlyph->info.height,
pCache->depth, pCache->depth, 0,
(pointer) (pGlyph + 1));
if (!pPixmap)
return NULL;
-
- (*pScreen->ModifyPixmapHeader) (pPixmap,
+
+ (*pScreen->ModifyPixmapHeader) (pPixmap,
pGlyph->info.width,
pGlyph->info.height,
0, 0, -1, (pointer) (pGlyph + 1));
@@ -366,7 +379,7 @@
/* 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);
@@ -375,7 +388,7 @@
if (pGlyphPriv->pArea)
{
int stride;
-
+
GLYPH_AREA_PRIV (pGlyphPriv->pArea);
pAreaPriv->serial = glyphSerialNumber;
@@ -388,7 +401,7 @@
}
} else
pGlyphPriv->pArea = &zeroSizeArea;
-
+
REGION_DESTROY (pScreen, pRegion);
}
else
@@ -398,11 +411,11 @@
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;
@@ -417,19 +430,22 @@
pGlyph->info.width, pGlyph->info.height,
TRUE, (pointer) pGlyph);
}
-
+
if (pGlyphPriv->pArea)
{
+ glitz_surface_t *surface;
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,
+
+ surface = pTexture->pMask->pSourcePict->source.devPrivate.ptr;
+
+ glitz_set_pixels (surface,
pGlyphPriv->pArea->x,
pGlyphPriv->pArea->y,
pGlyph->info.width,
@@ -441,10 +457,10 @@
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);
-
+
+ glitz_surface_translate_point (surface, &p1, &p1);
+ glitz_surface_translate_point (surface, &p2, &p2);
+
pAreaPriv->serial = glyphSerialNumber;
if (pTexture->geometryDataType)
{
@@ -465,7 +481,7 @@
} else
pGlyphPriv->pArea = &zeroSizeArea;
}
-
+
return pGlyphPriv->pArea;
}
@@ -499,7 +515,7 @@
usingCache = FALSE;
}
}
-
+
while (pOp->nGlyphs)
{
glyph = *pOp->ppGlyphs;
@@ -511,7 +527,7 @@
pOp->xOff += pOp->pLists->xOff;
pOp->yOff += pOp->pLists->yOff;
}
-
+
xOff = pOp->xOff;
yOff = pOp->yOff;
@@ -523,7 +539,7 @@
{
if (!pArea)
pArea = xglCacheGlyph (pCache, glyph);
-
+
if (pArea)
break;
}
@@ -533,26 +549,26 @@
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;
-
+ XID componentAlpha;
+ int error;
+
pPixmap = GetScratchPixmapHeader (pScreen,
glyph->info.width,
- glyph->info.height,
+ 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,
@@ -564,8 +580,8 @@
return;
}
}
-
- (*pScreen->ModifyPixmapHeader) (pPixmap,
+
+ (*pScreen->ModifyPixmapHeader) (pPixmap,
glyph->info.width, glyph->info.height,
0, 0, -1, (pointer) (glyph + 1));
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
@@ -594,7 +610,7 @@
glyph->info.width,
glyph->info.height);
}
-
+
if (pPicture)
{
FreeScratchPixmapHeader (pPixmap);
@@ -624,10 +640,10 @@
int depth = pOp->pLists->format->depth;
int i, remaining = pOp->nGlyphs;
int nGlyph = 0;
- glitz_surface_t *mask = NULL;
+ PicturePtr pMaskPicture = NULL;
XGL_SCREEN_PRIV (pScreen);
-
+
pCache = &pScreenPriv->glyphCache[depth];
if (!pCache->pScreen)
{
@@ -663,23 +679,23 @@
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;
}
@@ -687,11 +703,11 @@
{
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;
-
+ pMaskPicture = pCache->u.texture.pMask;
+
vData.list.s = glitz_buffer_map (pGeometry->buffer,
GLITZ_BUFFER_ACCESS_WRITE_ONLY);
}
@@ -714,7 +730,7 @@
pOp->xOff += pOp->pLists->xOff;
pOp->yOff += pOp->pLists->yOff;
}
-
+
xOff = pOp->xOff;
yOff = pOp->yOff;
@@ -726,7 +742,7 @@
pOp->listLen--;
pOp->nGlyphs--;
pOp->ppGlyphs++;
-
+
pOp->xOff += glyph->info.xOff;
pOp->yOff += glyph->info.yOff;
@@ -739,7 +755,7 @@
extents.x1 = x1;
if (x2 > extents.x2)
extents.x2 = x2;
-
+
y1 = yOff - glyph->info.y;
y2 = y1 + glyph->info.height;
if (y1 < extents.y1)
@@ -786,7 +802,7 @@
glitz_buffer_unmap (pGeometry->buffer);
pGeometry->count = nGlyph * 4;
}
-
+
xSrc += extents.x1;
ySrc += extents.y1;
@@ -794,27 +810,26 @@
{
op = PictOpAdd;
pSrc = pScreenPriv->pSolidAlpha;
-
+
if (remaining)
- *pOp = opSave;
+ *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))
+
+ if (xglCompositeGeneral (op,
+ pSrc,
+ pMaskPicture,
+ pDst,
+ pGeometry,
+ xSrc, ySrc,
+ 0, 0,
+ pDst->pDrawable->x + extents.x1,
+ pDst->pDrawable->y + extents.y1,
+ extents.x2 - extents.x1,
+ extents.y2 - extents.y1))
{
xglAddCurrentBitDamage (pDst->pDrawable);
return remaining;
@@ -857,7 +872,7 @@
extents->x1 = MAXSHORT;
extents->x2 = MINSHORT;
extents->y1 = MAXSHORT;
- extents->y2 = MINSHORT;
+ extents->y2 = MINSHORT;
while (!list->len)
{
@@ -892,7 +907,7 @@
y += list->yOff;
n = list->len;
list++;
-
+
while (n--)
{
glyph = *glyphs++;
@@ -945,7 +960,7 @@
extents->y1 = line.y1;
if (line.y2 > extents->y2)
extents->y2 = line.y2;
-
+
overlap = TRUE;
}
@@ -959,7 +974,7 @@
line.x2 = x2;
line.y2 = y2;
}
-
+
x += glyph->info.xOff;
y += glyph->info.yOff;
}
@@ -983,15 +998,15 @@
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;
@@ -1006,7 +1021,7 @@
nlist--;
list++;
-
+
while (nlist--)
{
if (list->format->id != id)
@@ -1037,20 +1052,18 @@
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 ||
+ (!target || overlap || op != PictOpOver ||
xglGlyphListFormatId (list, nlist) != maskFormat->id))
{
PixmapPtr pPixmap;
- CARD32 componentAlpha;
+ XID componentAlpha;
GCPtr pGC;
xRectangle rect;
int error;
@@ -1065,7 +1078,7 @@
maskFormat->depth);
if (!pPixmap)
return;
-
+
componentAlpha = NEEDS_COMPONENT (maskFormat->format);
pMask = CreatePicture (0, &pPixmap->drawable,
maskFormat, CPComponentAlpha, &componentAlpha,
@@ -1076,12 +1089,11 @@
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;
+ {
+ /* make sure we don't do accelerated drawing to mask */
+ xglSetPixmapVisual (pPixmap, NULL);
+ }
ValidatePicture (pMask);
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
@@ -1092,7 +1104,7 @@
(*pScreen->DestroyPixmap) (pPixmap);
target = xglPrepareTarget (pMask->pDrawable);
-
+
glyphOp.xOff = -extents.x1;
glyphOp.yOff = -extents.y1;
pSrcPicture = NULL;
@@ -1100,9 +1112,6 @@
}
else
{
- /* make sure destination drawable is locked */
- pPixmapPriv->lock++;
-
glyphOp.xOff = 0;
glyphOp.yOff = 0;
pSrcPicture = pSrc;
@@ -1119,12 +1128,12 @@
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;
}
@@ -1142,26 +1151,19 @@
&glyphOp);
}
}
-
+
if (pMask)
{
- CompositePicture (op,
- pSrc,
- pMask,
- pDst,
+ 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
Index: xglinit.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglinit.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xglinit.c 23 Dec 2005 02:07:58 -0000 1.3
+++ xglinit.c 3 Jan 2006 09:56:22 -0000 1.4
@@ -24,26 +24,41 @@
*/
#include "xgl.h"
+#include "xglglx.h"
#include "micmap.h"
#include "mipointer.h"
#include "fb.h"
-#define DEAFULT_DDX_MODULE_NAME "xglx"
+#ifdef XLOADABLE
+#include <dlfcn.h>
+#endif
-static char *ddxModuleName = DEAFULT_DDX_MODULE_NAME;
+#define DEFAULT_DDX_MODULE_NAME "xglx"
+
+static char *ddxModuleName = DEFAULT_DDX_MODULE_NAME;
xglScreenInfoRec xglScreenInfo = {
- NULL, 0, 0, 0, 0,
+ NULL, 0, 0, 0, 0, 0,
DEFAULT_GEOMETRY_DATA_TYPE,
DEFAULT_GEOMETRY_USAGE,
FALSE,
XGL_DEFAULT_PBO_MASK,
FALSE,
- FALSE
+ {
+ { FALSE, FALSE, { 0, 0, 0, 0 } },
+ { FALSE, FALSE, { 0, 0, 0, 0 } },
+ { FALSE, FALSE, { 0, 0, 0, 0 } },
+ { FALSE, FALSE, { 0, 0, 0, 0 } }
+ }
};
#ifdef GLXEXT
static Bool loadGlx = TRUE;
+
+#ifndef NGLXEXTLOG
+static char *glxExtLogFile = 0;
+#endif
+
#endif
typedef struct _xglDDXFunc {
@@ -105,6 +120,29 @@
if (!status)
return FALSE;
+#ifdef GLXEXT
+ /* GLX and GLcore modules must be loaded with RTLD_NOW and RTLD_LOCAL
+ flags before DDX module which is linked to libGL and should be
+ loaded with RTLD_GLOBAL. */
+ if (loadGlx)
+ {
+ if (!xglLoadGLXModules ())
+ FatalError ("No GLX modules loaded");
+
+#ifndef NGLXEXTLOG
+ if (glxExtLogFile)
+ {
+ __xglGLXLogFp = fopen (glxExtLogFile, "w");
+ if (!__xglGLXLogFp)
+ perror ("InitOutput");
+ }
+ else
+ __xglGLXLogFp = 0;
+#endif
+
+ }
+#endif
+
if (!ddxHandle)
{
xglSymbolRec sym[] = {
@@ -119,7 +157,7 @@
SYM (__ddxFunc.osVendorInit, "OsVendorInit")
};
- ddxHandle = xglLoadModule (ddxModuleName);
+ ddxHandle = xglLoadModule (ddxModuleName, RTLD_NOW | RTLD_GLOBAL);
if (!ddxHandle)
return (status = FALSE);
@@ -149,14 +187,6 @@
if (!xglEnsureDDXModule ())
FatalError ("No DDX module loaded");
-#ifdef GLXEXT
- if (loadGlx)
- {
- if (!xglLoadGLXModules ())
- FatalError ("No GLX modules loaded");
- }
-#endif
-
(*__ddxFunc.initOutput) (pScreenInfo, argc, argv);
}
@@ -191,68 +221,83 @@
#ifdef GLXEXT
ErrorF ("-noglx don't load glx extension\n");
+
+#ifndef NGLXEXTLOG
+ ErrorF ("-glxlog file glx extension log file\n");
+#endif
+
#endif
+ xglUseMsg ();
+
if (xglEnsureDDXModule ())
(*__ddxFunc.useMsg) ();
}
-#define LOPT(s, l) { (s), (l) }
-#define OPT(s) LOPT (s, 0)
-
int
ddxProcessArgument (int argc,
char **argv,
int i)
{
- struct _option {
- char *name;
- int length;
- } commonOption[] = {
- LOPT (":", 1), OPT ("-a"), OPT ("-ac"), OPT ("-audit"), OPT ("-auth"),
- OPT ("bc"), OPT ("-br"), OPT ("+bs"), OPT ("-bs"), OPT ("c"), OPT ("-c"),
- OPT ("-cc"), OPT ("-co"), OPT ("-core"), OPT ("-dpi"),
- OPT ("-deferglyphs"), OPT ("-f"), OPT ("-fc"), OPT ("-fn"), OPT ("-fp"),
- OPT ("-help"), OPT ("-nolisten"), OPT ("-noreset"), OPT ("-p"),
- OPT ("-pn"), OPT ("-nopn"), OPT ("r"), OPT ("-r"), OPT ("-s"),
- OPT ("-su"), OPT ("-t"), OPT ("-terminate"), OPT ("-to"), OPT ("-tst"),
- OPT ("v"), OPT ("-v"), OPT ("-wm"), OPT ("-x"), OPT ("-I"),
- LOPT ("tty", 3)
- };
- int skip, j;
+ static Bool checkDDX = FALSE;
+ int skip;
- for (j = 0; j < sizeof (commonOption) / sizeof (commonOption[0]); j++)
+ if (!checkDDX)
{
- if (commonOption[j].length)
- {
- if (!strncmp (argv[i], commonOption[j].name, commonOption[j].length))
- return 0;
- }
- else
+ int j;
+
+ for (j = i; j < argc; j++)
{
- if (!strcmp (argv[i], commonOption[j].name))
- return 0;
+ if (!strcmp (argv[j], "-ddx"))
+ {
+ if (++j < argc)
+ ddxModuleName = argv[j];
+ }
+
+#ifdef GLXEXT
+ else if (!strcmp (argv[j], "-noglx"))
+ {
+ loadGlx = FALSE;
+ }
+
+#ifndef NGLXEXTLOG
+ else if (!strcmp (argv[j], "-glxlog"))
+ {
+ if (++j < argc)
+ glxExtLogFile = argv[j];
+ }
}
+#endif
+
+#endif
+
+ checkDDX = TRUE;
}
if (!strcmp (argv[i], "-ddx"))
{
if ((i + 1) < argc)
- {
- ddxModuleName = argv[i + 1];
- }
- else
- return 1;
+ return 2;
- return 2;
+ return 1;
}
#ifdef GLXEXT
else if (!strcmp (argv[i], "-noglx"))
{
- loadGlx = FALSE;
return 1;
}
+
+#ifndef NGLXEXTLOG
+ else if (!strcmp (argv[i], "-glxlog"))
+ {
+ if ((i + 1) < argc)
+ return 2;
+
+ return 1;
+ }
+#endif
+
#endif
skip = xglProcessArgument (argc, argv, i);
Index: xglinput.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglinput.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xglinput.c 7 Jun 2005 08:53:40 -0000 1.5
+++ xglinput.c 3 Jan 2006 09:56:22 -0000 1.6
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -47,7 +47,7 @@
case DEVICE_INIT:
for (i = 1; i <= NUM_BUTTONS; i++)
map[i] = i;
-
+
InitPointerDeviceStruct (pDev,
map,
NUM_BUTTONS,
@@ -63,7 +63,7 @@
pDev->on = FALSE;
break;
}
-
+
return Success;
}
@@ -226,7 +226,7 @@
case DEVICE_INIT:
if (pDev != LookupKeyboardDevice ())
return !Success;
-
+
ret = InitKeyboardDeviceStruct (pDev,
&xglKeySyms,
xglModMap,
@@ -243,7 +243,7 @@
pDev->on = FALSE;
break;
}
-
+
return Success;
}
@@ -251,13 +251,13 @@
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);
}
Index: xglloader.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglloader.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xglloader.c 23 Dec 2005 02:07:58 -0000 1.1
+++ xglloader.c 3 Jan 2006 09:56:22 -0000 1.2
@@ -33,7 +33,8 @@
#define SYM(ptr, name) { (void **) &(ptr), (name) }
void *
-xglLoadModule (const char *name)
+xglLoadModule (const char *name,
+ int flag)
{
ModuleVersionProcPtr moduleVersion;
ModuleInitProcPtr moduleInit;
@@ -50,7 +51,7 @@
sprintf (module, MODULEPATH "/xgl/lib%s.so", name);
- handle = dlopen (module, RTLD_NOW);
+ handle = dlopen (module, flag);
if (handle)
{
if (xglLookupSymbols (handle, mSym, sizeof (mSym) / sizeof (mSym[0])))
Index: xgloutput.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xgloutput.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xgloutput.c 26 Jan 2005 10:58:52 -0000 1.4
+++ xgloutput.c 3 Jan 2006 09:56:22 -0000 1.5
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -25,6 +25,9 @@
#include "xgl.h"
+#include <mivalidate.h>
+#include <dixstruct.h>
+
typedef struct _xglDepth {
CARD8 depth;
CARD8 bpp;
@@ -46,20 +49,167 @@
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++) {
+ 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;
}
}
+
+void
+xglSetRootClip (ScreenPtr pScreen,
+ Bool enable)
+{
+ WindowPtr pWin = WindowTable[pScreen->myNum];
+ WindowPtr pChild;
+ Bool wasViewable;
+ Bool anyMarked = FALSE;
+ RegionPtr pOldClip = 0, bsExposed;
+
+#ifdef DO_SAVE_UNDERS
+ Bool dosave = FALSE;
+#endif
+
+ WindowPtr pLayerWin;
+ BoxRec box;
+
+ if (!pWin)
+ return;
+
+ wasViewable = (Bool) (pWin->viewable);
+ if (wasViewable)
+ {
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ (void) (*pScreen->MarkOverlappedWindows) (pChild,
+ pChild,
+ &pLayerWin);
+ }
+
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+
+ if (pWin->valdata)
+ {
+ if (HasBorder (pWin))
+ {
+ RegionPtr borderVisible;
+
+ borderVisible = REGION_CREATE (pScreen, NullBox, 1);
+ REGION_SUBTRACT (pScreen, borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ pWin->valdata->before.resized = TRUE;
+ }
+ }
+
+ if (enable)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+
+ pWin->drawable.width = pScreen->width;
+ pWin->drawable.height = pScreen->height;
+
+ REGION_INIT (pScreen, &pWin->winSize, &box, 1);
+ REGION_INIT (pScreen, &pWin->borderSize, &box, 1);
+ REGION_RESET (pScreen, &pWin->borderClip, &box);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+ else
+ {
+ REGION_EMPTY (pScreen, &pWin->borderClip);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+
+ ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
+
+ if (wasViewable)
+ {
+ if (pWin->backStorage)
+ {
+ pOldClip = REGION_CREATE (pScreen, NullBox, 1);
+ REGION_COPY (pScreen, pOldClip, &pWin->clipList);
+ }
+
+ if (pWin->firstChild)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin->firstChild,
+ pWin->firstChild,
+ (WindowPtr *) 0);
+ }
+ else
+ {
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ }
+
+#ifdef DO_SAVE_UNDERS
+ if (DO_SAVE_UNDERS (pWin))
+ dosave = (*pScreen->ChangeSaveUnder) (pLayerWin, pLayerWin);
+#endif
+
+ if (anyMarked)
+ (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
+ }
+
+ if (pWin->backStorage && ((pWin->backingStore == Always) || wasViewable))
+ {
+ if (!wasViewable)
+ pOldClip = &pWin->clipList; /* a convenient empty region */
+
+ bsExposed = (*pScreen->TranslateBackingStore) (pWin, 0, 0, pOldClip,
+ pWin->drawable.x,
+ pWin->drawable.y);
+
+ if (wasViewable)
+ REGION_DESTROY(pScreen, pOldClip);
+
+ if (bsExposed)
+ {
+ RegionPtr valExposed = NullRegion;
+
+ if (pWin->valdata)
+ valExposed = &pWin->valdata->after.exposed;
+
+ (*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
+
+ if (valExposed)
+ REGION_EMPTY (pScreen, valExposed);
+
+ REGION_DESTROY (pScreen, bsExposed);
+ }
+ }
+
+ if (wasViewable)
+ {
+ if (anyMarked)
+ (*pScreen->HandleExposures) (pWin);
+
+#ifdef DO_SAVE_UNDERS
+ if (dosave)
+ (*pScreen->PostChangeSaveUnder) (pLayerWin, pLayerWin);
+#endif
+
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pWin, NullWindow, VTOther);
+ }
+
+ if (pWin->realized)
+ WindowsRestructured ();
+}
Index: xglparse.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglparse.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- xglparse.c 23 Dec 2005 02:07:58 -0000 1.6
+++ xglparse.c 3 Jan 2006 09:56:22 -0000 1.7
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -33,13 +33,13 @@
{
while (*cur && !strchr (delim, *cur))
*save++ = *cur++;
-
+
*save = 0;
*last = *cur;
-
+
if (*cur)
cur++;
-
+
return cur;
}
@@ -57,28 +57,28 @@
if (!arg)
return;
-
+
if (strlen (arg) >= sizeof (save))
return;
-
+
for (i = 0; i < 2; i++)
{
- arg = xglParseFindNext (arg, "x/@XY", save, &delim);
+ arg = xglParseFindNext (arg, "x/", save, &delim);
if (!save[0])
return;
-
+
pixels = atoi (save);
mm = 0;
-
+
if (delim == '/')
{
- arg = xglParseFindNext (arg, "x at XY", save, &delim);
+ arg = xglParseFindNext (arg, "x", save, &delim);
if (!save[0])
return;
-
+
mm = atoi (save);
}
-
+
if (i == 0)
{
xglScreenInfo.width = pixels;
@@ -89,12 +89,98 @@
xglScreenInfo.height = pixels;
xglScreenInfo.heightMm = mm;
}
-
+
if (delim != 'x')
return;
}
}
+static void
+xglParseAccel (char *arg)
+{
+ xglAccelInfoPtr pAccel;
+ char delim;
+ char save[1024];
+
+ if (!arg)
+ return;
+
+ if (strlen (arg) >= sizeof (save))
+ return;
+
+ arg = xglParseFindNext (arg, "@:", save, &delim);
+ if (!save[0])
+ return;
+
+ if (strcasecmp (save, "pixmap") == 0)
+ pAccel = &xglScreenInfo.accel.pixmap;
+ else if (strcasecmp (save, "window") == 0)
+ pAccel = &xglScreenInfo.accel.window;
+ else if (strcasecmp (save, "glx") == 0)
+ pAccel = &xglScreenInfo.accel.glx;
+ else if (strcasecmp (save, "xv") == 0)
+ pAccel = &xglScreenInfo.accel.xv;
+ else
+ return;
+
+ if (delim == '@')
+ {
+ arg = xglParseFindNext (arg, "/x:", save, &delim);
+ if (!save[0])
+ return;
+
+ pAccel->size.aboveWidth = pAccel->size.minWidth = atoi (save);
+
+ if (delim == '/')
+ {
+ arg = xglParseFindNext (arg, "x:", save, &delim);
+ if (!save[0])
+ return;
+
+ pAccel->size.aboveWidth = atoi (save);
+ }
+
+ if (delim == 'x')
+ {
+ arg = xglParseFindNext (arg, "/:", save, &delim);
+ if (!save[0])
+ return;
+
+ pAccel->size.aboveHeight = pAccel->size.minHeight = atoi (save);
+
+ if (delim == '/')
+ {
+ arg = xglParseFindNext (arg, ":", save, &delim);
+ if (!save[0])
+ return;
+
+ pAccel->size.aboveHeight = atoi (save);
+ }
+ }
+ }
+
+ pAccel->enabled = TRUE;
+ pAccel->pbuffer = FALSE;
+
+ if (delim == ':')
+ {
+ if (strcasecmp (arg, "fbo") == 0)
+ ;
+ else if (strcasecmp (arg, "off") == 0 ||
+ strncasecmp (arg, "0", 1) == 0 ||
+ strncasecmp (arg, "f", 1) == 0 ||
+ strncasecmp (arg, "n", 1) == 0)
+ {
+ pAccel->enabled = FALSE;
+ pAccel->pbuffer = FALSE;
+ }
+ else if (strcasecmp (arg, "pbuffer") == 0)
+ {
+ pAccel->pbuffer = TRUE;
+ }
+ }
+}
+
void
xglUseMsg (void)
{
@@ -106,8 +192,8 @@
"use vertex buffer objects for streaming of vertex data\n");
ErrorF ("-pbomask [1|4|8|16|32] "
"set bpp's to use with pixel buffer objects\n");
- ErrorF ("-fbo "
- "use frame buffer objects for accelerate offscreen drawing\n");
+ ErrorF ("-accel TYPE[@WIDTH[/MIN]xHEIGHT[/MIN]][:METHOD] "
+ "offscreen acceleration\n");
}
int
@@ -126,7 +212,7 @@
}
else
return 1;
-
+
return 2;
}
else if (!strcmp (argv[i], "-yinverted"))
@@ -152,14 +238,20 @@
}
else
return 1;
-
+
return 2;
}
- else if (!strcmp (argv[i], "-fbo"))
+ else if (!strcmp (argv[i], "-accel"))
{
- xglScreenInfo.fbo = TRUE;
- return 1;
+ if ((i + 1) < argc)
+ {
+ xglParseAccel (argv[i + 1]);
+ }
+ else
+ return 1;
+
+ return 2;
}
-
+
return 0;
}
Index: xglpict.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglpict.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- xglpict.c 23 Dec 2005 01:51:40 -0000 1.7
+++ xglpict.c 3 Jan 2006 09:56:22 -0000 1.8
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -28,6 +28,8 @@
#ifdef RENDER
+#include "fbpict.h"
+
#define XGL_PICTURE_FALLBACK_PROLOGUE(pPicture, func) \
xglSyncDamageBoxBits (pPicture->pDrawable); \
XGL_PICTURE_SCREEN_UNWRAP (func)
@@ -55,18 +57,18 @@
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))
+ if (xglCompositeGeneral (op,
+ pSrc, pMask, pDst, NULL,
+ xSrc, ySrc,
+ xMask, yMask,
+ xDst + pDst->pDrawable->x,
+ yDst + pDst->pDrawable->y,
+ width, height))
{
xglAddCurrentBitDamage (pDst->pDrawable);
return;
}
-
+
pPictureScreen = GetPictureScreen (pScreen);
if (pSrc->pDrawable)
@@ -74,7 +76,7 @@
if (!xglSyncBits (pSrc->pDrawable, NullBox))
FatalError (XGL_SW_FAILURE_STRING);
}
-
+
if (pMask && pMask->pDrawable)
{
if (!xglSyncBits (pMask->pDrawable, NullBox))
@@ -84,12 +86,12 @@
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,
@@ -103,16 +105,19 @@
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
+ if (pSrc->pDrawable)
+ {
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+ }
- if (pMask)
+ if (pMask && pMask->pDrawable)
{
xMask += pMask->pDrawable->x;
yMask += pMask->pDrawable->y;
}
-
- if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst,
+
+ if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst,
xSrc, ySrc, xMask, yMask, xDst, yDst,
width, height))
return;
@@ -130,7 +135,7 @@
int ntri,
xTriangle *tris)
{
- PictureScreenPtr pPictureScreen;
+ PictureScreenPtr pPictureScreen;
ScreenPtr pScreen = pDst->pDrawable->pScreen;
XGL_SCREEN_PRIV (pScreen);
@@ -153,7 +158,7 @@
xglChangePicture (PicturePtr pPicture,
Mask mask)
{
- PictureScreenPtr pPictureScreen;
+ PictureScreenPtr pPictureScreen;
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
XGL_SCREEN_PRIV (pScreen);
@@ -179,7 +184,7 @@
xglChangePictureTransform (PicturePtr pPicture,
PictTransform *transform)
{
- PictureScreenPtr pPictureScreen;
+ PictureScreenPtr pPictureScreen;
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
int ret;
@@ -187,14 +192,17 @@
XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
pPictureScreen = GetPictureScreen (pScreen);
-
- pPixmapPriv->pictureMask |= xglPCTransformMask;
+
+ if (transform != pPicture->transform ||
+ (transform && memcmp (transform, &pPicture->transform,
+ sizeof (PictTransform))))
+ pPixmapPriv->pictureMask |= xglPCTransformMask;
XGL_PICTURE_SCREEN_UNWRAP (ChangePictureTransform);
ret = (*pPictureScreen->ChangePictureTransform) (pPicture, transform);
XGL_PICTURE_SCREEN_WRAP (ChangePictureTransform,
xglChangePictureTransform);
-
+
return ret;
}
@@ -204,7 +212,7 @@
xFixed *params,
int nparams)
{
- PictureScreenPtr pPictureScreen;
+ PictureScreenPtr pPictureScreen;
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
int ret;
@@ -212,7 +220,7 @@
XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
pPictureScreen = GetPictureScreen (pScreen);
-
+
pPixmapPriv->pictureMask |= xglPCFilterMask;
XGL_PICTURE_SCREEN_UNWRAP (ChangePictureFilter);
@@ -223,21 +231,48 @@
return ret;
}
-void
+static void
+xglDestroyDevicePicture (PicturePtr pPicture)
+{
+ if (pPicture->pSourcePict->source.devPrivate.ptr)
+ glitz_surface_destroy (pPicture->pSourcePict->source.devPrivate.ptr);
+}
+
+PicturePtr
+xglCreateDevicePicture (pointer data)
+{
+ PicturePtr pPicture;
+ int error;
+
+ pPicture = CreateDevicePicture (0, &error);
+ if (!pPicture)
+ return 0;
+
+ pPicture->pSourcePict->source.devPrivate.ptr = data;
+ pPicture->pSourcePict->source.Destroy = xglDestroyDevicePicture;
+
+ return pPicture;
+}
+
+static int fillMode[] = {
+ GLITZ_FILL_TRANSPARENT, /* RepeatNone */
+ GLITZ_FILL_REPEAT, /* RepeatNormal */
+ GLITZ_FILL_NEAREST, /* RepeatPad */
+ GLITZ_FILL_REFLECT /* RepeatReflect */
+};
+
+static 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);
+ glitz_surface_set_fill (surface, fillMode[pPicture->repeat]);
}
if (pPixmapPriv->pictureMask & xglPCFilterMask)
@@ -269,23 +304,263 @@
if (pPixmapPriv->pictureMask & xglPCComponentAlphaMask)
{
- if (pPicture->componentAlpha)
- glitz_surface_set_component_alpha (surface, 1);
- else
- glitz_surface_set_component_alpha (surface, 0);
+ glitz_surface_set_component_alpha (surface, pPicture->componentAlpha);
}
if (pPixmapPriv->pictureMask & xglPCDitherMask)
{
- if (pPicture->dither)
- glitz_surface_set_dither (surface, 1);
- else
- glitz_surface_set_dither (surface, 0);
+ glitz_surface_set_dither (surface, pPicture->dither);
}
pPixmapPriv->pictureMask &= ~XGL_PICTURE_CHANGES (~0);
}
+#define N_STACK_PARAM 256
+
+static int gradientNParam[] = {
+ 0, /* SourcePictTypeSolidFill */
+ 4, /* SourcePictTypeLinear */
+ 6, /* SourcePictTypeRadial */
+ 4, /* SourcePictTypeConical */
+};
+
+Bool
+xglSyncPicture (ScreenPtr pScreen,
+ PicturePtr pPicture,
+ INT16 x,
+ INT16 y,
+ CARD16 width,
+ CARD16 height,
+ INT16 *xOff,
+ INT16 *yOff)
+{
+ xglPixmapPtr pPixmapPriv;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ *xOff = *yOff = 0;
+
+ if (pPicture->pSourcePict)
+ {
+ if (pPicture->pSourcePict->source.devPrivate.ptr)
+ return TRUE;
+
+ if (pPicture->pDrawable)
+ {
+ (*pScreen->DestroyPixmap) ((PixmapPtr) pPicture->pDrawable);
+ pPicture->pDrawable = (DrawablePtr) 0;
+ }
+
+ switch (pPicture->pSourcePict->source.type) {
+ case SourcePictTypeSolidFill:
+ x = y = 0;
+ width = height = 1;
+ break;
+ case SourcePictTypeLinear:
+ case SourcePictTypeRadial: {
+ glitz_fixed16_16_t stackParam[N_STACK_PARAM];
+ glitz_fixed16_16_t *param;
+ int nParam, nStop, size, i;
+ CARD32 *pixel;
+ PictGradientStopPtr pStop;
+ glitz_buffer_t *buffer;
+ glitz_format_t *format;
+ glitz_surface_t *surface;
+ static glitz_pixel_format_t pixelFormat = {
+ GLITZ_FOURCC_RGB,
+ {
+ 32,
+ 0xff000000,
+ 0x00ff0000,
+ 0x0000ff00,
+ 0x000000ff
+ },
+ 0, 0, 0,
+ GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
+ };
+
+ if (!(pScreenPriv->features & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK))
+ break;
+
+ format = glitz_find_standard_format (pScreenPriv->drawable,
+ GLITZ_STANDARD_ARGB32);
+ if (!format)
+ break;
+
+ nParam = gradientNParam[pPicture->pSourcePict->gradient.type];
+ pStop = pPicture->pSourcePict->gradient.stops;
+ nStop = pPicture->pSourcePict->gradient.nstops;
+
+ size = nParam + nStop * 4;
+ if (size > N_STACK_PARAM)
+ {
+ param = malloc (sizeof (xFixed) * size);
+ if (!param)
+ break;
+ }
+ else
+ {
+ param = stackParam;
+ }
+
+ pixel = (CARD32 *) (param + nParam + nStop * 3);
+
+ buffer = glitz_buffer_create_for_data (pixel);
+ if (!buffer)
+ {
+ if (size > N_STACK_PARAM)
+ free (param);
+
+ break;
+ }
+
+ surface = glitz_surface_create (pScreenPriv->drawable,
+ format, nStop, 1, 0, NULL);
+ if (!surface)
+ {
+ glitz_buffer_destroy (buffer);
+ if (size > N_STACK_PARAM)
+ free (param);
+
+ break;
+ }
+
+ for (i = 0; i < nStop; i++)
+ {
+ pixel[i] = pStop[i].color;
+
+ param[nParam + 3 * i + 0] = pStop[i].x;
+ param[nParam + 3 * i + 1] = i << 16;
+ param[nParam + 3 * i + 2] = 0;
+ }
+
+ glitz_set_pixels (surface, 0, 0, nStop, 1, &pixelFormat, buffer);
+
+ glitz_buffer_destroy (buffer);
+
+ switch (pPicture->pSourcePict->source.type) {
+ case SourcePictTypeLinear:
+ param[0] = pPicture->pSourcePict->linear.p1.x;
+ param[1] = pPicture->pSourcePict->linear.p1.y;
+ param[2] = pPicture->pSourcePict->linear.p2.x;
+ param[3] = pPicture->pSourcePict->linear.p2.y;
+
+ glitz_surface_set_filter (surface,
+ GLITZ_FILTER_LINEAR_GRADIENT,
+ param, nParam + nStop * 3);
+ break;
+ case SourcePictTypeRadial:
+ param[0] = pPicture->pSourcePict->radial.inner.x;
+ param[1] = pPicture->pSourcePict->radial.inner.y;
+ param[2] = pPicture->pSourcePict->radial.inner_radius;
+ param[3] = pPicture->pSourcePict->radial.outer.x;
+ param[4] = pPicture->pSourcePict->radial.outer.y;
+ param[5] = pPicture->pSourcePict->radial.outer_radius;
+
+ glitz_surface_set_filter (surface,
+ GLITZ_FILTER_RADIAL_GRADIENT,
+ param, nParam + nStop * 3);
+ break;
+ }
+
+ glitz_surface_set_fill (surface, fillMode[pPicture->repeat]);
+ glitz_surface_set_transform (surface, (glitz_transform_t *)
+ pPicture->transform);
+
+ pPicture->pSourcePict->gradient.devPrivate.ptr = surface;
+ pPicture->pSourcePict->gradient.Destroy = xglDestroyDevicePicture;
+
+ if (size > N_STACK_PARAM)
+ free (param);
+
+ return TRUE;
+ } break;
+ case SourcePictTypeConical:
+ default:
+ break;
+ }
+
+ if (!pPicture->pDrawable)
+ {
+ PictFormatPtr pFormat;
+ PixmapPtr pPixmap;
+ PicturePtr pTmp;
+ RegionRec region;
+ BoxRec box;
+ int error;
+
+ pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
+ if (!pFormat)
+ return FALSE;
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
+ pFormat->depth);
+ if (!pPixmap)
+ return FALSE;
+
+ pTmp = CreatePicture (0, &pPixmap->drawable, pFormat, 0, NULL,
+ serverClient, &error);
+ if (!pTmp)
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return FALSE;
+ }
+
+ ValidatePicture (pTmp);
+
+ if (!xglSyncBits (pTmp->pDrawable, NullBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ fbCompositeGeneral (PictOpSrc,
+ pPicture, 0, pTmp,
+ x, y, 0, 0, 0, 0,
+ width, height);
+
+ FreePicture ((pointer) pTmp, (XID) 0);
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = width;
+ box.y2 = height;
+
+ REGION_INIT (pScreen, ®ion, &box, 1);
+ xglAddSurfaceDamage (&pPixmap->drawable, ®ion);
+ REGION_UNINIT (pDrawable->pScreen, ®ion);
+
+ pPicture->pDrawable = &pPixmap->drawable;
+
+ *xOff = x;
+ *yOff = y;
+
+ XGL_GET_PIXMAP_PRIV (pPixmap)->pictureMask &=
+ ~(xglPCFillMask | xglPCFilterMask | xglPCTransformMask);
+ }
+ }
+
+#ifdef XV
+ switch (pPicture->format) {
+ case PICT_yuy2:
+ xglSetPixmapVisual ((PixmapPtr) pPicture->pDrawable,
+ &pScreenPriv->pXvVisual[XGL_XV_FORMAT_YUY2]);
+ break;
+ case PICT_yv12:
+ xglSetPixmapVisual ((PixmapPtr) pPicture->pDrawable,
+ &pScreenPriv->pXvVisual[XGL_XV_FORMAT_YV12]);
+ default:
+ break;
+ }
+#endif
+
+ if (!xglSyncSurface (pPicture->pDrawable))
+ return FALSE;
+
+ pPixmapPriv = XGL_GET_PIXMAP_PRIV ((PixmapPtr) pPicture->pDrawable);
+ if (XGL_PICTURE_CHANGES (pPixmapPriv->pictureMask))
+ xglUpdatePicture (pPicture);
+
+ return TRUE;
+}
+
static int
xglVisualDepth (ScreenPtr pScreen, VisualPtr pVisual)
{
@@ -299,7 +574,7 @@
if (pDepth->vids[v] == pVisual->vid)
return pDepth->depth;
}
-
+
return 0;
}
@@ -319,10 +594,10 @@
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;
}
@@ -342,7 +617,7 @@
int r, g, b;
int d;
DepthPtr pDepth;
-
+
/* formats required by protocol */
formats[nformats].format = PICT_a1;
formats[nformats].depth = 1;
@@ -364,8 +639,8 @@
depth = xglVisualDepth (pScreen, pVisual);
if (!depth)
continue;
-
- bpp = BitsPerPixel (depth);
+
+ bpp = BitsPerPixel (depth);
switch (pVisual->class) {
case DirectColor:
case TrueColor:
@@ -399,7 +674,7 @@
if (pDepth->depth == 15)
nformats = xglAddFormat (formats, nformats,
PICT_x1r5g5b5, pDepth->depth);
- if (pDepth->depth == 16)
+ if (pDepth->depth == 16)
nformats = xglAddFormat (formats, nformats,
PICT_r5g6b5, pDepth->depth);
break;
@@ -416,42 +691,52 @@
}
}
+ /* add YUV formats */
+ nformats = xglAddFormat (formats, nformats, PICT_yuy2, 16);
+ nformats = xglAddFormat (formats, nformats, PICT_yv12, 12);
+
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].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].type = PictTypeDirect;
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) +
+ 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].type = PictTypeDirect;
pFormats[f].direct.alpha = 0;
pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A (format));
break;
case PICT_TYPE_COLOR:
case PICT_TYPE_GRAY:
+ pFormats[f].type = PictTypeDirect;
+ break;
+ case PICT_TYPE_YUY2:
+ case PICT_TYPE_YV12:
+ pFormats[f].type = PictTypeOther;
break;
}
}
@@ -460,7 +745,7 @@
return FALSE;
PictureAddFilter (pScreen, FilterConvolution, miFilterValidateParams);
-
+
return TRUE;
}
Index: xglpixmap.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglpixmap.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- xglpixmap.c 23 Dec 2005 02:07:58 -0000 1.12
+++ xglpixmap.c 3 Jan 2006 09:56:22 -0000 1.13
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -69,7 +69,8 @@
if (pExt->y2 > pPixmapPriv->damageBox.y2)
pPixmapPriv->damageBox.y2 = pExt->y2;
- } else
+ }
+ else
pPixmapPriv->damageBox = *pExt;
}
@@ -88,34 +89,119 @@
return FALSE;
DamageRegister (&pPixmap->drawable, pPixmapPriv->pDamage);
-
+
return TRUE;
}
+void
+xglSetPixmapVisual (PixmapPtr pPixmap,
+ xglVisualPtr pVisual)
+{
+ xglVisualPtr pOldVisual;
+
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ pOldVisual = pPixmapPriv->pVisual;
+ if (pOldVisual && pVisual)
+ {
+ glitz_surface_t *surface;
+
+ if (pOldVisual->vid != pVisual->vid)
+ {
+ surface = pPixmapPriv->surface;
+ if (surface)
+ {
+ glitz_drawable_t *drawable;
+
+ drawable = glitz_surface_get_attached_drawable (surface);
+ if (drawable)
+ {
+ if (pOldVisual->format.drawable->id !=
+ pVisual->format.drawable->id)
+ {
+ glitz_surface_detach (pPixmapPriv->surface);
+ pPixmapPriv->target = xglPixmapTargetOut;
+ }
+ }
+
+ if (pOldVisual->format.surface->id != pVisual->format.surface->id)
+ {
+ xglSyncBits (&pPixmap->drawable, NULL);
+ glitz_surface_destroy (pPixmapPriv->surface);
+ pPixmapPriv->surface = 0;
+ }
+ }
+ }
+ }
+ else if (pOldVisual)
+ {
+ if (pPixmapPriv->surface)
+ {
+ xglSyncBits (&pPixmap->drawable, NULL);
+ glitz_surface_destroy (pPixmapPriv->surface);
+ pPixmapPriv->surface = 0;
+ }
+ pPixmapPriv->target = xglPixmapTargetNo;
+ }
+
+ pPixmapPriv->pVisual = pVisual;
+
+ if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface)
+ {
+ if (!pPixmapPriv->pDamage)
+ {
+ if (!xglPixmapCreateDamage (pPixmap))
+ FatalError (XGL_SW_FAILURE_STRING);
+ }
+ }
+}
+
static Bool
xglPixmapSurfaceInit (PixmapPtr pPixmap,
unsigned long features,
int width,
int height)
{
+ BoxRec box;
+
XGL_PIXMAP_PRIV (pPixmap);
-
+
pPixmapPriv->surface = NULL;
+ pPixmapPriv->drawable = NULL;
pPixmapPriv->acceleratedTile = FALSE;
pPixmapPriv->pictureMask = ~0;
pPixmapPriv->target = xglPixmapTargetNo;
- pPixmapPriv->lock = 0;
- if (pPixmapPriv->format)
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = width;
+ box.y2 = height;
+
+ REGION_INIT (pScreen, &pPixmapPriv->bitRegion, &box, 1);
+
+ pPixmapPriv->pVisual = xglFindVisualWithDepth (pPixmap->drawable.pScreen,
+ pPixmap->drawable.depth);
+ if (pPixmapPriv->pVisual)
+ {
+ XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
+
+ /* general pixmap acceleration */
+ if (pPixmapPriv->pVisual->format.drawable &&
+ pScreenPriv->accel.pixmap.enabled &&
+ xglCheckPixmapSize (pPixmap, &pScreenPriv->accel.pixmap.size))
+ pPixmapPriv->target = xglPixmapTargetOut;
+ }
+
+ if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface)
{
if (!pPixmapPriv->pDamage)
+ {
if (!xglPixmapCreateDamage (pPixmap))
FatalError (XGL_SW_FAILURE_STRING);
-
+ }
+
if (width && height)
{
- XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
-
if (width == 1 && height == 1)
{
pPixmapPriv->acceleratedTile = TRUE;
@@ -126,28 +212,6 @@
(POWER_OF_TWO (width) && POWER_OF_TWO (height)))
pPixmapPriv->acceleratedTile = TRUE;
}
-
- /*
- * Accelerated drawing to pixmaps when using FBOs
- */
- if (pScreenPriv->fbo)
- {
- 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;
- }
- else
- pPixmapPriv->target = xglPixmapTargetNo;
}
}
@@ -157,7 +221,7 @@
PixmapPtr
xglCreatePixmap (ScreenPtr pScreen,
int width,
- int height,
+ int height,
int depth)
{
xglPixmapPtr pPixmapPriv;
@@ -180,37 +244,32 @@
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->pVisual = NULL;
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;
}
@@ -218,7 +277,7 @@
xglFiniPixmap (PixmapPtr pPixmap)
{
XGL_PIXMAP_PRIV (pPixmap);
-
+
if (pPixmap->devPrivate.ptr)
{
if (pPixmapPriv->buffer)
@@ -230,10 +289,15 @@
if (pPixmapPriv->buffer)
glitz_buffer_destroy (pPixmapPriv->buffer);
-
+
if (pPixmapPriv->bits)
xfree (pPixmapPriv->bits);
-
+
+ REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion);
+
+ if (pPixmapPriv->drawable)
+ glitz_drawable_destroy (pPixmapPriv->drawable);
+
if (pPixmapPriv->surface)
glitz_surface_destroy (pPixmapPriv->surface);
}
@@ -247,7 +311,7 @@
xglFiniPixmap (pPixmap);
xfree (pPixmap);
-
+
return TRUE;
}
@@ -260,18 +324,16 @@
int devKind,
pointer pPixData)
{
- xglScreenPtr pScreenPriv;
- xglPixmapPtr pPixmapPriv;
- glitz_format_t *oldFormat;
- int oldWidth, oldHeight;
-
+ xglScreenPtr pScreenPriv;
+ xglPixmapPtr pPixmapPriv;
+ 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;
@@ -293,13 +355,13 @@
{
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))
@@ -312,18 +374,20 @@
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 ||
+ if (pPixmap->drawable.width != oldWidth ||
pPixmap->drawable.height != oldHeight)
{
+ pPixmapPriv->pVisual = NULL;
+ pPixmapPriv->target = xglPixmapTargetNo;
+
+ if (pPixmapPriv->drawable)
+ glitz_drawable_destroy (pPixmapPriv->drawable);
+
if (pPixmapPriv->surface)
glitz_surface_destroy (pPixmapPriv->surface);
+ REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion);
+
if (!xglPixmapSurfaceInit (pPixmap,
pScreenPriv->features,
pPixmap->drawable.width,
@@ -333,6 +397,8 @@
if (pPixData)
{
+ BoxRec box;
+
if (pPixmap->devPrivate.ptr)
{
if (pPixmapPriv->buffer)
@@ -346,10 +412,10 @@
GEOMETRY_UNINIT (pPixmapPriv->pGeometry);
pPixmapPriv->pGeometry = NULL;
}
-
+
if (pPixmapPriv->buffer)
glitz_buffer_destroy (pPixmapPriv->buffer);
-
+
if (pPixmapPriv->bits)
xfree (pPixmapPriv->bits);
@@ -359,36 +425,54 @@
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;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPixmap->drawable.width;
+ box.y2 = pPixmap->drawable.height;
+
+ REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion);
+ REGION_INIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion,
+ &box, 1);
if (pPixmapPriv->pDamage)
{
RegionPtr pRegion;
-
+
pRegion = DamageRegion (pPixmapPriv->pDamage);
REGION_UNINIT (pPixmap->drawable.pScreen, pRegion);
- REGION_INIT (pPixmap->drawable.pScreen, pRegion,
- &pPixmapPriv->bitBox, 1);
+ REGION_INIT (pPixmap->drawable.pScreen, pRegion, NullBox, 0);
+ REGION_SUBTRACT (pPixmap->drawable.pScreen, pRegion,
+ &pPixmapPriv->bitRegion, pRegion);
+
}
}
/*
- * Maybe there's a nicer way to detect if this is the screen pixmap.
+ * Screen pixmap
*/
- if (!pScreenPriv->pScreenPixmap)
+ if (!pScreenPriv->pScreenPixmap || pScreenPriv->pScreenPixmap == pPixmap)
{
- glitz_surface_reference (pScreenPriv->surface);
-
- pPixmapPriv->surface = pScreenPriv->surface;
+ if (!pPixmapPriv->drawable)
+ {
+ glitz_drawable_reference (pScreenPriv->drawable);
+ pPixmapPriv->drawable = pScreenPriv->drawable;
+ }
+
+ if (!pPixmapPriv->surface)
+ {
+ glitz_surface_reference (pScreenPriv->surface);
+ pPixmapPriv->surface = pScreenPriv->surface;
+ }
+
+ pPixmapPriv->pVisual = pScreenPriv->rootVisual;
pPixmapPriv->target = xglPixmapTargetIn;
-
- pScreenPriv->pScreenPixmap = pPixmap;
+
+ if (!pScreenPriv->pScreenPixmap)
+ pScreenPriv->pScreenPixmap = pPixmap;
}
-
+
return TRUE;
}
@@ -397,12 +481,12 @@
{
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);
@@ -423,14 +507,14 @@
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;
@@ -453,7 +537,7 @@
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;
@@ -473,27 +557,28 @@
{
XGL_PIXMAP_PRIV (pPixmap);
- if (!pPixmapPriv->format)
- return FALSE;
-
if (!pPixmapPriv->surface)
{
XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
+ if (!pPixmapPriv->pVisual || !pPixmapPriv->pVisual->format.surface)
+ return FALSE;
+
pPixmapPriv->surface =
glitz_surface_create (pScreenPriv->drawable,
- pPixmapPriv->format,
+ pPixmapPriv->pVisual->format.surface,
pPixmap->drawable.width,
pPixmap->drawable.height,
0, NULL);
if (!pPixmapPriv->surface)
{
- pPixmapPriv->format = NULL;
- pPixmapPriv->target = xglPixmapTargetNo;
+ pPixmapPriv->pVisual = NULL;
+ pPixmapPriv->target = xglPixmapTargetNo;
+
return FALSE;
}
}
-
+
return TRUE;
}
@@ -501,20 +586,20 @@
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,
@@ -544,7 +629,7 @@
pPixmapPriv->stride = stride;
else
pPixmapPriv->stride = -stride;
-
+
return TRUE;
}
@@ -554,14 +639,14 @@
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)
@@ -578,7 +663,7 @@
pPixmap->devPrivate.ptr = bits;
}
}
-
+
return TRUE;
}
@@ -589,10 +674,68 @@
pPixmap->devKind = 0;
pPixmap->devPrivate.ptr = 0;
-
+
if (pPixmapPriv->buffer)
if (glitz_buffer_unmap (pPixmapPriv->buffer))
return FALSE;
-
+
return TRUE;
}
+
+Bool
+xglCheckPixmapSize (PixmapPtr pPixmap,
+ xglSizeConstraintPtr pSize)
+{
+ if (pPixmap->drawable.width < pSize->minWidth ||
+ pPixmap->drawable.height < pSize->minHeight)
+ return FALSE;
+
+ if (pPixmap->drawable.width > pSize->aboveWidth ||
+ pPixmap->drawable.height > pSize->aboveHeight)
+ return TRUE;
+
+ return FALSE;
+}
+
+void
+xglEnablePixmapAccel (PixmapPtr pPixmap,
+ xglAccelInfoPtr pAccel)
+{
+ XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (pAccel->enabled && xglCheckPixmapSize (pPixmap, &pAccel->size))
+ {
+ xglVisualPtr v;
+
+ if (pAccel->pbuffer)
+ {
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->pPixel->depth != pPixmap->drawable.depth)
+ continue;
+
+ if (v->format.drawable && v->pbuffer)
+ break;
+ }
+ }
+ else
+ {
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->pPixel->depth != pPixmap->drawable.depth)
+ continue;
+
+ if (v->format.drawable && !v->pbuffer)
+ break;
+ }
+ }
+
+ if (v)
+ {
+ xglSetPixmapVisual (pPixmap, v);
+ if (!pPixmapPriv->target)
+ pPixmapPriv->target = xglPixmapTargetOut;
+ }
+ }
+}
Index: xglscreen.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglscreen.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- xglscreen.c 23 Dec 2005 02:07:58 -0000 1.11
+++ xglscreen.c 3 Jan 2006 09:56:22 -0000 1.12
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -60,27 +60,6 @@
#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)
{
@@ -91,7 +70,7 @@
xglScreenPrivateIndex = AllocateScreenPrivateIndex ();
if (xglScreenPrivateIndex < 0)
return FALSE;
-
+
xglGCPrivateIndex = AllocateGCPrivateIndex ();
if (xglGCPrivateIndex < 0)
return FALSE;
@@ -104,13 +83,13 @@
if (xglWinPrivateIndex < 0)
return FALSE;
-#ifdef RENDER
+#ifdef RENDER
xglGlyphPrivateIndex = AllocateGlyphPrivateIndex ();
if (xglGlyphPrivateIndex < 0)
return FALSE;
-#endif
-
- xglScreenGeneration = serverGeneration;
+#endif
+
+ xglScreenGeneration = serverGeneration;
}
if (!AllocateGCPrivate (pScreen, xglGCPrivateIndex, sizeof (xglGCRec)))
@@ -127,66 +106,74 @@
pScreenPriv = xalloc (sizeof (xglScreenRec));
if (!pScreenPriv)
return FALSE;
-
+
XGL_SET_SCREEN_PRIV (pScreen, pScreenPriv);
-
+
return TRUE;
}
Bool
-xglScreenInit (ScreenPtr pScreen)
+xglScreenInit (ScreenPtr pScreen)
{
xglScreenPtr pScreenPriv;
- int depth, bpp;
-
+ xglVisualPtr v;
+ int i, depth, bpp = 0;
+
#ifdef RENDER
PictureScreenPtr pPictureScreen;
#endif
-
+
+ depth = xglScreenInfo.depth;
+
+ for (v = xglVisuals; v; v = v->next)
+ {
+ if (v->pPixel->depth == depth)
+ {
+ bpp = v->pPixel->masks.bpp;
+ break;
+ }
+ }
+
+ if (!bpp)
+ return FALSE;
+
if (!xglAllocatePrivates (pScreen))
return FALSE;
pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen);
pScreenPriv->pScreenPixmap = NULL;
-
- pScreenPriv->pVisual = &xglVisuals[0];
+
+ /* Add any unlisted depths from the pixmap formats */
+ for (i = 0; i < screenInfo.numPixmapFormats; i++)
+ {
+ if (!xglHasVisualTypes (xglVisuals, screenInfo.formats[i].depth))
+ xglSetVisualTypes (screenInfo.formats[i].depth, 0, 0, 0, 0);
+ }
+
+ pScreenPriv->pVisual = 0;
+
+#ifdef GLXEXT
+ pScreenPriv->pGlxVisual = 0;
+#endif
+
+ pScreenPriv->rootVisual = 0;
+
pScreenPriv->drawable = xglScreenInfo.drawable;
pScreenPriv->features =
- glitz_drawable_get_features (xglScreenInfo.drawable);
+ glitz_drawable_get_features (xglScreenInfo.drawable);
- depth = pScreenPriv->pVisual->pPixel->depth;
- bpp = pScreenPriv->pVisual->pPixel->masks.bpp;
+ GEOMETRY_INIT (pScreen, &pScreenPriv->scratchGeometry,
+ GLITZ_GEOMETRY_TYPE_VERTEX,
+ pScreenPriv->geometryUsage, 0);
- xglInitPixmapFormats (pScreen);
- if (!pScreenPriv->pixmapFormats[depth].format)
- return FALSE;
-
pScreenPriv->geometryDataType = xglScreenInfo.geometryDataType;
pScreenPriv->geometryUsage = xglScreenInfo.geometryUsage;
pScreenPriv->yInverted = xglScreenInfo.yInverted;
pScreenPriv->pboMask = xglScreenInfo.pboMask;
pScreenPriv->lines = xglScreenInfo.lines;
- pScreenPriv->fbo = xglScreenInfo.fbo;
-
- GEOMETRY_INIT (pScreen, &pScreenPriv->scratchGeometry,
- GLITZ_GEOMETRY_TYPE_VERTEX,
- pScreenPriv->geometryUsage, 0);
-
- pScreenPriv->surface =
- glitz_surface_create (pScreenPriv->drawable,
- pScreenPriv->pixmapFormats[depth].format,
- xglScreenInfo.width, xglScreenInfo.height,
- 0, NULL);
- if (!pScreenPriv->surface)
- return FALSE;
-
- glitz_surface_attach (pScreenPriv->surface,
- pScreenPriv->drawable,
- GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
+ pScreenPriv->accel = xglScreenInfo.accel;
- pScreenPriv->backSurface = NULL;
-
if (monitorResolution == 0)
monitorResolution = XGL_DEFAULT_DPI;
@@ -197,7 +184,7 @@
return FALSE;
pScreen->SaveScreen = xglSaveScreen;
-
+
pScreen->CreatePixmap = xglCreatePixmap;
pScreen->DestroyPixmap = xglDestroyPixmap;
@@ -218,9 +205,10 @@
XGL_SCREEN_WRAP (GetImage, xglGetImage);
XGL_SCREEN_WRAP (GetSpans, xglGetSpans);
-
+
XGL_SCREEN_WRAP (CopyWindow, xglCopyWindow);
XGL_SCREEN_WRAP (CreateWindow, xglCreateWindow);
+ XGL_SCREEN_WRAP (DestroyWindow, xglDestroyWindow);
XGL_SCREEN_WRAP (ChangeWindowAttributes, xglChangeWindowAttributes);
XGL_SCREEN_WRAP (PaintWindowBackground, xglPaintWindowBackground);
XGL_SCREEN_WRAP (PaintWindowBorder, xglPaintWindowBorder);
@@ -234,13 +222,13 @@
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
@@ -250,7 +238,7 @@
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);
@@ -287,7 +275,8 @@
Bool
xglFinishScreenInit (ScreenPtr pScreen)
{
-
+ xglVisualPtr v;
+
#ifdef RENDER
glitz_vertex_format_t *format;
static glitz_color_t clearBlack = { 0x0, 0x0, 0x0, 0x0 };
@@ -296,38 +285,67 @@
#endif
XGL_SCREEN_PRIV (pScreen);
-
- pScreenPriv->solid =
+
+ xglInitVisuals (pScreen);
+
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->vid == pScreen->rootVisual)
+ pScreenPriv->rootVisual = v;
+ }
+
+ if (!pScreenPriv->rootVisual || !pScreenPriv->rootVisual->format.surface)
+ return FALSE;
+
+ pScreenPriv->surface =
glitz_surface_create (pScreenPriv->drawable,
- pScreenPriv->pixmapFormats[32].format,
- 1, 1, 0, NULL);
- if (!pScreenPriv->solid)
+ pScreenPriv->rootVisual->format.surface,
+ xglScreenInfo.width, xglScreenInfo.height,
+ 0, NULL);
+ if (!pScreenPriv->surface)
return FALSE;
-
- glitz_surface_set_fill (pScreenPriv->solid, GLITZ_FILL_REPEAT);
+
+ glitz_surface_attach (pScreenPriv->surface,
+ pScreenPriv->drawable,
+ GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
#ifdef RENDER
for (i = 0; i < 33; i++)
pScreenPriv->glyphCache[i].pScreen = NULL;
- pScreenPriv->pSolidAlpha = NULL;
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->pPixel->depth == 8)
+ break;
+ }
- pScreenPriv->trapInfo.mask =
- glitz_surface_create (pScreenPriv->drawable,
- pScreenPriv->pixmapFormats[8].format,
- 2, 1, 0, NULL);
- if (!pScreenPriv->trapInfo.mask)
- return FALSE;
+ pScreenPriv->pSolidAlpha = 0;
+ pScreenPriv->trapInfo.pMask = 0;
- 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);
+ /* An accelerated alpha only Xgl visual is required for trapezoid
+ acceleration */
+ if (v && v->format.surface)
+ {
+ glitz_surface_t *mask;
- format = &pScreenPriv->trapInfo.format.vertex;
+ mask = glitz_surface_create (pScreenPriv->drawable,
+ v->format.surface,
+ 2, 1, 0, NULL);
+ if (mask)
+ {
+ glitz_set_rectangle (mask, &clearBlack, 0, 0, 1, 1);
+ glitz_set_rectangle (mask, &solidWhite, 1, 0, 1, 1);
+
+ glitz_surface_set_fill (mask, GLITZ_FILL_NEAREST);
+ glitz_surface_set_filter (mask, GLITZ_FILTER_BILINEAR, NULL, 0);
+
+ pScreenPriv->trapInfo.pMask = xglCreateDevicePicture (mask);
+ if (!pScreenPriv->trapInfo.pMask)
+ return FALSE;
+ }
+ }
+
+ format = &pScreenPriv->trapInfo.format.vertex;
format->primitive = GLITZ_PRIMITIVE_QUADS;
format->attributes = GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK;
@@ -348,7 +366,12 @@
format->mask.offset = 2 * sizeof (glitz_short_t);
}
#endif
-
+
+#ifdef XV
+ if (!xglXvScreenInit (pScreen))
+ return FALSE;
+#endif
+
return TRUE;
}
@@ -356,37 +379,49 @@
xglCloseScreen (int index,
ScreenPtr pScreen)
{
+ xglVisualPtr v;
+
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);
+ if (pScreenPriv->trapInfo.pMask)
+ FreePicture ((pointer) pScreenPriv->trapInfo.pMask, 0);
#endif
xglFiniPixmap (pScreenPriv->pScreenPixmap);
if (pPixmapPriv->pDamage)
DamageDestroy (pPixmapPriv->pDamage);
- if (pScreenPriv->solid)
- glitz_surface_destroy (pScreenPriv->solid);
-
- if (pScreenPriv->backSurface)
- glitz_surface_destroy (pScreenPriv->backSurface);
-
if (pScreenPriv->surface)
glitz_surface_destroy (pScreenPriv->surface);
GEOMETRY_UNINIT (&pScreenPriv->scratchGeometry);
+ while (pScreenPriv->pVisual)
+ {
+ v = pScreenPriv->pVisual;
+ pScreenPriv->pVisual = v->next;
+ xfree (v);
+ }
+
+#ifdef GLXEXT
+ while (pScreenPriv->pGlxVisual)
+ {
+ v = pScreenPriv->pGlxVisual;
+ pScreenPriv->pGlxVisual = v->next;
+ xfree (v);
+ }
+#endif
+
XGL_SCREEN_UNWRAP (CloseScreen);
xfree (pScreenPriv);
@@ -404,7 +439,7 @@
int error;
Pixel pixel;
GCPtr pGC;
- CARD32 tmpval[2];
+ XID tmpval[2];
XGL_SCREEN_PRIV (pScreen);
@@ -415,25 +450,24 @@
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);
+ 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);
+ pScreenPriv->pSolidAlpha = CreatePicture (0, &pPixmap->drawable, pFormat,
+ CPRepeat, tmpval, 0, &error);
(*pScreen->DestroyPixmap) (pPixmap);
if (pScreenPriv->pSolidAlpha)
Index: xglshm.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglshm.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xglshm.c 16 Mar 2005 20:05:19 -0000 1.3
+++ xglshm.c 3 Jan 2006 09:56:22 -0000 1.4
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -56,9 +56,11 @@
GetScratchPixmapHeader (pScreen, w, h, depth,
BitsPerPixel (depth),
PixmapBytePad (w, depth),
- (pointer) data);
+ (pointer) data);
+
+ /* disable any possible acceleration of this pixmap */
if (pPixmap)
- XGL_GET_PIXMAP_PRIV (pPixmap)->format = NULL;
+ xglSetPixmapVisual (pPixmap, 0);
}
else
{
@@ -67,24 +69,22 @@
{
GCPtr pScratchGC;
- XGL_PIXMAP_PRIV (pPixmap);
-
if (!xglAllocatePixmapBits (pPixmap,
XGL_PIXMAP_USAGE_HINT_DEFAULT))
{
(*pScreen->DestroyPixmap) (pPixmap);
return;
}
- pPixmapPriv->format = NULL;
- pPixmapPriv->target = xglPixmapTargetNo;
-
+
+ xglSetPixmapVisual (pPixmap, 0);
+
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,
@@ -96,7 +96,7 @@
sx = sy = 0;
}
}
-
+
if (!pPixmap)
return;
@@ -112,7 +112,7 @@
sx, sy, sw, sh, dx, dy);
pPixmapPriv->target = saveTarget;
-
+
if (pPixmapHeader)
FreeScratchPixmapHeader (pPixmapHeader);
else
Index: xglsolid.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglsolid.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xglsolid.c 9 Aug 2005 15:58:20 -0000 1.4
+++ xglsolid.c 3 Jan 2006 09:56:22 -0000 1.5
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -31,7 +31,7 @@
Bool
xglSolid (DrawablePtr pDrawable,
glitz_operator_t op,
- glitz_color_t *color,
+ glitz_surface_t *solid,
xglGeometryPtr pGeometry,
int x,
int y,
@@ -42,18 +42,14 @@
{
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);
+ XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
if (pGeometry)
{
@@ -67,12 +63,12 @@
}
GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
-
+
if (!GEOMETRY_ENABLE (pGeometry, surface))
return FALSE;
glitz_composite (op,
- pScreenPriv->solid, NULL, surface,
+ solid, NULL, surface,
0, 0,
0, 0,
x + xOff,
@@ -80,7 +76,7 @@
width, height);
glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
-
+
if (glitz_surface_get_status (surface))
return FALSE;
@@ -104,7 +100,7 @@
x += pDrawable->x;
y += pDrawable->y;
-
+
GEOMETRY_INIT (pDrawable->pScreen, &geometry,
GLITZ_GEOMETRY_TYPE_BITMAP,
GEOMETRY_USAGE_SYSMEM, 0);
@@ -116,11 +112,11 @@
pglyphBase);
GEOMETRY_TRANSLATE (&geometry, x, y);
-
+
widthBack = 0;
while (nGlyph--)
widthBack += (*ppci++)->metrics.characterWidth;
-
+
xBack = x;
if (widthBack < 0)
{
@@ -129,10 +125,10 @@
}
yBack = y - FONTASCENT (pGC->font);
heightBack = FONTASCENT (pGC->font) + FONTDESCENT (pGC->font);
-
+
if (xglSolid (pDrawable,
pGCPriv->op,
- &pGCPriv->bg,
+ pGCPriv->bg,
NULL,
xBack,
yBack,
@@ -143,7 +139,7 @@
{
if (xglSolid (pDrawable,
pGCPriv->op,
- &pGCPriv->fg,
+ pGCPriv->fg,
&geometry,
xBack,
yBack,
@@ -153,10 +149,11 @@
REGION_NUM_RECTS (pGC->pCompositeClip)))
{
GEOMETRY_UNINIT (&geometry);
+ xglAddCurrentBitDamage (pDrawable);
return TRUE;
}
}
-
+
GEOMETRY_UNINIT (&geometry);
return FALSE;
}
Index: xglsync.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglsync.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- xglsync.c 1 Jan 2006 06:48:49 -0000 1.10
+++ xglsync.c 3 Jan 2006 09:56:22 -0000 1.11
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -25,49 +25,11 @@
#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);
@@ -76,53 +38,66 @@
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));
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPixmap->drawable.width;
+ box.y2 = pPixmap->drawable.height;
+ if (pExtents->x1 > box.x1)
+ box.x1 = pExtents->x1;
+ if (pExtents->y1 > box.y1)
+ box.y1 = pExtents->y1;
+ if (pExtents->x2 < box.x2)
+ box.x2 = pExtents->x2;
+ if (pExtents->y2 < box.y2)
+ box.y2 = pExtents->y2;
- if (!BOX_NOTEMPTY (&box))
+ if (box.x2 <= box.x1 || box.y2 <= box.y1)
return xglMapPixmapBits (pPixmap);
-
- if (BOX_NOTEMPTY (pBitBox))
+
+ if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion))
{
- RegionRec bitRegion;
-
- REGION_INIT (pDrawable->pScreen, &bitRegion, pBitBox, 1);
-
- switch (RECT_IN_REGION (pDrawable->pScreen, &bitRegion, &box)) {
+ switch (RECT_IN_REGION (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion,
+ &box)) {
case rgnIN:
REGION_INIT (pDrawable->pScreen, ®ion, NullBox, 0);
break;
case rgnOUT:
REGION_INIT (pDrawable->pScreen, ®ion, &box, 1);
- *pBitBox = box;
- pPixmapPriv->allBits = ALL_BITS (pPixmap, pBitBox);
+ REGION_UNION (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
+ ®ion);
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, ®ion, pBitBox, 1);
+ REGION_INIT (pDrawable->pScreen, ®ion, &box, 1);
REGION_SUBTRACT (pDrawable->pScreen, ®ion, ®ion,
- &bitRegion);
-
+ &pPixmapPriv->bitRegion);
+ REGION_UNION (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
+ ®ion);
break;
}
- REGION_UNINIT (pDrawable->pScreen, &bitRegion);
}
else
{
REGION_INIT (pDrawable->pScreen, ®ion, &box, 1);
- *pBitBox = box;
- pPixmapPriv->allBits = ALL_BITS (pPixmap, pBitBox);
+ REGION_SUBTRACT (pDrawable->pScreen, &pPixmapPriv->bitRegion,
+ ®ion, &pPixmapPriv->bitRegion);
+ }
+
+ if (REGION_NUM_RECTS (&pPixmapPriv->bitRegion) == 1)
+ {
+ BoxPtr pBox;
+
+ pBox = REGION_RECTS (&pPixmapPriv->bitRegion);
+
+ if (pBox->x1 <= 0 &&
+ pBox->y1 <= 0 &&
+ pBox->x2 >= pPixmap->drawable.width &&
+ pBox->y2 >= pPixmap->drawable.height)
+ pPixmapPriv->allBits = TRUE;
}
}
else
@@ -133,17 +108,9 @@
box.y2 = pPixmap->drawable.height;
REGION_INIT (pDrawable->pScreen, ®ion, &box, 1);
-
- if (BOX_NOTEMPTY (pBitBox))
- {
- RegionRec bitRegion;
-
- REGION_INIT (pDrawable->pScreen, &bitRegion, pBitBox, 1);
- REGION_SUBTRACT (pDrawable->pScreen, ®ion, ®ion, &bitRegion);
- REGION_UNINIT (pDrawable->pScreen, &bitRegion);
- }
-
- *pBitBox = box;
+ REGION_SUBTRACT (pDrawable->pScreen, ®ion, ®ion,
+ &pPixmapPriv->bitRegion);
+
pPixmapPriv->allBits = TRUE;
}
@@ -151,62 +118,66 @@
if (!xglAllocatePixmapBits (pPixmap, XGL_PIXMAP_USAGE_HINT_DEFAULT))
return FALSE;
- if (pPixmapPriv->pDamage)
- {
- RegionPtr pRegion;
-
- pRegion = DamageRegion (pPixmapPriv->pDamage);
- REGION_SUBTRACT (pDrawable->pScreen, ®ion, ®ion, pRegion);
- }
-
if (REGION_NOTEMPTY (pDrawable->pScreen, ®ion) && pPixmapPriv->surface)
{
glitz_pixel_format_t format;
BoxPtr pBox;
+ BoxPtr pExt;
int nBox;
-
+
if (!xglSyncSurface (pDrawable))
FatalError (XGL_SW_FAILURE_STRING);
xglUnmapPixmapBits (pPixmap);
-
+
pBox = REGION_RECTS (®ion);
nBox = REGION_NUM_RECTS (®ion);
+ pExt = REGION_EXTENTS (pDrawable->pScreen, ®ion);
- format.fourcc = GLITZ_FOURCC_RGB;
- format.masks = pPixmapPriv->pPixel->masks;
-
- while (nBox--)
+ format.fourcc = GLITZ_FOURCC_RGB;
+ format.masks = pPixmapPriv->pVisual->pPixel->masks;
+ format.xoffset = pExt->x1;
+
+ if (pPixmapPriv->stride < 0)
{
- format.xoffset = pBox->x1;
+ 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;
+ }
- 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_surface_set_clip_region (pPixmapPriv->surface,
+ 0, 0, (glitz_box_t *) pBox, nBox);
- glitz_get_pixels (pPixmapPriv->surface,
- pBox->x1,
- pBox->y1,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1,
- &format,
- pPixmapPriv->buffer);
-
- pBox++;
- }
+ glitz_get_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_UNINIT (pDrawable->pScreen, ®ion);
+ if (pPixmapPriv->allBits)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPixmap->drawable.width;
+ box.y2 = pPixmap->drawable.height;
+
+ REGION_UNINIT (pDrawable->pScreen, &pPixmapPriv->bitRegion);
+ REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion, &box, 1);
+ }
+
return xglMapPixmapBits (pPixmap);
}
@@ -229,9 +200,6 @@
if (!pPixmapPriv->surface)
{
- if (!pPixmapPriv->format)
- return FALSE;
-
if (!xglCreatePixmapSurface (pPixmap))
return FALSE;
}
@@ -239,20 +207,20 @@
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.fourcc = GLITZ_FOURCC_RGB;
- format.masks = pPixmapPriv->pPixel->masks;
+ format.fourcc = pPixmapPriv->pVisual->format.surface->color.fourcc;
+ format.masks = pPixmapPriv->pVisual->pPixel->masks;
format.xoffset = pExt->x1;
if (pPixmapPriv->stride < 0)
@@ -299,16 +267,51 @@
case xglPixmapTargetOut:
if (xglSyncSurface (pDrawable))
{
- pPixmapPriv->target = xglPixmapTargetIn;
- return TRUE;
+ glitz_drawable_format_t *format;
+
+ XGL_SCREEN_PRIV (pDrawable->pScreen);
+
+ if (!pPixmapPriv->drawable)
+ {
+ unsigned int width, height;
+
+ format = pPixmapPriv->pVisual->format.drawable;
+ width = pPixmap->drawable.width;
+ height = pPixmap->drawable.height;
+
+ if (pPixmapPriv->pVisual->pbuffer)
+ {
+ pPixmapPriv->drawable =
+ glitz_create_pbuffer_drawable (pScreenPriv->drawable,
+ format, width, height);
+ }
+ else
+ {
+ pPixmapPriv->drawable =
+ glitz_create_drawable (pScreenPriv->drawable,
+ format, width, height);
+ }
+ }
+
+ if (pPixmapPriv->drawable)
+ {
+ glitz_surface_attach (pPixmapPriv->surface,
+ pPixmapPriv->drawable,
+ GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
+
+ pPixmapPriv->target = xglPixmapTargetIn;
+
+ return TRUE;
+ }
}
+ pPixmapPriv->target = xglPixmapTargetNo;
break;
case xglPixmapTargetIn:
if (xglSyncSurface (pDrawable))
return TRUE;
break;
}
-
+
return FALSE;
}
@@ -316,52 +319,65 @@
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);
+ if (pPixmapPriv->pDamage)
+ {
+ RegionPtr pDamageRegion;
+
+ pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
+
+ REGION_UNION (pDrawable->pScreen,
+ pDamageRegion, pDamageRegion,
+ pRegion);
+ }
+
+ REGION_UNION (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
+ pRegion);
- 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, ®ion, &pPixmapPriv->damageBox, 1);
+
+ if (pPixmapPriv->pDamage)
+ {
+ RegionPtr pDamageRegion;
+
+ pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
+
+ REGION_UNION (pDrawable->pScreen,
+ pDamageRegion, pDamageRegion,
+ ®ion);
+ }
+
REGION_UNION (pDrawable->pScreen,
- pDamageRegion, pDamageRegion, ®ion);
+ &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
+ ®ion);
+
REGION_UNINIT (pDrawable->pScreen, ®ion);
-
+
pPixmapPriv->damageBox = miEmptyBox;
}
}
@@ -370,34 +386,42 @@
xglAddBitDamage (DrawablePtr pDrawable,
RegionPtr pRegion)
{
- BoxPtr pBox;
- BoxPtr pExt;
- int nBox;
-
XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
- pBox = REGION_RECTS (pRegion);
- pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion);
- nBox = REGION_NUM_RECTS (pRegion);
-
- if (pExt->x1 < pPixmapPriv->bitBox.x2 &&
- pExt->y1 < pPixmapPriv->bitBox.y2 &&
- pExt->x2 > pPixmapPriv->bitBox.x1 &&
- pExt->y2 > pPixmapPriv->bitBox.y1)
+ if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion))
{
- while (nBox--)
+ BoxPtr pBox;
+ BoxPtr pExt, pBitExt;
+ int nBox;
+
+ pBox = REGION_RECTS (pRegion);
+ pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion);
+ nBox = REGION_NUM_RECTS (pRegion);
+
+ pBitExt = REGION_EXTENTS (pDrawable->pScreen, &pPixmapPriv->bitRegion);
+
+ if (pExt->x1 < pBitExt->x2 &&
+ pExt->y1 < pBitExt->y2 &&
+ pExt->x2 > pBitExt->x1 &&
+ pExt->y2 > pBitExt->y1)
{
- if (pBox->x1 < pPixmapPriv->bitBox.x2 &&
- pBox->y1 < pPixmapPriv->bitBox.y2 &&
- pBox->x2 > pPixmapPriv->bitBox.x1 &&
- pBox->y2 > pPixmapPriv->bitBox.y1)
+ while (nBox--)
{
- pPixmapPriv->bitBox = miEmptyBox;
- pPixmapPriv->allBits = FALSE;
- return;
+ if (pBox->x1 < pBitExt->x2 &&
+ pBox->y1 < pBitExt->y2 &&
+ pBox->x2 > pBitExt->x1 &&
+ pBox->y2 > pBitExt->y1)
+ {
+ REGION_UNINIT (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion);
+ REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion,
+ NullBox, 0);
+ pPixmapPriv->allBits = FALSE;
+ return;
+ }
+
+ pBox++;
}
-
- pBox++;
}
}
}
@@ -407,13 +431,22 @@
{
XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
- if (pPixmapPriv->damageBox.x1 < pPixmapPriv->bitBox.x2 &&
- pPixmapPriv->damageBox.y1 < pPixmapPriv->bitBox.y2 &&
- pPixmapPriv->damageBox.x2 > pPixmapPriv->bitBox.x1 &&
- pPixmapPriv->damageBox.y2 > pPixmapPriv->bitBox.y1)
+ if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion))
{
- pPixmapPriv->bitBox = miEmptyBox;
- pPixmapPriv->allBits = FALSE;
+ BoxPtr pBitExt;
+
+ pBitExt = REGION_EXTENTS (pDrawable->pScreen, &pPixmapPriv->bitRegion);
+
+ if (pPixmapPriv->damageBox.x1 < pBitExt->x2 &&
+ pPixmapPriv->damageBox.y1 < pBitExt->y2 &&
+ pPixmapPriv->damageBox.x2 > pBitExt->x1 &&
+ pPixmapPriv->damageBox.y2 > pBitExt->y1)
+ {
+ REGION_UNINIT (pDrawable->pScreen, &pPixmapPriv->bitRegion);
+ REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion,
+ NullBox, 0);
+ pPixmapPriv->allBits = FALSE;
+ }
}
pPixmapPriv->damageBox = miEmptyBox;
Index: xgltile.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xgltile.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xgltile.c 26 Jan 2005 10:58:52 -0000 1.3
+++ xgltile.c 3 Jan 2006 09:56:22 -0000 1.4
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -63,7 +63,7 @@
tileWidth = pTile->drawable.width;
tileHeight = pTile->drawable.height;
-
+
for (i = 0; i < nBox; i++)
size +=
(((pBox[i].x2 - pBox[i].x1) / tileWidth) + 2) *
@@ -75,7 +75,7 @@
data = glitz_buffer_map (pGeometry->buffer,
GLITZ_BUFFER_ACCESS_WRITE_ONLY);
-
+
while (nBox--)
{
x = pBox->x1;
@@ -87,19 +87,19 @@
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;
@@ -107,7 +107,7 @@
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);
@@ -122,29 +122,29 @@
*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++;
}
@@ -197,7 +197,7 @@
GLITZ_FILTER_NEAREST,
NULL, 0);
glitz_surface_set_transform (pTilePriv->surface, NULL);
-
+
if (pTilePriv->acceleratedTile)
{
if (pGeometry)
@@ -212,9 +212,9 @@
4 * nBox);
GEOMETRY_ADD_BOX (pDrawable->pScreen, pGeometry, pBox, nBox);
}
-
+
GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
-
+
if (!GEOMETRY_ENABLE (pGeometry, surface))
return FALSE;
@@ -231,7 +231,7 @@
width, height);
glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
-
+
if (!glitz_surface_get_status (surface))
return TRUE;
@@ -249,10 +249,10 @@
return FALSE;
GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
-
+
if (!GEOMETRY_ENABLE (pGeometry, surface))
return FALSE;
-
+
glitz_composite (op,
pTilePriv->surface, NULL, surface,
0, 0,
@@ -260,9 +260,9 @@
x + xOff,
y + yOff,
width, height);
-
+
if (glitz_surface_get_status (surface))
return FALSE;
-
+
return TRUE;
}
Index: xgltrap.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xgltrap.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- xgltrap.c 23 Dec 2005 02:07:58 -0000 1.7
+++ xgltrap.c 3 Jan 2006 09:56:22 -0000 1.8
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -74,15 +74,15 @@
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++;
@@ -95,15 +95,15 @@
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;
@@ -117,18 +117,18 @@
if (x2 > extents->x2)
extents->x2 = x2;
}
-
+
if (y1 >= extents->y2)
extents->y2 = y2;
else if (y2 <= extents->y1)
- extents->y1 = y1;
+ extents->y1 = y1;
else
{
if (y1 < extents->y1)
extents->y1 = y1;
if (y2 > extents->y2)
extents->y2 = y2;
-
+
if (x_overlap)
overlap = TRUE;
}
@@ -151,21 +151,20 @@
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
PicturePtr pMask = NULL, pSrcPicture, pDstPicture;
+ PicturePtr pMaskPicture = NULL;
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;
@@ -180,7 +179,7 @@
xRectangle rect;
int error;
int area;
-
+
if (!pScreenPriv->pSolidAlpha)
{
xglCreateSolidAlphaPicture (pScreen);
@@ -194,11 +193,11 @@
rect.height = extents.y2 - extents.y1;
pPixmap = (*pScreen->CreatePixmap) (pScreen,
- rect.width, rect.height,
+ rect.width, rect.height,
maskFormat->depth);
if (!pPixmap)
return;
-
+
pMask = CreatePicture (0, &pPixmap->drawable, maskFormat,
0, 0, serverClient, &error);
if (!pMask)
@@ -206,15 +205,17 @@
(*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)
+ {
+ /* make sure we don't do accelerated drawing to mask */
+ xglSetPixmapVisual (pPixmap, NULL);
+ }
+
area = rect.width * rect.height;
- if (!target || (SMOOTH_TRAPS_ESTIMATE_RECTS (nTrap) * 4) > area)
- XGL_GET_PIXMAP_PRIV (pPixmap)->lock = 1;
-
+ if ((SMOOTH_TRAPS_ESTIMATE_RECTS (nTrap) * 4) > area)
+ XGL_GET_PIXMAP_PRIV (pPixmap)->target = xglPixmapTargetNo;
+
ValidatePicture (pMask);
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
ValidateGC (&pPixmap->drawable, pGC);
@@ -224,7 +225,7 @@
(*pScreen->DestroyPixmap) (pPixmap);
target = xglPrepareTarget (pMask->pDrawable);
-
+
xOff = -extents.x1;
yOff = -extents.y1;
pSrcPicture = pScreenPriv->pSolidAlpha;
@@ -232,9 +233,6 @@
}
else
{
- /* make sure destination drawable is locked */
- pPixmapPriv->lock++;
-
if (maskFormat)
{
if (maskFormat->depth == 1)
@@ -242,7 +240,7 @@
else
polyEdge = PolyEdgeSmooth;
}
-
+
xOff = 0;
yOff = 0;
pSrcPicture = pSrc;
@@ -254,37 +252,38 @@
if (maskFormat || polyEdge == PolyEdgeSmooth)
{
glitz_vertex_format_t *format;
+ glitz_surface_t *mask;
xTrapezoid *pTrap = traps;
int nAddedTrap, n = nTrap;
int offset = 0;
int size = SMOOTH_TRAPS_ESTIMATE_RECTS (n);
- mask = pScreenPriv->trapInfo.mask;
+ pMaskPicture = pScreenPriv->trapInfo.pMask;
format = &pScreenPriv->trapInfo.format.vertex;
-
+ mask = pMaskPicture->pSourcePict->source.devPrivate.ptr;
+
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;
@@ -304,10 +303,9 @@
if (pMask)
FreePicture (pMask, 0);
- pPixmapPriv->lock--;
return;
}
-
+
GEOMETRY_ADD_TRAPEZOID (pScreen, pGeometry, traps, nTrap);
}
@@ -317,19 +315,18 @@
}
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))
+ xglCompositeGeneral (pMask ? PictOpAdd : op,
+ pSrcPicture,
+ pMaskPicture,
+ pDstPicture,
+ pGeometry,
+ 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))
{
/* no intermediate mask? we need to register damage from here as
CompositePicture will never be called. */
@@ -340,12 +337,12 @@
REGION_INIT (pScreen, ®ion, &extents, 1);
REGION_TRANSLATE (pScreen, ®ion,
pDst->pDrawable->x, pDst->pDrawable->y);
-
+
DamageDamageRegion (pDst->pDrawable, ®ion);
REGION_UNINIT (pScreen, ®ion);
}
-
+
xglAddCurrentBitDamage (pDstPicture->pDrawable);
}
else
@@ -363,16 +360,17 @@
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,
+ }
+ else
+ miTrapezoids (op, pSrc, pDstPicture, maskFormat,
xSrc, ySrc, nTrap, traps);
}
-
+
if (pMask)
{
CompositePicture (op, pSrc, pMask, pDst,
@@ -382,12 +380,9 @@
extents.x1, extents.y1,
extents.x2 - extents.x1,
extents.y2 - extents.y1);
-
+
FreePicture (pMask, 0);
}
-
- /* release destination drawable lock */
- pPixmapPriv->lock--;
}
void
@@ -397,9 +392,9 @@
int nTrap,
xTrap *traps)
{
- PictureScreenPtr pPictureScreen;
+ PictureScreenPtr pPictureScreen;
ScreenPtr pScreen = pDst->pDrawable->pScreen;
-
+
XGL_SCREEN_PRIV (pScreen);
XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
@@ -417,33 +412,36 @@
if (xglPrepareTarget (pDst->pDrawable))
{
+ PicturePtr pMask;
glitz_vertex_format_t *format;
+ glitz_surface_t *mask;
xglGeometryPtr pGeometry;
xTrap *pTrap = traps;
int nAddedTrap, n = nTrap;
int offset = 0;
int size = SMOOTH_TRAPS_ESTIMATE_RECTS (n);
+ pMask = pScreenPriv->trapInfo.pMask;
format = &pScreenPriv->trapInfo.format.vertex;
+ mask = pMask->pSourcePict->source.devPrivate.ptr;
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,
+ offset, size - offset, format->type, mask,
(glitz_trap_t *) pTrap, n,
&nAddedTrap);
-
+
n -= nAddedTrap;
pTrap += nAddedTrap;
size *= 2;
@@ -455,17 +453,17 @@
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))
+
+ if (xglCompositeGeneral (PictOpAdd,
+ pScreenPriv->pSolidAlpha,
+ pMask,
+ pDst,
+ pGeometry,
+ 0, 0,
+ 0, 0,
+ pDst->pDrawable->x, pDst->pDrawable->y,
+ pDst->pDrawable->width,
+ pDst->pDrawable->height))
{
xglAddCurrentBitDamage (pDst->pDrawable);
return;
Index: xglwindow.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglwindow.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xglwindow.c 16 Mar 2005 20:05:19 -0000 1.5
+++ xglwindow.c 3 Jan 2006 09:56:22 -0000 1.6
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -40,7 +40,7 @@
{
ScreenPtr pScreen = pWin->drawable.pScreen;
Bool ret;
-
+
XGL_SCREEN_PRIV (pScreen);
XGL_WINDOW_PRIV (pWin);
@@ -54,15 +54,30 @@
}
Bool
+xglDestroyWindow (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool ret;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ XGL_SCREEN_UNWRAP (DestroyWindow);
+ ret = (*pScreen->DestroyWindow) (pWin);
+ XGL_SCREEN_WRAP (DestroyWindow, xglDestroyWindow);
+
+ 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)
@@ -74,7 +89,7 @@
xglSyncBits (&pPixmap->drawable, NULL);
}
}
-
+
if (mask & CWBorderPixmap)
{
if (pWin->borderIsPixel == FALSE)
@@ -90,12 +105,12 @@
XGL_SCREEN_UNWRAP (ChangeWindowAttributes);
ret = (*pScreen->ChangeWindowAttributes) (pWin, mask);
XGL_SCREEN_WRAP (ChangeWindowAttributes, xglChangeWindowAttributes);
-
+
return ret;
}
-void
-xglCopyWindow (WindowPtr pWin,
+void
+xglCopyWindow (WindowPtr pWin,
DDXPointRec ptOldOrg,
RegionPtr prgnSrc)
{
@@ -111,10 +126,10 @@
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,
@@ -122,7 +137,7 @@
fbCopyRegion (&pWin->drawable, &pWin->drawable,
0, &rgnDst, dx, dy, xglCopyProc, 0, (void *) &box);
-
+
REGION_UNINIT (pWin->drawable.pScreen, &rgnDst);
}
@@ -131,29 +146,53 @@
RegionPtr pRegion,
Pixel pixel)
{
- glitz_color_t color;
- BoxPtr pExtent;
+ glitz_pixel_format_t format;
+ glitz_surface_t *solid;
+ glitz_buffer_t *buffer;
+ BoxPtr pExtent;
+ Bool ret;
XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+ XGL_SCREEN_PRIV (pDrawable->pScreen);
- if (!pPixmapPriv->target)
+ if (!xglPrepareTarget (pDrawable))
+ return FALSE;
+
+ solid = glitz_surface_create (pScreenPriv->drawable,
+ pPixmapPriv->pVisual->format.surface,
+ 1, 1, 0, NULL);
+ if (!solid)
return FALSE;
+ glitz_surface_set_fill (solid, GLITZ_FILL_REPEAT);
+
+ format.fourcc = GLITZ_FOURCC_RGB;
+ format.masks = pPixmapPriv->pVisual->pPixel->masks;
+ format.xoffset = 0;
+ format.skip_lines = 0;
+ format.bytes_per_line = sizeof (CARD32);
+ format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
+
+ buffer = glitz_buffer_create_for_data (&pixel);
+
+ glitz_set_pixels (solid, 0, 0, 1, 1, &format, buffer);
+
+ glitz_buffer_destroy (buffer);
+
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;
+ ret = xglSolid (pDrawable,
+ GLITZ_OPERATOR_SRC,
+ solid,
+ NULL,
+ pExtent->x1, pExtent->y1,
+ pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
+ REGION_RECTS (pRegion),
+ REGION_NUM_RECTS (pRegion));
+
+ glitz_surface_destroy (solid);
+
+ return ret;
}
static Bool
@@ -164,11 +203,6 @@
int tileY)
{
BoxPtr pExtent;
-
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if (!pPixmapPriv->target)
- return FALSE;
pExtent = REGION_EXTENTS (pDrawable->pScreen, pRegion);
@@ -182,7 +216,7 @@
REGION_RECTS (pRegion),
REGION_NUM_RECTS (pRegion)))
return TRUE;
-
+
return FALSE;
}
@@ -194,7 +228,7 @@
ScreenPtr pScreen = pWin->drawable.pScreen;
XGL_SCREEN_PRIV (pScreen);
-
+
switch (pWin->backgroundState) {
case None:
return;
@@ -202,7 +236,7 @@
do {
pWin = pWin->parent;
} while (pWin->backgroundState == ParentRelative);
-
+
(*pScreen->PaintWindowBackground) (pWin, pRegion, what);
return;
case BackgroundPixmap:
@@ -215,7 +249,7 @@
xglAddCurrentBitDamage (&pWin->drawable);
return;
}
-
+
if (!xglSyncBits (&pWin->background.pixmap->drawable, NullBox))
FatalError (XGL_SW_FAILURE_STRING);
break;
@@ -258,7 +292,7 @@
else
{
WindowPtr pBgWin = pWin;
-
+
while (pBgWin->backgroundState == ParentRelative)
pBgWin = pBgWin->parent;
@@ -271,7 +305,7 @@
xglAddCurrentBitDamage (&pWin->drawable);
return;
}
-
+
if (!xglSyncBits (&pWin->border.pixmap->drawable, NullBox))
FatalError (XGL_SW_FAILURE_STRING);
}
@@ -281,3 +315,27 @@
XGL_WINDOW_FALLBACK_EPILOGUE (pWin, pRegion, PaintWindowBorder,
xglPaintWindowBorder);
}
+
+PixmapPtr
+xglGetWindowPixmap (WindowPtr pWin)
+{
+ return XGL_GET_WINDOW_PIXMAP (pWin);
+}
+
+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;
+
+ if (pPixmap != pScreenPriv->pScreenPixmap)
+ xglEnablePixmapAccel (pPixmap, &pScreenPriv->accel.window);
+}
--- NEW FILE: xglxv.c ---
(This appears to be a binary file; contents omitted.)
- Previous message: xserver/hw/xgl/glxext Makefile.am, 1.1, 1.2 xglglxext.c, 1.1,
1.2 xglglxext.h, 1.2, 1.3 xglglxlog.c, NONE, 1.1
- Next message: xserver/hw/xgl/egl xegl.c,1.7,1.8 xeglinit.c,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the xserver-commit
mailing list