[PATCH] randr: Take panning into account when computing CRTC bounds

Rui Matos tiagomatos at gmail.com
Tue Jun 28 21:32:06 PDT 2011


Fixes regression introduced in 56c90e29f04727c903bd0f084d23bf44eb1a0a11.

Signed-off-by: Rui Matos <tiagomatos at gmail.com>
---
 randr/rrcrtc.c |   54 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 0437795..a940847 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -297,20 +297,60 @@ RRCrtcPendingProperties (RRCrtcPtr crtc)
 static void
 crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom)
 {
-    *left = crtc->x;
-    *top = crtc->y;
+    ScreenPtr pScreen = crtc->pScreen;
+    rrScrPriv (pScreen);
+    BoxRec panned_area;
+    Bool x_pan = FALSE;
+    Bool y_pan = FALSE;
+
+    if (pScrPriv->rrGetPanning &&
+        pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL))
+    {
+        x_pan = panned_area.x2 > panned_area.x1;
+        y_pan = panned_area.y2 > panned_area.y1;
+    }
 
     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;
+
+        if (x_pan) {
+            *left = panned_area.x1;
+            *right = panned_area.x2;
+        } else {
+            *left = crtc->x;
+            *right = crtc->x + crtc->mode->mode.width;
+        }
+
+        if (y_pan) {
+            *top = panned_area.y1;
+            *bottom = panned_area.y2;
+        } else {
+            *top = crtc->y;
+            *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;
+
+        if (x_pan) {
+            *left = panned_area.x1;
+            *right = panned_area.x2;
+        } else {
+            *left = crtc->x;
+            *right = crtc->x + crtc->mode->mode.height;
+        }
+
+        if (y_pan) {
+            *top = panned_area.y1;
+            *bottom = panned_area.y2;
+        } else {
+            *top = crtc->y;
+            *bottom = crtc->y + crtc->mode->mode.width;
+        }
+
        return;
     }
 }
-- 
1.7.5.4



More information about the xorg-devel mailing list