summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2006-06-24 16:01:19 +0200
committerMichel Dänzer <michel@tungstengraphics.com>2006-06-24 16:01:19 +0200
commitc5d8c8db3e75976687bfb364f0a7b235c7ae8793 (patch)
tree7bec26a4e3bac8c0f2d382fdce2b6fd748edb2a6
parentf25ba3dc0e7850f0b1b78f54c0e7211bf2e81b3a (diff)
Bug #7274: Fix corruption with 'small' accelerated DownloadFromScreen transfers.
-rw-r--r--src/radeon_exa_funcs.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index bc221478..a86e148c 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -51,6 +51,7 @@
#endif
#endif
+#include <errno.h>
#include <string.h>
#include "radeon.h"
@@ -379,7 +380,7 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h,
#endif
while (h) {
- int oldhpass = hpass;
+ int oldhpass = hpass, i = 0;
src = (CARD8*)scratch->address + scratch_off;
@@ -394,8 +395,19 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h,
x, y, 0, 0, w, hpass);
}
- /* Wait for previous blit to complete */
- RADEONWaitForIdleMMIO(pScrn);
+ /*
+ * Wait for previous blit to complete.
+ *
+ * XXX: Doing here essentially the same things this ioctl does in
+ * the DRM results in corruption with 'small' transfers, apparently
+ * because the data doesn't actually land in system RAM before the
+ * memcpy. I suspect the ioctl helps mostly due to its latency; what
+ * we'd really need is a way to reliably wait for the host interface
+ * to be done with pushing the data to the host.
+ */
+ while ((drmCommandNone(info->drmFD, DRM_RADEON_CP_IDLE) == -EBUSY)
+ && (i++ < RADEON_TIMEOUT))
+ ;
/* Kick next blit */
if (hpass)