summaryrefslogtreecommitdiff
path: root/src/radeon_textured_video.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/radeon_textured_video.c')
-rw-r--r--src/radeon_textured_video.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index 29910d0f..1490ccb7 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -281,34 +281,34 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
}
if (info->ChipFamily >= CHIP_FAMILY_R600)
- hw_align = 255;
+ hw_align = 256;
else
- hw_align = 63;
+ hw_align = 64;
switch(id) {
case FOURCC_YV12:
case FOURCC_I420:
- srcPitch = (width + 3) & ~3;
- srcPitch2 = ((width >> 1) + 3) & ~3;
+ srcPitch = RADEON_ALIGN(width, 4);
+ srcPitch2 = RADEON_ALIGN(width >> 1, 4);
if (pPriv->bicubic_state != BICUBIC_OFF) {
- dstPitch = ((dst_width << 1) + hw_align) & ~hw_align;
+ dstPitch = RADEON_ALIGN(dst_width << 1, hw_align);
dstPitch2 = 0;
} else {
- dstPitch = (dst_width + hw_align) & ~hw_align;
- dstPitch2 = ((dstPitch >> 1) + hw_align) & ~hw_align;
+ dstPitch = RADEON_ALIGN(dst_width, hw_align);
+ dstPitch2 = RADEON_ALIGN(dstPitch >> 1, hw_align);
}
break;
case FOURCC_UYVY:
case FOURCC_YUY2:
default:
- dstPitch = ((dst_width << 1) + hw_align) & ~hw_align;
+ dstPitch = RADEON_ALIGN(dst_width << 1, hw_align);
srcPitch = (width << 1);
srcPitch2 = 0;
break;
}
size = dstPitch * dst_height + 2 * dstPitch2 * ((dst_height + 1) >> 1);
- size = (size + hw_align) & ~hw_align;
+ size = RADEON_ALIGN(size, hw_align);
if (pPriv->video_memory != NULL && size != pPriv->size) {
radeon_legacy_free_memory(pScrn, pPriv->video_memory);
@@ -318,7 +318,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
if (pPriv->video_memory == NULL) {
pPriv->video_offset = radeon_legacy_allocate_memory(pScrn,
&pPriv->video_memory,
- size, hw_align + 1,
+ size, hw_align,
RADEON_GEM_DOMAIN_GTT);
if (pPriv->video_offset == 0)
return BadAlloc;
@@ -326,7 +326,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
if (info->cs) {
pPriv->src_bo[0] = pPriv->video_memory;
radeon_legacy_allocate_memory(pScrn, (void*)&pPriv->src_bo[1], size,
- hw_align + 1,
+ hw_align,
RADEON_GEM_DOMAIN_GTT);
}
}
@@ -364,7 +364,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
/* copy data */
top = (y1 >> 16) & ~1;
- nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
+ nlines = RADEON_ALIGN((y2 + 0xffff) >> 16, 2) - top;
pPriv->src_offset = pPriv->video_offset;
if (info->cs) {
@@ -387,9 +387,9 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
pPriv->src_pitch = dstPitch;
pPriv->planeu_offset = dstPitch * dst_height;
- pPriv->planeu_offset = (pPriv->planeu_offset + hw_align) & ~hw_align;
+ pPriv->planeu_offset = RADEON_ALIGN(pPriv->planeu_offset, hw_align);
pPriv->planev_offset = pPriv->planeu_offset + dstPitch2 * ((dst_height + 1) >> 1);
- pPriv->planev_offset = (pPriv->planev_offset + hw_align) & ~hw_align;
+ pPriv->planev_offset = RADEON_ALIGN(pPriv->planev_offset, hw_align);
pPriv->size = size;
pPriv->pDraw = pDraw;
@@ -397,7 +397,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
switch(id) {
case FOURCC_YV12:
case FOURCC_I420:
- s2offset = srcPitch * ((height + 1) & ~1);
+ s2offset = srcPitch * (RADEON_ALIGN(height, 2));
s3offset = s2offset + (srcPitch2 * ((height + 1) >> 1));
s2offset += ((top >> 1) * srcPitch2);
s3offset += ((top >> 1) * srcPitch2);