Blob Blame History Raw
From a4a72f0b8b18ee70c9103088c646ead7b61f745d Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Mon, 21 Dec 2009 16:00:48 +1000
Subject: [PATCH] revert api

---
 src/r600_exa.c         |    9 ++++++---
 src/radeon_exa.c       |    3 +--
 src/radeon_exa_funcs.c |    9 ++++++---
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/r600_exa.c b/src/r600_exa.c
index 6a132bb..634e6ca 100644
--- a/src/r600_exa.c
+++ b/src/r600_exa.c
@@ -2027,7 +2027,7 @@ R600UploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
     driver_priv = exaGetPixmapDriverPrivate(pDst);
 
     /* If we know the BO won't be busy, don't bother */
-    if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs) &&
+    if (driver_priv->bo->cref == 1 &&
 	!radeon_bo_is_busy(driver_priv->bo, &dst_domain))
 	return FALSE;
 
@@ -2097,8 +2097,11 @@ R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
     driver_priv = exaGetPixmapDriverPrivate(pSrc);
 
     /* If we know the BO won't end up in VRAM anyway, don't bother */
-    if (radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) {
-	src_domain = radeon_bo_get_src_domain(driver_priv->bo);
+    if (driver_priv->bo->cref > 1) {
+	src_domain = driver_priv->bo->space_accounted & 0xffff;
+	if (!src_domain)
+	    src_domain = driver_priv->bo->space_accounted >> 16;
+
 	if ((src_domain & (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM)) ==
 	    (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM))
 	    src_domain = 0;
diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 97733c3..bff6ec0 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -341,7 +341,6 @@ Bool RADEONPrepareAccess_CS(PixmapPtr pPix, int index)
 {
     ScreenPtr pScreen = pPix->drawable.pScreen;
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_exa_pixmap_priv *driver_priv;
     int ret;
 
@@ -357,7 +356,7 @@ Bool RADEONPrepareAccess_CS(PixmapPtr pPix, int index)
       return FALSE;
 
     /* if we have more refs than just the BO then flush */
-    if (radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs))
+    if (driver_priv->bo->cref > 1)
         radeon_cs_flush_indirect(pScrn);
     
     /* flush IB */
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 6d2522a..61c7427 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -484,7 +484,7 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
 #endif
 
     /* If we know the BO won't be busy, don't bother */
-    if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs) &&
+    if (driver_priv->bo->cref == 1 &&
 	!radeon_bo_is_busy(driver_priv->bo, &dst_domain)) {
 #if X_BYTE_ORDER == X_BIG_ENDIAN
 	/* Can't return FALSE here if we need to swap bytes */
@@ -582,8 +582,11 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
 #endif
 
     /* If we know the BO won't end up in VRAM anyway, don't bother */
-    if (radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) {
-	src_domain = radeon_bo_get_src_domain(driver_priv->bo);
+    if (driver_priv->bo->cref > 1) {
+	src_domain = driver_priv->bo->space_accounted & 0xffff;
+	if (!src_domain)
+	    src_domain = driver_priv->bo->space_accounted >> 16;
+
 	if ((src_domain & (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM)) ==
 	    (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM))
 	    src_domain = 0;
-- 
1.6.5.2