xserver: Branch 'glucose-2'
Alan Hourihane
alanh at kemper.freedesktop.org
Wed Mar 28 17:37:52 EEST 2007
hw/xgl/xgl.h | 32 +++++++++
hw/xgl/xglcmap.c | 27 ++-----
hw/xgl/xglcompose.c | 11 ++-
hw/xgl/xglcopy.c | 9 ++
hw/xgl/xglfill.c | 176 ++++++++++++++++++++++++++++++----------------------
hw/xgl/xglgc.c | 3
hw/xgl/xglget.c | 7 ++
hw/xgl/xglinit.c | 2
hw/xgl/xglparse.c | 63 ++++++++++++++++++
hw/xgl/xglpict.c | 48 +++++++++++++-
hw/xgl/xglpixmap.c | 12 ++-
hw/xgl/xglscreen.c | 59 ++++++++++++++++-
hw/xgl/xglsolid.c | 6 +
hw/xgl/xglsync.c | 46 +++++++++++++
hw/xgl/xgltile.c | 9 ++
hw/xgl/xglxv.c | 140 +++++++++++++++++++++++++++++++++--------
16 files changed, 518 insertions(+), 132 deletions(-)
New commits:
diff-tree 615cdbe20bd8134f140211e3ef38256d90b69321 (from 3814989624a7ae18c63c0ce331625e67a991a59a)
Author: Alan Hourihane <alanh at fairlite.demon.co.uk>
Date: Wed Mar 28 15:37:51 2007 +0100
Update xgl code to latest and make some changes for glucose.
diff --git a/hw/xgl/xgl.h b/hw/xgl/xgl.h
index cd4cec1..0fcf672 100644
--- a/hw/xgl/xgl.h
+++ b/hw/xgl/xgl.h
@@ -102,6 +102,8 @@ typedef struct _xglScreenInfo {
Bool yInverted;
int pboMask;
Bool lines;
+ Bool noYuv;
+ char *xvFilter;
xglScreenAccelInfoRec accel;
} xglScreenInfoRec, *xglScreenInfoPtr;
@@ -124,6 +126,7 @@ typedef struct _xglVisual {
} xglVisualRec, *xglVisualPtr;
extern xglVisualPtr xglVisuals;
+extern xglPixelFormatRec xglPixelFormats[];
#define xglAreaAvailable 0
#define xglAreaDivided 1
@@ -255,6 +258,8 @@ typedef struct _xglScreen {
Bool yInverted;
int pboMask;
Bool lines;
+ Bool noYuv;
+ char *xvFilter;
xglGeometryRec scratchGeometry;
xglScreenAccelInfoRec accel;
@@ -372,6 +377,7 @@ typedef struct _xglXvPort {
PixmapPtr pPixmap;
PicturePtr pSrc;
PicturePtr pDst;
+ PicturePtr pTmp;
} xglXvPortRec, *xglXvPortPtr;
#endif
@@ -503,6 +509,21 @@ xglKbdCtrl (DeviceIntPtr pDevice,
void
xglInitInput (int argc, char **argv);
+#ifdef XEVDEV
+
+extern Bool useEvdev;
+extern char *kbdEvdevFile;
+extern char *ptrEvdevFile;
+
+void
+xglEvdevReadInput (void);
+
+void
+xglWakeupHandler (pointer blockData,
+ int result,
+ pointer pReadMask);
+
+#endif
/* xgloutput.c */
@@ -545,6 +566,9 @@ xglFindVisualWithId (ScreenPtr pScreen,
void
xglClearVisualTypes (void);
+int
+xglNumPixelFormats (void);
+
/* xglparse.c */
@@ -923,6 +947,14 @@ void
xglEnablePixmapAccel (PixmapPtr pPixmap,
xglAccelInfoPtr pAccel);
+Bool
+xglPixmapSurfaceInit (PixmapPtr pPixmap,
+ unsigned long features,
+ int width,
+ int height);
+
+Bool
+xglPixmapCreateDamage (PixmapPtr pPixmap);
/* xglsync.c */
diff --git a/hw/xgl/xglcmap.c b/hw/xgl/xglcmap.c
index b96308d..99593eb 100644
--- a/hw/xgl/xglcmap.c
+++ b/hw/xgl/xglcmap.c
@@ -28,7 +28,7 @@
#include "micmap.h"
#include "fb.h"
-static xglPixelFormatRec xglPixelFormats[] = {
+xglPixelFormatRec xglPixelFormats[] = {
{
8, 8,
{
@@ -77,11 +77,14 @@ static xglPixelFormatRec xglPixelFormats
}
};
-#define NUM_XGL_PIXEL_FORMATS \
- (sizeof (xglPixelFormats) / sizeof (xglPixelFormats[0]))
-
xglVisualPtr xglVisuals = NULL;
+int
+xglNumPixelFormats(void)
+{
+ return (sizeof (xglPixelFormats) / sizeof(xglPixelFormats[0]));
+}
+
void
xglSetVisualTypes (int depth,
int visuals,
@@ -92,7 +95,7 @@ xglSetVisualTypes (int depth,
xglPixelFormatPtr pBestFormat = 0;
int i, rs, gs, bs, diff, bestDiff = 0;
- for (i = 0; i < NUM_XGL_PIXEL_FORMATS; i++)
+ for (i = 0; i < xglNumPixelFormats(); i++)
{
if (xglPixelFormats[i].depth == depth)
{
@@ -133,8 +136,6 @@ xglSetVisualTypes (int depth,
if (pBestFormat)
{
xglVisualPtr new, *prev, v;
- unsigned int bitsPerRGB;
- Pixel rm, gm, bm;
new = xalloc (sizeof (xglVisualRec));
if (!new)
@@ -147,21 +148,9 @@ xglSetVisualTypes (int depth,
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
- {
- fbSetVisualTypesAndMasks (depth, 0, 0, 0, 0, 0);
- }
}
Bool
diff --git a/hw/xgl/xglcompose.c b/hw/xgl/xglcompose.c
index d2aead0..f9f7e5b 100644
--- a/hw/xgl/xglcompose.c
+++ b/hw/xgl/xglcompose.c
@@ -23,6 +23,10 @@
* Author: David Reveman <davidr at novell.com>
*/
+#include "glxserver.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
#include "xgl.h"
#ifdef RENDER
@@ -175,9 +179,10 @@ xglCompositeGeneral (CARD8 op,
if (!pGeometry)
{
- if (!pSrc->transform && pSrc->filter != PictFilterConvolution)
+ if (pSrc->pDrawable && !pSrc->transform &&
+ pSrc->filter != PictFilterConvolution)
{
- if (pSrc->pDrawable && pSrc->repeat == RepeatNormal)
+ if (pSrc->repeatType == RepeatNormal)
{
XGL_PIXMAP_PRIV ((PixmapPtr) pSrc->pDrawable);
@@ -261,12 +266,14 @@ xglCompositeGeneral (CARD8 op,
else
GEOMETRY_DISABLE (dst);
+ __glXleaveServer();
glitz_composite (XGL_OPERATOR (op),
src, mask, dst,
xSrc, ySrc,
xMask, yMask,
xDst + dstXoff, yDst + dstYoff,
width, height);
+ __glXenterServer();
glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
diff --git a/hw/xgl/xglcopy.c b/hw/xgl/xglcopy.c
index d612b33..ec7bd64 100644
--- a/hw/xgl/xglcopy.c
+++ b/hw/xgl/xglcopy.c
@@ -22,6 +22,11 @@
*
* Author: David Reveman <davidr at novell.com>
*/
+#include "glxserver.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+
#include "xgl.h"
#include "fb.h"
@@ -64,6 +69,7 @@ xglCopy (DrawablePtr pSrc,
dstXoff, dstYoff,
(glitz_box_t *) pBox, nBox);
+ __glXleaveServer();
glitz_copy_area (src,
dst,
srcXoff + dx,
@@ -72,10 +78,11 @@ xglCopy (DrawablePtr pSrc,
pPixmap->drawable.height - dstYoff,
dstXoff,
dstYoff);
+ __glXenterServer();
glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
- if (glitz_surface_get_status (dst))
+ if (glitz_surface_get_status (dst))
return FALSE;
return TRUE;
diff --git a/hw/xgl/xglfill.c b/hw/xgl/xglfill.c
index 64759ab..a2957b2 100644
--- a/hw/xgl/xglfill.c
+++ b/hw/xgl/xglfill.c
@@ -172,6 +172,7 @@ xglFillRect (DrawablePtr pDrawable,
RegionPtr pClip = pGC->pCompositeClip;
BoxPtr pClipBox;
BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
+ int fullX1, fullX2, fullY1, fullY2;
BoxRec part, full;
BoxPtr heapBox = NULL;
BoxRec stackBox[N_STACK_BOX];
@@ -181,21 +182,26 @@ xglFillRect (DrawablePtr pDrawable,
while (nrect--)
{
- full.x1 = prect->x + pDrawable->x;
- full.y1 = prect->y + pDrawable->y;
- full.x2 = full.x1 + (int) prect->width;
- full.y2 = full.y1 + (int) prect->height;
+ fullX1 = prect->x + pDrawable->x;
+ fullY1 = prect->y + pDrawable->y;
+ fullX2 = fullX1 + (int) prect->width;
+ fullY2 = fullY1 + (int) prect->height;
prect++;
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
+ if (fullX1 < pExtent->x1)
+ fullX1 = pExtent->x1;
+ if (fullY1 < pExtent->y1)
+ fullY1 = pExtent->y1;
+ if (fullX2 > pExtent->x2)
+ fullX2 = pExtent->x2;
+ if (fullY2 > pExtent->y2)
+ fullY2 = pExtent->y2;
+
+ full.x1 = fullX1;
+ full.y1 = fullY1;
+ full.x2 = fullX2;
+ full.y2 = fullY2;
if (full.x1 >= full.x2 || full.y1 >= full.y2)
continue;
@@ -246,6 +252,7 @@ xglFillSpan (DrawablePtr pDrawable,
RegionPtr pClip = pGC->pCompositeClip;
BoxPtr pClipBox;
BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
+ int fullX1, fullX2, fullY1, fullY2;
BoxRec part, full;
BoxPtr heapBox = NULL;
BoxRec stackBox[N_STACK_BOX];
@@ -255,22 +262,27 @@ xglFillSpan (DrawablePtr pDrawable,
while (n--)
{
- full.x1 = ppt->x;
- full.y1 = ppt->y;
- full.x2 = full.x1 + *pwidth;
- full.y2 = full.y1 + 1;
+ fullX1 = ppt->x;
+ fullY1 = ppt->y;
+ fullX2 = fullX1 + *pwidth;
+ fullY2 = fullY1 + 1;
pwidth++;
ppt++;
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
+ if (fullX1 < pExtent->x1)
+ fullX1 = pExtent->x1;
+ if (fullY1 < pExtent->y1)
+ fullY1 = pExtent->y1;
+ if (fullX2 > pExtent->x2)
+ fullX2 = pExtent->x2;
+ if (fullY2 > pExtent->y2)
+ fullY2 = pExtent->y2;
+
+ full.x1 = fullX1;
+ full.y1 = fullY1;
+ full.x2 = fullX2;
+ full.y2 = fullY2;
if (full.x1 >= full.x2 || full.y1 >= full.y2)
continue;
@@ -373,6 +385,7 @@ xglFillLine (DrawablePtr pDrawable,
if (horizontalAndVertical)
{
BoxPtr pClipBox;
+ int fullX1, fullX2, fullY1, fullY2;
BoxRec part, full;
BoxPtr heapBox = NULL;
BoxRec stackBox[N_STACK_BOX];
@@ -403,49 +416,49 @@ xglFillLine (DrawablePtr pDrawable,
{
if (dx > 0)
{
- full.x1 = pt.x + pDrawable->x;
+ fullX1 = pt.x + pDrawable->x;
if (npt || coincidentEndpoints)
- full.x2 = full.x1 + dx;
+ fullX2 = fullX1 + dx;
else
- full.x2 = full.x1 + dx + 1;
+ fullX2 = fullX1 + dx + 1;
}
else
{
- full.x2 = pt.x + pDrawable->x + 1;
+ fullX2 = pt.x + pDrawable->x + 1;
if (npt || coincidentEndpoints)
- full.x1 = full.x2 + dx;
+ fullX1 = fullX2 + dx;
else
- full.x1 = full.x2 + dx - 1;
+ fullX1 = fullX2 + dx - 1;
}
- full.y1 = pt.y + pDrawable->y;
- full.y2 = full.y1 + 1;
+ fullY1 = pt.y + pDrawable->y;
+ fullY2 = fullY1 + 1;
}
else
{
if (dy > 0)
{
- full.y1 = pt.y + pDrawable->y;
+ fullY1 = pt.y + pDrawable->y;
if (npt || coincidentEndpoints)
- full.y2 = full.y1 + dy;
+ fullY2 = fullY1 + dy;
else
- full.y2 = full.y1 + dy + 1;
+ fullY2 = fullY1 + dy + 1;
}
else
{
- full.y2 = pt.y + pDrawable->y + 1;
+ fullY2 = pt.y + pDrawable->y + 1;
if (npt || coincidentEndpoints)
- full.y1 = full.y2 + dy;
+ fullY1 = fullY2 + dy;
else
- full.y1 = full.y2 + dy - 1;
+ fullY1 = fullY2 + dy - 1;
}
- full.x1 = pt.x + pDrawable->x;
- full.x2 = full.x1 + 1;
+ fullX1 = pt.x + pDrawable->x;
+ fullX2 = fullX1 + 1;
}
pt.x += dx;
@@ -453,14 +466,19 @@ xglFillLine (DrawablePtr pDrawable,
ppt++;
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
+ if (fullX1 < pExtent->x1)
+ fullX1 = pExtent->x1;
+ if (fullY1 < pExtent->y1)
+ fullY1 = pExtent->y1;
+ if (fullX2 > pExtent->x2)
+ fullX2 = pExtent->x2;
+ if (fullY2 > pExtent->y2)
+ fullY2 = pExtent->y2;
+
+ full.x1 = fullX1;
+ full.y1 = fullY1;
+ full.x2 = fullX2;
+ full.y2 = fullY2;
if (full.x1 >= full.x2 || full.y1 >= full.y2)
continue;
@@ -570,6 +588,7 @@ xglFillSegment (DrawablePtr pDrawable,
if (horizontalAndVertical)
{
BoxPtr pClipBox;
+ int fullX1, fullX2, fullY1, fullY2;
BoxRec part, full;
BoxPtr heapBox = NULL;
BoxRec stackBox[N_STACK_BOX];
@@ -583,49 +602,62 @@ xglFillSegment (DrawablePtr pDrawable,
{
if (pSegInit->x1 < pSegInit->x2)
{
- full.x1 = pSegInit->x1;
- full.x2 = pSegInit->x2;
+ fullX1 = pSegInit->x1;
+ fullX2 = pSegInit->x2;
+ if (pGC->capStyle != CapNotLast)
+ fullX2++;
}
else
{
- full.x1 = pSegInit->x2;
- full.x2 = pSegInit->x1;
+ fullX1 = pSegInit->x2;
+ fullX2 = pSegInit->x1 + 1;
+ if (pGC->capStyle == CapNotLast)
+ fullX1++;
}
- full.x1 += pDrawable->x;
- full.x2 += pDrawable->x + 1;
- full.y1 = pSegInit->y1 + pDrawable->y;
- full.y2 = full.y1 + 1;
+ fullX1 += pDrawable->x;
+ fullX2 += pDrawable->x;
+ fullY1 = pSegInit->y1 + pDrawable->y;
+ fullY2 = fullY1 + 1;
}
else
{
if (pSegInit->y1 < pSegInit->y2)
{
- full.y1 = pSegInit->y1;
- full.y2 = pSegInit->y2;
+ fullY1 = pSegInit->y1;
+ fullY2 = pSegInit->y2;
+ if (pGC->capStyle != CapNotLast)
+ fullY2++;
}
else
{
- full.y1 = pSegInit->y2;
- full.y2 = pSegInit->y1;
+ fullY1 = pSegInit->y2;
+ fullY2 = pSegInit->y1 + 1;
+ if (pGC->capStyle == CapNotLast)
+ fullY1++;
}
- full.y1 += pDrawable->y;
- full.y2 += pDrawable->y + 1;
- full.x1 = pSegInit->x1 + pDrawable->x;
- full.x2 = full.x1 + 1;
+ fullY1 += pDrawable->y;
+ fullY2 += pDrawable->y;
+ fullX1 = pSegInit->x1 + pDrawable->x;
+ fullX2 = fullX1 + 1;
}
pSegInit++;
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
+ if (fullX1 < pExtent->x1)
+ fullX1 = pExtent->x1;
+ if (fullY1 < pExtent->y1)
+ fullY1 = pExtent->y1;
+ if (fullX2 > pExtent->x2)
+ fullX2 = pExtent->x2;
+ if (fullY2 > pExtent->y2)
+ fullY2 = pExtent->y2;
+
+ full.x1 = fullX1;
+ full.y1 = fullY1;
+ full.x2 = fullX2;
+ full.y2 = fullY2;
if (full.x1 >= full.x2 || full.y1 >= full.y2)
continue;
diff --git a/hw/xgl/xglgc.c b/hw/xgl/xglgc.c
index 7e7e751..deb3982 100644
--- a/hw/xgl/xglgc.c
+++ b/hw/xgl/xglgc.c
@@ -85,6 +85,9 @@ static const GCOps xglGCOps = {
xglImageGlyphBlt,
xglPolyGlyphBlt,
xglPushPixels
+#ifdef NEED_LINEHELPER
+ , NULL
+#endif
};
void
diff --git a/hw/xgl/xglget.c b/hw/xgl/xglget.c
index 87bcb05..e91f072 100644
--- a/hw/xgl/xglget.c
+++ b/hw/xgl/xglget.c
@@ -22,6 +22,11 @@
*
* Author: David Reveman <davidr at novell.com>
*/
+#include "glxserver.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+
#include "xgl.h"
@@ -48,8 +53,10 @@ xglGetImage (DrawablePtr pDrawable,
if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
FatalError (XGL_SW_FAILURE_STRING);
+ __glXleaveServer();
glitz_surface_flush (pScreenPriv->surface);
glitz_drawable_finish (pScreenPriv->drawable);
+ __glXenterServer();
}
XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
diff --git a/hw/xgl/xglinit.c b/hw/xgl/xglinit.c
index e0c9e7d..0019331 100644
--- a/hw/xgl/xglinit.c
+++ b/hw/xgl/xglinit.c
@@ -99,10 +99,8 @@ void *symTab[] = {
SYMFUNC (mieqInit),
SYMFUNC (mieqProcessInputEvents),
SYMFUNC (miPointerAbsoluteCursor),
- SYMFUNC (miRegisterPointerDevice),
SYMFUNC (miPointerWarpCursor),
SYMFUNC (miDCInitialize),
- SYMFUNC (miPointerAbsoluteCursor),
SYMFUNC (miPointerUpdate),
SYMFUNC (miRegisterRedirectBorderClipProc)
};
diff --git a/hw/xgl/xglparse.c b/hw/xgl/xglparse.c
index 5292692..983ee67 100644
--- a/hw/xgl/xglparse.c
+++ b/hw/xgl/xglparse.c
@@ -188,12 +188,25 @@ xglUseMsg (void)
ErrorF ("-yinverted Y is upside-down\n");
ErrorF ("-lines "
"accelerate lines that are not vertical or horizontal\n");
+ ErrorF ("-noyuv "
+ "turns off hardware color-space conversion of YUV data\n");
+
+#ifdef XV
+ ErrorF ("-xvfilter [nearest|linear] set xvideo filter\n");
+#endif
+
ErrorF ("-vbo "
"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 ("-accel TYPE[@WIDTH[/MIN]xHEIGHT[/MIN]][:METHOD] "
"offscreen acceleration\n");
+
+#ifdef XEVDEV
+ ErrorF ("-kbd file evdev file to read keyboard events\n");
+ ErrorF ("-ptr file evdev file to read pointer events\n");
+#endif
+
}
int
@@ -225,6 +238,29 @@ xglProcessArgument (int argc,
xglScreenInfo.lines = TRUE;
return 1;
}
+ else if (!strcmp (argv[i], "-noyuv"))
+ {
+ xglScreenInfo.noYuv = TRUE;
+ return 1;
+ }
+
+#ifdef XV
+ else if (!strcmp (argv[i], "-xvfilter"))
+ {
+ if ((i + 1) < argc)
+ {
+ if (!strcasecmp (argv[i + 1], "nearest"))
+ xglScreenInfo.xvFilter = FilterNearest;
+ else if (!strcasecmp (argv[i + 1], "linear"))
+ xglScreenInfo.xvFilter = FilterBilinear;
+ }
+ else
+ return 1;
+
+ return 2;
+ }
+#endif
+
else if (!strcmp (argv[i], "-vbo"))
{
xglScreenInfo.geometryUsage = GEOMETRY_USAGE_STREAM;
@@ -253,5 +289,32 @@ xglProcessArgument (int argc,
return 2;
}
+#ifdef XEVDEV
+ else if (!strcmp (argv[i], "-kbd"))
+ {
+ if ((i + 1) < argc)
+ {
+ kbdEvdevFile = argv[i + 1];
+ useEvdev = TRUE;
+ }
+ else
+ return 1;
+
+ return 2;
+ }
+ else if (!strcmp (argv[i], "-ptr"))
+ {
+ if ((i + 1) < argc)
+ {
+ ptrEvdevFile = argv[i + 1];
+ useEvdev = TRUE;
+ }
+ else
+ return 1;
+
+ return 2;
+ }
+#endif
+
return 0;
}
diff --git a/hw/xgl/xglpict.c b/hw/xgl/xglpict.c
index 932d31a..eb77e77 100644
--- a/hw/xgl/xglpict.c
+++ b/hw/xgl/xglpict.c
@@ -272,7 +272,7 @@ xglUpdatePicture (PicturePtr pPicture)
if (pPixmapPriv->pictureMask & xglPCFillMask)
{
- glitz_surface_set_fill (surface, fillMode[pPicture->repeat]);
+ glitz_surface_set_fill (surface, fillMode[pPicture->repeatType]);
}
if (pPixmapPriv->pictureMask & xglPCFilterMask)
@@ -463,7 +463,7 @@ xglSyncPicture (ScreenPtr pScreen,
break;
}
- glitz_surface_set_fill (surface, fillMode[pPicture->repeat]);
+ glitz_surface_set_fill (surface, fillMode[pPicture->repeatType]);
glitz_surface_set_transform (surface, (glitz_transform_t *)
pPicture->transform);
@@ -784,4 +784,48 @@ xglPictureClipExtents (PicturePtr pPictu
}
}
+void
+xglCreateSolidAlphaPicture (ScreenPtr pScreen)
+{
+ static xRenderColor solidWhite = { 0xffff, 0xffff, 0xffff, 0xffff };
+ static xRectangle one = { 0, 0, 1, 1 };
+ PixmapPtr pPixmap;
+ PictFormatPtr pFormat;
+ int error;
+ Pixel pixel;
+ GCPtr pGC;
+ XID tmpval[2];
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
+ if (!pFormat)
+ return;
+
+ pGC = GetScratchGC (pFormat->depth, pScreen);
+ if (!pGC)
+ return;
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, pFormat->depth);
+ if (!pPixmap)
+ return;
+
+ miRenderColorToPixel (pFormat, &solidWhite, &pixel);
+
+ tmpval[0] = GXcopy;
+ tmpval[1] = pixel;
+
+ ChangeGC (pGC, GCFunction | GCForeground, tmpval);
+ ValidateGC (&pPixmap->drawable, pGC);
+ (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one);
+ FreeScratchGC (pGC);
+
+ tmpval[0] = xTrue;
+ pScreenPriv->pSolidAlpha = CreatePicture (0, &pPixmap->drawable, pFormat,
+ CPRepeat, tmpval, 0, &error);
+ (*pScreen->DestroyPixmap) (pPixmap);
+
+ if (pScreenPriv->pSolidAlpha)
+ ValidatePicture (pScreenPriv->pSolidAlpha);
+}
#endif
diff --git a/hw/xgl/xglpixmap.c b/hw/xgl/xglpixmap.c
index 368c3ea..bcd3e49 100644
--- a/hw/xgl/xglpixmap.c
+++ b/hw/xgl/xglpixmap.c
@@ -75,7 +75,7 @@ xglPixmapDamageReport (DamagePtr pDamage
}
-static Bool
+Bool
xglPixmapCreateDamage (PixmapPtr pPixmap)
{
XGL_PIXMAP_PRIV (pPixmap);
@@ -156,7 +156,7 @@ xglSetPixmapVisual (PixmapPtr pPixmap
}
}
-static Bool
+Bool
xglPixmapSurfaceInit (PixmapPtr pPixmap,
unsigned long features,
int width,
@@ -298,8 +298,12 @@ xglFiniPixmap (PixmapPtr pPixmap)
if (pPixmapPriv->drawable)
glitz_drawable_destroy (pPixmapPriv->drawable);
- if (pPixmapPriv->surface)
+ if (pPixmapPriv->surface) {
+ /* leaving because texture destruction can occur and flush primitives */
+ __glXleaveServer();
glitz_surface_destroy (pPixmapPriv->surface);
+ __glXenterServer();
+ }
}
Bool
@@ -564,12 +568,14 @@ xglCreatePixmapSurface (PixmapPtr pPixma
if (!pPixmapPriv->pVisual || !pPixmapPriv->pVisual->format.surface)
return FALSE;
+ __glXleaveServer();
pPixmapPriv->surface =
glitz_surface_create (pScreenPriv->drawable,
pPixmapPriv->pVisual->format.surface,
pPixmap->drawable.width,
pPixmap->drawable.height,
0, NULL);
+ __glXenterServer();
if (!pPixmapPriv->surface)
{
pPixmapPriv->pVisual = NULL;
diff --git a/hw/xgl/xglscreen.c b/hw/xgl/xglscreen.c
index 5ad9091..86906c9 100644
--- a/hw/xgl/xglscreen.c
+++ b/hw/xgl/xglscreen.c
@@ -118,6 +118,7 @@ xglScreenInit (ScreenPtr pScreen)
xglScreenPtr pScreenPriv;
xglVisualPtr v;
int i, depth, bpp = 0;
+ int dpiX, dpiY;
#ifdef RENDER
PictureScreenPtr pPictureScreen;
@@ -151,6 +152,37 @@ xglScreenInit (ScreenPtr pScreen)
xglSetVisualTypes (screenInfo.formats[i].depth, 0, 0, 0, 0);
}
+ fbSetVisualTypesAndMasks (depth, (1 << TrueColor),
+ v->pPixel->bitsPerRGB,
+ v->pPixel->masks.red_mask,
+ v->pPixel->masks.green_mask,
+ v->pPixel->masks.blue_mask);
+
+ for (i = 0; i < screenInfo.numPixmapFormats; i++)
+ {
+ Pixel rm = 0, gm = 0, bm = 0;
+ int bitsPerRGB = 0;
+
+ if (screenInfo.formats[i].depth == depth)
+ continue;
+
+ for (v = xglVisuals; v; v = v->next)
+ {
+ if (v->pPixel->depth == screenInfo.formats[i].depth)
+ {
+ rm = v->pPixel->masks.red_mask;
+ gm = v->pPixel->masks.green_mask;
+ bm = v->pPixel->masks.blue_mask;
+
+ bitsPerRGB = v->pPixel->bitsPerRGB;
+ break;
+ }
+ }
+
+ fbSetVisualTypesAndMasks (screenInfo.formats[i].depth,
+ 0, bitsPerRGB, rm, gm, bm);
+ }
+
pScreenPriv->pVisual = 0;
#ifdef GLXEXT
@@ -172,14 +204,31 @@ xglScreenInit (ScreenPtr pScreen)
pScreenPriv->yInverted = xglScreenInfo.yInverted;
pScreenPriv->pboMask = xglScreenInfo.pboMask;
pScreenPriv->lines = xglScreenInfo.lines;
+ pScreenPriv->noYuv = xglScreenInfo.noYuv;
+ pScreenPriv->xvFilter = xglScreenInfo.xvFilter;
pScreenPriv->accel = xglScreenInfo.accel;
- if (monitorResolution == 0)
- monitorResolution = XGL_DEFAULT_DPI;
+ if (monitorResolution)
+ {
+ dpiX = dpiY = monitorResolution;
+ }
+ else
+ {
+ dpiX = xglScreenInfo.widthMm;
+ dpiY = xglScreenInfo.heightMm;
+
+ if (dpiX && dpiY)
+ {
+ dpiX = (xglScreenInfo.width * 254 + dpiX * 5) / (dpiX * 10);
+ dpiY = (xglScreenInfo.height * 254 + dpiY * 5) / (dpiY * 10);
+ }
+ else
+ dpiX = dpiY = XGL_DEFAULT_DPI;
+ }
if (!fbSetupScreen (pScreen, NULL,
xglScreenInfo.width, xglScreenInfo.height,
- monitorResolution, monitorResolution,
+ dpiX, dpiY,
xglScreenInfo.width, bpp))
return FALSE;
@@ -190,7 +239,7 @@ xglScreenInit (ScreenPtr pScreen)
if (!fbFinishScreenInit (pScreen, NULL,
xglScreenInfo.width, xglScreenInfo.height,
- monitorResolution, monitorResolution,
+ dpiX, dpiY,
xglScreenInfo.width, bpp))
return FALSE;
@@ -215,6 +264,7 @@ xglScreenInit (ScreenPtr pScreen)
XGL_SCREEN_WRAP (CreateGC, xglCreateGC);
+#if 0
pScreen->ConstrainCursor = xglConstrainCursor;
pScreen->CursorLimits = xglCursorLimits;
pScreen->DisplayCursor = xglDisplayCursor;
@@ -222,6 +272,7 @@ xglScreenInit (ScreenPtr pScreen)
pScreen->UnrealizeCursor = xglUnrealizeCursor;
pScreen->RecolorCursor = xglRecolorCursor;
pScreen->SetCursorPosition = xglSetCursorPosition;
+#endif
pScreen->ModifyPixmapHeader = xglModifyPixmapHeader;
diff --git a/hw/xgl/xglsolid.c b/hw/xgl/xglsolid.c
index 8657a9a..74caa01 100644
--- a/hw/xgl/xglsolid.c
+++ b/hw/xgl/xglsolid.c
@@ -22,6 +22,10 @@
*
* Author: David Reveman <davidr at novell.com>
*/
+#include "glxserver.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
#include "xgl.h"
#include "gcstruct.h"
@@ -67,6 +71,7 @@ xglSolid (DrawablePtr pDrawable,
if (!GEOMETRY_ENABLE (pGeometry, surface))
return FALSE;
+ __glXleaveServer();
glitz_composite (op,
solid, NULL, surface,
0, 0,
@@ -74,6 +79,7 @@ xglSolid (DrawablePtr pDrawable,
x + xOff,
y + yOff,
width, height);
+ __glXenterServer();
glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
diff --git a/hw/xgl/xglsync.c b/hw/xgl/xglsync.c
index 6b5c00b..e52a0ca 100644
--- a/hw/xgl/xglsync.c
+++ b/hw/xgl/xglsync.c
@@ -154,6 +154,7 @@ xglSyncBits (DrawablePtr pDrawable,
glitz_surface_set_clip_region (pPixmapPriv->surface,
0, 0, (glitz_box_t *) pBox, nBox);
+ __glXleaveServer();
glitz_get_pixels (pPixmapPriv->surface,
pExt->x1,
pExt->y1,
@@ -161,6 +162,7 @@ xglSyncBits (DrawablePtr pDrawable,
pExt->y2 - pExt->y1,
&format,
pPixmapPriv->buffer);
+ __glXenterServer();
glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0);
}
@@ -206,7 +208,7 @@ xglSyncSurface (DrawablePtr pDrawable)
pRegion = DamageRegion (pPixmapPriv->pDamage);
- if (REGION_NOTEMPTY (pDrawable->pScreen, pRegion))
+ if (pPixmapPriv->surface && REGION_NOTEMPTY (pDrawable->pScreen, pRegion))
{
glitz_pixel_format_t format;
BoxPtr pBox;
@@ -236,9 +238,46 @@ xglSyncSurface (DrawablePtr pDrawable)
format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
}
+ /* If all bits are up to date we can avoid transferring a large set
+ of boxes by transferring the extents box instead. */
+ if (pPixmapPriv->allBits && nBox != 1)
+ {
+ /* This many boxes. It is likely more efficient to always transfer
+ the extents box instead. */
+ if (nBox > 64)
+ {
+ pBox = pExt;
+ nBox = 1;
+ }
+ else
+ {
+ int i, w, e, r = 0;
+
+ for (i = 0; i < nBox; i++)
+ r += (pBox[i].x2 - pBox[i].x1) * (pBox[i].y2 - pBox[i].y1);
+
+ e = (pExt->x2 - pExt->x1) * (pExt->y2 - pExt->y1);
+ w = e - r;
+
+ /* r, is the area of all boxes. e, is the are for the
+ extents. w, is the area that doesn't need to be
+ transferred.
+
+ If w per box is less than 2 times the area of all
+ boxes, transferring the extents has been proved more
+ efficient. */
+ if ((w / nBox) < (r << 1))
+ {
+ pBox = pExt;
+ nBox = 1;
+ }
+ }
+ }
+
glitz_surface_set_clip_region (pPixmapPriv->surface,
0, 0, (glitz_box_t *) pBox, nBox);
+ __glXleaveServer();
glitz_set_pixels (pPixmapPriv->surface,
pExt->x1,
pExt->y1,
@@ -246,6 +285,7 @@ xglSyncSurface (DrawablePtr pDrawable)
pExt->y2 - pExt->y1,
&format,
pPixmapPriv->buffer);
+ __glXenterServer();
glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0);
@@ -322,6 +362,10 @@ xglAddSurfaceDamage (DrawablePtr pDrawab
glitz_surface_t *surface;
int xOff, yOff;
+#if 0
+ miPrintRegion(pRegion);
+#endif
+
XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
pPixmapPriv->damageBox = miEmptyBox;
diff --git a/hw/xgl/xgltile.c b/hw/xgl/xgltile.c
index 25b78c3..9d69344 100644
--- a/hw/xgl/xgltile.c
+++ b/hw/xgl/xgltile.c
@@ -22,6 +22,11 @@
*
* Author: David Reveman <davidr at novell.com>
*/
+#include "glxserver.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+
#include "xgl.h"
@@ -221,6 +226,7 @@ xglTile (DrawablePtr pDrawable,
pTilePriv->pictureMask |= xglPCFillMask;
glitz_surface_set_fill (pTilePriv->surface, GLITZ_FILL_REPEAT);
+ __glXleaveServer();
glitz_composite (op,
pTilePriv->surface, NULL, surface,
x + tileX,
@@ -229,6 +235,7 @@ xglTile (DrawablePtr pDrawable,
x + xOff,
y + yOff,
width, height);
+ __glXenterServer();
glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
@@ -253,6 +260,7 @@ xglTile (DrawablePtr pDrawable,
if (!GEOMETRY_ENABLE (pGeometry, surface))
return FALSE;
+ __glXleaveServer();
glitz_composite (op,
pTilePriv->surface, NULL, surface,
0, 0,
@@ -260,6 +268,7 @@ xglTile (DrawablePtr pDrawable,
x + xOff,
y + yOff,
width, height);
+ __glXenterServer();
if (glitz_surface_get_status (surface))
return FALSE;
diff --git a/hw/xgl/xglxv.c b/hw/xgl/xglxv.c
index aaa66c7..b9f96f3 100644
--- a/hw/xgl/xglxv.c
+++ b/hw/xgl/xglxv.c
@@ -200,6 +200,12 @@ xglXvFreePort (XvPortPtr pPort)
pPortPriv->pSrc = (PicturePtr) 0;
}
+ if (pPortPriv->pTmp)
+ {
+ FreePicture ((pointer) pPortPriv->pTmp, 0);
+ pPortPriv->pTmp = (PicturePtr) 0;
+ }
+
if (pPortPriv->pPixmap)
{
ScreenPtr pScreen;
@@ -239,6 +245,37 @@ xglXvStopVideo (ClientPtr client,
return Success;
}
+static PicturePtr
+xglXvCreateDstPict (DrawablePtr pDrawable,
+ Mask vmask,
+ XID *vlist,
+ int *error)
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ PictFormatPtr pFormat = 0;
+ int i;
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ {
+ if (pScreen->visuals[i].nplanes == pDrawable->depth)
+ {
+ pFormat = PictureMatchVisual (pScreen, pDrawable->depth,
+ &pScreen->visuals[i]);
+ break;
+ }
+ }
+
+ if (!pFormat)
+ {
+ *error = BadImplementation;
+ return (PicturePtr) 0;
+ }
+
+ return CreatePicture (0, pDrawable,
+ pFormat, vmask, vlist, serverClient,
+ error);
+}
+
static int
xglXvPutImage (ClientPtr client,
DrawablePtr pDrawable,
@@ -259,8 +296,9 @@ xglXvPutImage (ClientPtr client,
CARD16 height)
{
ScreenPtr pScreen = pDrawable->pScreen;
+ PicturePtr pSrc;
PictTransform transform;
- int depth, bpp;
+ int depth, bpp, stride, noVisual = FALSE;
CARD32 format;
XGL_SCREEN_PRIV (pScreen);
@@ -268,19 +306,25 @@ xglXvPutImage (ClientPtr client,
XGL_DRAWABLE_PIXMAP (pDrawable);
XGL_PIXMAP_PRIV (pPixmap);
+ stride = ((width + 7) & ~7);
+
switch (pImage->id) {
case GLITZ_FOURCC_YUY2:
bpp = depth = 16;
format = PICT_yuy2;
+ noVisual = !pScreenPriv->pXvVisual[XGL_XV_FORMAT_YUY2].format.surface;
+ stride *= 2;
break;
case GLITZ_FOURCC_YV12:
depth = bpp = 12;
format = PICT_yv12;
+ noVisual = !pScreenPriv->pXvVisual[XGL_XV_FORMAT_YV12].format.surface;
break;
case GLITZ_FOURCC_RGB:
depth = 24;
bpp = 32;
format = PICT_x8r8g8b8;
+ stride *= 4;
break;
default:
return BadImplementation;
@@ -299,7 +343,7 @@ xglXvPutImage (ClientPtr client,
srcWidth, srcHeight,
depth, bpp, -1, (pointer) data);
- XGL_GET_PIXMAP_PRIV (pPortPriv->pPixmap)->stride = -srcWidth;
+ XGL_GET_PIXMAP_PRIV (pPortPriv->pPixmap)->stride = -stride;
pPortPriv->pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
@@ -326,34 +370,21 @@ xglXvPutImage (ClientPtr client,
}
SetPictureFilter (pPortPriv->pSrc,
- FilterBilinear, strlen (FilterBilinear),
+ pScreenPriv->xvFilter,
+ strlen (pScreenPriv->xvFilter),
0, 0);
}
+ pSrc = pPortPriv->pSrc;
+
if (!pPortPriv->pDst || pPortPriv->pDst->pDrawable != pDrawable)
{
- PictFormatPtr pFormat = 0;
- int i, error;
-
- for (i = 0; i < pScreen->numVisuals; i++)
- {
- if (pScreen->visuals[i].nplanes == pDrawable->depth)
- {
- pFormat = PictureMatchVisual (pScreen, pDrawable->depth,
- &pScreen->visuals[i]);
- break;
- }
- }
-
- if (!pFormat)
- return BadImplementation;
+ int error;
if (pPortPriv->pDst)
FreePicture ((pointer) pPortPriv->pDst, 0);
- pPortPriv->pDst = CreatePicture (0, pDrawable,
- pFormat, 0, 0, serverClient,
- &error);
+ pPortPriv->pDst = xglXvCreateDstPict (pDrawable, 0, NULL, &error);
if (!pPortPriv->pDst)
{
xglXvFreePort (pPort);
@@ -361,6 +392,66 @@ xglXvPutImage (ClientPtr client,
}
}
+ if (pPixmap != pScreenPriv->pScreenPixmap && !pPixmapPriv->target)
+ xglEnablePixmapAccel (pPixmap, &pScreenPriv->accel.xv);
+
+ /* software color-space conversion */
+ if (pPixmapPriv->target && (noVisual || pScreenPriv->noYuv))
+ {
+ if (!pPortPriv->pTmp ||
+ srcWidth != pPortPriv->pTmp->pDrawable->width ||
+ srcHeight != pPortPriv->pTmp->pDrawable->height)
+ {
+ static XID value = RepeatPad;
+ int error;
+
+ if (pPortPriv->pTmp)
+ FreePicture ((pointer) pPortPriv->pTmp, 0);
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen,
+ srcWidth, srcHeight,
+ pDrawable->depth);
+ if (!pPixmap)
+ {
+ xglXvFreePort (pPort);
+ return BadAlloc;
+ }
+
+ pPortPriv->pTmp = xglXvCreateDstPict (&pPixmap->drawable,
+ CPRepeat, &value,
+ &error);
+ if (!pPortPriv->pTmp)
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ xglXvFreePort (pPort);
+ return error;
+ }
+
+ /* no accelerated drawing */
+ XGL_GET_PIXMAP_PRIV (pPixmap)->target = xglPixmapTargetNo;
+
+ (*pScreen->DestroyPixmap) (pPixmap);
+
+ SetPictureFilter (pPortPriv->pTmp,
+ pScreenPriv->xvFilter,
+ strlen (pScreenPriv->xvFilter),
+ 0, 0);
+ }
+
+ SetPictureTransform (pSrc, 0);
+
+ CompositePicture (PictOpSrc,
+ pSrc,
+ (PicturePtr) 0,
+ pPortPriv->pTmp,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ srcWidth, srcHeight);
+
+ pSrc = pPortPriv->pTmp;
+ }
+
transform.matrix[0][0] = ((srcWidth << 16) + (dstWidth >> 1))
/ dstWidth;
transform.matrix[0][1] = 0;
@@ -376,13 +467,10 @@ xglXvPutImage (ClientPtr client,
transform.matrix[2][1] = 0;
transform.matrix[2][2] = 1 << 16;
- SetPictureTransform (pPortPriv->pSrc, &transform);
-
- if (pPixmap != pScreenPriv->pScreenPixmap && !pPixmapPriv->target)
- xglEnablePixmapAccel (pPixmap, &pScreenPriv->accel.xv);
+ SetPictureTransform (pSrc, &transform);
CompositePicture (PictOpSrc,
- pPortPriv->pSrc,
+ pSrc,
(PicturePtr) 0,
pPortPriv->pDst,
srcX, srcY,
More information about the xorg-commit
mailing list