diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2015-11-07 16:48:54 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2015-11-07 16:48:54 +0000 |
commit | 6c07b8ab53c2bbf0feb0afbbe98b33171c7b7872 (patch) | |
tree | 35eb85f0db40ffe6e6614d780b3de61b93edb3bc /xserver/randr/rrcrtc.c | |
parent | f4e01ac5608a8dfd9a4ee2f7aa43d28cc1710d81 (diff) |
Update to xserver 1.17.4.
tested by naddy@
Diffstat (limited to 'xserver/randr/rrcrtc.c')
-rw-r--r-- | xserver/randr/rrcrtc.c | 67 |
1 files changed, 45 insertions, 22 deletions
diff --git a/xserver/randr/rrcrtc.c b/xserver/randr/rrcrtc.c index dca0691ac..349874514 100644 --- a/xserver/randr/rrcrtc.c +++ b/xserver/randr/rrcrtc.c @@ -1663,23 +1663,30 @@ Bool RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable) { rrScrPriv(pDrawable->pScreen); - int i; - Bool size_fits = FALSE; - Bool changed = FALSE; Bool ret = TRUE; + PixmapPtr *saved_scanout_pixmap; + int i; + + saved_scanout_pixmap = malloc(sizeof(PixmapPtr)*pScrPriv->numCrtcs); + if (saved_scanout_pixmap == NULL) + return FALSE; for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; + Bool size_fits; + + saved_scanout_pixmap[i] = crtc->scanout_pixmap; if (!crtc->mode && enable) continue; + if (!crtc->scanout_pixmap && !enable) + continue; - changed = FALSE; - if (crtc->mode && crtc->x == pDrawable->x && - crtc->y == pDrawable->y && - crtc->mode->mode.width == pDrawable->width && - crtc->mode->mode.height == pDrawable->height) - size_fits = TRUE; + size_fits = (crtc->mode && + crtc->x == pDrawable->x && + crtc->y == pDrawable->y && + crtc->mode->mode.width == pDrawable->width && + crtc->mode->mode.height == pDrawable->height); /* is the pixmap already set? */ if (crtc->scanout_pixmap == pPixmap) { @@ -1687,32 +1694,48 @@ RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable) if (enable == FALSE) { /* set scanout to NULL */ crtc->scanout_pixmap = NULL; - changed = TRUE; - } else { - /* if the size fits then we are already setup */ - if (size_fits) - return TRUE; + } + else if (!size_fits) { /* if the size no longer fits then drop off */ crtc->scanout_pixmap = NULL; - changed = TRUE; + pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap); + + (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y, + crtc->rotation, crtc->numOutputs, crtc->outputs); + saved_scanout_pixmap[i] = crtc->scanout_pixmap; ret = FALSE; } - } else { + else { + /* if the size fits then we are already setup */ + } + } + else { if (!size_fits) - return FALSE; - if (enable) { + ret = FALSE; + else if (enable) crtc->scanout_pixmap = pPixmap; - pScrPriv->rrCrtcSetScanoutPixmap(crtc, pPixmap); - changed = TRUE; - } + else + /* reject an attempt to disable someone else's scanout_pixmap */ + ret = FALSE; } + } + + for (i = 0; i < pScrPriv->numCrtcs; i++) { + RRCrtcPtr crtc = pScrPriv->crtcs[i]; + + if (crtc->scanout_pixmap == saved_scanout_pixmap[i]) + continue; - if (changed && pScrPriv->rrCrtcSet) { + if (ret) { pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap); (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y, crtc->rotation, crtc->numOutputs, crtc->outputs); } + else + crtc->scanout_pixmap = saved_scanout_pixmap[i]; } + free(saved_scanout_pixmap); + return ret; } |