xf86-video-intel: Branch 'modesetting-rotation' - 2 commits - src/i830_cursor.c src/i830_xf86Rotate.c

Eric Anholt anholt at kemper.freedesktop.org
Thu Jan 18 23:14:34 EET 2007


 src/i830_cursor.c     |   67 +++++++++++++++++++++++++-------------------------
 src/i830_xf86Rotate.c |   15 ++++-------
 2 files changed, 40 insertions(+), 42 deletions(-)

New commits:
diff-tree 8759f4d89a141f7d69f1894ec3059ba6bd1cf86b (from b296cd9b8f63ab80e8fe46fcfcdba2e9af846468)
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 18 13:13:25 2007 -0800

    Partially deal with cursor rotation.
    
    The remaining issue is having a cursor image per CRTC so that the cursors can
    be rotated on the independently rotated CRTCs.

diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index 5e7a21a..364320e 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -456,49 +456,50 @@ I830SetCursorPosition(ScrnInfoPtr pScrn,
     I830Ptr pI830 = I830PTR(pScrn);
     CARD32 temp;
     Bool inrange;
-    int oldx = x, oldy = y;
-    int hotspotx = 0, hotspoty = 0;
+    int root_x = x, root_y = y;
     int pipe;
 
-    oldx += pScrn->frameX0; /* undo what xf86HWCurs did */
-    oldy += pScrn->frameY0;
-
-    switch (pI830->rotation) {
-    case RR_Rotate_0:
-	x = oldx;
-	y = oldy;
-	break;
-    case RR_Rotate_90:
-	x = oldy;
-	y = pScrn->pScreen->width - oldx;
-	hotspoty = I810_CURSOR_X;
-	break;
-    case RR_Rotate_180:
-	x = pScrn->pScreen->width - oldx;
-	y = pScrn->pScreen->height - oldy;
-	hotspotx = I810_CURSOR_X;
-	hotspoty = I810_CURSOR_Y;
-	break;
-    case RR_Rotate_270:
-	x = pScrn->pScreen->height - oldy;
-	y = oldx;
-	hotspotx = I810_CURSOR_Y;
-	break;
-    }
-
-    x -= hotspotx;
-    y -= hotspoty;
+    root_x = x + pScrn->frameX0; /* undo what xf86HWCurs did */
+    root_y = y + pScrn->frameY0;
 
     for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
     {
-	xf86CrtcPtr    crtc = xf86_config->crtc[pipe];
+	xf86CrtcPtr	    crtc = xf86_config->crtc[pipe];
 	DisplayModePtr	    mode = &crtc->mode;
-	int		    thisx = x - crtc->x;
-	int		    thisy = y - crtc->y;
+	int		    thisx;
+	int		    thisy;
+	int hotspotx = 0, hotspoty = 0;
 
 	if (!crtc->enabled)
 	    continue;
 
+	/* XXX: deal with hotspot issues */
+	switch (crtc->rotation) {
+	case RR_Rotate_0:
+	    thisx = (root_x - crtc->x);
+	    thisy = (root_y - crtc->y);
+	    break;
+	case RR_Rotate_90:
+	    thisx = (root_y - crtc->y);
+	    thisy = mode->VDisplay - (root_x - crtc->x);
+	    /*hotspoty = I810_CURSOR_X;*/
+	    break;
+	case RR_Rotate_180:
+	    thisx = mode->HDisplay - (root_x - crtc->x);
+	    thisy = mode->VDisplay - (root_y - crtc->y);
+	    /*hotspotx = I810_CURSOR_X;
+	      hotspoty = I810_CURSOR_Y;*/
+	    break;
+	case RR_Rotate_270:
+	    thisx = mode->VDisplay - (root_y - crtc->y);
+	    thisy = (root_x - crtc->x);
+	    /*hotspotx = I810_CURSOR_Y;*/
+	    break;
+	}
+
+	thisx -= hotspotx;
+	thisy -= hotspoty;
+
 	/*
 	 * There is a screen display problem when the cursor position is set
 	 * wholely outside of the viewport.  We trap that here, turning the
diff-tree b296cd9b8f63ab80e8fe46fcfcdba2e9af846468 (from d2ae2e2ccc3a8e7dc84745c235836cba150754d8)
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 18 13:02:26 2007 -0800

    Fix transformation matrices for rotation at 90 and 270 degrees.

diff --git a/src/i830_xf86Rotate.c b/src/i830_xf86Rotate.c
index 670ad7a..8da79b6 100644
--- a/src/i830_xf86Rotate.c
+++ b/src/i830_xf86Rotate.c
@@ -144,23 +144,20 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crt
 	transform.matrix[1][1] = IntToxFixed(1);
 	break;
     case RR_Rotate_90:
-	/* XXX probably wrong */
-	transform.matrix[0][1] = IntToxFixed(1);
-	transform.matrix[1][0] = IntToxFixed(-1);
-	transform.matrix[1][2] += IntToxFixed(crtc->mode.HDisplay);
+	transform.matrix[0][1] = IntToxFixed(-1);
+	transform.matrix[1][0] = IntToxFixed(1);
+	transform.matrix[0][2] += IntToxFixed(crtc->mode.VDisplay);
 	break;
     case RR_Rotate_180:
-	/* XXX probably wrong */
 	transform.matrix[0][0] = IntToxFixed(-1);
 	transform.matrix[1][1] = IntToxFixed(-1);
 	transform.matrix[0][2] += IntToxFixed(crtc->mode.HDisplay);
 	transform.matrix[1][2] += IntToxFixed(crtc->mode.VDisplay);
 	break;
     case RR_Rotate_270:
-	/* XXX probably wrong */
-	transform.matrix[0][1] = IntToxFixed(-1);
-	transform.matrix[1][0] = IntToxFixed(1);
-	transform.matrix[0][2] += IntToxFixed(crtc->mode.VDisplay);
+	transform.matrix[0][1] = IntToxFixed(1);
+	transform.matrix[1][0] = IntToxFixed(-1);
+	transform.matrix[1][2] += IntToxFixed(crtc->mode.VDisplay);
 	break;
     }
 



More information about the xorg-commit mailing list