summaryrefslogtreecommitdiff
path: root/src/sna/sna_display.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-10-12 17:55:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2017-10-12 17:58:46 +0100
commitd287d46d5cc99dce25a7814952e4465f831498bc (patch)
tree020461cecb26deb2fea9efcf3b0412634e6ed431 /src/sna/sna_display.c
parenta384b462a3a563718527f02cc977cb902ee4ab57 (diff)
sna: Validate rrPrimaryOutput belongs to our Screen
If the randr->rrPrimaryOutput is set to an output on a slave, we have to reject it in favour of one of our own. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_display.c')
-rw-r--r--src/sna/sna_display.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 93c21456..33dbfc2d 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -7852,12 +7852,14 @@ sna_covering_crtc(struct sna *sna, const BoxRec *box, xf86CrtcPtr desired)
__FUNCTION__, box->x1, box->y1, box->x2, box->y2));
if (desired == NULL) {
- rrScrPrivPtr rr = rrGetScrPriv(xf86ScrnToScreen(sna->scrn));
- if (rr && rr->primaryOutput) {
+ ScreenPtr screen = xf86ScrnToScreen(sna->scrn);
+ rrScrPrivPtr rr = rrGetScrPriv(screen);
+ if (rr && rr->primaryOutput && rr->primaryOutput->pScreen == screen) {
xf86OutputPtr output = rr->primaryOutput->devPrivate;
DBG(("%s: have PrimaryOutput? %d marking as desired\n", __FUNCTION__, output->crtc != NULL));
desired = output->crtc;
}
+ assert(!desired || desired->pScreen == screen);
}
if (desired && to_sna_crtc(desired) && to_sna_crtc(desired)->bo) {
BoxRec cover_box;
@@ -7895,8 +7897,9 @@ sna_covering_crtc(struct sna *sna, const BoxRec *box, xf86CrtcPtr desired)
return crtc;
}
- if (!sna_box_intersect(&cover_box, &crtc->bounds, box))
- continue;
+ coverage = 0;
+ if (sna_box_intersect(&cover_box, &crtc->bounds, box))
+ coverage = sna_box_area(&cover_box);
DBG(("%s: box instersects (%d, %d), (%d, %d) of crtc %d\n",
__FUNCTION__,
@@ -7904,7 +7907,6 @@ sna_covering_crtc(struct sna *sna, const BoxRec *box, xf86CrtcPtr desired)
cover_box.x2, cover_box.y2,
c));
- coverage = sna_box_area(&cover_box);
DBG(("%s: box covers %d of crtc %d\n",
__FUNCTION__, coverage, c));
if (coverage > best_coverage) {