summaryrefslogtreecommitdiff
path: root/src/radeon_textured_videofuncs.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-04-16 15:38:49 -0400
committerAlex Deucher <alexdeucher@gmail.com>2010-04-16 19:36:03 -0400
commit10799b4ce0c18c5a7d92d688549e8e777344f111 (patch)
tree416972057e3b519c5f66f49dfa10bcfd3f26b91e /src/radeon_textured_videofuncs.c
parentbd1cf42201a1f918080bf34786a6de327cb31b5f (diff)
r2xx textured video: split into prepare and draw functions
Diffstat (limited to 'src/radeon_textured_videofuncs.c')
-rw-r--r--src/radeon_textured_videofuncs.c68
1 files changed, 39 insertions, 29 deletions
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index f5f91017..ff4c055f 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -475,16 +475,16 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
OUT_ACCEL_REG(RADEON_WAIT_UNTIL, RADEON_WAIT_3D_IDLECLEAN);
#ifdef ACCEL_CP
- ADVANCE_RING();
+ ADVANCE_RING();
#else
- FINISH_ACCEL();
+ FINISH_ACCEL();
#endif /* !ACCEL_CP */
DamageDamageRegion(pPriv->pDraw, &pPriv->clip);
}
-static void
-FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
+static Bool
+FUNC_NAME(R200PrepareTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
PixmapPtr pPixmap = pPriv->pPixmap;
@@ -494,10 +494,9 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
uint32_t txfilter, txsize, txpitch, txoffset;
uint32_t dst_pitch, dst_format;
uint32_t colorpitch;
- int dstxoff, dstyoff, pixel_shift;
- BoxPtr pBox = REGION_RECTS(&pPriv->clip);
- int nBox = REGION_NUM_RECTS(&pPriv->clip);
-
+ int pixel_shift;
+ int scissor_w = MIN(pPixmap->drawable.width, 2047);
+ int scissor_h = MIN(pPixmap->drawable.height, 2047);
/* note: in contrast to r300, use input biasing on uv components */
const float Loff = -0.0627;
float uvcosf, uvsinf;
@@ -525,7 +524,7 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
ret = radeon_cs_space_check(info->cs);
if (ret) {
ErrorF("Not enough RAM to hw accel xv operation\n");
- return;
+ return FALSE;
}
}
#endif
@@ -541,14 +540,6 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
dst_pitch = pPixmap->devKind;
}
-#ifdef COMPOSITE
- dstxoff = -pPixmap->screen_x + pPixmap->drawable.x;
- dstyoff = -pPixmap->screen_y + pPixmap->drawable.y;
-#else
- dstxoff = 0;
- dstyoff = 0;
-#endif
-
#ifdef USE_EXA
if (info->useEXA) {
RADEON_SWITCH_TO_3D();
@@ -581,7 +572,7 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
dst_format = RADEON_COLOR_FORMAT_ARGB8888;
break;
default:
- return;
+ return FALSE;
}
if (pPriv->id == FOURCC_I420 || pPriv->id == FOURCC_YV12) {
@@ -923,17 +914,36 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
FINISH_ACCEL();
}
- {
- int scissor_w, scissor_h;
- scissor_w = MIN(pPixmap->drawable.width, 2047);
- scissor_h = MIN(pPixmap->drawable.height, 2047);
- BEGIN_ACCEL(2);
- OUT_ACCEL_REG(RADEON_RE_TOP_LEFT, 0);
- OUT_ACCEL_REG(RADEON_RE_WIDTH_HEIGHT, ((scissor_w << RADEON_RE_WIDTH_SHIFT) |
- (scissor_h << RADEON_RE_HEIGHT_SHIFT)));
- }
+ BEGIN_ACCEL(2);
+ OUT_ACCEL_REG(RADEON_RE_TOP_LEFT, 0);
+ OUT_ACCEL_REG(RADEON_RE_WIDTH_HEIGHT, ((scissor_w << RADEON_RE_WIDTH_SHIFT) |
+ (scissor_h << RADEON_RE_HEIGHT_SHIFT)));
FINISH_ACCEL();
+ return TRUE;
+}
+
+static void
+FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ PixmapPtr pPixmap = pPriv->pPixmap;
+ int dstxoff, dstyoff;
+ BoxPtr pBox = REGION_RECTS(&pPriv->clip);
+ int nBox = REGION_NUM_RECTS(&pPriv->clip);
+ ACCEL_PREAMBLE();
+
+#ifdef COMPOSITE
+ dstxoff = -pPixmap->screen_x + pPixmap->drawable.x;
+ dstyoff = -pPixmap->screen_y + pPixmap->drawable.y;
+#else
+ dstxoff = 0;
+ dstyoff = 0;
+#endif
+
+ if (!FUNC_NAME(R200PrepareTexturedVideo)(pScrn, pPriv))
+ return;
+
if (pPriv->vsync) {
xf86CrtcPtr crtc;
if (pPriv->desired_crtc)
@@ -1034,9 +1044,9 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
OUT_ACCEL_REG(RADEON_WAIT_UNTIL, RADEON_WAIT_3D_IDLECLEAN);
#ifdef ACCEL_CP
- ADVANCE_RING();
+ ADVANCE_RING();
#else
- FINISH_ACCEL();
+ FINISH_ACCEL();
#endif /* !ACCEL_CP */
DamageDamageRegion(pPriv->pDraw, &pPriv->clip);