summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2011-08-09 19:13:26 +0200
committerMichel Dänzer <michel@daenzer.net>2011-08-09 19:13:26 +0200
commit9151f3b1c2ebcc34e63195888ba696f2183ba5e2 (patch)
tree5adba84408174fd4abc4d5d7bf40618f72e67dda
parent3b9fdc807dd7e52af0576299cefba596040f6f2f (diff)
Prefer the CRTC of the primary output for synchronization.
See https://bugs.freedesktop.org/show_bug.cgi?id=39696 . Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
-rw-r--r--man/radeon.man6
-rw-r--r--src/radeon_video.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/man/radeon.man b/man/radeon.man
index 83e33e78..8a2343c6 100644
--- a/man/radeon.man
+++ b/man/radeon.man
@@ -719,8 +719,10 @@ It has two values: 'off'(0) and 'on'(1). The default is
XV_CRTC is used to control which display controller (crtc) the textured
adapter synchronizes the screen update with when XV_VSYNC is enabled.
The default, 'auto'(-1), will sync to the display controller that more
-of the video is on. This attribute is useful for things like clone mode
-where the user can best decide which display should be synced.
+of the video is on; when this is ambiguous, the display controller associated
+with the RandR primary output is preferred. This attribute is useful for
+things like clone mode where the user can best decide which display should be
+synced.
The default is
.B 'auto'(-1).
diff --git a/src/radeon_video.c b/src/radeon_video.c
index edd6d54b..66ff2ad1 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -142,19 +142,27 @@ radeon_pick_best_crtc(ScrnInfoPtr pScrn,
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int coverage, best_coverage, c;
BoxRec box, crtc_box, cover_box;
- xf86CrtcPtr best_crtc = NULL;
+ RROutputPtr primary_output;
+ xf86CrtcPtr best_crtc = NULL, primary_crtc = NULL;
box.x1 = x1;
box.x2 = x2;
box.y1 = y1;
box.y2 = y2;
best_coverage = 0;
+
+ /* Prefer the CRTC of the primary output */
+ primary_output = RRFirstOutput(pScrn->pScreen);
+ if (primary_output && primary_output->crtc)
+ primary_crtc = primary_output->crtc->devPrivate;
+
for (c = 0; c < xf86_config->num_crtc; c++) {
xf86CrtcPtr crtc = xf86_config->crtc[c];
radeon_crtc_box(crtc, &crtc_box);
radeon_box_intersect(&cover_box, &crtc_box, &box);
coverage = radeon_box_area(&cover_box);
- if (coverage > best_coverage) {
+ if (coverage > best_coverage ||
+ (coverage == best_coverage && crtc == primary_crtc)) {
best_crtc = crtc;
best_coverage = coverage;
}