summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-08-22 21:16:25 +1000
committerDave Airlie <airlied@redhat.com>2009-08-22 21:16:25 +1000
commit77f98717d825162da106c6898cdbcbdf5c984ae6 (patch)
tree70cef5f6a174075e0694f51d7ceb9877a5231d96
parentb1b77a4d6fb7404af9568644e1a8e050fdfa956e (diff)
exa/cs: add DFS from GTT optimisation
This uses the new libdrm busy interface, once I had this in place I added a error if this happened and it does on my desktop here, so may as well add the optimisation that used to be in my old KMS tree. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/radeon_exa_funcs.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index e48317f5..f937c4e3 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -507,6 +507,33 @@ 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)
{
@@ -519,11 +546,19 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
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);
size = scratch_pitch * h;
scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);