summaryrefslogtreecommitdiff
path: root/src/evergreen_exa.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2011-02-10 03:28:01 -0500
committerAlex Deucher <alexdeucher@gmail.com>2011-02-10 03:28:01 -0500
commit5f9bc127d302404432b631e3e774192950f57b42 (patch)
treee87c958906deb0d0cdee692cd315a37a174844c5 /src/evergreen_exa.c
parenta4899db96029acde6cd400fc0541693a487898e7 (diff)
kms/r6xx+: clean up pitch/height alignment in EXA UTS/DFS
Diffstat (limited to 'src/evergreen_exa.c')
-rw-r--r--src/evergreen_exa.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
index 2eb698da..52a5030a 100644
--- a/src/evergreen_exa.c
+++ b/src/evergreen_exa.c
@@ -1525,16 +1525,15 @@ EVERGREENUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
unsigned size;
uint32_t dst_domain;
int bpp = pDst->drawable.bitsPerPixel;
- uint32_t scratch_pitch = RADEON_ALIGN(w * bpp / 8, 256);
+ uint32_t scratch_pitch;
uint32_t copy_pitch;
- uint32_t src_pitch_hw = scratch_pitch / (bpp / 8);
uint32_t dst_pitch_hw = exaGetPixmapPitch(pDst) / (bpp / 8);
int ret;
Bool flush = TRUE;
Bool r;
int i;
struct r600_accel_object src_obj, dst_obj;
- uint32_t tiling_flags = 0, pitch = 0;
+ uint32_t tiling_flags = 0, pitch = 0, height;
if (bpp < 8)
return FALSE;
@@ -1558,13 +1557,16 @@ EVERGREENUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
}
}
- size = scratch_pitch * h;
+ scratch_pitch = RADEON_ALIGN(w, drmmode_get_pitch_align(pScrn, (bpp / 8), 0));
+ height = RADEON_ALIGN(h, drmmode_get_height_align(pScrn, 0));
+
+ size = scratch_pitch * height * (bpp / 8);
scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);
if (scratch == NULL) {
goto copy;
}
- src_obj.pitch = src_pitch_hw;
+ src_obj.pitch = scratch_pitch;
src_obj.width = w;
src_obj.height = h;
src_obj.offset = 0;
@@ -1589,7 +1591,7 @@ EVERGREENUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
goto copy;
}
copy_dst = scratch;
- copy_pitch = scratch_pitch;
+ copy_pitch = scratch_pitch * (bpp / 8);
flush = FALSE;
copy:
@@ -1641,15 +1643,14 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w,
unsigned size;
uint32_t src_domain = 0;
int bpp = pSrc->drawable.bitsPerPixel;
- uint32_t scratch_pitch = RADEON_ALIGN(w * bpp / 8, 256);
+ uint32_t scratch_pitch;
uint32_t copy_pitch;
- uint32_t dst_pitch_hw = scratch_pitch / (bpp / 8);
uint32_t src_pitch_hw = exaGetPixmapPitch(pSrc) / (bpp / 8);
int ret;
Bool flush = FALSE;
Bool r;
struct r600_accel_object src_obj, dst_obj;
- uint32_t tiling_flags = 0, pitch = 0;
+ uint32_t tiling_flags = 0, pitch = 0, height;
if (bpp < 8)
return FALSE;
@@ -1686,7 +1687,10 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w,
if (info->ChipFamily == CHIP_FAMILY_PALM)
goto copy;
- size = scratch_pitch * h;
+ scratch_pitch = RADEON_ALIGN(w, drmmode_get_pitch_align(pScrn, (bpp / 8), 0));
+ height = RADEON_ALIGN(h, drmmode_get_height_align(pScrn, 0));
+
+ size = scratch_pitch * height * (bpp / 8);
scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);
if (scratch == NULL) {
goto copy;
@@ -1711,7 +1715,7 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w,
src_obj.domain = RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT;
src_obj.bo = radeon_get_pixmap_bo(pSrc);
- dst_obj.pitch = dst_pitch_hw;
+ dst_obj.pitch = scratch_pitch;
dst_obj.width = w;
dst_obj.height = h;
dst_obj.offset = 0;
@@ -1733,7 +1737,7 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w,
EVERGREENAppendCopyVertex(pScrn, x, y, 0, 0, w, h);
EVERGREENDoCopy(pScrn);
copy_src = scratch;
- copy_pitch = scratch_pitch;
+ copy_pitch = scratch_pitch * (bpp / 8);
flush = TRUE;
copy: