Rebased ref, commits from common ancestor:
commit 5776f86ea25051a4d36a2752659be7bf0f483a65
Author: Chris Wilson
Date: Wed Jul 23 11:09:46 2014 +0100
randr: Consider rotation of slaved crtcs when computing bounds
Signed-off-by: Chris Wilson
(cherry picked from commit c94e7caf60eeaa7d5112adb92ec1848ec60c9047)
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index c3c3516..ac9945d 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -279,25 +279,41 @@ RRCrtcPendingProperties(RRCrtcPtr crtc)
return FALSE;
}
+static int mode_height(const RRModeRec *mode, Rotation rotation)
+{
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ return mode->mode.height;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ return mode->mode.width;
+ default:
+ return 0;
+ }
+}
+
+static int mode_width(const RRModeRec *mode, Rotation rotation)
+{
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ return mode->mode.width;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ return mode->mode.height;
+ default:
+ return 0;
+ }
+}
+
static void
crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom)
{
*left = crtc->x;
*top = crtc->y;
-
-switch (crtc->rotation) {
-case RR_Rotate_0:
-case RR_Rotate_180:
-default:
-*right = crtc->x + crtc->mode->mode.width;
-*bottom = crtc->y + crtc->mode->mode.height;
-return;
-case RR_Rotate_90:
-case RR_Rotate_270:
-*right = crtc->x + crtc->mode->mode.height;
-*bottom = crtc->y + crtc->mode->mode.width;
-return;
-}
+*right = crtc->x + mode_width(crtc->mode, crtc->rotation);
+*bottom = crtc->y + mode_height(crtc->mode, crtc->rotation);
}
/* overlapping counts as adjacent */
@@ -472,9 +488,9 @@ rrCheckPixmapBounding(ScreenPtr pScreen,
if (!pScrPriv->crtcs[c]->mode)
continue;
newbox.x1 = pScrPriv->crtcs[c]->x;
-newbox.x2 = pScrPriv->crtcs[c]->x +
pScrPriv->crtcs[c]->mode->mode.width;
+newbox.x2 = pScrPriv->crtcs[c]->x +
mode_width(pScrPriv->crtcs[c]->mode, pScrPriv->crtcs[c]->rotation);
newbox.y1 = pScrPriv->crtcs[c]->y;
-newbox.y2 = pScrPriv->crtcs[c]->y +
pScrPriv->crtcs[c]->mode->mode.height;
+newbox.y2 = pScrPriv->crtcs[c]->y +
mode_height(pScrPriv->crtcs[c]->mode, pScrPriv->crtcs[c]->rotation);
}
RegionInit(&new_crtc_region, &newbox, 1);
RegionUnion(&total_region, &total_region, &new_crtc_region);
@@ -493,9 +509,9 @@ rrCheckPixmapBounding(ScreenPtr pScreen,
if (!slave_priv->crtcs[c]->mode)
continue;
newbox.x1 = slave_priv->crtcs[c]->x;
-newbox.x2 = slave_priv->crtcs[c]->x +
slave_priv->crtcs[c]->mode->mode.width;
+ newbox.x2 = slave_priv->crtcs[c]->x +
mode_width(slave_priv->crtcs[c]->mode, slave_priv->crtcs[c]->rotation);
newbox.y1 = slave_priv->crtcs[c]->y;
-newbox.y2 = slave_priv->crtcs[c]->y +
slave_priv->crtcs[c]->mode->mode.height;
+ newbox.y2 = slave_priv->crtcs[c]->y +
mode_height(slave_priv->crtcs[c]->mode, slave_priv->crtcs[c]->rotation);
}
RegionInit(&new_crtc_region, &newbox, 1);
RegionUnion(&total_region, &total_region, &new_crtc_region);
@@ -560,8 +576,8 @@ RRCrtcSet(RRCrtcPtr crtc,
int width = 0, height = 0;
if (mode) {
-width = mode->mode.width;
-height = mode->mode.height;
+width = mode_width(mode, rotation);
+height = mode_height(mode, rotation);
}
DBG(("have a master to look out for\n"));
ret = rrCheckPixmapBounding(master, crtc,
@@ -1687,8 +1703,8 @@ RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr
pPixmap, Bool enable)
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)
+mode_width(crtc->mode, crtc->rotation) == pDrawable->width &&
+mode_height(crtc->mode, crtc->rotation) == pDrawable->height)
size_fits = TRUE;
/* is the pixmap already set? */
commit 5574c7a52c1f11266c6ea0665881adb817bc6ea6
Author: Chris Wilson
Date: Wed Jul 23 10:17:37 2014 +0100
randr: Suppress debug messages from prime
Hide the ErrorF used for debugging behind an ifdefed out macro.
Signed-off-by: Chris Wilson
(cherry picked from commit 1bb575f8c158c14949075fb35c085a7ae8e3b810)
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 69b3ecf..c3c3516 100644
--- a/randr/rrcrtc.c
+++