summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2011-02-01 19:20:00 -0500
committerAlex Deucher <alexdeucher@gmail.com>2011-02-01 19:20:00 -0500
commitbb16dd77321e5a64a3cb2d2ca9982117799ac1a8 (patch)
tree742f2abd972ecd85221af142317a9ea245f425b5
parent9c124f781049ef11a8b19894a29b7f62975b3011 (diff)
kms/r6xx+: fix tiling and pageflipping harder
Thanks for Michel for final fix. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=33738 for r6xx+ asics. A similar approach for pre-r6xx asics is pending. Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
-rw-r--r--src/evergreen_exa.c30
-rw-r--r--src/r600_exa.c29
2 files changed, 41 insertions, 18 deletions
diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
index 93fa267..2eb698d 100644
--- a/src/evergreen_exa.c
+++ b/src/evergreen_exa.c
@@ -1534,19 +1534,28 @@ EVERGREENUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
Bool r;
int i;
struct r600_accel_object src_obj, dst_obj;
+ uint32_t tiling_flags = 0, pitch = 0;
if (bpp < 8)
return FALSE;
driver_priv = exaGetPixmapDriverPrivate(pDst);
+ if (!driver_priv || !driver_priv->bo)
+ return FALSE;
+
+ ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch);
+ if (ret)
+ ErrorF("radeon_bo_get_tiling failed\n");
/* If we know the BO won't be busy, don't bother with a scratch */
copy_dst = driver_priv->bo;
copy_pitch = pDst->devKind;
- if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) {
- flush = FALSE;
- if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain))
- goto copy;
+ if (!(tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO))) {
+ if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) {
+ flush = FALSE;
+ if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain))
+ goto copy;
+ }
}
size = scratch_pitch * h;
@@ -1646,6 +1655,8 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w,
return FALSE;
driver_priv = exaGetPixmapDriverPrivate(pSrc);
+ if (!driver_priv || !driver_priv->bo)
+ return FALSE;
ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch);
if (ret)
@@ -1663,13 +1674,14 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w,
else /* A write may be scheduled */
flush = TRUE;
}
- }
- if (!src_domain)
- radeon_bo_is_busy(driver_priv->bo, &src_domain);
+ if (!src_domain)
+ radeon_bo_is_busy(driver_priv->bo, &src_domain);
- if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM)
- goto copy;
+ if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM)
+ goto copy;
+
+ }
if (info->ChipFamily == CHIP_FAMILY_PALM)
goto copy;
diff --git a/src/r600_exa.c b/src/r600_exa.c
index f652ab6..5fc41ad 100644
--- a/src/r600_exa.c
+++ b/src/r600_exa.c
@@ -1785,19 +1785,28 @@ R600UploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
Bool r;
int i;
struct r600_accel_object src_obj, dst_obj;
+ uint32_t tiling_flags = 0, pitch = 0;
if (bpp < 8)
return FALSE;
driver_priv = exaGetPixmapDriverPrivate(pDst);
+ if (!driver_priv || !driver_priv->bo)
+ return FALSE;
+
+ ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch);
+ if (ret)
+ ErrorF("radeon_bo_get_tiling failed\n");
/* If we know the BO won't be busy, don't bother with a scratch */
copy_dst = driver_priv->bo;
copy_pitch = pDst->devKind;
- if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) {
- flush = FALSE;
- if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain))
- goto copy;
+ if (!(tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO))) {
+ if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) {
+ flush = FALSE;
+ if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain))
+ goto copy;
+ }
}
size = scratch_pitch * h;
@@ -1897,6 +1906,8 @@ R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
return FALSE;
driver_priv = exaGetPixmapDriverPrivate(pSrc);
+ if (!driver_priv || !driver_priv->bo)
+ return FALSE;
ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch);
if (ret)
@@ -1914,13 +1925,13 @@ R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
else /* A write may be scheduled */
flush = TRUE;
}
- }
- if (!src_domain)
- radeon_bo_is_busy(driver_priv->bo, &src_domain);
+ if (!src_domain)
+ radeon_bo_is_busy(driver_priv->bo, &src_domain);
- if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM)
- goto copy;
+ if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM)
+ goto copy;
+ }
size = scratch_pitch * h;
scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);