[PATCH 1/6] DownloadFromScreenCS: download via a scratch BO if pixmap domain is unknown

Karl Tomlinson karlt+ at karlt.net
Sat Aug 21 02:44:39 PDT 2010


radeon_bo_is_busy() may return without setting the domain out-parameter.
If this happens, then download via a scratch GTT BO to avoid CPU VRAM read.
---
 src/r600_exa.c         |    2 +-
 src/radeon_exa_funcs.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/r600_exa.c b/src/r600_exa.c
index d6e98ff..9b7a0c9 100644
--- a/src/r600_exa.c
+++ b/src/r600_exa.c
@@ -1885,7 +1885,7 @@ R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
     if (!src_domain)
 	radeon_bo_is_busy(driver_priv->bo, &src_domain);
 
-    if (src_domain != RADEON_GEM_DOMAIN_VRAM)
+    if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM)
 	return FALSE;
 
     size = scratch_pitch * h;
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 2df6ccb..a82e416 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -598,7 +598,7 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
     if (!src_domain)
 	radeon_bo_is_busy(driver_priv->bo, &src_domain);
 
-    if (src_domain != RADEON_GEM_DOMAIN_VRAM) {
+    if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM) {
 #if X_BYTE_ORDER == X_BIG_ENDIAN
 	/* Can't return FALSE here if we need to swap bytes */
 	if (swap != RADEON_HOST_DATA_SWAP_NONE) {
-- 
1.7.1



More information about the xorg-driver-ati mailing list