xf86-video-ati: Branch 'master' - 2 commits

Alex Deucher agd5f at kemper.freedesktop.org
Wed Mar 4 16:08:01 PST 2009


 src/radeon_driver.c         |    5 -
 src/radeon_textured_video.c |  148 ++++++++++++++++++++++++++++++++++++--------
 src/radeon_video.c          |    2 
 3 files changed, 124 insertions(+), 31 deletions(-)

New commits:
commit 3b0fc22ad9e5c0f120a74c4f3d8e48c270f0ff29
Author: Alex Deucher <alexdeucher at gmail.com>
Date:   Wed Mar 4 19:04:34 2009 -0500

    R6xx/R7xx: wire up DMAForXv option like older asics
    
    Select between SW and HW-assisted uploads

diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 8a28f3f..0842164 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -2345,10 +2345,7 @@ static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn)
     xf86DrvMsg(pScrn->scrnIndex, from, "Page Flipping %sabled%s\n",
 	       info->dri->allowPageFlip ? "en" : "dis", reason);
 
-    if (info->ChipFamily >= CHIP_FAMILY_R600)
-	info->DMAForXv = FALSE;
-    else
-	info->DMAForXv = TRUE;
+    info->DMAForXv = TRUE;
     from = xf86GetOptValBool(info->Options, OPTION_XV_DMA, &info->DMAForXv)
 	 ? X_CONFIG : X_INFO;
     xf86DrvMsg(pScrn->scrnIndex, from,
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index dad7795..2df299f 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -160,11 +160,11 @@ static __inline__ uint32_t F_TO_24(float val)
 #endif /* XF86DRI */
 
 static void
-R600CopyPlanar(ScrnInfoPtr pScrn,
-	       unsigned char *y_src, unsigned char *u_src, unsigned char *v_src,
-	       uint32_t dst_mc_addr,
-	       int srcPitch, int srcPitch2, int dstPitch,
-	       int w, int h)
+R600CopyPlanarHW(ScrnInfoPtr pScrn,
+		 unsigned char *y_src, unsigned char *u_src, unsigned char *v_src,
+		 uint32_t dst_mc_addr,
+		 int srcPitch, int srcPitch2, int dstPitch,
+		 int w, int h)
 {
     int dstPitch2 = dstPitch >> 1;
     int h2 = h >> 1;
@@ -195,10 +195,10 @@ R600CopyPlanar(ScrnInfoPtr pScrn,
 }
 
 static void
-R600CopyPacked(ScrnInfoPtr pScrn,
-	       unsigned char *src, uint32_t dst_mc_addr,
-	       int srcPitch, int dstPitch,
-	       int w, int h)
+R600CopyPackedHW(ScrnInfoPtr pScrn,
+		 unsigned char *src, uint32_t dst_mc_addr,
+		 int srcPitch, int dstPitch,
+		 int w, int h)
 {
 
     /* YUV */
@@ -209,6 +209,82 @@ R600CopyPacked(ScrnInfoPtr pScrn,
 
 }
 
+static void
+R600CopyPlanarSW(ScrnInfoPtr pScrn,
+		 unsigned char *y_src, unsigned char *u_src, unsigned char *v_src,
+		 unsigned char *dst,
+		 int srcPitch, int srcPitch2, int dstPitch,
+		 int w, int h)
+{
+    int i;
+    int dstPitch2 = dstPitch >> 1;
+    int h2 = h >> 1;
+
+    /* Y */
+    if (srcPitch == dstPitch) {
+        memcpy(dst, y_src, srcPitch * h);
+	dst += (dstPitch * h);
+    } else {
+	for (i = 0; i < h; i++) {
+            memcpy(dst, y_src, srcPitch);
+            y_src += srcPitch;
+            dst += dstPitch;
+        }
+    }
+
+    /* tex base need 256B alignment */
+    if (h & 1)
+	dst += dstPitch;
+
+    /* V */
+    if (srcPitch2 == dstPitch2) {
+        memcpy(dst, v_src, srcPitch2 * h2);
+	dst += (dstPitch2 * h2);
+    } else {
+	for (i = 0; i < h2; i++) {
+            memcpy(dst, v_src, srcPitch2);
+            v_src += srcPitch2;
+            dst += dstPitch2;
+        }
+    }
+
+    /* tex base need 256B alignment */
+    if (h2 & 1)
+	dst += dstPitch2;
+
+    /* U */
+    if (srcPitch2 == dstPitch2) {
+        memcpy(dst, u_src, srcPitch2 * h2);
+	dst += (dstPitch2 * h2);
+    } else {
+	for (i = 0; i < h2; i++) {
+            memcpy(dst, u_src, srcPitch2);
+            u_src += srcPitch2;
+            dst += dstPitch2;
+        }
+    }
+}
+
+static void
+R600CopyPackedSW(ScrnInfoPtr pScrn,
+		 unsigned char *src, unsigned char *dst,
+		 int srcPitch, int dstPitch,
+		 int w, int h)
+{
+    int i;
+
+    if (srcPitch == dstPitch) {
+        memcpy(dst, src, srcPitch * h);
+	dst += (dstPitch * h);
+    } else {
+	for (i = 0; i < h; i++) {
+            memcpy(dst, src, srcPitch);
+            src += srcPitch;
+            dst += dstPitch;
+        }
+    }
+}
+
 static int
 RADEONPutImageTextured(ScrnInfoPtr pScrn,
 		       short src_x, short src_y,
@@ -371,17 +447,29 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
 	if (info->ChipFamily >= CHIP_FAMILY_R600) {
 	    s2offset = srcPitch * height;
 	    s3offset = (srcPitch2 * (height >> 1)) + s2offset;
-	    if (id == FOURCC_YV12)
-		R600CopyPlanar(pScrn, buf, buf + s3offset, buf + s2offset,
-			       pPriv->src_offset,
-			       srcPitch, srcPitch2, pPriv->src_pitch,
-			       width, height);
-	    else
-		R600CopyPlanar(pScrn, buf, buf + s2offset, buf + s3offset,
-			       pPriv->src_offset,
-			       srcPitch, srcPitch2, pPriv->src_pitch,
-			       width, height);
-
+	    if (info->DMAForXv) {
+		if (id == FOURCC_YV12)
+		    R600CopyPlanarHW(pScrn, buf, buf + s3offset, buf + s2offset,
+				     pPriv->src_offset,
+				     srcPitch, srcPitch2, pPriv->src_pitch,
+				     width, height);
+		else
+		    R600CopyPlanarHW(pScrn, buf, buf + s2offset, buf + s3offset,
+				     pPriv->src_offset,
+				     srcPitch, srcPitch2, pPriv->src_pitch,
+				     width, height);
+	    } else {
+		if (id == FOURCC_YV12)
+		    R600CopyPlanarSW(pScrn, buf, buf + s3offset, buf + s2offset,
+				     pPriv->src_addr,
+				     srcPitch, srcPitch2, pPriv->src_pitch,
+				     width, height);
+		else
+		    R600CopyPlanarSW(pScrn, buf, buf + s2offset, buf + s3offset,
+				     pPriv->src_addr,
+				     srcPitch, srcPitch2, pPriv->src_pitch,
+				     width, height);
+	    }
 	} else {
 	    top &= ~1;
 	    nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
@@ -406,9 +494,14 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
     case FOURCC_YUY2:
     default:
 	if (info->ChipFamily >= CHIP_FAMILY_R600) {
-	    R600CopyPacked(pScrn, buf, pPriv->src_offset,
-			   2 * width, pPriv->src_pitch,
-			   width, height);
+	    if (info->DMAForXv)
+		R600CopyPackedHW(pScrn, buf, pPriv->src_offset,
+				 2 * width, pPriv->src_pitch,
+				 width, height);
+	    else
+		R600CopyPackedSW(pScrn, buf, pPriv->src_addr,
+				 2 * width, pPriv->src_pitch,
+				 width, height);
 	} else {
 	    nlines = ((y2 + 0xffff) >> 16) - top;
 	    RADEONCopyData(pScrn, buf, pPriv->src_addr, srcPitch, dstPitch, nlines, npixels, 2);
diff --git a/src/radeon_video.c b/src/radeon_video.c
index 2fb5fcc..92d1a71 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -310,7 +310,7 @@ void RADEONInitVideo(ScreenPtr pScreen)
 	    } else
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set up textured video\n");
 	} else
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textured video requires CP on R5xx/IGP\n");
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textured video requires CP on R5xx/R6xx/R7xx/IGP\n");
     } else
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textured video disabled on RV250 due to HW bug\n");
 
commit 52f06ace04ad8141effc45fb6a0107a05bb46a73
Author: Alex Deucher <alexdeucher at gmail.com>
Date:   Wed Mar 4 18:51:44 2009 -0500

    R6xx/R7xx: disable XV_BICUBIC attribute
    
    It's not implemented yet.

diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index cbedb7e..dad7795 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -417,8 +417,11 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
     }
 
     /* Upload bicubic filter tex */
-    if (pPriv->bicubic_enabled)
-	RADEONCopyData(pScrn, (uint8_t *)bicubic_tex_512, (uint8_t *)(info->FB + pPriv->bicubic_offset), 1024, 1024, 1, 512, 2);
+    if (pPriv->bicubic_enabled) {
+	if (info->ChipFamily < CHIP_FAMILY_R600)
+	    RADEONCopyData(pScrn, (uint8_t *)bicubic_tex_512,
+			   (uint8_t *)(info->FB + pPriv->bicubic_offset), 1024, 1024, 1, 512, 2);
+    }
 
     /* update cliplist */
     if (!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) {
@@ -593,7 +596,7 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
     pPortPriv =
 	(RADEONPortPrivPtr)(&adapt->pPortPrivates[num_texture_ports]);
 
-    if (IS_R300_3D || IS_R500_3D || IS_R600_3D) {
+    if (IS_R300_3D || IS_R500_3D) {
 	adapt->pAttributes = Attributes_r300;
 	adapt->nAttributes = NUM_ATTRIBUTES_R300;
     } else {


More information about the xorg-commit mailing list