summaryrefslogtreecommitdiff
path: root/src/radeon_exa_funcs.c
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-08-27 09:52:11 +0200
committerMichel Dänzer <daenzer@vmware.com>2009-08-27 09:52:11 +0200
commit174b61bb786a841cebd354e23b4b0caa85b541aa (patch)
treedcac4122752bdb7302b036ac710a1446961a8a84 /src/radeon_exa_funcs.c
parent7623e169e1f7d5afbd4108de03f28098bca519db (diff)
KMS: DownloadFromScreen improvements.
* Drop superfluous RADEONDownloadFromScreenGTT function, EXA does the same thing when we return FALSE. * Take unflushed operations into account for determining which GEM domain the pixmap BO will end up in. * Only use a blit if it ends up in VRAM.
Diffstat (limited to 'src/radeon_exa_funcs.c')
-rw-r--r--src/radeon_exa_funcs.c51
1 files changed, 17 insertions, 34 deletions
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index f937c4e3..d95adb51 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -507,33 +507,6 @@ out:
}
static Bool
-RADEONDownloadFromScreenGTT(PixmapPtr pSrc, int x, int y, int w,
- int h, char *dst, int dst_pitch)
-{
- struct radeon_exa_pixmap_priv *driver_priv;
- int src_pitch = exaGetPixmapPitch(pSrc);
- int bpp = pSrc->drawable.bitsPerPixel;
- int src_offset;
- int r;
-
- driver_priv = exaGetPixmapDriverPrivate(pSrc);
- r = radeon_bo_map(driver_priv->bo, 0);
- if (r)
- return FALSE;
-
- src_offset = (x * bpp / 8) + (y * src_pitch);
- w *= bpp / 8;
-
- while (h--) {
- memcpy(dst, driver_priv->bo->ptr + src_offset, w);
- src_offset += src_pitch;
- dst += dst_pitch;
- }
- radeon_bo_unmap(driver_priv->bo);
- return TRUE;
-}
-
-static Bool
RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
int h, char *dst, int dst_pitch)
{
@@ -542,23 +515,33 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
struct radeon_bo *scratch;
unsigned size;
uint32_t datatype = 0;
+ uint32_t src_domain = 0;
uint32_t src_pitch_offset;
unsigned bpp = pSrc->drawable.bitsPerPixel;
uint32_t scratch_pitch = (w * bpp / 8 + 63) & ~63;
Bool r;
- uint32_t src_domain;
- int busy;
if (bpp < 8)
return FALSE;
driver_priv = exaGetPixmapDriverPrivate(pSrc);
-
- busy = radeon_bo_is_busy(driver_priv->bo, &src_domain);
- if (src_domain == RADEON_GEM_DOMAIN_GTT)
- return RADEONDownloadFromScreenGTT(pSrc, x, y, w, h,
- dst, dst_pitch);
+ /* If we know the BO won't end up in VRAM anyway, don't bother */
+ 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;
+ }
+
+ if (!src_domain)
+ radeon_bo_is_busy(driver_priv->bo, &src_domain);
+
+ if (src_domain != RADEON_GEM_DOMAIN_VRAM)
+ return FALSE;
size = scratch_pitch * h;
scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);