xserver: Branch 'server-1.2-branch' - 2 commits
Kevin E Martin
kem at kemper.freedesktop.org
Sat Dec 16 19:06:07 EET 2006
configure.ac | 2
hw/dmx/dmxextension.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++++-
hw/dmx/dmxinit.c | 2
hw/dmx/dmxpict.c | 85 +++++++++++++++++++------------
hw/dmx/dmxpict.h | 2
hw/vfb/Makefile.am | 2
hw/xnest/Makefile.am | 1
hw/xprint/Makefile.am | 3 -
8 files changed, 192 insertions(+), 38 deletions(-)
New commits:
diff-tree c10663e9cc6ee6616dd3ece8798591fd400d3914 (from 7d927a6f6a5bb7c09216fea273df72940676c654)
Author: James Steven Supancic III <arrummzen at arrummzen.net>
Date: Sat Dec 16 12:04:42 2006 -0500
Fix RENDER issues (bug #7555) and implement RENDER add/remove screen
support (bug #8485).
diff --git a/configure.ac b/configure.ac
index 249f58d..f1a1e2f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -936,7 +936,7 @@ dnl ------------------------------------
dnl DMX DDX
AC_MSG_CHECKING([whether to build Xdmx DDX])
-PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no])
+PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfixes xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no])
if test "x$DMX" = xauto; then
DMX="$have_dmx"
fi
diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index efcaca4..c12973b 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -1056,6 +1056,116 @@ static Bool dmxCompareScreens(DMXScreenI
return TRUE;
}
+#ifdef RENDER
+/** Restore Render's picture */
+static void dmxBERestoreRenderPict(pointer value, XID id, pointer n)
+{
+ PicturePtr pPicture = value; /* The picture */
+ DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */
+ int scrnNum = (int)n;
+
+ if (pDraw->pScreen->myNum != scrnNum) {
+ /* Picture not on the screen we are restoring*/
+ return;
+ }
+
+ if (pDraw->type == DRAWABLE_PIXMAP) {
+ PixmapPtr pPixmap = (PixmapPtr)pDraw;
+
+ /* Create and restore the pixmap drawable */
+ dmxBECreatePixmap(pPixmap);
+ dmxBERestorePixmap(pPixmap);
+ }
+
+ dmxBECreatePicture(pPicture);
+}
+
+/** Restore Render's glyphs */
+static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
+{
+ GlyphSetPtr glyphSet = value;
+ int scrnNum = (int)n;
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum];
+ GlyphRefPtr table;
+ char *images;
+ Glyph *gids;
+ XGlyphInfo *glyphs;
+ char *pos;
+ int beret;
+ int len_images = 0;
+ int i;
+ int ctr;
+
+ if (glyphPriv->glyphSets[scrnNum]) {
+ /* Only restore glyphs on the screen we are attaching */
+ return;
+ }
+
+ /* First we must create the glyph set on the backend. */
+ if ((beret = dmxBECreateGlyphSet(scrnNum, glyphSet)) != Success) {
+ dmxLog(dmxWarning,
+ "\tdmxBERestoreRenderGlyph failed to create glyphset!\n");
+ return;
+ }
+
+ /* Now for the complex part, restore the glyph data */
+ table = glyphSet->hash.table;
+
+ /* We need to know how much memory to allocate for this part */
+ for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
+ GlyphRefPtr gr = &table[i];
+ GlyphPtr gl = gr->glyph;
+
+ if (!gl || gl == DeletedGlyph) continue;
+ len_images += gl->size - sizeof(gl->info);
+ }
+
+ /* Now allocate the memory we need */
+ images = ALLOCATE_LOCAL(len_images*sizeof(char));
+ gids = ALLOCATE_LOCAL(glyphSet->hash.tableEntries*sizeof(Glyph));
+ glyphs = ALLOCATE_LOCAL(glyphSet->hash.tableEntries*sizeof(XGlyphInfo));
+
+ memset(images, 0, len_images * sizeof(char));
+ pos = images;
+ ctr = 0;
+
+ /* Fill the allocated memory with the proper data */
+ for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
+ GlyphRefPtr gr = &table[i];
+ GlyphPtr gl = gr->glyph;
+
+ if (!gl || gl == DeletedGlyph) continue;
+
+ /* First lets put the data into gids */
+ gids[ctr] = gr->signature;
+
+ /* Next do the glyphs data structures */
+ glyphs[ctr].width = gl->info.width;
+ glyphs[ctr].height = gl->info.height;
+ glyphs[ctr].x = gl->info.x;
+ glyphs[ctr].y = gl->info.y;
+ glyphs[ctr].xOff = gl->info.xOff;
+ glyphs[ctr].yOff = gl->info.yOff;
+
+ /* Copy the images from the DIX's data into the buffer */
+ memcpy(pos, gl+1, gl->size - sizeof(gl->info));
+ pos += gl->size - sizeof(gl->info);
+ ctr++;
+ }
+
+ /* Now restore the glyph data */
+ XRenderAddGlyphs(dmxScreen->beDisplay, glyphPriv->glyphSets[scrnNum],
+ gids,glyphs, glyphSet->hash.tableEntries, images,
+ len_images);
+
+ /* Clean up */
+ DEALLOCATE_LOCAL(len_images);
+ DEALLOCATE_LOCAL(gids);
+ DEALLOCATE_LOCAL(glyphs);
+}
+#endif
+
/** Reattach previously detached back-end screen. */
int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
{
@@ -1174,6 +1284,20 @@ int dmxAttachScreen(int idx, DMXScreenAt
/* Create window hierarchy (top down) */
dmxBECreateWindowTree(idx);
+#ifdef RENDER
+ /* Restore the picture state for RENDER */
+ for (i = currentMaxClients; --i >= 0; )
+ if (clients[i])
+ FindClientResourcesByType(clients[i],PictureType,
+ dmxBERestoreRenderPict,(pointer)idx);
+
+ /* Restore the glyph state for RENDER */
+ for (i = currentMaxClients; --i >= 0; )
+ if (clients[i])
+ FindClientResourcesByType(clients[i],GlyphSetType,
+ dmxBERestoreRenderGlyph,(pointer)idx);
+#endif
+
/* Refresh screen by generating exposure events for all windows */
dmxForceExposures(idx);
@@ -1362,8 +1486,15 @@ static void dmxBEDestroyResources(pointe
#ifdef RENDER
} else if ((type & TypeMask) == (PictureType & TypeMask)) {
PicturePtr pPict = value;
- if (pPict->pDrawable->pScreen->myNum == scrnNum)
+ if (pPict->pDrawable->pScreen->myNum == scrnNum) {
+ /* Free the pixmaps on the backend if needed */
+ if (pPict->pDrawable->type == DRAWABLE_PIXMAP) {
+ PixmapPtr pPixmap = (PixmapPtr)(pPict->pDrawable);
+ dmxBESavePixmap(pPixmap);
+ dmxBEFreePixmap(pPixmap);
+ }
dmxBEFreePicture((PicturePtr)value);
+ }
} else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
#endif
diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 9c5356e..1d3689c 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -624,7 +624,7 @@ void InitOutput(ScreenInfo *pScreenInfo,
}
/* Make sure that the command-line arguments are sane. */
- if (dmxAddRemoveScreens && (!noRenderExtension || dmxGLXProxy)) {
+ if (dmxAddRemoveScreens && dmxGLXProxy) {
/* Currently it is not possible to support GLX and Render
* extensions with dynamic screen addition/removal due to the
* state that each extension keeps, which cannot be restored. */
diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index 9cdd123..f2d050f 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -223,6 +223,36 @@ Bool dmxBEFreeGlyphSet(ScreenPtr pScreen
return FALSE;
}
+/** Create \a glyphSet on the backend screen number \a idx. */
+int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet)
+{
+ XRenderPictFormat *pFormat;
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ PictFormatPtr pFmt = glyphSet->format;
+ int (*oldErrorHandler)(Display *, XErrorEvent *);
+
+ pFormat = dmxFindFormat(dmxScreen, pFmt);
+ if (!pFormat) {
+ return BadMatch;
+ }
+
+ dmxGlyphLastError = 0;
+ oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
+
+ /* Catch when this fails */
+ glyphPriv->glyphSets[idx]
+ = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat);
+
+ XSetErrorHandler(oldErrorHandler);
+
+ if (dmxGlyphLastError) {
+ return dmxGlyphLastError;
+ }
+
+ return Success;
+}
+
/** Create a Glyph Set on each screen. Save the glyphset ID from each
* screen in the Glyph Set's private structure. Fail if the format
* requested is not available or if the Glyph Set cannot be created on
@@ -235,12 +265,9 @@ static int dmxProcRenderCreateGlyphSet(C
ret = dmxSaveRenderVector[stuff->renderReqType](client);
if (ret == Success) {
- int (*oldErrorHandler)(Display *, XErrorEvent *);
GlyphSetPtr glyphSet;
dmxGlyphPrivPtr glyphPriv;
int i;
- PictFormatPtr pFmt;
- XRenderPictFormat *pFormat;
/* Look up glyphSet that was just created ???? */
/* Store glyphsets from backends in glyphSet->devPrivate ????? */
@@ -254,21 +281,16 @@ static int dmxProcRenderCreateGlyphSet(C
MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv);
- pFmt = SecurityLookupIDByType(client, stuff->format, PictFormatType,
- SecurityReadAccess);
-
- oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
-
for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ int beret;
if (!dmxScreen->beDisplay) {
glyphPriv->glyphSets[i] = 0;
continue;
}
- pFormat = dmxFindFormat(dmxScreen, pFmt);
- if (!pFormat) {
+ if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) {
int j;
/* Free the glyph sets we've allocated thus far */
@@ -278,30 +300,9 @@ static int dmxProcRenderCreateGlyphSet(C
/* Free the resource created by render */
FreeResource(stuff->gsid, RT_NONE);
- ret = BadMatch;
- break;
- }
-
- /* Catch when this fails */
- glyphPriv->glyphSets[i]
- = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat);
-
- if (dmxGlyphLastError) {
- int j;
-
- /* Free the glyph sets we've allocated thus far */
- for (j = 0; j < i; j++)
- dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet);
-
- /* Free the resource created by render */
- FreeResource(stuff->gsid, RT_NONE);
-
- ret = dmxGlyphLastError;
- break;
+ return beret;
}
}
-
- XSetErrorHandler(oldErrorHandler);
}
return ret;
@@ -753,6 +754,20 @@ void dmxCreatePictureList(WindowPtr pWin
}
}
+/** Create \a pPicture on the backend. */
+int dmxBECreatePicture(PicturePtr pPicture)
+{
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ /* Create picutre on BE */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+
+ /* Flush changes to the backend server */
+ dmxValidatePicture(pPicture, (1 << (CPLastBit+1)) - 1);
+
+ return Success;
+}
+
/** Create a picture. This function handles the CreatePicture
* unwrapping/wrapping and calls dmxDoCreatePicture to actually create
* the picture on the appropriate screen. */
@@ -853,7 +868,11 @@ int dmxChangePictureClip(PicturePtr pPic
/* The clip has already been changed into a region by the mi
* routine called above.
*/
- if (pPicture->clientClip) {
+ if (clipType == CT_NONE) {
+ /* Disable clipping, show all */
+ XFixesSetPictureClipRegion(dmxScreen->beDisplay,
+ pPictPriv->pict, 0, 0, None);
+ } else if (pPicture->clientClip) {
RegionPtr pClip = pPicture->clientClip;
BoxPtr pBox = REGION_RECTS(pClip);
int nBox = REGION_NUM_RECTS(pClip);
diff --git a/hw/dmx/dmxpict.h b/hw/dmx/dmxpict.h
index 2ca04ed..fe2a659 100644
--- a/hw/dmx/dmxpict.h
+++ b/hw/dmx/dmxpict.h
@@ -112,7 +112,9 @@ extern void dmxTriFan(CARD8 op,
INT16 xSrc, INT16 ySrc,
int npoint, xPointFixed *points);
+extern int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet);
extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet);
+extern int dmxBECreatePicture(PicturePtr pPicture);
extern Bool dmxBEFreePicture(PicturePtr pPicture);
extern int dmxPictPrivateIndex; /**< Index for picture private data */
diff-tree 7d927a6f6a5bb7c09216fea273df72940676c654 (from 731952c561a3972d09d1315f4fd31466e459ccb9)
Author: Kevin E Martin <kem at freedesktop.org>
Date: Sat Dec 16 12:03:30 2006 -0500
For Xvfb, Xnest and Xprt, compile fbcmap.c with -DXFree86Server
diff --git a/hw/vfb/Makefile.am b/hw/vfb/Makefile.am
index baab5ca..ca113c9 100644
--- a/hw/vfb/Makefile.am
+++ b/hw/vfb/Makefile.am
@@ -21,7 +21,7 @@ Xvfb_LDFLAGS =
AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
-DNO_HW_ONLY_EXTS \
-DNO_MODULE_EXTS \
- \
+ -DXFree86Server \
$(XVFBMODULES_CFLAGS)
# Man page
diff --git a/hw/xnest/Makefile.am b/hw/xnest/Makefile.am
index d40d122..cce1fef 100644
--- a/hw/xnest/Makefile.am
+++ b/hw/xnest/Makefile.am
@@ -51,6 +51,7 @@ Xnest_LDFLAGS =
AM_CFLAGS = -DHAVE_XNEST_CONFIG_H \
-DNO_HW_ONLY_EXTS \
+ -DXFree86Server \
$(DIX_CFLAGS) \
$(XNESTMODULES_CFLAGS)
diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am
index 27a7e30..d4f22d2 100644
--- a/hw/xprint/Makefile.am
+++ b/hw/xprint/Makefile.am
@@ -5,7 +5,8 @@ bin_PROGRAMS = Xprt
Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \
-DXPRINT -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \
-DXPRINTDIR=\"$(libdir)/X11/xserver\" \
- -DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX
+ -DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \
+ -DXFree86Server
Xprt_LDFLAGS = -L$(top_srcdir)
Xprt_LDADD = @XPRINT_LIBS@ ps/libps.la raster/libraster.la \
More information about the xorg-commit
mailing list