summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2011-02-11 13:51:11 -0500
committerAlex Deucher <alexdeucher@gmail.com>2011-02-11 13:51:11 -0500
commit3d10278ce511f5dabb68ed86ee43eaaf43585983 (patch)
treeb58f53f0e12dc4fa4c7871f5fabdd741d03c8420
parenta9c135809945fb372ce390f06918b9fd8e455b3f (diff)
Xv: fix textured video alignment harder
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
-rw-r--r--src/evergreen_textured_videofuncs.c4
-rw-r--r--src/r600_textured_videofuncs.c4
-rw-r--r--src/radeon_textured_video.c25
-rw-r--r--src/radeon_video.h1
4 files changed, 17 insertions, 17 deletions
diff --git a/src/evergreen_textured_videofuncs.c b/src/evergreen_textured_videofuncs.c
index 28b5c58f..b1849560 100644
--- a/src/evergreen_textured_videofuncs.c
+++ b/src/evergreen_textured_videofuncs.c
@@ -288,7 +288,7 @@ EVERGREENDisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
tex_res.format = FMT_8;
tex_res.w = accel_state->src_obj[0].width >> 1;
tex_res.h = accel_state->src_obj[0].height >> 1;
- tex_res.pitch = RADEON_ALIGN(accel_state->src_obj[0].pitch >> 1, 256);
+ tex_res.pitch = RADEON_ALIGN(accel_state->src_obj[0].pitch >> 1, pPriv->hw_align);
tex_res.dst_sel_x = SQ_SEL_X; /* V or U */
tex_res.dst_sel_y = SQ_SEL_1;
tex_res.dst_sel_z = SQ_SEL_1;
@@ -311,7 +311,7 @@ EVERGREENDisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
tex_res.format = FMT_8;
tex_res.w = accel_state->src_obj[0].width >> 1;
tex_res.h = accel_state->src_obj[0].height >> 1;
- tex_res.pitch = RADEON_ALIGN(accel_state->src_obj[0].pitch >> 1, 256);
+ tex_res.pitch = RADEON_ALIGN(accel_state->src_obj[0].pitch >> 1, pPriv->hw_align);
tex_res.dst_sel_x = SQ_SEL_X; /* V or U */
tex_res.dst_sel_y = SQ_SEL_1;
tex_res.dst_sel_z = SQ_SEL_1;
diff --git a/src/r600_textured_videofuncs.c b/src/r600_textured_videofuncs.c
index 0fb919b7..fdf76b2a 100644
--- a/src/r600_textured_videofuncs.c
+++ b/src/r600_textured_videofuncs.c
@@ -303,7 +303,7 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
tex_res.format = FMT_8;
tex_res.w = accel_state->src_obj[0].width >> 1;
tex_res.h = accel_state->src_obj[0].height >> 1;
- tex_res.pitch = RADEON_ALIGN(accel_state->src_obj[0].pitch >> 1, 256);
+ tex_res.pitch = RADEON_ALIGN(accel_state->src_obj[0].pitch >> 1, pPriv->hw_align);
tex_res.dst_sel_x = SQ_SEL_X; /* V or U */
tex_res.dst_sel_y = SQ_SEL_1;
tex_res.dst_sel_z = SQ_SEL_1;
@@ -326,7 +326,7 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
tex_res.format = FMT_8;
tex_res.w = accel_state->src_obj[0].width >> 1;
tex_res.h = accel_state->src_obj[0].height >> 1;
- tex_res.pitch = RADEON_ALIGN(accel_state->src_obj[0].pitch >> 1, 256);
+ tex_res.pitch = RADEON_ALIGN(accel_state->src_obj[0].pitch >> 1, pPriv->hw_align);
tex_res.dst_sel_x = SQ_SEL_X; /* V or U */
tex_res.dst_sel_y = SQ_SEL_1;
tex_res.dst_sel_z = SQ_SEL_1;
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index 301e47a1..33405df5 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -247,7 +247,6 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
int top, nlines, size;
BoxRec dstBox;
int dst_width = width, dst_height = height;
- int hw_align;
/* make the compiler happy */
s2offset = s3offset = srcPitch2 = 0;
@@ -286,14 +285,14 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
#ifdef XF86DRM_MODE
if (info->cs)
- hw_align = drmmode_get_base_align(pScrn, 2, 0);
+ pPriv->hw_align = drmmode_get_base_align(pScrn, 2, 0);
else
#endif
{
if (info->ChipFamily >= CHIP_FAMILY_R600)
- hw_align = 256;
+ pPriv->hw_align = 256;
else
- hw_align = 64;
+ pPriv->hw_align = 64;
}
switch(id) {
@@ -302,24 +301,24 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
srcPitch = RADEON_ALIGN(width, 4);
srcPitch2 = RADEON_ALIGN(width >> 1, 4);
if (pPriv->bicubic_state != BICUBIC_OFF) {
- dstPitch = RADEON_ALIGN(dst_width << 1, hw_align);
+ dstPitch = RADEON_ALIGN(dst_width << 1, pPriv->hw_align);
dstPitch2 = 0;
} else {
- dstPitch = RADEON_ALIGN(dst_width, hw_align);
- dstPitch2 = RADEON_ALIGN(dstPitch >> 1, hw_align);
+ dstPitch = RADEON_ALIGN(dst_width, pPriv->hw_align);
+ dstPitch2 = RADEON_ALIGN(dstPitch >> 1, pPriv->hw_align);
}
break;
case FOURCC_UYVY:
case FOURCC_YUY2:
default:
- dstPitch = RADEON_ALIGN(dst_width << 1, hw_align);
+ dstPitch = RADEON_ALIGN(dst_width << 1, pPriv->hw_align);
srcPitch = (width << 1);
srcPitch2 = 0;
break;
}
size = dstPitch * dst_height + 2 * dstPitch2 * ((dst_height + 1) >> 1);
- size = RADEON_ALIGN(size, hw_align);
+ size = RADEON_ALIGN(size, pPriv->hw_align);
if (size != pPriv->size) {
RADEONFreeVideoMemory(pScrn, pPriv);
@@ -328,7 +327,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
if (pPriv->video_memory == NULL) {
pPriv->video_offset = radeon_legacy_allocate_memory(pScrn,
&pPriv->video_memory,
- size, hw_align,
+ size, pPriv->hw_align,
RADEON_GEM_DOMAIN_GTT);
if (pPriv->video_offset == 0)
return BadAlloc;
@@ -336,7 +335,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,
+ pPriv->hw_align,
RADEON_GEM_DOMAIN_GTT);
}
}
@@ -397,9 +396,9 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
pPriv->src_pitch = dstPitch;
pPriv->planeu_offset = dstPitch * dst_height;
- pPriv->planeu_offset = RADEON_ALIGN(pPriv->planeu_offset, hw_align);
+ pPriv->planeu_offset = RADEON_ALIGN(pPriv->planeu_offset, pPriv->hw_align);
pPriv->planev_offset = pPriv->planeu_offset + dstPitch2 * ((dst_height + 1) >> 1);
- pPriv->planev_offset = RADEON_ALIGN(pPriv->planev_offset, hw_align);
+ pPriv->planev_offset = RADEON_ALIGN(pPriv->planev_offset, pPriv->hw_align);
pPriv->size = size;
pPriv->pDraw = pDraw;
diff --git a/src/radeon_video.h b/src/radeon_video.h
index c315bbb5..3a4a709c 100644
--- a/src/radeon_video.h
+++ b/src/radeon_video.h
@@ -120,6 +120,7 @@ typedef struct {
int vsync;
Bool is_planar;
int vtx_count;
+ int hw_align;
struct radeon_bo *src_bo[2];
} RADEONPortPrivRec, *RADEONPortPrivPtr;