xserver/hw/xgl xgl.h, 1.9, 1.10 xglcmap.c, 1.4, 1.5 xglcopy.c, 1.4,
1.5 xglparse.c, 1.3, 1.4 xglpixmap.c, 1.8, 1.9 xglscreen.c,
1.5, 1.6 xglshm.c, 1.1, 1.2 xglsync.c, 1.4, 1.5 xgltrap.c, 1.2, 1.3
David Reveman
xserver-commit at pdx.freedesktop.org
Thu Mar 10 16:58:51 PST 2005
Committed by: davidr
Update of /cvs/xserver/xserver/hw/xgl
In directory gabe:/tmp/cvs-serv2534/hw/xgl
Modified Files:
xgl.h xglcmap.c xglcopy.c xglparse.c xglpixmap.c xglscreen.c
xglshm.c xglsync.c xgltrap.c
Log Message:
Use negative stride and PBOs in Xgl
Index: xgl.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xgl.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- xgl.h 8 Mar 2005 09:12:17 -0000 1.9
+++ xgl.h 11 Mar 2005 00:58:49 -0000 1.10
@@ -54,6 +54,8 @@
extern WindowPtr *WindowTable;
+#define XGL_DEFAULT_PBO_MASK 0 /* don't use PBO as default */
+
typedef struct _xglScreenInfo {
glitz_drawable_t *drawable;
unsigned int width;
@@ -63,6 +65,8 @@
Bool fullscreen;
int geometryDataType;
int geometryUsage;
+ Bool yInverted;
+ int pboMask;
} xglScreenInfoRec, *xglScreenInfoPtr;
typedef struct _xglPixelFormat {
@@ -217,6 +221,8 @@
int nOffscreen;
int geometryUsage;
int geometryDataType;
+ Bool yInverted;
+ int pboMask;
xglGeometryRec scratchGeometry;
#ifdef RENDER
@@ -830,12 +836,27 @@
/* xglpixmap.c */
+#define XGL_PIXMAP_USAGE_HINT_STREAM_DRAW 1
+#define XGL_PIXMAP_USAGE_HINT_STREAM_READ 2
+#define XGL_PIXMAP_USAGE_HINT_STREAM_COPY 3
+#define XGL_PIXMAP_USAGE_HINT_STATIC_DRAW 4
+#define XGL_PIXMAP_USAGE_HINT_STATIC_READ 5
+#define XGL_PIXMAP_USAGE_HINT_STATIC_COPY 6
+#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_DRAW 7
+#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_READ 8
+#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_COPY 9
+
+#define XGL_PIXMAP_USAGE_HINT_DEFAULT XGL_PIXMAP_USAGE_HINT_STREAM_DRAW
+
PixmapPtr
xglCreatePixmap (ScreenPtr pScreen,
int width,
int height,
int depth);
+void
+xglFiniPixmap (PixmapPtr pPixmap);
+
Bool
xglDestroyPixmap (PixmapPtr pPixmap);
@@ -860,7 +881,7 @@
xglCreatePixmapSurface (PixmapPtr pPixmap);
Bool
-xglAllocatePixmapBits (PixmapPtr pPixmap);
+xglAllocatePixmapBits (PixmapPtr pPixmap, int hint);
Bool
xglMapPixmapBits (PixmapPtr pPixmap);
Index: xglcmap.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglcmap.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xglcmap.c 11 Feb 2005 20:19:20 -0000 1.4
+++ xglcmap.c 11 Mar 2005 00:58:49 -0000 1.5
@@ -157,8 +157,8 @@
if (xglPbufferVisuals)
{
xglPbufferVisuals[nxglPbufferVisuals].format = format;
- xglPbufferVisuals[nxglPbufferVisuals].pPixel = pPixelFormat;
- xglPbufferVisuals[nxglPbufferVisuals].visuals = visuals;
+ xglPbufferVisuals[nxglPbufferVisuals].pPixel = NULL;
+ xglPbufferVisuals[nxglPbufferVisuals].visuals = 0;
nxglPbufferVisuals++;
}
}
@@ -217,23 +217,6 @@
rm, gm, bm);
}
}
-
-#if 1
- {
- for (j = 0; j < nxglVisuals; j++)
- {
- ErrorF ("Visual: 0x%x (%c) - r/g/b/a: %d/%d/%d/%d db: %d\n",
- (int) xglVisuals[j].format->id,
- xglVisuals[j].format->types.pbuffer? 'y' : 'n',
- xglVisuals[j].format->color.red_size,
- xglVisuals[j].format->color.green_size,
- xglVisuals[j].format->color.blue_size,
- xglVisuals[j].format->color.alpha_size,
- xglVisuals[j].format->doublebuffer);
- }
- }
-#endif
-
}
void
Index: xglcopy.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglcopy.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xglcopy.c 8 Mar 2005 09:27:09 -0000 1.4
+++ xglcopy.c 11 Mar 2005 00:58:49 -0000 1.5
@@ -158,12 +158,6 @@
pBox++;
}
-
- if (pPixmapPriv->target == xglPixmapTargetIn)
- {
- if (!xglSyncSurface (pDst))
- FatalError (XGL_SW_FAILURE_STRING);
- }
} else
xglAddCurrentBitDamage (pDst);
}
Index: xglparse.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglparse.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xglparse.c 26 Jan 2005 10:58:52 -0000 1.3
+++ xglparse.c 11 Mar 2005 00:58:49 -0000 1.4
@@ -105,6 +105,9 @@
ErrorF ("-vertextype [short|float] set vertex data type\n");
ErrorF ("-vbostream "
"use vertex buffer objects for streaming of vertex data\n");
+ ErrorF ("-yinverted Y is upside-down\n");
+ ErrorF ("-pbomask [1|4|8|16|32] "
+ "set bpp's to use with pixel buffer objects\n");
}
int
@@ -148,6 +151,22 @@
pScreenInfo->geometryUsage = GEOMETRY_USAGE_STREAM;
return 1;
}
+ else if (!strcmp (argv[i], "-yinverted"))
+ {
+ pScreenInfo->yInverted = TRUE;
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-pbomask"))
+ {
+ if ((i + 1) < argc)
+ {
+ pScreenInfo->pboMask = atoi (argv[i + 1]);
+ }
+ else
+ return 1;
+
+ return 2;
+ }
return 0;
}
Index: xglpixmap.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglpixmap.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- xglpixmap.c 11 Feb 2005 20:19:20 -0000 1.8
+++ xglpixmap.c 11 Mar 2005 00:58:49 -0000 1.9
@@ -26,6 +26,24 @@
#include "xgl.h"
#include "fb.h"
+static glitz_buffer_hint_t xglPixmapUsageHints[] = {
+ (glitz_buffer_hint_t) 0, /* reserved for system memory */
+ GLITZ_BUFFER_HINT_STREAM_DRAW,
+ GLITZ_BUFFER_HINT_STREAM_READ,
+ GLITZ_BUFFER_HINT_STREAM_COPY,
+ GLITZ_BUFFER_HINT_STATIC_DRAW,
+ GLITZ_BUFFER_HINT_STATIC_READ,
+ GLITZ_BUFFER_HINT_STATIC_COPY,
+ GLITZ_BUFFER_HINT_DYNAMIC_DRAW,
+ GLITZ_BUFFER_HINT_DYNAMIC_READ,
+ GLITZ_BUFFER_HINT_DYNAMIC_COPY
+};
+
+#define NUM_XGL_PIXMAP_USAGE_HINTS \
+ (sizeof (xglPixmapUsageHints) / sizeof (xglPixmapUsageHints[0]))
+
+#define XGL_PIXMAP_USAGE_HINT(hint) (xglPixmapUsageHints[hint])
+
static void
xglPixmapDamageReport (DamagePtr pDamage,
RegionPtr pRegion,
@@ -187,14 +205,11 @@
return pPixmap;
}
-Bool
-xglDestroyPixmap (PixmapPtr pPixmap)
+void
+xglFiniPixmap (PixmapPtr pPixmap)
{
XGL_PIXMAP_PRIV (pPixmap);
-
- if (--pPixmap->refcnt)
- return TRUE;
-
+
if (pPixmapPriv->pArea)
xglWithdrawArea (pPixmapPriv->pArea);
@@ -215,6 +230,15 @@
if (pPixmapPriv->surface)
glitz_surface_destroy (pPixmapPriv->surface);
+}
+
+Bool
+xglDestroyPixmap (PixmapPtr pPixmap)
+{
+ if (--pPixmap->refcnt)
+ return TRUE;
+
+ xglFiniPixmap (pPixmap);
xfree (pPixmap);
@@ -362,7 +386,6 @@
glitz_surface_reference (pScreenPriv->surface);
pPixmapPriv->surface = pScreenPriv->surface;
- pPixmapPriv->pPixel = pScreenPriv->pVisual[0].pPixel;
pPixmapPriv->target = xglPixmapTargetIn;
pScreenPriv->pScreenPixmap = pPixmap;
@@ -405,7 +428,8 @@
if (!pPixmapPriv->buffer)
{
- if (!xglAllocatePixmapBits (pPixmap))
+ if (!xglAllocatePixmapBits (pPixmap,
+ XGL_PIXMAP_USAGE_HINT_DEFAULT))
return NULL;
}
@@ -476,11 +500,12 @@
}
Bool
-xglAllocatePixmapBits (PixmapPtr pPixmap)
+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;
@@ -490,22 +515,37 @@
if (stride)
{
- pPixmapPriv->bits = xalloc (height * stride);
- if (!pPixmapPriv->bits)
- return FALSE;
+ glitz_buffer_t *buffer;
+
+ if ((pScreenPriv->pboMask & bpp) && hint)
+ {
+ buffer = glitz_pixel_buffer_create (pScreenPriv->drawable,
+ NULL, height * stride,
+ XGL_PIXMAP_USAGE_HINT (hint));
+ }
+ else
+ {
+ pPixmapPriv->bits = xalloc (height * stride);
+ if (!pPixmapPriv->bits)
+ return FALSE;
- pPixmapPriv->buffer =
- glitz_buffer_create_for_data (pPixmapPriv->bits);
- if (!pPixmapPriv->buffer)
+ buffer = glitz_buffer_create_for_data (pPixmapPriv->bits);
+ }
+
+ if (!buffer)
{
- xfree (pPixmapPriv->bits);
+ if (pPixmapPriv->bits)
+ xfree (pPixmapPriv->bits);
pPixmapPriv->bits = NULL;
return FALSE;
- }
+ }
+ pPixmapPriv->buffer = buffer;
}
- /* XXX: pPixmapPriv->stride = -stride */
- pPixmapPriv->stride = stride;
+ if (pScreenPriv->yInverted)
+ pPixmapPriv->stride = stride;
+ else
+ pPixmapPriv->stride = -stride;
return TRUE;
}
@@ -520,7 +560,8 @@
XGL_PIXMAP_PRIV (pPixmap);
if (!pPixmapPriv->buffer)
- if (!xglAllocatePixmapBits (pPixmap))
+ if (!xglAllocatePixmapBits (pPixmap,
+ XGL_PIXMAP_USAGE_HINT_DEFAULT))
return FALSE;
bits = glitz_buffer_map (pPixmapPriv->buffer,
Index: xglscreen.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglscreen.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xglscreen.c 8 Mar 2005 09:12:17 -0000 1.5
+++ xglscreen.c 11 Mar 2005 00:58:49 -0000 1.6
@@ -135,6 +135,7 @@
xglScreenInfoPtr pScreenInfo)
{
xglScreenPtr pScreenPriv;
+ int depth;
#ifdef RENDER
PictureScreenPtr pPictureScreen;
@@ -152,15 +153,19 @@
pScreenPriv->features =
glitz_drawable_get_features (pScreenInfo->drawable);
+ depth = pScreenPriv->pVisual->pPixel->depth;
+
if (!xglInitOffscreen (pScreen, pScreenInfo))
return FALSE;
xglInitPixmapFormats (pScreen);
- if (!pScreenPriv->pixmapFormats[32].format)
+ if (!pScreenPriv->pixmapFormats[depth].format)
return FALSE;
pScreenPriv->geometryDataType = pScreenInfo->geometryDataType;
pScreenPriv->geometryUsage = pScreenInfo->geometryUsage;
+ pScreenPriv->yInverted = pScreenInfo->yInverted;
+ pScreenPriv->pboMask = pScreenInfo->pboMask;
GEOMETRY_INIT (pScreen, &pScreenPriv->scratchGeometry,
GLITZ_GEOMETRY_TYPE_VERTEX,
@@ -168,7 +173,7 @@
pScreenPriv->surface =
glitz_surface_create (pScreenPriv->drawable,
- pScreenPriv->pixmapFormats[32].format,
+ pScreenPriv->pixmapFormats[depth].format,
pScreenInfo->width, pScreenInfo->height,
0, NULL);
if (!pScreenPriv->surface)
@@ -283,7 +288,9 @@
XGL_SCREEN_PRIV (pScreen);
- miInitializeBackingStore (pScreen);
+ /* Do we want to use BackingStore?
+ miInitializeBackingStore (pScreen);
+ */
if (!fbCreateDefColormap (pScreen))
return FALSE;
@@ -348,7 +355,8 @@
ScreenPtr pScreen)
{
XGL_SCREEN_PRIV (pScreen);
-
+ XGL_PIXMAP_PRIV (pScreenPriv->pScreenPixmap);
+
#ifdef RENDER
int i;
@@ -362,6 +370,10 @@
glitz_surface_destroy (pScreenPriv->trapInfo.mask);
#endif
+ xglFiniPixmap (pScreenPriv->pScreenPixmap);
+ if (pPixmapPriv->pDamage)
+ DamageDestroy (pPixmapPriv->pDamage);
+
if (pScreenPriv->solid)
glitz_surface_destroy (pScreenPriv->solid);
Index: xglshm.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglshm.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xglshm.c 8 Mar 2005 09:12:17 -0000 1.1
+++ xglshm.c 11 Mar 2005 00:58:49 -0000 1.2
@@ -64,7 +64,8 @@
XGL_PIXMAP_PRIV (pPixmap);
- if (!xglAllocatePixmapBits (pPixmap))
+ if (!xglAllocatePixmapBits (pPixmap,
+ XGL_PIXMAP_USAGE_HINT_DEFAULT))
{
(*pScreen->DestroyPixmap) (pPixmap);
return;
Index: xglsync.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglsync.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xglsync.c 1 Mar 2005 16:57:54 -0000 1.4
+++ xglsync.c 11 Mar 2005 00:58:49 -0000 1.5
@@ -80,7 +80,7 @@
pBitBox = &pPixmapPriv->bitBox;
- if (pExtents)
+ if (pPixmapPriv->target == xglPixmapTargetIn && pExtents)
{
box.x1 = MAX (0, pExtents->x1);
box.y1 = MAX (0, pExtents->y1);
@@ -150,7 +150,7 @@
}
if (!pPixmapPriv->buffer)
- if (!xglAllocatePixmapBits (pPixmap))
+ if (!xglAllocatePixmapBits (pPixmap, XGL_PIXMAP_USAGE_HINT_DEFAULT))
return FALSE;
if (pPixmapPriv->pDamage)
@@ -176,23 +176,24 @@
nBox = REGION_NUM_RECTS (®ion);
format.masks = pPixmapPriv->pPixel->masks;
-
- if (pPixmapPriv->stride < 0)
- {
- format.bytes_per_line = -pPixmapPriv->stride;
- format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
- }
- else
- {
- format.bytes_per_line = pPixmapPriv->stride;
- format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
- }
while (nBox--)
{
- format.xoffset = pBox->x1;
- format.skip_lines = pBox->y1;
-
+ format.xoffset = pBox->x1;
+
+ if (pPixmapPriv->stride < 0)
+ {
+ format.skip_lines = pPixmap->drawable.height - pBox->y2;
+ format.bytes_per_line = -pPixmapPriv->stride;
+ format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
+ }
+ else
+ {
+ format.skip_lines = pBox->y1;
+ format.bytes_per_line = pPixmapPriv->stride;
+ format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
+ }
+
glitz_get_pixels (pPixmapPriv->surface,
pBox->x1,
pBox->y1,
@@ -254,17 +255,18 @@
pBox = REGION_RECTS (pRegion);
pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion);
- format.masks = pPixmapPriv->pPixel->masks;
- format.xoffset = pExt->x1;
- format.skip_lines = pExt->y1;
-
+ format.masks = pPixmapPriv->pPixel->masks;
+ format.xoffset = pExt->x1;
+
if (pPixmapPriv->stride < 0)
{
+ format.skip_lines = pPixmap->drawable.height - pExt->y2;
format.bytes_per_line = -pPixmapPriv->stride;
format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
}
else
{
+ format.skip_lines = pExt->y1;
format.bytes_per_line = pPixmapPriv->stride;
format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
}
Index: xgltrap.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xgltrap.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xgltrap.c 1 Feb 2005 21:22:02 -0000 1.2
+++ xgltrap.c 11 Mar 2005 00:58:49 -0000 1.3
@@ -66,17 +66,13 @@
{
XGL_PIXMAP_PRIV (pPixmap);
- if (!xglAllocatePixmapBits (pPixmap))
+ if (!xglAllocatePixmapBits (pPixmap, XGL_PIXMAP_USAGE_HINT_DEFAULT))
{
(*pScreen->DestroyPixmap) (pPixmap);
return 0;
}
pPixmapPriv->target = xglPixmapTargetNo;
-
- /* force negative stride */
- if (pPixmapPriv->stride > 0)
- pPixmapPriv->stride = -pPixmapPriv->stride;
}
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
More information about the xserver-commit
mailing list