diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c index c8da476b5..ea9e7a88c 100644 --- a/hw/xfree86/drivers/modesetting/vblank.c +++ b/hw/xfree86/drivers/modesetting/vblank.c @@ -120,7 +120,8 @@ static RRCrtcPtr rr_crtc_covering_box(ScreenPtr pScreen, BoxPtr box, Bool screen_is_xf86_hint) { rrScrPrivPtr pScrPriv; - RRCrtcPtr crtc, best_crtc; + RROutputPtr primary_output; + RRCrtcPtr crtc, best_crtc, primary_crtc; int coverage, best_coverage; int c; BoxRec crtc_box, cover_box; @@ -136,6 +137,11 @@ rr_crtc_covering_box(ScreenPtr pScreen, BoxPtr box, Bool screen_is_xf86_hint) if (!pScrPriv) return NULL; + primary_crtc = NULL; + primary_output = RRFirstOutput(pScreen); + if (primary_output) + primary_crtc = primary_output->crtc; + for (c = 0; c < pScrPriv->numCrtcs; c++) { crtc = pScrPriv->crtcs[c]; @@ -146,7 +152,8 @@ rr_crtc_covering_box(ScreenPtr pScreen, BoxPtr box, Bool screen_is_xf86_hint) rr_crtc_box(crtc, &crtc_box); box_intersect(&cover_box, &crtc_box, box); coverage = box_area(&cover_box); - if (coverage > best_coverage) { + if ((coverage > best_coverage) || + (coverage == best_coverage && crtc == primary_crtc)) { best_crtc = crtc; best_coverage = coverage; }