xf86-video-intel: 3 commits - src/i830_driver.c src/i830.h src/i830_render.c src/i830_video.c src/i915_render.c

Keith Packard keithp at kemper.freedesktop.org
Mon Sep 21 17:24:24 PDT 2009


 src/i830.h        |    6 -
 src/i830_driver.c |   44 -------------
 src/i830_render.c |    4 -
 src/i830_video.c  |    4 -
 src/i915_render.c |  178 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 181 insertions(+), 55 deletions(-)

New commits:
commit bd817e2d733dfdb1140874b06595ccd1ef39159b
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Sep 21 17:21:17 2009 -0700

    Split i915/i830 composite_emit_primitive into two functions.
    
    The i915 and i830 take similar but different data when emitting the
    primitives, instead of trying to share code here, just split this
    apart and avoid potentially breaking things later on.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830.h b/src/i830.h
index d597308..009641a 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -791,9 +791,6 @@ i830_transform_is_affine (PictTransformPtr t);
 
 void i830_composite(PixmapPtr pDst, int srcX, int srcY,
 		    int maskX, int maskY, int dstX, int dstY, int w, int h);
-void i830_emit_composite_primitive(PixmapPtr pDst, int srcX, int srcY,
-				   int maskX, int maskY, int dstX, int dstY,
-				   int w, int h);
 void i830_done_composite(PixmapPtr pDst);
 /* i915_render.c */
 Bool i915_check_composite(int op, PicturePtr pSrc, PicturePtr pMask,
diff --git a/src/i830_render.c b/src/i830_render.c
index 8213e29..2c95601 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -604,9 +604,9 @@ i830_emit_composite_state(ScrnInfoPtr pScrn)
 
 /* Emit the vertices for a single composite rectangle.
  *
- * This function is shared between i830 and i915 generation code.
+ * This function is no longer shared between i830 and i915 generation code.
  */
-void
+static void
 i830_emit_composite_primitive(PixmapPtr pDst,
 			      int srcX, int srcY,
 			      int maskX, int maskY,
diff --git a/src/i915_render.c b/src/i915_render.c
index 9d5d425..a4c2768 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -547,6 +547,182 @@ i915_emit_composite_setup(ScrnInfoPtr pScrn)
     FS_END();
 }
 
+
+
+/* Emit the vertices for a single composite rectangle.
+ *
+ * This function is no longer shared between i830 and i915 generation code.
+ */
+static void
+i915_emit_composite_primitive(PixmapPtr pDst,
+			      int srcX, int srcY,
+			      int maskX, int maskY,
+			      int dstX, int dstY,
+			      int w, int h)
+{
+    ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+    I830Ptr pI830 = I830PTR(pScrn);
+    Bool is_affine_src, is_affine_mask = TRUE;
+    int per_vertex, num_floats;
+    float src_x[3], src_y[3], src_w[3], mask_x[3], mask_y[3], mask_w[3];
+
+    per_vertex = 2; /* dest x/y */
+
+    {
+	float x = srcX + pI830->src_coord_adjust;
+	float y = srcY + pI830->src_coord_adjust;
+
+	is_affine_src = i830_transform_is_affine (pI830->transform[0]);
+	if (is_affine_src) {
+	    if (!i830_get_transformed_coordinates(x, y,
+						  pI830->transform[0],
+						  &src_x[0], &src_y[0]))
+		return;
+
+	    if (!i830_get_transformed_coordinates(x, y + h,
+						  pI830->transform[0],
+						  &src_x[1], &src_y[1]))
+		return;
+
+	    if (!i830_get_transformed_coordinates(x + w, y + h,
+						  pI830->transform[0],
+						  &src_x[2], &src_y[2]))
+		return;
+
+	    per_vertex += 2;    /* src x/y */
+	} else {
+	    if (!i830_get_transformed_coordinates_3d(x, y,
+						     pI830->transform[0],
+						     &src_x[0],
+						     &src_y[0],
+						     &src_w[0]))
+		return;
+
+	    if (!i830_get_transformed_coordinates_3d(x, y + h,
+						     pI830->transform[0],
+						     &src_x[1],
+						     &src_y[1],
+						     &src_w[1]))
+		return;
+
+	    if (!i830_get_transformed_coordinates_3d(x + w, y + h,
+						     pI830->transform[0],
+						     &src_x[2],
+						     &src_y[2],
+						     &src_w[2]))
+		return;
+
+	    per_vertex += 4;    /* src x/y/z/w */
+	}
+    }
+
+    if (pI830->render_mask) {
+	float x = maskX + pI830->mask_coord_adjust;
+	float y = maskY + pI830->mask_coord_adjust;
+
+	is_affine_mask = i830_transform_is_affine (pI830->transform[1]);
+	if (is_affine_mask) {
+	    if (!i830_get_transformed_coordinates(x, y,
+						  pI830->transform[1],
+						  &mask_x[0], &mask_y[0]))
+		return;
+
+	    if (!i830_get_transformed_coordinates(x, y + h,
+						  pI830->transform[1],
+						  &mask_x[1], &mask_y[1]))
+		return;
+
+	    if (!i830_get_transformed_coordinates(x + w, y + h,
+						  pI830->transform[1],
+						  &mask_x[2], &mask_y[2]))
+		return;
+
+	    per_vertex += 2;	/* mask x/y */
+	} else {
+	    if (!i830_get_transformed_coordinates_3d(x, y,
+						     pI830->transform[1],
+						     &mask_x[0],
+						     &mask_y[0],
+						     &mask_w[0]))
+		return;
+
+	    if (!i830_get_transformed_coordinates_3d(x, y + h,
+						     pI830->transform[1],
+						     &mask_x[1],
+						     &mask_y[1],
+						     &mask_w[1]))
+		return;
+
+	    if (!i830_get_transformed_coordinates_3d(x + w, y + h,
+						     pI830->transform[1],
+						     &mask_x[2],
+						     &mask_y[2],
+						     &mask_w[2]))
+		return;
+
+	    per_vertex += 4;	/* mask x/y/z/w */
+	}
+    }
+
+    num_floats = 3 * per_vertex;
+
+    BEGIN_BATCH(1 + num_floats);
+
+    OUT_BATCH(PRIM3D_INLINE | PRIM3D_RECTLIST | (num_floats-1));
+    OUT_BATCH_F(pI830->dst_coord_adjust + dstX + w);
+    OUT_BATCH_F(pI830->dst_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) {
+	OUT_BATCH_F(0.0);
+	OUT_BATCH_F(src_w[2]);
+    }
+    if (pI830->render_mask) {
+	OUT_BATCH_F(mask_x[2] / pI830->scale_units[1][0]);
+	OUT_BATCH_F(mask_y[2] / pI830->scale_units[1][1]);
+	if (!is_affine_mask) {
+	    OUT_BATCH_F(0.0);
+	    OUT_BATCH_F(mask_w[2]);
+	}
+    }
+
+    OUT_BATCH_F(pI830->dst_coord_adjust + dstX);
+    OUT_BATCH_F(pI830->dst_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) {
+	OUT_BATCH_F(0.0);
+	OUT_BATCH_F(src_w[1]);
+    }
+    if (pI830->render_mask) {
+	OUT_BATCH_F(mask_x[1] / pI830->scale_units[1][0]);
+	OUT_BATCH_F(mask_y[1] / pI830->scale_units[1][1]);
+	if (!is_affine_mask) {
+	    OUT_BATCH_F(0.0);
+	    OUT_BATCH_F(mask_w[1]);
+	}
+    }
+
+    OUT_BATCH_F(pI830->dst_coord_adjust + dstX);
+    OUT_BATCH_F(pI830->dst_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) {
+	OUT_BATCH_F(0.0);
+	OUT_BATCH_F(src_w[0]);
+    }
+    if (pI830->render_mask) {
+	OUT_BATCH_F(mask_x[0] / pI830->scale_units[1][0]);
+	OUT_BATCH_F(mask_y[0] / pI830->scale_units[1][1]);
+	if (!is_affine_mask) {
+	    OUT_BATCH_F(0.0);
+	    OUT_BATCH_F(mask_w[0]);
+	}
+    }
+
+    ADVANCE_BATCH();
+}
+
 void
 i915_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
 	       int dstX, int dstY, int w, int h)
@@ -559,7 +735,7 @@ i915_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
     if (pI830->i915_render_state.needs_emit)
 	i915_emit_composite_setup(pScrn);
 
-    i830_emit_composite_primitive(pDst, srcX, srcY, maskX, maskY, dstX, dstY,
+    i915_emit_composite_primitive(pDst, srcX, srcY, maskX, maskY, dstX, dstY,
 				  w, h);
 
     intel_batch_end_atomic(pScrn);
commit 5e80297d088e8cdbf66d765f7d252dab66c8df86
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Sep 18 21:05:23 2009 -0700

    Remove DGA support from the driver.
    
    The xf86DiDGA code required that the scanout buffer always be
    mappable, stay be at a fixed address in the aperture and have a
    constant size. With frame buffer resizing, the latter two are no
    longer true, and with KMS, we'd really prefer to not allow the former.
    
    The only option available to the driver is to completely disable DGA
    as the modes code has internal calls to the xf86DiDGA code when
    fetching new modes from the hardware.
    
    A fix for the DiDGA code will be added to the X server which will
    automatically initialize DGA for mode switching and input, but not
    frame buffer access, and not require any driver cooperation.
    
    Thus, the correct solution is for the driver to not call xf86DiDGAInit
    at all. For old servers, this eliminates a potential catastrophic
    problem where random memory is written by the X server. New servers
    will get the DIX-based behaviour automatically.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 4eb0255..316a1fa 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2708,11 +2708,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
    xf86SetBlackWhitePixels(pScreen);
 
-#ifdef XFreeXDGA
-   if (!pI830->use_drm_mode)
-       xf86DiDGAInit (pScreen, pI830->LinearAddr + pScrn->fbOffset);
-#endif
-
    if (!I830AccelInit(pScreen)) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		 "Hardware acceleration initialization failed\n");
commit 4758311842a16600287c8f9f77ce0af1a31b9264
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Sep 18 20:59:52 2009 -0700

    Remove vestigial internal rotation which broke KMS DGA/VidMode modesetting.
    
    Pre-2.0, the driver supported rotation internally, rather than relying
    on the X server rotation support. The last piece of this dealt with
    rotating the mouse coordinates and also tried to preserve rotation
    across DGA/VidModeExtension modesetting requests.
    
    That latter bit of code broke under KMS as the rotation value was
    never initialized, and when set to zero would create an invalid
    configuration. This would confuse xrandr which would bail before
    making any changes, leaving the user without a way to recover.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830.h b/src/i830.h
index c3b0d02..d597308 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -395,8 +395,7 @@ typedef struct _I830Rec {
 #endif
 
    XF86ModReqInfo shadowReq; /* to test for later libshadow */
-   Rotation rotation;
-   void (*PointerMoved)(int, int, int);
+
    CreateScreenResourcesProcPtr    CreateScreenResources;
 
    i830_memory *power_context;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 2863e45..4eb0255 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1359,9 +1359,6 @@ i830_user_modesetting_init(ScrnInfoPtr pScrn)
     }
     RestoreHWState(pScrn);
 
-    /* XXX This should go away, replaced by xf86Crtc.c support for it */
-    pI830->rotation = RR_Rotate_0;
-
     pI830->stolen_size = I830DetectMemory(pScrn);
 
     return TRUE;
@@ -2133,33 +2130,6 @@ RestoreHWState(ScrnInfoPtr pScrn)
    return TRUE;
 }
 
-static void
-I830PointerMoved(int index, int x, int y)
-{
-   ScrnInfoPtr pScrn = xf86Screens[index];
-   I830Ptr pI830 = I830PTR(pScrn);
-   int newX = x, newY = y;
-
-   switch (pI830->rotation) {
-      case RR_Rotate_0:
-         break;
-      case RR_Rotate_90:
-         newX = y;
-         newY = pScrn->pScreen->width - x - 1;
-         break;
-      case RR_Rotate_180:
-         newX = pScrn->pScreen->width - x - 1;
-         newY = pScrn->pScreen->height - y - 1;
-         break;
-      case RR_Rotate_270:
-         newX = pScrn->pScreen->height - y - 1;
-         newY = x;
-         break;
-   }
-
-   (*pI830->PointerMoved)(index, newX, newY);
-}
-
 /**
  * Intialiazes the hardware for the 3D pipeline use in the 2D driver.
  *
@@ -2830,11 +2800,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Not available\n");
 #endif
 
-
-   /* Wrap pointer motion to flip touch screen around */
-   pI830->PointerMoved = pScrn->PointerMoved;
-   pScrn->PointerMoved = I830PointerMoved;
-
    if (serverGeneration == 1)
       xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
 
@@ -3086,9 +3051,8 @@ static Bool
 I830SwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
 {
    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-   I830Ptr pI830 = I830PTR(pScrn);
 
-   return xf86SetSingleMode (pScrn, mode, pI830->rotation);
+   return xf86SetSingleMode (pScrn, mode, RR_Rotate_0);
 }
 
 static Bool
@@ -3142,7 +3106,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
 
    xf86GARTCloseScreen(scrnIndex);
 
-   pScrn->PointerMoved = pI830->PointerMoved;
    pScrn->vtSema = FALSE;
    pI830->closing = FALSE;
    return TRUE;
diff --git a/src/i830_video.c b/src/i830_video.c
index 9fb0b56..47c026d 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2751,10 +2751,6 @@ I830AllocateSurface(ScrnInfoPtr pScrn,
 	    return BadAlloc;
     }
 
-    /* What to do when rotated ?? */
-    if (pI830->rotation != RR_Rotate_0)
-	return BadAlloc;
-
     if (!(surface->pitches = xalloc(sizeof(int))))
 	return BadAlloc;
     if (!(surface->offsets = xalloc(sizeof(int)))) {


More information about the xorg-commit mailing list