On Sat, Nov 15, 2008 at 10:09 PM, Michel Dänzer
<[EMAIL PROTECTED]> wrote:
> On Sat, 2008-11-15 at 12:22 +1000, Dave Airlie wrote:
>> I'm not quite sure what causes it,
>>
>> TRACE: RADEONPrepareCopyCP
>> TRACE: RADEONDoneCopyCP
>> copy without emission
>>
>> Backtrace:
>> 0: /usr/bin/Xorg(xorg_backtrace+0x3b) [0x812b9ab]
>> 1: /usr/lib/xorg/modules/drivers//radeon_drv.so [0xb7c45353]
>> 2: /usr/lib/xorg/modules//libexa.so(exaCopyNtoN+0x835) [0xb7ba03c5]
>> 3: /usr/lib/xorg/modules//libfb.so(fbCopyRegion+0x161) [0xb7bbb6c1]
>> 4: /usr/lib/xorg/modules//libexa.so(exaCopyWindow+0xe0) [0xb7b9fa60]
>> 5: /usr/bin/Xorg [0x816f680]
>> 6: /usr/bin/Xorg [0x811b244]
>> 7: /usr/bin/Xorg(compCopyWindow+0xb4) [0x813ccd4]
>> 8: /usr/bin/Xorg(miSlideAndSizeWindow+0x743) [0x8123043]
>> 9: /usr/bin/Xorg(compResizeWindow+0xb8) [0x813d1d8]
>> 10: /usr/bin/Xorg(ConfigureWindow+0xa91) [0x8072251]
>> 11: /usr/bin/Xorg(ProcConfigureWindow+0x92) [0x8085412]
>> 12: /usr/bin/Xorg(Dispatch+0x34f) [0x8085e6f]
>> 13: /usr/bin/Xorg(main+0x47d) [0x806b6ed]
>> 14: /lib/libc.so.6(__libc_start_main+0xe5) [0xb7d286d5]
>> 15: /usr/bin/Xorg [0x806aad1]
>> TRACE: RADEONMarkSyncCP
>>
>>
>> I hacked up my exa driver to report these and I get a fair few of them
>> at startup
>>
>> miClearToBackground and miSlideAndSizeWindow seems to be main entry
>> points into the issue
>>
>> I also see some from exaFillRegionTiled
>
> Sounds like maybe exaCopyNtoN and exaFillRegionTiled should bail early
> if nbox == 0. Or maybe that should really be done higher up, e.g. the
> damage layer could not call down unless really necessary.

Okay one of them was from CopyNtoN getting nbox == 0, so I just made
it bail, simple patch so I checked it in.

The other is from the tiled code doing the second pass for leftover areas.

Initial patch is attached it just prechecks if the copies will be
needed and avoids them if they aren't, this one I thought
might need some review.

Dave.

>
>
> --
> Earthling Michel Dänzer           |          http://tungstengraphics.com
> Libre software enthusiast         |          Debian, X and DRI developer
>
>
From 7ba8cf885f7df9e13e7367bf60ec8d206a53a98f Mon Sep 17 00:00:00 2001
From: Dave Airlie <[EMAIL PROTECTED]>
Date: Mon, 17 Nov 2008 10:28:48 +1000
Subject: [PATCH] exa: avoid doing prepare/done without intervening copies in exaFillRegionTiled

This does a precursor check to make sure the copies are required before
entering the prepare/done code.
---
 exa/exa_accel.c |   61 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index ccef744..6e754b2 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -1233,36 +1233,51 @@ exaFillRegionTiled (DrawablePtr	pDrawable,
 	 */
 	if (alu != GXcopy)
 	    ret = TRUE;
-	else if ((*pExaScr->info->PrepareCopy) (pPixmap, pPixmap, 1, 1, alu,
-						planemask)) {
-	    for (i = 0; i < nbox; i++)
-	    {
+	else {
+	    Bool more_copy = FALSE;
+
+	    for (i = 0; i < nbox; i++) {
 		int dstX = pBox[i].x1 + tileWidth;
 		int dstY = pBox[i].y1 + tileHeight;
-		int width = min(pBox[i].x2 - dstX, tileWidth);
-		int height = min(pBox[i].y2 - pBox[i].y1, tileHeight);
-
-		while (dstX < pBox[i].x2) {
-		    (*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
-					    dstX, pBox[i].y1, width, height);
-		    dstX += width;
-		    width = min(pBox[i].x2 - dstX, width * 2);
-		}
 
-		width = pBox[i].x2 - pBox[i].x1;
-		height = min(pBox[i].y2 - dstY, tileHeight);
+		if ((dstX < pBox[i].x2) && (dstY < pBox[i].y2))
+		    more_copy = TRUE;
+	    }
 
-		while (dstY < pBox[i].y2) {
-		    (*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
-					    pBox[i].x1, dstY, width, height);
-		    dstY += height;
-		    height = min(pBox[i].y2 - dstY, height * 2);
+	    if (more_copy == FALSE)
+		ret = TRUE;
+
+	    if (more_copy && (*pExaScr->info->PrepareCopy) (pPixmap, pPixmap,
+							    1, 1, alu, planemask)) {
+		for (i = 0; i < nbox; i++)
+		{
+		    int dstX = pBox[i].x1 + tileWidth;
+		    int dstY = pBox[i].y1 + tileHeight;
+		    int width = min(pBox[i].x2 - dstX, tileWidth);
+		    int height = min(pBox[i].y2 - pBox[i].y1, tileHeight);
+
+		    while (dstX < pBox[i].x2) {
+			(*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
+						dstX, pBox[i].y1, width, height);
+			dstX += width;
+			width = min(pBox[i].x2 - dstX, width * 2);
+		    }
+
+		    width = pBox[i].x2 - pBox[i].x1;
+		    height = min(pBox[i].y2 - dstY, tileHeight);
+
+		    while (dstY < pBox[i].y2) {
+			(*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
+						pBox[i].x1, dstY, width, height);
+			dstY += height;
+			height = min(pBox[i].y2 - dstY, height * 2);
+		    }
 		}
-	    }
 
-	    (*pExaScr->info->DoneCopy) (pPixmap);
+		(*pExaScr->info->DoneCopy) (pPixmap);
 
-	    ret = TRUE;
+		ret = TRUE;
+	    }
 	}
 
 	exaMarkSync(pDrawable->pScreen);
-- 
1.6.0.3

_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to