xserver: Branch 'server-1.5-branch' - 13 commits

Adam Jackson ajax at kemper.freedesktop.org
Mon Jun 9 14:10:17 PDT 2008


 configure.ac                              |    5 +-
 dix/Makefile.am                           |   14 ++++-
 exa/exa.c                                 |   75 ++++++++++++++++++++++++------
 exa/exa.h                                 |    2 
 exa/exa_accel.c                           |   66 +++++++++++++-------------
 exa/exa_migration.c                       |    2 
 exa/exa_offscreen.c                       |   49 +++++++++++++------
 exa/exa_priv.h                            |    1 
 exa/exa_unaccel.c                         |    4 +
 hw/xfree86/common/xf86VidMode.c           |   10 ++--
 hw/xfree86/os-support/linux/int10/linux.c |    4 +
 hw/xprint/Makefile.am                     |    3 -
 hw/xprint/ddxInit.c                       |    6 ++
 include/xorg-config.h.in                  |    3 +
 14 files changed, 171 insertions(+), 73 deletions(-)

New commits:
commit c7c43285b139952d03e60db1b95306941ad094ee
Merge: facf271... 77313bd...
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jun 9 17:06:41 2008 -0400

    Merge branch 'server-1.5-branch' of git+ssh://git.freedesktop.org/git/xorg/xserver into server-1.5-branch

commit facf271b052eb1ee6b9c577d51991333372fa8c1
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Fri Jun 6 11:01:03 2008 +0200

    EXA: Fix exaGetPixmapFirstPixel() crash if the driver has a CreatePixmap hook.
    
    Fixes http://bugs.freedesktop.org/show_bug.cgi?id=16243
    (cherry picked from commit 6b96281100f2118fe9d99536c33d48298a5bce7b)

diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index c55ef03..8e19886 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -359,6 +359,7 @@ ExaCheckComposite (CARD8      op,
 CARD32
 exaGetPixmapFirstPixel (PixmapPtr pPixmap)
 {
+    ExaScreenPriv(pPixmap->drawable.pScreen);
     CARD32 pixel;
     void *fb;
     Bool need_finish = FALSE;
@@ -373,7 +374,8 @@ exaGetPixmapFirstPixel (PixmapPtr pPixmap)
     fb = pExaPixmap->sys_ptr;
 
     /* Try to avoid framebuffer readbacks */
-    if ((!offscreen && !sys_valid && !damaged) ||
+    if (pExaScr->info->CreatePixmap ||
+	(!offscreen && !sys_valid && !damaged) ||
 	(offscreen && (!sys_valid || damaged)))
     {
 	box.x1 = 0;
commit 60990c69b43046795bbc2311b3e4f27771b988c1
Author: Paulo Cesar Pereira de Andrade <pcpa at mandriva.com.br>
Date:   Fri May 23 13:50:39 2008 -0300

    Correct a NULL pointer deference
    
      The problem happens if Monitor/Card combo doesn't provide EDID info,
    and the XFree86-VidModeExtension extension is used.
    
    Signed-off-by: Peter Hutterer <peter at cs.unisa.edu.au>
    (cherry picked from commit c8af7ce35a900ac9b898f51c1b95dabad3ba1d76)

diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c
index 38d605c..9260bb5 100644
--- a/hw/xfree86/common/xf86VidMode.c
+++ b/hw/xfree86/common/xf86VidMode.c
@@ -150,10 +150,14 @@ VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock)
 	return FALSE;
 
     pScrn = xf86Screens[scrnIndex];
-    *mode = (pointer)(pScrn->currentMode);
-    *dotClock = pScrn->currentMode->Clock;
 
-    return TRUE;
+    if (pScrn->currentMode) {
+	*mode = (pointer)(pScrn->currentMode);
+	*dotClock = pScrn->currentMode->Clock;
+
+	return TRUE;
+    }
+    return FALSE;
 }
 
 _X_EXPORT int
commit 1667ed6e2474c274d6cf9cdbd83518450dea4d44
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sat May 24 20:01:36 2008 +0200

    EXA: Don't migrate twice in exaImageGlyphBlt.
    
    exaPrepareAccess already handles migration.
    (cherry picked from commit f6d61d3d86971d6a202b46ff2fab8c8799a4d057)

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index da9e714..d66dd47 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -950,10 +950,8 @@ exaImageGlyphBlt (DrawablePtr	pDrawable,
     int		    dstBpp;
     int		    dstXoff, dstYoff;
     FbBits	    depthMask;
-    Bool	    fallback;
     PixmapPtr	    pPixmap = exaGetDrawablePixmap(pDrawable);
     ExaPixmapPriv(pPixmap);
-    ExaMigrationRec pixmaps[1];
     RegionPtr	    pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
     BoxRec	    extents = *REGION_EXTENTS(pScreen, pending_damage);
     int		    xoff, yoff;
@@ -962,16 +960,8 @@ exaImageGlyphBlt (DrawablePtr	pDrawable,
 	return;
 
     depthMask = FbFullMask(pDrawable->depth);
-    fallback = (pGC->planemask & depthMask) != depthMask;
-
-    pixmaps[0].as_dst = TRUE;
-    pixmaps[0].as_src = FALSE;
-    pixmaps[0].pPix = pPixmap;
-    pixmaps[0].pReg = fallback ? NULL : pending_damage;
-
-    exaDoMigration(pixmaps, 1, FALSE);
 
-    if (fallback)
+    if ((pGC->planemask & depthMask) != depthMask)
     {
 	ExaCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);
 	return;
@@ -994,7 +984,7 @@ exaImageGlyphBlt (DrawablePtr	pDrawable,
     extents.y1 -= yoff;
     extents.y2 -= yoff;
 
-    exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pixmaps[0].pReg);
+    exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pending_damage);
 
     if (TERMINALFONT (pGC->font) && !glyph)
     {
commit 6dee3fdf18f618dea034ad3b5cb028da0fb51639
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sat May 24 20:01:31 2008 +0200

    EXA: Don't suggest exaCopyDirty be inlined.
    
    Leave the decision to the compiler toolchain.
    (cherry picked from commit d73304398255e0c3b03a497a8d4a2f8d900eef44)

diff --git a/exa/exa_migration.c b/exa/exa_migration.c
index d3646b0..5f22474 100644
--- a/exa/exa_migration.c
+++ b/exa/exa_migration.c
@@ -116,7 +116,7 @@ exaPixmapShouldBeInFB (PixmapPtr pPix)
  * If the pixmap is currently dirty, this copies at least the dirty area from
  * FB to system or vice versa.  Both areas must be allocated.
  */
-static _X_INLINE void
+static void
 exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
 	     Bool (*transfer) (PixmapPtr pPix, int x, int y, int w, int h,
 			       char *sys, int sys_pitch), CARD8 *fallback_src,
commit 3943a3a567c76aa3aee2ffe577e8d1d8c2c0f26b
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sat May 24 20:01:21 2008 +0200

    EXA: Specify region used for source pixmap migration in exaCopyNtoN.
    
    Avoids excessive migration overhead in some pathological cases. See
    http://bugs.freedesktop.org/show_bug.cgi?id=15845 .
    (cherry picked from commit 3baf3b42e079b4e7b61c1e20df305db0724d21f8)

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index c2bfdee..da9e714 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -487,7 +487,8 @@ exaCopyNtoN (DrawablePtr    pSrcDrawable,
     int	    src_off_x, src_off_y;
     int	    dst_off_x, dst_off_y;
     ExaMigrationRec pixmaps[2];
-    RegionPtr region = NULL;
+    RegionPtr srcregion = NULL, dstregion = NULL;
+    xRectangle *rects;
 
     pSrcPixmap = exaGetDrawablePixmap (pSrcDrawable);
     pDstPixmap = exaGetDrawablePixmap (pDstDrawable);
@@ -495,33 +496,38 @@ exaCopyNtoN (DrawablePtr    pSrcDrawable,
     exaGetDrawableDeltas (pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y);
     exaGetDrawableDeltas (pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y);
 
-    if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
-				       pGC->fillStyle, pGC->alu)) {
-	xRectangle *rects = xalloc(nbox * sizeof(xRectangle));
+    rects = xalloc(nbox * sizeof(xRectangle));
 
-	if (rects) {
-	    int i;
+    if (rects) {
+	int i;
 
-	    for (i = 0; i < nbox; i++) {
-		rects[i].x = pbox[i].x1 + dst_off_x;
-		rects[i].y = pbox[i].y1 + dst_off_y;
-		rects[i].width = pbox[i].x2 - pbox[i].x1;
-		rects[i].height = pbox[i].y2 - pbox[i].y1;
-	    }
+	for (i = 0; i < nbox; i++) {
+	    rects[i].x = pbox[i].x1 + dx + src_off_x;
+	    rects[i].y = pbox[i].y1 + dy + src_off_y;
+	    rects[i].width = pbox[i].x2 - pbox[i].x1;
+	    rects[i].height = pbox[i].y2 - pbox[i].y1;
+	}
 
-	    region  = RECTS_TO_REGION(pScreen, nbox, rects, CT_YXBANDED);
-	    xfree(rects);
+	srcregion  = RECTS_TO_REGION(pScreen, nbox, rects, CT_YXBANDED);
+	xfree(rects);
+
+	if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
+					   pGC->fillStyle, pGC->alu)) {
+	    dstregion = REGION_CREATE(pScreen, NullBox, 0);
+	    REGION_COPY(pScreen, dstregion, srcregion);
+	    REGION_TRANSLATE(pScreen, dstregion, dst_off_x - dx - src_off_x,
+			     dst_off_y - dy - src_off_y);
 	}
     }
 
     pixmaps[0].as_dst = TRUE;
     pixmaps[0].as_src = FALSE;
     pixmaps[0].pPix = pDstPixmap;
-    pixmaps[0].pReg = region;
+    pixmaps[0].pReg = dstregion;
     pixmaps[1].as_dst = FALSE;
     pixmaps[1].as_src = TRUE;
     pixmaps[1].pPix = pSrcPixmap;
-    pixmaps[1].pReg = NULL;
+    pixmaps[1].pReg = srcregion;
 
     pSrcExaPixmap = ExaGetPixmapPriv (pSrcPixmap);
     pDstExaPixmap = ExaGetPixmapPriv (pDstPixmap);
@@ -574,17 +580,21 @@ fallback:
     EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrcDrawable, pDstDrawable,
 		  exaDrawableLocation(pSrcDrawable),
 		  exaDrawableLocation(pDstDrawable)));
-    exaPrepareAccessReg (pDstDrawable, EXA_PREPARE_DEST, region);
-    exaPrepareAccess (pSrcDrawable, EXA_PREPARE_SRC);
+    exaPrepareAccessReg (pDstDrawable, EXA_PREPARE_DEST, dstregion);
+    exaPrepareAccessReg (pSrcDrawable, EXA_PREPARE_SRC, srcregion);
     fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy, reverse,
 		upsidedown, bitplane, closure);
     exaFinishAccess (pSrcDrawable, EXA_PREPARE_SRC);
     exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST);
 
 out:
-    if (region) {
-	REGION_UNINIT(pScreen, region);
-	REGION_DESTROY(pScreen, region);
+    if (dstregion) {
+	REGION_UNINIT(pScreen, dstregion);
+	REGION_DESTROY(pScreen, dstregion);
+    }
+    if (srcregion) {
+	REGION_UNINIT(pScreen, srcregion);
+	REGION_DESTROY(pScreen, srcregion);
     }
 }
 
commit c00ff932f88f497dd638662c151ea63ffbc8bed1
Author: Drew Parsons <dparsons at debian.org>
Date:   Fri May 9 23:20:11 2008 +1000

    Disable D-BUS from Xprint.
    
    Use dummy config functions to replace those from config/config.c, and
    therefore do not link Xprt with $CONFIG_LIB.
    
    Works around an endlessly spinning loop in dix/dispatch.c::Dispatch()
    (WaitForSomething() not waiting) when built with dbus, which was
    causing Xprt to use 95% cpu.
    (cherry picked from commit 2a3d1421e0cc18822ae8f478fcc272e16a9e9340)

diff --git a/configure.ac b/configure.ac
index 4bb4370..3b2e761 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1602,7 +1602,7 @@ AC_MSG_RESULT([$XPRINT])
 if test "x$XPRINT" = xyes; then
 	PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau])
 	XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS -DXPRINT"
-	XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB"
+	XPRINT_LIBS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB"
 	XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS"
 
 	xpconfigdir=$libdir/X11/xserver
diff --git a/hw/xprint/ddxInit.c b/hw/xprint/ddxInit.c
index d744121..7950521 100644
--- a/hw/xprint/ddxInit.c
+++ b/hw/xprint/ddxInit.c
@@ -291,6 +291,12 @@ ddxProcessArgument (
 #include "XIstubs.h"
 #include "exglobals.h"
 
+/* Place dummy config functions here instead of config/config.c, 
+   since Xprint does not use D-BUS */
+void config_init() { }
+void config_fini() { }
+
+
 int
 ChangePointerDevice (
     DeviceIntPtr       old_dev,
commit 2f994cb00e9b6d0e8362b9d777091dd673960d53
Author: Drew Parsons <dparsons at debian.org>
Date:   Mon Mar 10 22:54:49 2008 +1100

    Create dix/libXpdix.la for Xprint-specific build of libdix.la
    
    (cherry picked from commit 4e2c6dbabdbbaaca213fd08edd422de15d0900cc)
    
    required because of commit 7c0709a736c0f3aa011de67dd2c2962585ab146e,
    which made requestingClient in dix specific to Xprint only.
    Add to XPRINT_LIBS in hw/xprint/Makefile.am in front of
    $(XSERVER_LIBS) to override definitions in libdix.la for standard xservers.
    
    Follows 571206832d454771e3c638c7515767958365c19c (providing -DXPRINT
    to xprint subdirs).
    
    Note it may be possible to restructure the code so that
    requestingClient is stored elsewhere than in dix. See discussions
    following http://lists.freedesktop.org/archives/xorg/2008-March/033844.html
    If this is done it may be possible to revert this commit (if not 571206...).
    (cherry picked from commit 966ae1781f3ca563e15a9a1b8cab6fab94e07fe9)

diff --git a/dix/Makefile.am b/dix/Makefile.am
index b7b1ec0..e44b510 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -1,4 +1,10 @@
-noinst_LTLIBRARIES = libdix.la libxpstubs.la
+standard_dix_libs = libdix.la libxpstubs.la
+
+if XPRINT
+noinst_LTLIBRARIES = $(standard_dix_libs) libXpdix.la
+else
+noinst_LTLIBRARIES = $(standard_dix_libs)
+endif
 
 AM_CFLAGS = $(DIX_CFLAGS) \
 	-DVENDOR_NAME=\""@VENDOR_NAME@"\" \
@@ -39,7 +45,11 @@ libdix_la_SOURCES = 	\
 libxpstubs_la_SOURCES =	\
 	xpstubs.c
 
-INCLUDES = -I$(top_srcdir)/Xprint
+if XPRINT
+libXpdix_la_SOURCES = $(libdix_la_SOURCES)
+libXpdix_la_CPPFLAGS = -I$(top_srcdir)/hw/xprint
+libXpdix_la_CFLAGS = $(AM_CFLAGS) $(XPRINT_CFLAGS)
+endif
 
 EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in
 
diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am
index 5ca04ff..2ed7aaf 100644
--- a/hw/xprint/Makefile.am
+++ b/hw/xprint/Makefile.am
@@ -17,6 +17,7 @@ XPRINT_LIBS = \
 	pcl-mono/libpcl.la \
 	$(top_builddir)/fb/libfb.la \
 	$(top_builddir)/render/librender.la \
+	$(top_builddir)/dix/libXpdix.la \
 	$(XSERVER_LIBS) \
 	$(top_builddir)/Xext/libXext.la \
 	$(top_builddir)/xkb/libxkb.la \
commit 30774d6b3cde6deda7a21ad25e396449fb791237
Author: Drew Parsons <dparsons at debian.org>
Date:   Mon Mar 10 13:48:05 2008 +1100

    Define XPRINT in XPRINT_CFLAGS (configure.ac)
    
    -DXPRINT had only been set for Xprt in hw/xprint/Makefile.am
    After commit 7c0709a736c0f3aa011de67dd2c2962585ab146e it is also
    required for ps/PsArea.c and PsFonts.c to ensure ‘requestingClient’ is
    defined, so make it a global Xprint definition in configure.ac.
    (cherry picked from commit 28a6719fd486d9a9cecad0b057d9ea7c59c66055)
    (cherry picked from commit 571206832d454771e3c638c7515767958365c19c)

diff --git a/configure.ac b/configure.ac
index e53801b..4bb4370 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1601,7 +1601,7 @@ AC_MSG_RESULT([$XPRINT])
 
 if test "x$XPRINT" = xyes; then
 	PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau])
-	XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS"
+	XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS -DXPRINT"
 	XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB"
 	XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS"
 
diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am
index 1b80048..5ca04ff 100644
--- a/hw/xprint/Makefile.am
+++ b/hw/xprint/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = doc pcl pcl-mono raster ps etc config
 bin_PROGRAMS = Xprt
 
 Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \
-	-DXPRINT -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_  \
+	-DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_  \
 	-DXPRINTDIR=\"$(libdir)/X11/xserver\"    \
 	-DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \
 	-DXFree86Server
commit 200d676be2de8d83899420655efe870ac0b61d24
Author: Tilman Sauerbeck <tilman at code-monkey.de>
Date:   Mon Apr 21 11:22:07 2008 +0200

    EXA: Set pixmap->accel_blocked on the screen pixmap, too.
    (cherry picked from commit 3f081b4de55e1378728a24d069bf06575ffca2d8)

diff --git a/exa/exa.c b/exa/exa.c
index 0e3ea70..3a6ad98 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -699,6 +699,34 @@ exaBitmapToRegion(PixmapPtr pPix)
   return ret;
 }
 
+static Bool
+exaCreateScreenResources(ScreenPtr pScreen)
+{
+    ExaScreenPriv(pScreen);
+    PixmapPtr pScreenPixmap;
+    Bool b;
+
+    pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources;
+    b = pScreen->CreateScreenResources(pScreen);
+    pScreen->CreateScreenResources = exaCreateScreenResources;
+
+    if (!b)
+        return FALSE;
+
+    pScreenPixmap = pScreen->GetScreenPixmap(pScreen);
+
+    if (pScreenPixmap) {
+        ExaPixmapPriv(pScreenPixmap);
+
+        exaSetAccelBlock(pExaScr, pExaPixmap,
+                         pScreenPixmap->drawable.width,
+                         pScreenPixmap->drawable.height,
+                         pScreenPixmap->drawable.bitsPerPixel);
+    }
+
+    return TRUE;
+}
+
 /**
  * exaCloseScreen() unwraps its wrapped screen functions and tears down EXA's
  * screen private, before calling down to the next CloseSccreen.
@@ -720,6 +748,7 @@ exaCloseScreen(int i, ScreenPtr pScreen)
     pScreen->CopyWindow = pExaScr->SavedCopyWindow;
     pScreen->ChangeWindowAttributes = pExaScr->SavedChangeWindowAttributes;
     pScreen->BitmapToRegion = pExaScr->SavedBitmapToRegion;
+    pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources;
 #ifdef RENDER
     if (ps) {
 	ps->Composite = pExaScr->SavedComposite;
@@ -877,6 +906,9 @@ exaDriverInit (ScreenPtr		pScreen,
     pExaScr->SavedBitmapToRegion = pScreen->BitmapToRegion;
     pScreen->BitmapToRegion = exaBitmapToRegion;
 
+    pExaScr->SavedCreateScreenResources = pScreen->CreateScreenResources;
+    pScreen->CreateScreenResources = exaCreateScreenResources;
+
 #ifdef RENDER
     if (ps) {
         pExaScr->SavedComposite = ps->Composite;
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index e41f46a..0138e4a 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -107,6 +107,7 @@ typedef struct {
     CopyWindowProcPtr 		 SavedCopyWindow;
     ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
     BitmapToRegionProcPtr        SavedBitmapToRegion;
+    CreateScreenResourcesProcPtr SavedCreateScreenResources;
     ModifyPixmapHeaderProcPtr    SavedModifyPixmapHeader;
 #ifdef RENDER
     CompositeProcPtr             SavedComposite;
commit 2df83b491e87b27a3bba2fd874afe74a6af7e2cc
Author: Tilman Sauerbeck <tilman at code-monkey.de>
Date:   Mon Apr 21 11:03:27 2008 +0200

    EXA: Update sys_pitch/fb_pitch in exaModifyPixmapHeader.
    
    exaModifyPixmapHeader now also only evaluates arguments that have a
    meaningful value.
    (cherry picked from commit 26c1801a27b81fdd988d5bd210ba0e76ecc274ae)

diff --git a/exa/exa.c b/exa/exa.c
index 81dc3e2..0e3ea70 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -248,6 +248,19 @@ exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
         pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT;
 }
 
+static void
+exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
+              int w, int h, int bpp)
+{
+    if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
+        pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
+    else
+        pExaPixmap->fb_pitch = w * bpp / 8;
+
+    pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
+                                     pExaScr->info->pixmapPitchAlign);
+}
+
 /**
  * exaCreatePixmap() creates a new pixmap.
  *
@@ -292,12 +305,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
         if (paddedWidth / 4 > 32767 || h > 32767)
             return NullPixmap;
 
-        if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
-            pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
-        else
-            pExaPixmap->fb_pitch = w * bpp / 8;
-        pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
-                                         pExaScr->info->pixmapPitchAlign);
+        exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
+
         if (paddedWidth < pExaPixmap->fb_pitch)
             paddedWidth = pExaPixmap->fb_pitch;
 
@@ -331,12 +340,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
         pExaPixmap->offscreen = FALSE;
 
         pExaPixmap->fb_ptr = NULL;
-        if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
-            pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
-        else
-            pExaPixmap->fb_pitch = w * bpp / 8;
-        pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
-				         pExaScr->info->pixmapPitchAlign);
+        exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
         pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
 
         if (pExaPixmap->fb_pitch > 131071) {
@@ -384,10 +388,19 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
     pExaPixmap = ExaGetPixmapPriv(pPixmap);
 
     if (pExaPixmap) {
-	pExaPixmap->sys_ptr = pPixData;
+        if (pPixData)
+            pExaPixmap->sys_ptr = pPixData;
 
-        exaSetAccelBlock(pExaScr, pExaPixmap,
-                         width, height, bitsPerPixel);
+        if (devKind > 0)
+            pExaPixmap->sys_pitch = devKind;
+
+        if (width > 0 && height > 0 && bitsPerPixel > 0) {
+            exaSetFbPitch(pExaScr, pExaPixmap,
+                          width, height, bitsPerPixel);
+
+            exaSetAccelBlock(pExaScr, pExaPixmap,
+                             width, height, bitsPerPixel);
+        }
     }
 
 
commit 0fba91a5324662c10d15bc0e41cc8737c51340bb
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Mon Apr 21 10:45:11 2008 +0200

    EXA: Offscreen memory eviction improvements.
    
    * Make sure available areas are considered to have no eviction cost. This seems
      to help for https://bugs.freedesktop.org/show_bug.cgi?id=15513 but I'm afraid
      that may just be coincidence.
    * Only calculate eviction cost of each area once for each eviction pass.
      Safeguard against potential (though unlikely) division by zero.
    * Cosmetic enhancements: Name eviction cost related variables 'cost' instead of
      'score' to emphasize that smaller values are better, update Doxygen file
      comment to the way eviction works now.
    (cherry picked from commit 6c95fae1e9d6b0eb64bc78eced05a6e9f5faf02e)

diff --git a/exa/exa.h b/exa/exa.h
index 97ae6c0..2562094 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -64,6 +64,8 @@ struct _ExaOffscreenArea {
     ExaOffscreenState   state;
 
     ExaOffscreenArea    *next;
+
+    unsigned            eviction_cost;
 };
 
 /**
diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c
index 85b5388..4aaa2c1 100644
--- a/exa/exa_offscreen.c
+++ b/exa/exa_offscreen.c
@@ -21,11 +21,9 @@
  */
 
 /** @file
- * This allocator allocates blocks of memory by maintaining a list of areas
- * and a score for each area.  As an area is marked used, its score is
- * incremented, and periodically all of the areas have their scores decayed by
- * a fraction.  When allocating, the contiguous block of areas with the minimum
- * score is found and evicted in order to make room for the new allocation.
+ * This allocator allocates blocks of memory by maintaining a list of areas.
+ * When allocating, the contiguous block of areas with the minimum eviction
+ * cost is found and evicted in order to make room for the new allocation.
  */
 
 #include "exa_priv.h"
@@ -71,19 +69,36 @@ ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area)
     return exaOffscreenFree (pScreen, area);
 }
 
-#define AREA_SCORE(area) (area->size / (double)(pExaScr->offScreenCounter - area->last_use))
+static void
+exaUpdateEvictionCost(ExaOffscreenArea *area, unsigned offScreenCounter)
+{
+    unsigned age;
+
+    if (area->state == ExaOffscreenAvail)
+	return;
+
+    age = offScreenCounter - area->last_use;
+
+    /* This is unlikely to happen, but could result in a division by zero... */
+    if (age > (UINT_MAX / 2)) {
+	age = UINT_MAX / 2;
+	area->last_use = offScreenCounter - age;
+    }
+
+    area->eviction_cost = area->size / age;
+}
 
 static ExaOffscreenArea *
 exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
 {
     ExaOffscreenArea *begin, *end, *best;
-    double score, best_score;
+    unsigned cost, best_cost;
     int avail, real_size, tmp;
 
-    best_score = UINT_MAX;
+    best_cost = UINT_MAX;
     begin = end = pExaScr->info->offScreenAreas;
     avail = 0;
-    score = 0;
+    cost = 0;
     best = 0;
 
     while (end != NULL)
@@ -106,23 +121,24 @@ exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
 	    if (end->state == ExaOffscreenLocked) {
 		/* Can't more room here, restart after this locked area */
 		avail = 0;
-		score = 0;
+		cost = 0;
 		begin = end;
 		goto restart;
 	    }
 	    avail += end->size;
-	    score += AREA_SCORE(end);
+	    exaUpdateEvictionCost(end, pExaScr->offScreenCounter);
+	    cost += end->eviction_cost;
 	    end = end->next;
 	}
 
-	/* Check the score, update best */
-	if (avail >= real_size && score < best_score) {
+	/* Check the cost, update best */
+	if (avail >= real_size && cost < best_cost) {
 	    best = begin;
-	    best_score = score;
+	    best_cost = cost;
 	}
 
 	avail -= begin->size;
-	score -= AREA_SCORE(begin);
+	cost -= begin->eviction_cost;
 	begin = begin->next;
     }
 
@@ -244,6 +260,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
 	new_area->state = ExaOffscreenAvail;
 	new_area->save = NULL;
 	new_area->last_use = 0;
+	new_area->eviction_cost = 0;
 	new_area->next = area->next;
 	area->next = new_area;
 	area->size = real_size;
@@ -409,6 +426,7 @@ exaOffscreenFree (ScreenPtr pScreen, ExaOffscreenArea *area)
     area->state = ExaOffscreenAvail;
     area->save = NULL;
     area->last_use = 0;
+    area->eviction_cost = 0;
     /*
      * Find previous area
      */
@@ -474,6 +492,7 @@ exaOffscreenInit (ScreenPtr pScreen)
     area->save = NULL;
     area->next = NULL;
     area->last_use = 0;
+    area->eviction_cost = 0;
 
     /* Add it to the free areas */
     pExaScr->info->offScreenAreas = area;
commit 50e77eb8384b8d9c569ef3726bb7f4abf43b2af8
Author: Dave Airlie <airlied at redhat.com>
Date:   Tue May 20 13:59:09 2008 +1000

    int10: add pci_device_enable support on Linux
    (cherry picked from commit ea4ec9e9983e25d94a3edf8a77ed2ad1db193284)

diff --git a/configure.ac b/configure.ac
index 07df3db..e53801b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1331,6 +1331,7 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
 	CFLAGS=$PCIACCESS_CFLAGS
 	LIBS=$PCIACCESS_LIBS
 	AC_CHECK_FUNCS([pci_system_init_dev_mem])
+	AC_CHECK_FUNCS([pci_device_enable])
 	LIBS=$SAVE_LIBS
 	CFLAGS=$SAVE_CFLAGS
 	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS"
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
index 5748434..9e2c619 100644
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ b/hw/xfree86/os-support/linux/int10/linux.c
@@ -278,6 +278,10 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
 	    struct pci_device *rom_device =
 		xf86GetPciInfoForEntity(pInt->entityIndex);
 
+#if HAVE_PCI_DEVICE_ENABLE
+	    pci_device_enable(rom_device);
+#endif
+
 	    err = pci_device_read_rom(rom_device, (unsigned char *)(V_BIOS));
 	    if (err) {
 		xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (%s)\n",
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index 5587c0a..e05d3bf 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -118,6 +118,9 @@
 /* Have pci_system_init_dev_mem() */
 #undef HAVE_PCI_SYSTEM_INIT_DEV_MEM
 
+/* Have pci_enable_device */
+#undef HAVE_PCI_DEVICE_ENABLE
+
 /* Path to text files containing PCI IDs */
 #undef PCI_TXT_IDS_PATH
 


More information about the xorg-commit mailing list