summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-04-07 11:33:44 -0400
committerAlex Deucher <alexdeucher@gmail.com>2009-04-07 11:33:44 -0400
commit8ec27be3c8043a6ddc816b0b1480dd19f8d73832 (patch)
tree874ab0e78533f123a9743dc301e15395e1c66048
parentf8c7d6a6162196a743f6885ecaf63ba50de1722a (diff)
radeon: fix Xv vsync for multi-head
-rw-r--r--src/r600_textured_videofuncs.c20
-rw-r--r--src/radeon_textured_videofuncs.c26
-rw-r--r--src/radeon_video.c17
-rw-r--r--src/radeon_video.h7
4 files changed, 37 insertions, 33 deletions
diff --git a/src/r600_textured_videofuncs.c b/src/r600_textured_videofuncs.c
index 3dfe151a..88745d5c 100644
--- a/src/r600_textured_videofuncs.c
+++ b/src/r600_textured_videofuncs.c
@@ -446,17 +446,21 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
EREG(accel_state->ib, SPI_INTERP_CONTROL_0, 0);
- if (pPriv->vsync)
- cp_wait_vline_sync(pScrn, accel_state->ib, pPixmap,
- radeon_covering_crtc_num(pScrn,
+ if (pPriv->vsync) {
+ xf86CrtcPtr crtc = radeon_xv_pick_best_crtc(pScrn,
pPriv->drw_x,
pPriv->drw_x + pPriv->dst_w,
pPriv->drw_y,
- pPriv->drw_y + pPriv->dst_h,
- pPriv->desired_crtc),
- pPriv->drw_y,
- pPriv->drw_y + pPriv->dst_h);
-
+ pPriv->drw_y + pPriv->dst_h);
+ if (crtc) {
+ RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
+
+ cp_wait_vline_sync(pScrn, accel_state->ib, pPixmap,
+ radeon_crtc->crtc_id,
+ pPriv->drw_y - crtc->y,
+ (pPriv->drw_y - crtc->y) + pPriv->dst_h);
+ }
+ }
accel_state->vb_index = 0;
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index 05acb93f..6cb2870a 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -1983,17 +1983,21 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
}
}
- if (pPriv->vsync)
- FUNC_NAME(RADEONWaitForVLine)(pScrn, pPixmap,
- radeon_covering_crtc_num(pScrn,
- pPriv->drw_x,
- pPriv->drw_x + pPriv->dst_w,
- pPriv->drw_y,
- pPriv->drw_y + pPriv->dst_h,
- pPriv->desired_crtc),
- pPriv->drw_y,
- pPriv->drw_y + pPriv->dst_h);
-
+ if (pPriv->vsync) {
+ xf86CrtcPtr crtc = radeon_xv_pick_best_crtc(pScrn,
+ pPriv->drw_x,
+ pPriv->drw_x + pPriv->dst_w,
+ pPriv->drw_y,
+ pPriv->drw_y + pPriv->dst_h);
+ if (crtc) {
+ RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
+
+ FUNC_NAME(RADEONWaitForVLine)(pScrn, pPixmap,
+ radeon_crtc->crtc_id,
+ pPriv->drw_y - crtc->y,
+ (pPriv->drw_y - crtc->y) + pPriv->dst_h);
+ }
+ }
/*
* Rendering of the actual polygon is done in two different
* ways depending on chip generation:
diff --git a/src/radeon_video.c b/src/radeon_video.c
index 42aa0361..6314eb18 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -135,15 +135,14 @@ radeon_box_area(BoxPtr box)
return (int) (box->x2 - box->x1) * (int) (box->y2 - box->y1);
}
-int
-radeon_covering_crtc_num(ScrnInfoPtr pScrn,
- int x1, int x2, int y1, int y2,
- xf86CrtcPtr desired)
+xf86CrtcPtr
+radeon_xv_pick_best_crtc(ScrnInfoPtr pScrn,
+ int x1, int x2, int y1, int y2)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int coverage, best_coverage;
- int c, best_crtc = 0;
+ int coverage, best_coverage, c;
BoxRec box, crtc_box, cover_box;
+ xf86CrtcPtr best_crtc = NULL;
box.x1 = x1;
box.x2 = x2;
@@ -155,10 +154,8 @@ radeon_covering_crtc_num(ScrnInfoPtr pScrn,
radeon_crtc_box(crtc, &crtc_box);
radeon_box_intersect(&cover_box, &crtc_box, &box);
coverage = radeon_box_area(&cover_box);
- if (coverage && crtc == desired) {
- return c;
- } else if (coverage > best_coverage) {
- best_crtc = c;
+ if (coverage > best_coverage) {
+ best_crtc = crtc;
best_coverage = coverage;
}
}
diff --git a/src/radeon_video.h b/src/radeon_video.h
index 34fb07f0..44980025 100644
--- a/src/radeon_video.h
+++ b/src/radeon_video.h
@@ -123,10 +123,9 @@ typedef struct {
int vsync;
} RADEONPortPrivRec, *RADEONPortPrivPtr;
-int
-radeon_covering_crtc_num(ScrnInfoPtr pScrn,
- int x1, int x2, int y1, int y2,
- xf86CrtcPtr desired);
+xf86CrtcPtr
+radeon_xv_pick_best_crtc(ScrnInfoPtr pScrn,
+ int x1, int x2, int y1, int y2);
void RADEONInitI2C(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
void RADEONResetI2C(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);