xserver: Branch 'server-1.4-branch' - 9 commits

Eric Anholt anholt at kemper.freedesktop.org
Thu Aug 23 18:01:33 PDT 2007


 GL/glx/glxglcore.c             |   13 ++--
 configure.ac                   |    2 
 exa/exa_unaccel.c              |   24 ++++----
 fb/fbcopy.c                    |    4 -
 fb/fbpict.c                    |    7 +-
 hw/xfree86/loader/xf86sym.c    |    1 
 hw/xfree86/modes/xf86Crtc.c    |  122 ++++++++++++++++++++++++++++++++++++++++-
 hw/xfree86/modes/xf86Crtc.h    |   19 ++++++
 hw/xfree86/modes/xf86Cursors.c |   11 +++
 9 files changed, 178 insertions(+), 25 deletions(-)

New commits:
diff-tree 37954c019afd92edbe4aaa9d6deb6efaad7bf088 (from d34b66402c9205aae38316c5855f3b492a7612c2)
Author: Brian Paul <brian.paul at tungstengraphics.com>
Date:   Thu Aug 23 19:38:53 2007 +0200

    glx: fix crash when freeing visuals
    
    Don't set screen->num_vis to a value greater than the actual number of visuals.
    
    X.Org Bug #10809 <http://bugs.freedesktop.org/show_bug.cgi?id=10809>
    (cherry picked from commit ff089e6cae634ac3eb509abd448a250bcbb17275)

diff --git a/GL/glx/glxglcore.c b/GL/glx/glxglcore.c
index df9be07..679d55c 100644
--- a/GL/glx/glxglcore.c
+++ b/GL/glx/glxglcore.c
@@ -296,7 +296,7 @@ static void init_screen_visuals(__GLXMES
     __GLcontextModes *modes;
     XMesaVisual *pXMesaVisual;
     int *used;
-    int i, j, size;
+    int num_vis, j, size;
 
     /* Alloc space for the list of XMesa visuals */
     size = screen->base.numVisuals * sizeof(XMesaVisual);
@@ -312,7 +312,7 @@ static void init_screen_visuals(__GLXMES
     used = (int *) xalloc(pScreen->numVisuals * sizeof(int));
     memset(used, 0, pScreen->numVisuals * sizeof(int));
 
-    i = 0;
+    num_vis = 0;
     for ( modes = screen->base.modes; modes != NULL; modes = modes->next ) {
 	const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
 	const int nplanes = (modes->rgbBits - modes->alphaBits);
@@ -327,7 +327,8 @@ static void init_screen_visuals(__GLXMES
 		!used[j]) {
 
 		/* Create the XMesa visual */
-		pXMesaVisual[i] =
+                assert(num_vis < screen->base.numVisuals);
+		pXMesaVisual[num_vis] =
 		    XMesaCreateVisual(pScreen,
 				      &pVis[j],
 				      modes->rgbMode,
@@ -364,13 +365,15 @@ static void init_screen_visuals(__GLXMES
 	    FatalError( "Matching visual found, but visualID still -1!\n" );
 	}
 
-	i++;
+	num_vis++;
     }
 
     xfree(used);
 
-    screen->num_vis = pScreen->numVisuals;
+    screen->num_vis = num_vis;
     screen->xm_vis = pXMesaVisual;
+
+    assert(screen->num_vis <= screen->base.numVisuals);
 }
 
 static __GLXscreen *
diff-tree d34b66402c9205aae38316c5855f3b492a7612c2 (from efac9c9c2e7cfa974fb0e7737832f0e34d156f65)
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Aug 23 16:22:03 2007 +1000

    randr: fixup crtc and output destroy
    
    if you are moving pointers, you want to move the pointers not just a byte
    (cherry picked from commit 76bf3cd7b8c6189b6b08518cde00c8bd991bdfb7)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 08306bc..5a6fc3a 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -128,7 +128,7 @@ xf86CrtcDestroy (xf86CrtcPtr crtc)
 	{
 	    memmove (&xf86_config->crtc[c],
 		     &xf86_config->crtc[c+1],
-		     xf86_config->num_crtc - (c + 1));
+		     ((xf86_config->num_crtc - (c + 1)) * sizeof(void*)));
 	    xf86_config->num_crtc--;
 	    break;
 	}
@@ -596,7 +596,7 @@ xf86OutputDestroy (xf86OutputPtr output)
 	{
 	    memmove (&xf86_config->output[o],
 		     &xf86_config->output[o+1],
-		     xf86_config->num_output - (o + 1));
+		     ((xf86_config->num_output - (o + 1)) * sizeof(void*)));
 	    xf86_config->num_output--;
 	    break;
 	}
diff-tree efac9c9c2e7cfa974fb0e7737832f0e34d156f65 (from 248b220b3e2bf8d999241543b69be3022a728b3a)
Author: Keith Packard <keithp at koto.keithp.com>
Date:   Sun Aug 19 20:28:05 2007 -0700

    Ref count cursors used in hw/xfree86/modes code.
    
    The multi-crtc cursor code in hw/xfree86/modes holds a reference to the
    current cursor. This reference must be correctly ref counted so the cursor
    is not freed out from underneath this code.
    (cherry picked from commit 7dc8531548cc9573e28bb04363dcbb3af5864c9a)

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 396bf30..92b90a9 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -447,7 +447,10 @@ xf86_use_hw_cursor (ScreenPtr screen, Cu
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     xf86CursorInfoPtr	cursor_info = xf86_config->cursor_info;
 
+    if (xf86_config->cursor)
+	FreeCursor (xf86_config->cursor, None);
     xf86_config->cursor = cursor;
+    ++cursor->refcnt;
     
     if (cursor->bits->width > cursor_info->MaxWidth ||
 	cursor->bits->height> cursor_info->MaxHeight)
@@ -463,7 +466,10 @@ xf86_use_hw_cursor_argb (ScreenPtr scree
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     xf86CursorInfoPtr	cursor_info = xf86_config->cursor_info;
     
+    if (xf86_config->cursor)
+	FreeCursor (xf86_config->cursor, None);
     xf86_config->cursor = cursor;
+    ++cursor->refcnt;
     
     /* Make sure ARGB support is available */
     if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
@@ -632,4 +638,9 @@ xf86_cursors_fini (ScreenPtr screen)
 	xfree (xf86_config->cursor_image);
 	xf86_config->cursor_image = NULL;
     }
+    if (xf86_config->cursor)
+    {
+	FreeCursor (xf86_config->cursor, None);
+	xf86_config->cursor = NULL;
+    }
 }
diff-tree 248b220b3e2bf8d999241543b69be3022a728b3a (from 242c05e326646cbe1ab6ced54504456fee327bce)
Author: Alex Deucher <alex at botch2.com>
Date:   Tue Aug 21 00:37:33 2007 -0400

    add xf86_crtc_clip_video_helper to xf86sym.c
    (cherry picked from commit 1f6ddae003ec65d6bc567831bf32bf75dfefdd6c)

diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 8a2768d..185eb80 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -1203,6 +1203,7 @@ _X_HIDDEN void *xfree86LookupTab[] = {
     SYMFUNC(xf86_show_cursors)
     SYMFUNC(xf86_hide_cursors)
     SYMFUNC(xf86_cursors_fini)
+    SYMFUNC(xf86_crtc_clip_video_helper)
 
     SYMFUNC(xf86DoEDID_DDC1)
     SYMFUNC(xf86DoEDID_DDC2)
diff-tree 242c05e326646cbe1ab6ced54504456fee327bce (from dd33e936b39d1c5229353d3f25c47e3b87de8498)
Author: Alex Deucher <alex at botch2.com>
Date:   Mon Aug 20 19:46:38 2007 -0400

    move intel crtc xv clipping helper to the xserver
    
    The code is generic and can be used by any overlay-based card when
    adding randr 1.2 support.  Tested on radeon.
    (cherry picked from commit 53c04351c462d2ae307684e50d5960debe1ee557)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 170c921..08306bc 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -45,6 +45,8 @@
 #include "picturestr.h"
 #endif
 
+#include "xf86xv.h"
+
 /*
  * Initialize xf86CrtcConfig structure
  */
@@ -2144,3 +2146,119 @@ xf86ConnectorGetName(xf86ConnectorType c
 {
     return _xf86ConnectorNames[connector];
 }
+
+static void
+x86_crtc_box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b)
+{
+    dest->x1 = a->x1 > b->x1 ? a->x1 : b->x1;
+    dest->x2 = a->x2 < b->x2 ? a->x2 : b->x2;
+    dest->y1 = a->y1 > b->y1 ? a->y1 : b->y1;
+    dest->y2 = a->y2 < b->y2 ? a->y2 : b->y2;
+
+    if (dest->x1 >= dest->x2 || dest->y1 >= dest->y2)
+	dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0;
+}
+
+static void
+x86_crtc_box(xf86CrtcPtr crtc, BoxPtr crtc_box)
+{
+    if (crtc->enabled) {
+	crtc_box->x1 = crtc->x;
+	crtc_box->x2 = crtc->x + xf86ModeWidth(&crtc->mode, crtc->rotation);
+	crtc_box->y1 = crtc->y;
+	crtc_box->y2 = crtc->y + xf86ModeHeight(&crtc->mode, crtc->rotation);
+    } else
+	crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
+}
+
+static int
+xf86_crtc_box_area(BoxPtr box)
+{
+    return (int) (box->x2 - box->x1) * (int) (box->y2 - box->y1);
+}
+
+/*
+ * Return the crtc covering 'box'. If two crtcs cover a portion of
+ * 'box', then prefer 'desired'. If 'desired' is NULL, then prefer the crtc
+ * with greater coverage
+ */
+
+static xf86CrtcPtr
+xf86_covering_crtc(ScrnInfoPtr pScrn,
+		   BoxPtr      box,
+		   xf86CrtcPtr desired,
+		   BoxPtr      crtc_box_ret)
+{
+    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    xf86CrtcPtr		crtc, best_crtc;
+    int			coverage, best_coverage;
+    int			c;
+    BoxRec		crtc_box, cover_box;
+
+    best_crtc = NULL;
+    best_coverage = 0;
+    crtc_box_ret->x1 = 0;
+    crtc_box_ret->x2 = 0;
+    crtc_box_ret->y1 = 0;
+    crtc_box_ret->y2 = 0;
+    for (c = 0; c < xf86_config->num_crtc; c++) {
+	crtc = xf86_config->crtc[c];
+	x86_crtc_box(crtc, &crtc_box);
+	x86_crtc_box_intersect(&cover_box, &crtc_box, box);
+	coverage = xf86_crtc_box_area(&cover_box);
+	if (coverage && crtc == desired) {
+	    *crtc_box_ret = crtc_box;
+	    return crtc;
+	} else if (coverage > best_coverage) {
+	    *crtc_box_ret = crtc_box;
+	    best_crtc = crtc;
+	    best_coverage = coverage;
+	}
+    }
+    return best_crtc;
+}
+
+/*
+ * For overlay video, compute the relevant CRTC and
+ * clip video to that
+ */
+
+Bool
+xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
+			    xf86CrtcPtr *crtc_ret,
+			    xf86CrtcPtr desired_crtc,
+			    BoxPtr      dst,
+			    INT32	*xa,
+			    INT32	*xb,
+			    INT32	*ya,
+			    INT32	*yb,
+			    RegionPtr   reg,
+			    INT32	width,
+			    INT32	height)
+{
+    Bool	ret;
+    RegionRec	crtc_region_local;
+    RegionPtr	crtc_region = reg;
+    
+    if (crtc_ret) {
+	BoxRec		crtc_box;
+	xf86CrtcPtr	crtc = xf86_covering_crtc(pScrn, dst,
+						  desired_crtc,
+						  &crtc_box);
+
+	if (crtc) {
+	    REGION_INIT (pScreen, &crtc_region_local, &crtc_box, 1);
+	    crtc_region = &crtc_region_local;
+	    REGION_INTERSECT (pScreen, crtc_region, crtc_region, reg);
+	}
+	*crtc_ret = crtc;
+    }
+
+    ret = xf86XVClipVideoHelper(dst, xa, xb, ya, yb, 
+				crtc_region, width, height);
+
+    if (crtc_region != reg)
+	REGION_UNINIT (pScreen, &crtc_region_local);
+
+    return ret;
+}
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index a4e8ea3..9693e12 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -765,5 +765,24 @@ xf86_hide_cursors (ScrnInfoPtr scrn);
  */
 void
 xf86_cursors_fini (ScreenPtr screen);
+
+/*
+ * For overlay video, compute the relevant CRTC and
+ * clip video to that.
+ * wraps xf86XVClipVideoHelper()
+ */
+
+Bool
+xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
+			    xf86CrtcPtr *crtc_ret,
+			    xf86CrtcPtr desired_crtc,
+			    BoxPtr      dst,
+			    INT32	*xa,
+			    INT32	*xb,
+			    INT32	*ya,
+			    INT32	*yb,
+			    RegionPtr   reg,
+			    INT32	width,
+			    INT32	height);
     
 #endif /* _XF86CRTC_H_ */
diff-tree dd33e936b39d1c5229353d3f25c47e3b87de8498 (from ec126e29e4a270577bba6337ed6f4ec8dbce46f9)
Author: Fredrik Höglund <fredrik at kde.org>
Date:   Sat Aug 18 19:02:18 2007 +0200

    EXA: Fix a couple of logic errors in exaGetPixmapFirstPixel.
    
    The fb pointer would be left uninitialized when exaPixmapIsOffscreen
    returned false. When it returned true and the pixmap was damaged,
    fb would be initialized from the pixmap's devPrivate.ptr before the
    exaDoMigration and exaPrepareAccess calls, at which point
    devPrivate.ptr would still be pointing at offscreen memory.
    (cherry picked from commit 3c448b0eb67337b56641e09a6d168aad6745e3ef)

diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index b67ea63..a94648b 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -382,19 +382,19 @@ exaGetPixmapFirstPixel (PixmapPtr pPixma
     ExaMigrationRec pixmaps[1];
     ExaPixmapPriv (pPixmap);
 
+    fb = pExaPixmap->sys_ptr;
+
     /* Try to avoid framebuffer readbacks */
-    if (exaPixmapIsOffscreen(pPixmap)) {
-	if (!miPointInRegion(DamageRegion(pExaPixmap->pDamage), 0, 0,  &box)) {
-	    fb = pExaPixmap->sys_ptr;
-	} else {
-	    need_finish = TRUE;
-	    fb = pPixmap->devPrivate.ptr;
-	    pixmaps[0].as_dst = FALSE;
-	    pixmaps[0].as_src = TRUE;
-	    pixmaps[0].pPix = pPixmap;
-	    exaDoMigration (pixmaps, 1, FALSE);
-	    exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
-	}
+    if (exaPixmapIsOffscreen(pPixmap) &&
+        miPointInRegion(DamageRegion(pExaPixmap->pDamage), 0, 0,  &box))
+    {
+	need_finish = TRUE;
+	pixmaps[0].as_dst = FALSE;
+	pixmaps[0].as_src = TRUE;
+	pixmaps[0].pPix = pPixmap;
+	exaDoMigration (pixmaps, 1, FALSE);
+	exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
+	fb = pPixmap->devPrivate.ptr;
     }
 
     switch (pPixmap->drawable.bitsPerPixel) {
diff-tree ec126e29e4a270577bba6337ed6f4ec8dbce46f9 (from 71ddf917d7449b721582c910c5026faa457597fe)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Tue Aug 21 14:26:14 2007 -0400

    Require pixman 0.9.5; Use pixman_image_set_source_clipping() to fix
    bug 11620 (reported by Jens Stroebel.
    (cherry picked from commit 53941c8e68014619d3ded7f8bc0f07d9a38bb9b1)

diff --git a/configure.ac b/configure.ac
index 41cc103..ad6ae4b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -623,7 +623,7 @@ XEXT_INC='-I$(top_srcdir)/Xext'
 XEXT_LIB='$(top_builddir)/Xext/libXext.la'
 XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
 
-PIXMAN="[pixman-1 >= 0.9.4]"
+PIXMAN="[pixman-1 >= 0.9.5]"
 PKG_CHECK_MODULES(PIXMAN, $PIXMAN)
 AC_SUBST(PIXMAN_CFLAGS)
 
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 8a146dd..85b5171 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -397,6 +397,7 @@ set_image_properties (pixman_image_t *im
     }
     
     pixman_image_set_filter (image, filter, (pixman_fixed_t *)pict->filter_params, pict->filter_nparams);
+    pixman_image_set_source_clipping (image, TRUE);
 }
 
 pixman_image_t *
diff-tree 71ddf917d7449b721582c910c5026faa457597fe (from 7cc53ae10adb7f8bb59f904b1362b7391b327f83)
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Thu Aug 16 17:43:29 2007 -0700

    stride is in FbBits-sized chunks, but xoff is not.
    
    Fixes corruption problems with composite rendering to redirected windows in
    depth 16.
    (cherry picked from commit 6a32a96d8df184c3ace4847beb48fdcb846d2286)

diff --git a/fb/fbpict.c b/fb/fbpict.c
index 4d1ad0b..8a146dd 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -291,9 +291,9 @@ create_bits_picture (PicturePtr pict,
     pixman_image_t *image;
     
     fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
-    
-    bits += yoff * stride + xoff;
-    
+
+    bits = (CARD8*)bits + yoff * stride * sizeof(FbBits) + xoff * (bpp / 8);
+
     image = pixman_image_create_bits (
 	pict->format,
 	pict->pDrawable->width, pict->pDrawable->height,
diff-tree 7cc53ae10adb7f8bb59f904b1362b7391b327f83 (from 2bf6cb3074d9c0dcd706e8e083747c6d84b70e30)
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Thu Aug 16 14:57:18 2007 -0700

    Bug #12015: Use the right offsets in the dst arguments of pixman_blt.
    (cherry picked from commit 32666d77227fcd2c066de16bf3c07366f92b0457)

diff --git a/fb/fbcopy.c b/fb/fbcopy.c
index 3ad01bf..68f403f 100644
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -64,8 +64,8 @@ fbCopyNtoN (DrawablePtr	pSrcDrawable,
 	    if (!pixman_blt ((uint32_t *)src, (uint32_t *)dst, srcStride, dstStride, srcBpp, dstBpp,
 			     (pbox->x1 + dx + srcXoff),
 			     (pbox->y1 + dy + srcYoff),
-			     (pbox->x1 + srcXoff),
-			     (pbox->y1 + srcYoff),
+			     (pbox->x1 + dstXoff),
+			     (pbox->y1 + dstYoff),
 			     (pbox->x2 - pbox->x1),
 			     (pbox->y2 - pbox->y1)))
 		goto fallback;


More information about the xorg-commit mailing list