xf86-video-intel: Branch 'xf86-video-intel-2.3-branch' - 3 commits - configure.ac src/i830_exa.c src/i830.h src/i830_render.c src/i830_video.c src/i915_render.c src/i965_render.c

Zhenyu Wang zhen at kemper.freedesktop.org
Mon Mar 24 00:08:45 PDT 2008


 configure.ac      |   10 +++-
 src/i830.h        |    5 +-
 src/i830_exa.c    |   55 ++++++++++++++++---------
 src/i830_render.c |  118 ++++++++++++++++++++++++++++++++----------------------
 src/i830_video.c  |   11 +++--
 src/i915_render.c |   10 ++++
 src/i965_render.c |   42 ++++++++++---------
 7 files changed, 158 insertions(+), 93 deletions(-)

New commits:
commit 996dc7fd8b5d0aaaa1cda339c2a069893d2d1a43
Author: Julien Cristau <jcristau at debian.org>
Date:   Mon Mar 24 13:29:24 2008 +0800

    Don't try to build XvMC if DRI is disabled
    
    Instead of failing the build, don't even try unless --enable-xvmc was used.

diff --git a/configure.ac b/configure.ac
index 9179bb2..871cd26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,9 +67,9 @@ AC_ARG_WITH(xserver-source,AC_HELP_STRING([--with-xserver-source=XSERVER_SOURCE]
 			   [ XSERVER_SOURCE="" ])
 
 AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc],
-                                  [Disable XvMC support [[default=yes]]]),
+                                  [Disable XvMC support [[default=auto]]]),
               [XVMC="$enableval"],
-              [XVMC=yes])
+              [XVMC=auto])
 
 # Checks for extensions
 XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
@@ -211,6 +211,12 @@ if test "$VIDEO_DEBUG" = yes; then
 fi
 
 AC_MSG_CHECKING([whether to include XvMC support])
+if test "$XVMC" = auto; then
+	XVMC="$DRI"
+fi
+if test "$XVMC" = yes && test "$DRI" = no; then
+	AC_MSG_ERROR([XvMC can't be enabled without DRI])
+fi
 AC_MSG_RESULT([$XVMC])
 AM_CONDITIONAL(XVMC, test x$XVMC = xyes)
 if test "$XVMC" = yes; then
commit 40744d88b477a27772c541d73311208f47ba562e
Author: Maxim Levitsky <maximlevitsky at gmail.com>
Date:   Mon Mar 24 13:24:12 2008 +0800

    Fix crash triggered by dpms low power mode with hardware overlay running
    
    When overlay switch crtc, it ignores current crtc dpms mode which
    might lead to hang.

diff --git a/src/i830_video.c b/src/i830_video.c
index 0d0a9a0..5939634 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -385,11 +385,13 @@ i830_overlay_switch_to_crtc (ScrnInfoPtr pScrn, xf86CrtcPtr crtc)
     I830CrtcPrivatePtr  intel_crtc = crtc->driver_private;
     int			pipeconf_reg = intel_crtc->pipe == 0 ? PIPEACONF : PIPEBCONF;
 
-    if (!IS_I965G(pI830) && (INREG(pipeconf_reg) & PIPEACONF_DOUBLE_WIDE))
+    /* overlay can't be used on pipe with double wide, and pipe must be enabled. */
+    if ((!IS_I965G(pI830) && (INREG(pipeconf_reg) & PIPEACONF_DOUBLE_WIDE))
+	    || (intel_crtc->dpms_mode == DPMSModeOff))
 	pPriv->overlayOK = FALSE;
     else
 	pPriv->overlayOK = TRUE;
-    
+
     if (!pPriv->overlayOK)
 	return;
 
@@ -1829,10 +1831,11 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
     
     if (crtc != pPriv->current_crtc)
     {
-        pPriv->current_crtc = crtc;
 	i830_overlay_switch_to_crtc (pScrn, crtc);
-	if (pPriv->overlayOK)
+	if (pPriv->overlayOK) {
+	    pPriv->current_crtc = crtc;
 	    I830ResetVideo (pScrn);
+	}
     }
 
     if (!pPriv->overlayOK)
commit 78d260fe9af068ed0445d28f8458850020bc2a8f
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Mar 21 03:08:24 2008 -0700

    Transformed coord computed using floats. Don't move bilinear composite dst.
    
    The homogeneous coordinate computation in the core server cannot be used for
    many legal matrices as it overflows. Just use floats in the driver; faster
    and avoids troubles.
    
    When compositing with bilinear filter, don't push the dst coordinates around
    as that makes the output blurry when pixels are aligned.

diff --git a/src/i830.h b/src/i830.h
index c84e802..1319c6a 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -524,6 +524,7 @@ typedef struct _I830Rec {
    float scale_units[2][2];
   /** Transform pointers for src/mask, or NULL if identity */
    PictTransform *transform[2];
+   float coord_adjust;
    /* i915 EXA render state */
    uint32_t mapstate[6];
    uint32_t samplerstate[6];
@@ -827,11 +828,11 @@ Bool i965_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMask,
 void i965_composite(PixmapPtr pDst, int srcX, int srcY,
 		    int maskX, int maskY, int dstX, int dstY, int w, int h);
 
-void
+Bool
 i830_get_transformed_coordinates(int x, int y, PictTransformPtr transform,
 				 float *x_out, float *y_out);
 
-void
+Bool
 i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
 				    float *x_out, float *y_out, float *z_out);
 
diff --git a/src/i830_exa.c b/src/i830_exa.c
index f9df277..9b5bb93 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -339,12 +339,31 @@ I830EXADoneCopy(PixmapPtr pDstPixmap)
 #define xFixedToFloat(val) \
 	((float)xFixedToInt(val) + ((float)xFixedFrac(val) / 65536.0))
 
+static Bool
+_i830_transform_point (PictTransformPtr transform,
+		       float		x,
+		       float		y,
+		       float		result[3])
+{
+    int		    j;
+
+    for (j = 0; j < 3; j++)
+    {
+	result[j] = (xFixedToFloat (transform->matrix[j][0]) * x +
+		     xFixedToFloat (transform->matrix[j][1]) * y +
+		     xFixedToFloat (transform->matrix[j][2]));
+    }
+    if (!result[2])
+	return FALSE;
+    return TRUE;
+}
+
 /**
  * Returns the floating-point coordinates transformed by the given transform.
  *
  * transform may be null.
  */
-void
+Bool
 i830_get_transformed_coordinates(int x, int y, PictTransformPtr transform,
 				 float *x_out, float *y_out)
 {
@@ -352,15 +371,14 @@ i830_get_transformed_coordinates(int x, int y, PictTransformPtr transform,
 	*x_out = x;
 	*y_out = y;
     } else {
-	PictVector v;
-
-        v.vector[0] = IntToxFixed(x);
-        v.vector[1] = IntToxFixed(y);
-        v.vector[2] = xFixed1;
-        PictureTransformPoint(transform, &v);
-	*x_out = xFixedToFloat(v.vector[0]);
-	*y_out = xFixedToFloat(v.vector[1]);
+	float	result[3];
+
+	if (!_i830_transform_point (transform, (float) x, (float) y, result))
+	    return FALSE;
+	*x_out = result[0] / result[2];
+	*y_out = result[1] / result[2];
     }
+    return TRUE;
 }
 
 /**
@@ -368,7 +386,7 @@ i830_get_transformed_coordinates(int x, int y, PictTransformPtr transform,
  *
  * transform may be null.
  */
-void
+Bool
 i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
 				    float *x_out, float *y_out, float *w_out)
 {
@@ -377,16 +395,15 @@ i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
 	*y_out = y;
 	*w_out = 1;
     } else {
-	PictVector v;
-
-        v.vector[0] = IntToxFixed(x);
-        v.vector[1] = IntToxFixed(y);
-        v.vector[2] = xFixed1;
-        PictureTransformPoint3d(transform, &v);
-	*x_out = xFixedToFloat(v.vector[0]);
-	*y_out = xFixedToFloat(v.vector[1]);
-	*w_out = xFixedToFloat(v.vector[2]);
+	float    result[3];
+
+	if (!_i830_transform_point (transform, (float) x, (float) y, result))
+	    return FALSE;
+	*x_out = result[0];
+	*y_out = result[1];
+	*w_out = result[2];
     }
+    return TRUE;
 }
 
 /**
diff --git a/src/i830_render.c b/src/i830_render.c
index 87543ef..195e9a8 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -396,6 +396,7 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
     I830Ptr pI830 = I830PTR(pScrn);
     uint32_t dst_format, dst_offset, dst_pitch;
     Bool is_affine_src, is_affine_mask;
+    Bool is_nearest = FALSE;
 
     IntelEmitInvarientState(pScrn);
     *pI830->last_3d = LAST_3D_RENDER;
@@ -407,9 +408,13 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
 
     if (!i830_texture_setup(pSrcPicture, pSrc, 0))
 	I830FALLBACK("fail to setup src texture\n");
+    if (pSrcPicture->filter == PictFilterNearest)
+	is_nearest = TRUE;
     if (pMask != NULL) {
 	if (!i830_texture_setup(pMaskPicture, pMask, 1))
 	    I830FALLBACK("fail to setup mask texture\n");
+	if (pMaskPicture->filter == PictFilterNearest)
+	    is_nearest = TRUE;
     } else {
 	pI830->transform[1] = NULL;
 	pI830->scale_units[1][0] = -1;
@@ -419,6 +424,11 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
     is_affine_src = i830_transform_is_affine (pI830->transform[0]);
     is_affine_mask = i830_transform_is_affine (pI830->transform[1]);
 
+    if (is_nearest)
+	pI830->coord_adjust = -0.125;
+    else
+	pI830->coord_adjust = 0;
+
     if (!is_affine_src || !is_affine_mask)
 	I830FALLBACK("non-affine transform unsupported on 8xx hardware\n");
 
@@ -591,56 +601,68 @@ i830_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
     per_vertex = 2; /* dest x/y */
     if (is_affine_src)
     {
-	i830_get_transformed_coordinates(srcX, srcY,
-					 pI830->transform[0],
-					 &src_x[0], &src_y[0]);
-	i830_get_transformed_coordinates(srcX, srcY + h,
-					 pI830->transform[0],
-					 &src_x[1], &src_y[1]);
-	i830_get_transformed_coordinates(srcX + w, srcY + h,
-					 pI830->transform[0],
-					 &src_x[2], &src_y[2]);
+	if (!i830_get_transformed_coordinates(srcX, srcY,
+					      pI830->transform[0],
+					      &src_x[0], &src_y[0]))
+	    return;
+	if (!i830_get_transformed_coordinates(srcX, srcY + h,
+					      pI830->transform[0],
+					      &src_x[1], &src_y[1]))
+	    return;
+	if (!i830_get_transformed_coordinates(srcX + w, srcY + h,
+					      pI830->transform[0],
+					      &src_x[2], &src_y[2]))
+	    return;
 	per_vertex += 2;    /* src x/y */
     } else {
-	i830_get_transformed_coordinates_3d(srcX, srcY,
-					    pI830->transform[0],
-					    &src_x[0], &src_y[0],
-					    &src_w[0]);
-	i830_get_transformed_coordinates_3d(srcX, srcY + h,
-					    pI830->transform[0],
-					    &src_x[1], &src_y[1],
-					    &src_w[1]);
-	i830_get_transformed_coordinates_3d(srcX + w, srcY + h,
-					    pI830->transform[0],
-					    &src_x[2], &src_y[2],
-					    &src_w[2]);
+	if (!i830_get_transformed_coordinates_3d(srcX, srcY,
+						 pI830->transform[0],
+						 &src_x[0], &src_y[0],
+						 &src_w[0]))
+	    return;
+	if (!i830_get_transformed_coordinates_3d(srcX, srcY + h,
+						 pI830->transform[0],
+						 &src_x[1], &src_y[1],
+						 &src_w[1]))
+	    return;
+	if (!i830_get_transformed_coordinates_3d(srcX + w, srcY + h,
+						 pI830->transform[0],
+						 &src_x[2], &src_y[2],
+						 &src_w[2]))
+	    return;
 	per_vertex += 4;    /* src x/y/z/w */
     }
     if (has_mask) {
 	if (is_affine_mask) {
-	    i830_get_transformed_coordinates(maskX, maskY,
-					     pI830->transform[1],
-					     &mask_x[0], &mask_y[0]);
-	    i830_get_transformed_coordinates(maskX, maskY + h,
-					     pI830->transform[1],
-					     &mask_x[1], &mask_y[1]);
-	    i830_get_transformed_coordinates(maskX + w, maskY + h,
-					     pI830->transform[1],
-					     &mask_x[2], &mask_y[2]);
+	    if (!i830_get_transformed_coordinates(maskX, maskY,
+						  pI830->transform[1],
+						  &mask_x[0], &mask_y[0]))
+		return;
+	    if (!i830_get_transformed_coordinates(maskX, maskY + h,
+						  pI830->transform[1],
+						  &mask_x[1], &mask_y[1]))
+		return;
+	    if (!i830_get_transformed_coordinates(maskX + w, maskY + h,
+						  pI830->transform[1],
+						  &mask_x[2], &mask_y[2]))
+		return;
 	    per_vertex += 2;	/* mask x/y */
 	} else {
-	    i830_get_transformed_coordinates_3d(maskX, maskY,
-						pI830->transform[1],
-						&mask_x[0], &mask_y[0],
-						&mask_w[0]);
-	    i830_get_transformed_coordinates_3d(maskX, maskY + h,
-						pI830->transform[1],
-						&mask_x[1], &mask_y[1],
-						&mask_w[1]);
-	    i830_get_transformed_coordinates_3d(maskX + w, maskY + h,
-						pI830->transform[1],
-						&mask_x[2], &mask_y[2],
-						&mask_w[2]);
+	    if (!i830_get_transformed_coordinates_3d(maskX, maskY,
+						     pI830->transform[1],
+						     &mask_x[0], &mask_y[0],
+						     &mask_w[0]))
+		return;
+	    if (!i830_get_transformed_coordinates_3d(maskX, maskY + h,
+						     pI830->transform[1],
+						     &mask_x[1], &mask_y[1],
+						     &mask_w[1]))
+		return;
+	    if (!i830_get_transformed_coordinates_3d(maskX + w, maskY + h,
+						     pI830->transform[1],
+						     &mask_x[2], &mask_y[2],
+						     &mask_w[2]))
+		return;
 	    per_vertex += 4;	/* mask x/y/z/w */
 	}
     }
@@ -655,8 +677,8 @@ i830_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
     OUT_BATCH(MI_NOOP);
 
     OUT_BATCH(PRIM3D_INLINE | PRIM3D_RECTLIST | (num_floats-1));
-    OUT_BATCH_F(-0.125 + dstX + w);
-    OUT_BATCH_F(-0.125 + dstY + h);
+    OUT_BATCH_F(pI830->coord_adjust + dstX + w);
+    OUT_BATCH_F(pI830->coord_adjust + dstY + h);
     OUT_BATCH_F(src_x[2] / pI830->scale_units[0][0]);
     OUT_BATCH_F(src_y[2] / pI830->scale_units[0][1]);
     if (!is_affine_src) {
@@ -672,8 +694,8 @@ i830_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
 	}
     }
 
-    OUT_BATCH_F(-0.125 + dstX);
-    OUT_BATCH_F(-0.125 + dstY + h);
+    OUT_BATCH_F(pI830->coord_adjust + dstX);
+    OUT_BATCH_F(pI830->coord_adjust + dstY + h);
     OUT_BATCH_F(src_x[1] / pI830->scale_units[0][0]);
     OUT_BATCH_F(src_y[1] / pI830->scale_units[0][1]);
     if (!is_affine_src) {
@@ -689,8 +711,8 @@ i830_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
 	}
     }
 
-    OUT_BATCH_F(-0.125 + dstX);
-    OUT_BATCH_F(-0.125 + dstY);
+    OUT_BATCH_F(pI830->coord_adjust + dstX);
+    OUT_BATCH_F(pI830->coord_adjust + dstY);
     OUT_BATCH_F(src_x[0] / pI830->scale_units[0][0]);
     OUT_BATCH_F(src_y[0] / pI830->scale_units[0][1]);
     if (!is_affine_src) {
diff --git a/src/i915_render.c b/src/i915_render.c
index 9c6da09..2b9ed04 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -321,6 +321,7 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
     int out_reg = FS_OC;
     FS_LOCALS(20);
     Bool is_affine_src, is_affine_mask;
+    Bool is_nearest = FALSE;
 
     IntelEmitInvarientState(pScrn);
     *pI830->last_3d = LAST_3D_RENDER;
@@ -332,9 +333,13 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
 
     if (!i915_texture_setup(pSrcPicture, pSrc, 0))
 	I830FALLBACK("fail to setup src texture\n");
+    if (pSrcPicture->filter == PictFilterNearest)
+	is_nearest = TRUE;
     if (pMask != NULL) {
 	if (!i915_texture_setup(pMaskPicture, pMask, 1))
 	    I830FALLBACK("fail to setup mask texture\n");
+	if (pMaskPicture->filter == PictFilterNearest)
+	    is_nearest = TRUE;
     } else {
 	pI830->transform[1] = NULL;
 	pI830->scale_units[1][0] = -1;
@@ -343,6 +348,11 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
     is_affine_src = i830_transform_is_affine (pI830->transform[0]);
     is_affine_mask = i830_transform_is_affine (pI830->transform[1]);
 
+    if (is_nearest)
+	pI830->coord_adjust = -0.125;
+    else
+	pI830->coord_adjust = 0;
+
     if (pMask == NULL) {
 	BEGIN_BATCH(10);
 	OUT_BATCH(_3DSTATE_MAP_STATE | 3);
diff --git a/src/i965_render.c b/src/i965_render.c
index ada3919..93583b0 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -1093,29 +1093,35 @@ i965_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
     float src_x[3], src_y[3], mask_x[3], mask_y[3];
     int i;
 
-    i830_get_transformed_coordinates(srcX, srcY,
-				     pI830->transform[0],
-				     &src_x[0], &src_y[0]);
-    i830_get_transformed_coordinates(srcX, srcY + h,
-				     pI830->transform[0],
-				     &src_x[1], &src_y[1]);
-    i830_get_transformed_coordinates(srcX + w, srcY + h,
-				     pI830->transform[0],
-				     &src_x[2], &src_y[2]);
+    if (!i830_get_transformed_coordinates(srcX, srcY,
+					  pI830->transform[0],
+					  &src_x[0], &src_y[0]))
+	return;
+    if (!i830_get_transformed_coordinates(srcX, srcY + h,
+					  pI830->transform[0],
+					  &src_x[1], &src_y[1]))
+	return;
+    if (!i830_get_transformed_coordinates(srcX + w, srcY + h,
+					  pI830->transform[0],
+					  &src_x[2], &src_y[2]))
+	return;
 
     if (pI830->scale_units[1][0] == -1 || pI830->scale_units[1][1] == -1) {
 	has_mask = FALSE;
     } else {
 	has_mask = TRUE;
-	i830_get_transformed_coordinates(maskX, maskY,
-					 pI830->transform[1],
-					 &mask_x[0], &mask_y[0]);
-	i830_get_transformed_coordinates(maskX, maskY + h,
-					 pI830->transform[1],
-					 &mask_x[1], &mask_y[1]);
-	i830_get_transformed_coordinates(maskX + w, maskY + h,
-					 pI830->transform[1],
-					 &mask_x[2], &mask_y[2]);
+	if (!i830_get_transformed_coordinates(maskX, maskY,
+					      pI830->transform[1],
+					      &mask_x[0], &mask_y[0]))
+	    return;
+	if (!i830_get_transformed_coordinates(maskX, maskY + h,
+					      pI830->transform[1],
+					      &mask_x[1], &mask_y[1]))
+	    return;
+	if (!i830_get_transformed_coordinates(maskX + w, maskY + h,
+					      pI830->transform[1],
+					      &mask_x[2], &mask_y[2]))
+	    return;
     }
 
     /* Wait for any existing composite rectangles to land before we overwrite


More information about the xorg-commit mailing list